aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authoricewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-06 14:17:47 +0000
committericewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-06 14:17:47 +0000
commit674205a2651af6f7e611dc001f6efc349580df55 (patch)
tree30a08037a08c04e2e12b5319f2089269db04e252 /engine
parentf933424c18201eb0daa38b1c554228bd7dbfd835 (diff)
downloadelgg-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')
-rw-r--r--engine/lib/annotations.php1
-rw-r--r--engine/lib/metadata.php1
-rw-r--r--engine/lib/sites.php39
3 files changed, 30 insertions, 11 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 11473c498..2b398fc61 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -136,7 +136,6 @@
$value = sanitise_string(trim($value));
$owner_id = (int)$owner_id;
- if ($owner_id=0) $owner_id = $_SESSION['id'];
$limit = (int)$limit;
$offset = (int)$offset;
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 19c2e2298..a02ff1ad7 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -234,7 +234,6 @@
$value = sanitise_string(trim($value));
$owner_id = (int)$owner_id;
- if ($owner_id==0) $owner_id = $_SESSION['id'];
$limit = (int)$limit;
$offset = (int)$offset;
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);
}
/**