diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-08-18 17:36:01 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2002-08-18 17:36:01 +0000 |
commit | 419ae3e5499b0569932ffb10fae55e388ae7a802 (patch) | |
tree | 8a9b9a50abdfec67e92c12a0c79fa1e049cbd4d9 /phpBB/includes/session.php | |
parent | d5f0bfc3e15a2174871e9a714af2c74553acef0b (diff) | |
download | forums-419ae3e5499b0569932ffb10fae55e388ae7a802.tar forums-419ae3e5499b0569932ffb10fae55e388ae7a802.tar.gz forums-419ae3e5499b0569932ffb10fae55e388ae7a802.tar.bz2 forums-419ae3e5499b0569932ffb10fae55e388ae7a802.tar.xz forums-419ae3e5499b0569932ffb10fae55e388ae7a802.zip |
More updates
git-svn-id: file:///svn/phpbb/trunk@2877 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
-rw-r--r-- | phpBB/includes/session.php | 54 |
1 files changed, 32 insertions, 22 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 579678b947..60bb9eb3a4 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -475,30 +475,22 @@ class acl break; } } + + // + // Store max result for type ... used later ... saves time + // + $this->acl[$forum_id][$type][0] = max($this->acl[$forum_id][$type]); } } } } -// print_r($this->acl); - return; } function get_acl($forum_id, $auth_main, $auth_type = false) { - if ( $this->founder ) - { - return true; - } - else if ( $auth_main && $auth_type ) - { - return $this->acl[$forum_id][$auth_main][$auth_type]; - } - else if ( !$auth_type && is_array($this->acl[$forum_id][$auth_main]) ) - { - return array_sum($this->acl[$forum_id][$auth_main]); - } + return ( $auth_main && $auth_type ) ? ( ( $this->founder || $this->acl[0]['admin'][0] ) ? true : $this->acl[$forum_id][$auth_main][$auth_type] ) : $this->acl[$forum_id][$auth_main][0]; } function get_acl_admin($auth_type = false) @@ -506,7 +498,7 @@ class acl return ( $this->founder ) ? true : $this->get_acl(0, 'admin', $auth_type); } - function set_acl_user(&$forum_id, &$user_id, &$auth, $dependencies = array()) + function set_acl_user(&$forum_id, &$user_id, &$auth, $dependencies = false) { global $db; @@ -550,11 +542,11 @@ class acl unset($sql_ary); } - function set_acl_group(&$forum_id, &$group_id, &$auth, $dependencies = array()) + function set_acl_group(&$forum_id, &$group_id, &$auth, $dependencies = false) { global $db; - $forum_sql = ( $forum_id ) ? "AND a.forum_id IN ($forum_id, 0)" : ''; + $forum_sql = "AND a.forum_id IN ($forum_id, 0)"; $sql = "SELECT o.auth_option_id, a.auth_allow_deny FROM " . ACL_GROUPS_TABLE . " a, " . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $forum_sql AND a.group_id = $group_id"; $result = $db->sql_query($sql); @@ -594,15 +586,24 @@ class acl unset($sql_ary); } - function delete_acl_user($forum_id, $user_id, $auth_type = false) + function delete_acl_user($forum_id, $user_id, $auth_ids = false) { global $db; - $auth_sql = ( $auth_type != '' ) ? " AND auth_option_id IN ()" : ""; + $auth_sql = ''; + if ( $auth_ids ) + { + for($i = 0; $i < count($auth_ids); $i++) + { + $auth_sql .= ( ( $auth_sql != '' ) ? ', ' : '' ) . $auth_ids[$i]; + } + $auth_sql = " AND auth_option_id IN ($auth_sql)"; + } $sql = "DELETE FROM " . ACL_USERS_TABLE . " WHERE user_id = $user_id - AND forum_id = $forum_id"; + AND forum_id = $forum_id + $auth_sql"; $db->sql_query($sql); } @@ -610,11 +611,20 @@ class acl { global $db; - $auth_sql = ( $auth_type != '' ) ? " AND auth_option_id IN ()" : ""; + $auth_sql = ''; + if ( $auth_ids ) + { + for($i = 0; $i < count($auth_ids); $i++) + { + $auth_sql .= ( ( $auth_sql != '' ) ? ', ' : '' ) . $auth_ids[$i]; + } + $auth_sql = " AND auth_option_id IN ($auth_sql)"; + } $sql = "DELETE FROM " . ACL_GROUPS_TABLE . " WHERE group_id = $group_id - AND forum_id = $forum_id"; + AND forum_id = $forum_id + $auth_sql"; $db->sql_query($sql); } } |