diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-06 14:17:47 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-06 14:17:47 +0000 |
commit | 674205a2651af6f7e611dc001f6efc349580df55 (patch) | |
tree | 30a08037a08c04e2e12b5319f2089269db04e252 /engine/lib/sites.php | |
parent | f933424c18201eb0daa38b1c554228bd7dbfd835 (diff) | |
download | elgg-674205a2651af6f7e611dc001f6efc349580df55.tar.gz elgg-674205a2651af6f7e611dc001f6efc349580df55.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Initial annotations and metadata get/sets functional, combined with site test
git-svn-id: https://code.elgg.org/elgg/trunk@98 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/sites.php')
-rw-r--r-- | engine/lib/sites.php | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/engine/lib/sites.php b/engine/lib/sites.php index 1c011f05c..7182e6060 100644 --- a/engine/lib/sites.php +++ b/engine/lib/sites.php @@ -165,7 +165,7 @@ * @param int $limit * @param int $offset */ - function getAnnotations($name, $limit = 50, $offset = 0) { return get_site_annotations($name, $limit, $offset); } + function getAnnotations($name, $limit = 50, $offset = 0) { return get_site_annotations($name, $this->id, $limit, $offset); } /** * Return the annotations for the site. @@ -360,8 +360,14 @@ */ function set_site_metadata($name, $value, $access_id, $site_id, $vartype = "") { - // TODO : Writeme - throw new NotImplementedException("Writeme!"); + $name = sanitise_string($name); + $value = sanitise_string($value); + $access_id = (int)$access_id; + $site_id = (int)$site_id; + $vartype = sanitise_string($vartype); + + $id = create_metadata($site_id, 'site', $name, $value, $vartype, $owner_id, $access_id); + return $id; } /** @@ -372,8 +378,10 @@ */ function get_site_metadata($name, $site_id) { - // TODO : Writeme - throw new NotImplementedException("Writeme!"); + $name = sanitise_string($name); + $site_id = (int)$site_id; + + return get_metadatas($site_id, 'site'); } /** @@ -401,8 +409,16 @@ */ function add_site_annotation($name, $value, $access_id, $owner_id, $site_id, $vartype) { - // TODO : Writeme - throw new NotImplementedException("Writeme!"); + $name = sanitise_string($name); + $value = sanitise_string($value); + $access_id = (int)$access_id; + $owner_id = (int)$owner_id; if ($owner_id==0) $owner_id = $_SESSION['id']; + $site_id = (int)$site_id; + $vartype = sanitise_string($vartype); + + $id = create_annotation($site_id, 'site', $name, $value, $vartype, $owner_id, $access_id); + + return $id; } /** @@ -415,8 +431,13 @@ */ function get_site_annotations($name, $site_id, $limit, $offset) { - // TODO : Writeme - throw new NotImplementedException("Writeme!"); + $name = sanitise_string($name); + $site_id = (int)$site_id; + $limit = (int)$limit; + $offset = (int)$offset; + $owner_id = (int)$owner_id; if ($owner_id==0) $owner_id = $_SESSION['id']; // Consider adding the option to change in param? + + return get_annotations($site_id, 'site', $owner_id, "created desc", $limit, $offset); } /** |