From 850f987aceda06ad195accfe0912d6b061bb305c Mon Sep 17 00:00:00 2001 From: ben Date: Fri, 18 Jul 2008 18:55:47 +0000 Subject: Fixed the can_write_to_container function when you're logged out. git-svn-id: https://code.elgg.org/elgg/trunk@1480 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 161ba5487..97518e886 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1007,12 +1007,14 @@ global $CONFIG; $user_guid = (int)$user_guid; - if (!$user_guid) $user_guid = $_SESSION['user']->getGUID(); + if (!$user_guid) $user_guid = (int) $_SESSION['guid']; $user = get_entity($user_guid); $container_guid = (int)$container_guid; if (!$container_guid) $container_guid = page_owner(); + if (!$container_guid) return true; + $container = get_entity($container_guid); if (($container) && ($user)) @@ -1192,13 +1194,13 @@ if (!is_array($owner_guid)) { $owner_array = array($owner_guid); $owner_guid = (int) $owner_guid; - $where[] = "owner_guid = '$owner_guid'"; + // $where[] = "owner_guid = '$owner_guid'"; } else if (sizeof($owner_guid) > 0) { - $owner_array = $owner_guid; + $owner_array = array_map('sanitise_int', $owner_guid); // Cast every element to the owner_guid array to int - $owner_guid = array_map("sanitise_int", $owner_guid); - $owner_guid = implode(",",$owner_guid); - $where[] = "owner_guid in ({$owner_guid})"; + // $owner_guid = array_map("sanitise_int", $owner_guid); + // $owner_guid = implode(",",$owner_guid); + // $where[] = "owner_guid in ({$owner_guid})"; } if (is_null($container_guid)) { $container_guid = $owner_array; -- cgit v1.2.3