diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-29 16:19:57 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-10-29 16:19:57 +0000 |
commit | 817ee490ff227ecc236d8f13d3db4fb8f33cb0dd (patch) | |
tree | 5ca495c74dfb493f792b8447bf6ff6357efb2ea3 /engine/lib | |
parent | b828d138fa4daf6c08bde3711ff29c8c72a495a4 (diff) | |
download | elgg-817ee490ff227ecc236d8f13d3db4fb8f33cb0dd.tar.gz elgg-817ee490ff227ecc236d8f13d3db4fb8f33cb0dd.tar.bz2 |
Reverted database access permission caching.
git-svn-id: https://code.elgg.org/elgg/trunk@2352 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/access.php | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index ff7cfe477..b920f9fbe 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -52,11 +52,11 @@ */
function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
- global $CONFIG;
+ global $CONFIG, $init_finished;
static $access_array, $acm, $ac; // Caches. $ac* flag whether we have executed a query previously, and stop it being run again if no data is returned. if (!isset($access_array) || (!isset($init_finished)) || (!$init_finished))
- $access_array = array();
+ $access_array = array();
if ($user_id == 0) $user_id = $_SESSION['guid'];
@@ -73,29 +73,21 @@ $tmp_access_array = array(2);
if (isloggedin())
$tmp_access_array[] = 1;
- - if (!$ac) - {
- if ($collections = get_data($query)) {
- foreach($collections as $collection)
- if (!empty($collection->access_collection_id)) $tmp_access_array[] = $collection->access_collection_id;
- } +
+ if ($collections = get_data($query)) {
+ foreach($collections as $collection)
+ if (!empty($collection->access_collection_id)) $tmp_access_array[] = $collection->access_collection_id; +
} - $ac = true; // We don't want to run this query again -
$query = "select ag.id from {$CONFIG->dbprefix}access_collections ag ";
$query .= " where ag.owner_guid = {$user_id} and (ag.site_guid = {$site_id} or ag.site_guid = 0)";
- if (!$acm) - {
- if ($collections = get_data($query)) {
- foreach($collections as $collection)
- if (!empty($collection->id)) $tmp_access_array[] = $collection->id;
- } - } - - $acm = true; // We don't want to run this query again
+ if ($collections = get_data($query)) {
+ foreach($collections as $collection)
+ if (!empty($collection->id)) $tmp_access_array[] = $collection->id;
+ } +
global $is_admin;
|