aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-06 16:22:54 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-06 16:22:54 +0000
commitefdd2b782479d7385eff0fece80316e0fab46fa9 (patch)
treedce6728feb59cd919e2241baba8117fb1e90cb0c /engine
parentf4b099236c0d70c51fdb0c0d573883f342daaef8 (diff)
downloadelgg-efdd2b782479d7385eff0fece80316e0fab46fa9.tar.gz
elgg-efdd2b782479d7385eff0fece80316e0fab46fa9.tar.bz2
Marcus Povey <marcus@dushka.co.uk>
* Count added git-svn-id: https://code.elgg.org/elgg/trunk@103 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/sites.php24
1 files changed, 17 insertions, 7 deletions
diff --git a/engine/lib/sites.php b/engine/lib/sites.php
index 7182e6060..d497acfcc 100644
--- a/engine/lib/sites.php
+++ b/engine/lib/sites.php
@@ -231,7 +231,19 @@
function delete() { return delete_site($this->id); }
}
-
+ /**
+ * Convert a database row to a new ElggSite
+ *
+ * @param stdClass $row
+ * @return stdClass or ElggSite
+ */
+ function row_to_elggsite($row)
+ {
+ if (!($row instanceof stdClass))
+ return $row;
+
+ return new ElggSite($row);
+ }
/**
* Enter description here...
@@ -246,7 +258,7 @@
*/
function get_sites($user_id = 0, $type = "", $metadata_type = "", $metadata_value = "", $order_by = "created desc", $limit = 10, $offset = 0)
{
- // TODO: Writeme
+ // TODO : Writeme
throw new NotImplementedException("Writeme!");
}
@@ -262,9 +274,8 @@
$site_id = (int) $site_id;
$access = get_access_list();
- error_log("select * from {$CONFIG->dbprefix}sites where id=$site_id and (access_id in {$access} or (access_id = 0 and owner_id = {$_SESSION['id']}))");
- return get_data_row("select * from {$CONFIG->dbprefix}sites where id=$site_id and (access_id in {$access} or (access_id = 0 and owner_id = {$_SESSION['id']}))");
+ return row_to_elggsite(get_data_row("select * from {$CONFIG->dbprefix}sites where id=$site_id and (access_id in {$access} or (access_id = 0 and owner_id = {$_SESSION['id']}))"));
}
/**
@@ -280,7 +291,7 @@
$url = sanitise_string(trim($url));
$access = get_access_list();
- return get_data_row("select o.* from {$CONFIG->dbprefix}sites where url='$url' and (o.access_id in {$access} or (o.access_id = 0 and o.owner_id = {$_SESSION['id']}))");
+ return row_to_elggsite(get_data_row("select o.* from {$CONFIG->dbprefix}sites where url='$url' and (o.access_id in {$access} or (o.access_id = 0 and o.owner_id = {$_SESSION['id']}))"));
}
@@ -448,8 +459,7 @@
*/
function count_site_annotations($name, $site_id)
{
- // TODO : Writeme
- throw new NotImplementedException("Writeme!");
+ return count_annotations($site_id, 'site', $name);
}
/**