aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/metadata.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-14 19:03:58 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-11-14 19:03:58 +0000
commit9bd5aad2c3bdb4a283d2b15ed0f91e295099c9e2 (patch)
tree8cf4279f57f654d5435dacba4dc2bcb4030d2199 /engine/lib/metadata.php
parent2d55e88e095aa1a6b4f58101077aab81788761c9 (diff)
downloadelgg-9bd5aad2c3bdb4a283d2b15ed0f91e295099c9e2.tar.gz
elgg-9bd5aad2c3bdb4a283d2b15ed0f91e295099c9e2.tar.bz2
* Introducing get_loggedin_user() and get_loggedin_userid()
* ACLs now using get_loggedin_user* * Some logic cleaned up * Some "Undefined..." messages cleaned up git-svn-id: https://code.elgg.org/elgg/trunk@2459 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/metadata.php')
-rw-r--r--engine/lib/metadata.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/engine/lib/metadata.php b/engine/lib/metadata.php
index 204b027c3..2e6337694 100644
--- a/engine/lib/metadata.php
+++ b/engine/lib/metadata.php
@@ -153,7 +153,7 @@
$id = (int)$id;
$access = get_access_sql_suffix("e");
$md_access = get_access_sql_suffix("m");
-
+
return row_to_elggmetadata(get_data_row("SELECT m.*, n.string as name, v.string as value from {$CONFIG->dbprefix}metadata m JOIN {$CONFIG->dbprefix}entities e on e.guid = m.entity_guid JOIN {$CONFIG->dbprefix}metastrings v on m.value_id = v.id JOIN {$CONFIG->dbprefix}metastrings n on m.name_id = n.id where m.id=$id and $access and $md_access"));
}
@@ -208,7 +208,7 @@
$owner_guid = (int)$owner_guid;
$allow_multiple = (boolean)$allow_multiple;
- if ($owner_guid==0) $owner_guid = $_SESSION['id'];
+ if ($owner_guid==0) $owner_guid = get_loggedin_userid();
$access_id = (int)$access_id;
@@ -276,10 +276,10 @@
global $CONFIG;
$id = (int)$id;
-
- if (!$md = get_metadata($id)) return false;
+
+ if (!$md = get_metadata($id)) return false;
if (!$md->canEdit()) return false;
-
+
// If memcached then we invalidate the cache for this entry
static $metabyname_memcache;
if ((!$metabyname_memcache) && (is_memcache_available()))
@@ -291,7 +291,7 @@
$value_type = detect_extender_valuetype($value, sanitise_string(trim($value_type)));
$owner_guid = (int)$owner_guid;
- if ($owner_guid==0) $owner_guid = $_SESSION['id'];
+ if ($owner_guid==0) $owner_guid = get_loggedin_userid();
$access_id = (int)$access_id;
@@ -386,6 +386,7 @@
$md_access = get_access_sql_suffix("m");
// If memcache is available then cache this (cache only by name for now since this is the most common query)
+ $meta = null;
static $metabyname_memcache;
if ((!$metabyname_memcache) && (is_memcache_available()))
$metabyname_memcache = new ElggMemcache('metabyname_memcache');