diff options
author | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-18 10:34:48 +0000 |
---|---|---|
committer | icewing <icewing@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-03-18 10:34:48 +0000 |
commit | 00b4002b0c73deefa8661f4650fe427ff2ff6e09 (patch) | |
tree | 6d01aa16838b34ef158a43368c3e93b483b47cbf /engine/lib/annotations.php | |
parent | 6586735cd44020cd1d44aaa16bfe8cf8b952302f (diff) | |
download | elgg-00b4002b0c73deefa8661f4650fe427ff2ff6e09.tar.gz elgg-00b4002b0c73deefa8661f4650fe427ff2ff6e09.tar.bz2 |
Marcus Povey <marcus@dushka.co.uk>
* Modified to better deal with metastrings table
git-svn-id: https://code.elgg.org/elgg/trunk@243 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r-- | engine/lib/annotations.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index 11e2bfcc2..22a8d247e 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -154,7 +154,7 @@ $annotation_id = (int) $annotation_id; $access = get_access_list(); - return row_to_elggannotation(get_data_row("select * from {$CONFIG->dbprefix}annotations where id=$annotation_id and (access_id in {$access} or (access_id = 0 and owner_guid = {$_SESSION['id']}))")); + return row_to_elggannotation(get_data_row("select a.*, v.string as value from {$CONFIG->dbprefix}annotations a JOIN JOIN {$CONFIG->dbprefix}metastrings v on a.value_id = v.id where a.id=$annotation_id and (a.access_id in {$access} or (a.access_id = 0 and a.owner_guid = {$_SESSION['id']}))")); } /** @@ -188,7 +188,7 @@ if (!$value) return false; // If ok then add it - return insert_data("INSERT into {$CONFIG->dbprefix}annotations (entity_guid, name, value, value_type, owner_guid, time_created, access_id) VALUES ($entity_guid,'$name',$value,'$value_type', $owner_guid, $time, $access_id)"); + return insert_data("INSERT into {$CONFIG->dbprefix}annotations (entity_guid, name, value_id, value_type, owner_guid, time_created, access_id) VALUES ($entity_guid,'$name',$value,'$value_type', $owner_guid, $time, $access_id)"); } /** @@ -222,7 +222,7 @@ if (!$value) return false; // If ok then add it - return update_data("UPDATE {$CONFIG->dbprefix}annotations set value='$value', value_type='$value_type', access_id=$access_id, owner_guid=$owner_guid where id=$annotation_id and name='$name' and (access_id in {$access} or (access_id = 0 and owner_guid = {$_SESSION['id']}))"); + return update_data("UPDATE {$CONFIG->dbprefix}annotations set value_id='$value', value_type='$value_type', access_id=$access_id, owner_guid=$owner_guid where id=$annotation_id and name='$name' and (access_id in {$access} or (access_id = 0 and owner_guid = {$_SESSION['id']}))"); } /** @@ -274,7 +274,7 @@ if ($value != "") $where[] = "a.value='$value'"; - $query = "SELECT * from {$CONFIG->dbprefix}annotations a JOIN {$CONFIG->dbprefix}entities e on a.entity_guid = e.guid where "; + $query = "SELECT a.*,v.string as value from {$CONFIG->dbprefix}annotations a JOIN {$CONFIG->dbprefix}entities e on a.entity_guid = e.guid JOIN {$CONFIG->dbprefix}metastrings v on a.value_id=v.id where "; foreach ($where as $w) $query .= " $w and "; $query .= " (a.access_id in {$access} or (a.access_id = 0 and a.owner_guid = {$_SESSION['id']}))"; // Add access controls |