aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/sessions.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-13 03:31:16 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-10-13 03:31:16 +0000
commita818e6fc766efa996df2841d63f1c943f97513b5 (patch)
treeabd8001026ee52b181e9584f96c44acb110a737f /engine/lib/sessions.php
parentc499b05093744813a04fe537e0b588a547f3a784 (diff)
downloadelgg-a818e6fc766efa996df2841d63f1c943f97513b5.tar.gz
elgg-a818e6fc766efa996df2841d63f1c943f97513b5.tar.bz2
First pass at removing $is_admin global.
git-svn-id: http://code.elgg.org/elgg/trunk@3528 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/sessions.php')
-rw-r--r--engine/lib/sessions.php38
1 files changed, 23 insertions, 15 deletions
diff --git a/engine/lib/sessions.php b/engine/lib/sessions.php
index d3e4a499d..914f3701a 100644
--- a/engine/lib/sessions.php
+++ b/engine/lib/sessions.php
@@ -171,26 +171,34 @@ function isadminloggedin() {
* @param $user_guid
* @return bool
*/
-function is_admin_user($user_guid) {
+function elgg_is_admin_user($user_guid) {
global $CONFIG;
- // cannot use metadata here because
+ // cannot use metadata here because of recursion
+
// caching is done at the db level so no need to here.
- $query = "SELECT * FROM {$CONFIG->dbprefix}users_entity as e, {$CONFIG->dbprefix}metastrings as ms1, {$CONFIG->dbprefix}metastrings as ms2, {$CONFIG->dbprefix}metadata as md
+ $query = "SELECT * FROM {$CONFIG->dbprefix}users_entity as e,
+ {$CONFIG->dbprefix}metastrings as ms1,
+ {$CONFIG->dbprefix}metastrings as ms2,
+ {$CONFIG->dbprefix}metadata as md
WHERE (
- ms1.string = 'admin' AND ms2.string = 'yes'
- AND md.name_id = ms1.id AND md.value_id = ms2.id
- AND e.guid = md.entity_guid
- AND e.guid = {$user_guid}
- AND e.banned = 'no'
+ (
+ (ms1.string = 'admin' AND ms2.string = 'yes')
+ OR (ms1.string = 'admin' AND ms2.string = '1')
)
- OR (
- ms1.string = 'admin' AND ms2.string = '1'
AND md.name_id = ms1.id AND md.value_id = ms2.id
AND e.guid = md.entity_guid
AND e.guid = {$user_guid}
AND e.banned = 'no'
)";
+// OR (
+// ms1.string = 'admin' AND ms2.string = '1'
+// AND md.name_id = ms1.id AND md.value_id = ms2.id
+// AND e.guid = md.entity_guid
+// AND e.guid = {$user_guid}
+// AND e.banned = 'no'
+// )";
+
// normalizing the results from get_data()
// See #1242
@@ -399,11 +407,11 @@ function login(ElggUser $user, $persistent = false) {
reset_login_failure_count($user->guid); // Reset any previous failed login attempts
// Set admin shortcut flag if this is an admin
- if (isadminloggedin()) {
- //@todo REMOVE THIS.
- global $is_admin;
- $is_admin = true;
- }
+// if (isadminloggedin()) {
+// //@todo REMOVE THIS.
+// global $is_admin;
+// $is_admin = true;
+// }
return true;
}