aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/acp/auth.php
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-02-18 13:54:12 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-02-18 13:54:12 +0000
commit26a6d215d0897afa82eea9b0cc0fca79d4544da5 (patch)
tree50645d56ce20cb6fa5e18a2eb1036deba65a1068 /phpBB/includes/acp/auth.php
parentf2f0dc78929228619f8644d6553a02a8d1572242 (diff)
downloadforums-26a6d215d0897afa82eea9b0cc0fca79d4544da5.tar
forums-26a6d215d0897afa82eea9b0cc0fca79d4544da5.tar.gz
forums-26a6d215d0897afa82eea9b0cc0fca79d4544da5.tar.bz2
forums-26a6d215d0897afa82eea9b0cc0fca79d4544da5.tar.xz
forums-26a6d215d0897afa82eea9b0cc0fca79d4544da5.zip
- fix some tiny bugs
- fix module system (sometimes the layout is broken due to falsly deactivated categories) - auth updates (setting permissions) - fix "category jumping" bug in acp - u_action is defined by the module itself git-svn-id: file:///svn/phpbb/trunk@5558 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/auth.php')
-rw-r--r--phpBB/includes/acp/auth.php592
1 files changed, 296 insertions, 296 deletions
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 59a6b03d54..ab744990a2 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -205,6 +205,186 @@ class auth_admin extends auth
}
/**
+ * Display permission mask (assign to template)
+ */
+ function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
+ {
+ global $template, $user, $db, $phpbb_root_path, $phpEx, $SID;
+
+ // Define names for template loops, might be able to be set
+ $tpl_pmask = 'p_mask';
+ $tpl_fmask = 'f_mask';
+ $tpl_category = 'category';
+ $tpl_mask = 'mask';
+
+ $l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
+
+ // Get names
+ if ($user_mode == 'user')
+ {
+ $sql = 'SELECT user_id as ug_id, username as ug_name
+ FROM ' . USERS_TABLE . '
+ WHERE user_id IN (' . implode(', ', array_keys($hold_ary)) . ')
+ ORDER BY username ASC';
+ }
+ else
+ {
+ $sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type
+ FROM ' . GROUPS_TABLE . '
+ WHERE group_id IN (' . implode(', ', array_keys($hold_ary)) . ')
+ ORDER BY group_type DESC, group_name ASC';
+ }
+ $result = $db->sql_query($sql);
+
+ $ug_names_ary = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']);
+ }
+ $db->sql_freeresult($result);
+
+ // Get used forums
+ $forum_ids = array();
+ foreach ($hold_ary as $ug_id => $row)
+ {
+ $forum_ids = array_merge($forum_ids, array_keys($row));
+ }
+ $forum_ids = array_unique($forum_ids);
+
+ $forum_names_ary = array();
+ if ($local)
+ {
+ $forum_names_ary = make_forum_select(false, false, true, false, false, true);
+ }
+ else
+ {
+ $forum_names_ary[0] = $l_acl_type;
+ }
+
+ // Now obtain memberships
+ $user_groups_default = $user_groups_custom = array();
+ if ($user_mode == 'user' && $group_display)
+ {
+ $sql = 'SELECT group_id, group_name, group_type
+ FROM ' . GROUPS_TABLE . '
+ ORDER BY group_type DESC, group_name ASC';
+ $result = $db->sql_query($sql);
+
+ $groups = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $groups[$row['group_id']] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ $memberships = group_memberships(false, array_keys($hold_ary), false);
+
+ foreach ($memberships as $row)
+ {
+ if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL)
+ {
+ $user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']];
+ }
+ else
+ {
+ $user_groups_custom[$row['user_id']][] = $groups[$row['group_id']]['group_name'];
+ }
+ }
+ unset($memberships, $groups);
+ }
+
+ // If we only have one forum id to display, we switch the complete interface to group by user/usergroup instead of grouping by forum
+ // To achive this, we need to switch the array a bit
+ if (sizeof($forum_ids) == 1)
+ {
+ $hold_ary_temp = $hold_ary;
+ $hold_ary = array();
+ foreach ($hold_ary_temp as $ug_id => $row)
+ {
+ foreach ($row as $forum_id => $auth_row)
+ {
+ $hold_ary[$forum_id][$ug_id] = $auth_row;
+ }
+ }
+ unset($hold_ary_temp);
+
+ foreach ($hold_ary as $forum_id => $forum_array)
+ {
+ $content_array = $categories = array();
+ $this->build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary));
+
+ $template->assign_block_vars($tpl_pmask, array(
+ 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],
+ 'CATEGORIES' => implode('</th><th>', $categories),
+
+ 'L_ACL_TYPE' => $l_acl_type,
+
+ 'S_LOCAL' => ($local) ? true : false,
+ 'S_GLOBAL' => (!$local) ? true : false,
+ 'S_NUM_CATS' => sizeof($categories),
+ 'S_VIEW' => ($mode == 'view') ? true : false,
+ 'S_NUM_OBJECTS' => sizeof($content_array),
+ 'S_USER_MODE' => ($user_mode == 'user') ? true : false,
+ 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false)
+ );
+
+ foreach ($content_array as $ug_id => $ug_array)
+ {
+ $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(
+ 'NAME' => $ug_names_ary[$ug_id],
+ 'UG_ID' => $ug_id,
+ 'FORUM_ID' => $forum_id)
+ );
+
+ $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id);
+ }
+ }
+ }
+ else
+ {
+ foreach ($ug_names_ary as $ug_id => $ug_name)
+ {
+ if (!isset($hold_ary[$ug_id]))
+ {
+ continue;
+ }
+
+ $content_array = $categories = array();
+ $this->build_permission_array($hold_ary[$ug_id], $content_array, $categories, array_keys($forum_names_ary));
+
+ $template->assign_block_vars($tpl_pmask, array(
+ 'NAME' => $ug_name,
+ 'CATEGORIES' => implode('</th><th>', $categories),
+
+ 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && sizeof($user_groups_default[$ug_id])) ? implode(', ', $user_groups_default[$ug_id]) : '',
+ 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && sizeof($user_groups_custom[$ug_id])) ? implode(', ', $user_groups_custom[$ug_id]) : '',
+ 'L_ACL_TYPE' => $l_acl_type,
+
+ 'S_LOCAL' => ($local) ? true : false,
+ 'S_GLOBAL' => (!$local) ? true : false,
+ 'S_NUM_CATS' => sizeof($categories),
+ 'S_VIEW' => ($mode == 'view') ? true : false,
+ 'S_NUM_OBJECTS' => sizeof($content_array),
+ 'S_USER_MODE' => ($user_mode == 'user') ? true : false,
+ 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false)
+ );
+
+ foreach ($content_array as $forum_id => $forum_array)
+ {
+ $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(
+ 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],
+ 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'],
+ 'UG_ID' => $ug_id,
+ 'FORUM_ID' => $forum_id)
+ );
+
+ $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id);
+ }
+ }
+ }
+ }
+
+ /**
* Display permission mask for presets
*/
function display_preset_mask(&$hold_ary)
@@ -384,123 +564,6 @@ class auth_admin extends auth
}
/**
- * Set a preset ACL record
- */
- function acl_set_preset($preset_id, &$auth)
- {
- global $db;
-
- if (!sizeof($this->option_ids))
- {
- $sql = 'SELECT auth_option_id, auth_option
- FROM ' . ACL_OPTIONS_TABLE;
- $result = $db->sql_query($sql);
-
- $this->option_ids = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $this->option_ids[$row['auth_option']] = $row['auth_option_id'];
- }
- $db->sql_freeresult($result);
- }
-
- // Set any flags as required
- foreach ($auth as $auth_option => $setting)
- {
- $flag = substr($auth_option, 0, strpos($auth_option, '_') + 1);
-
- if (!isset($auth[$flag]) || !$auth[$flag])
- {
- $auth[$flag] = $setting;
- }
- }
-
- $sql = 'SELECT auth_option_id, auth_setting
- FROM ' . ACL_PRESETS_DATA_TABLE . '
- WHERE preset_id = ' . $preset_id;
- $result = $db->sql_query($sql);
-
- $cur_auth = array();
- while ($row = $db->sql_fetchrow($result))
- {
- $cur_auth[$row['auth_option_id']] = $row['auth_setting'];
- }
- $db->sql_freeresult($result);
-
- $sql_ary = array();
-
- foreach ($auth as $auth_option => $setting)
- {
- $auth_option_id = (int) $this->option_ids[$auth_option];
-
- switch ($setting)
- {
- case ACL_UNSET:
- if (isset($cur_auth[$auth_option_id]))
- {
- $sql_ary['delete'][] = 'DELETE FROM ' . ACL_PRESETS_DATA_TABLE . '
- WHERE auth_option_id = ' . $auth_option_id . '
- AND preset_id = ' . $preset_id;
- }
- break;
-
- default:
- if (!isset($cur_auth[$auth_option_id]))
- {
- $sql_ary['insert'][] = array(
- 'preset_id' => (int) $preset_id,
- 'auth_option_id' => (int) $auth_option_id,
- 'auth_setting' => (int) $setting
- );
- }
- else if ($cur_auth[$auth_option_id] != $setting)
- {
- $sql_ary['update'][] = 'UPDATE ' . ACL_PRESETS_DATA_TABLE . '
- SET auth_setting = ' . (int) $setting . '
- WHERE preset_id = ' . $preset_id . '
- AND auth_option_id = ' . $auth_option_id;
- }
- break;
- }
- }
- unset($cur_auth);
-
- foreach ($sql_ary as $sql_type => $sql_subary)
- {
- switch ($sql_type)
- {
- case 'insert':
- switch (SQL_LAYER)
- {
- case 'mysql':
- case 'mysql4':
- case 'mysqli':
- $db->sql_query('INSERT INTO ' . ACL_PRESETS_DATA_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_subary));
- break;
-
- default:
- foreach ($sql_subary as $ary)
- {
- $db->sql_query('INSERT INTO ' . ACL_PRESETS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
- }
- break;
- }
- break;
-
- case 'update':
- case 'delete':
- foreach ($sql_subary as $sql)
- {
- $db->sql_query($sql);
- }
- break;
- }
- }
-
- $this->acl_clear_prefetch();
- }
-
- /**
* Set a user or group ACL record
*/
function acl_set($ug_type, &$forum_id, &$ug_id, &$auth)
@@ -659,222 +722,159 @@ class auth_admin extends auth
}
/**
- * Remove local permission
+ * Set a preset ACL record
*/
- function acl_delete($mode, $ug_id = false, $forum_id = false, $auth_id = false)
+ function acl_set_preset($preset_id, &$auth)
{
global $db;
- if ($ug_id === false && $forum_id === false && $auth_ids === false)
+ if (!sizeof($this->option_ids))
{
- return;
- }
-
- $table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE;
- $id_field = $mode . '_id';
-
- $sql = array();
+ $sql = 'SELECT auth_option_id, auth_option
+ FROM ' . ACL_OPTIONS_TABLE;
+ $result = $db->sql_query($sql);
- if ($auth_id !== false)
- {
- $sql[] = (!is_array($auth_id)) ? 'auth_option_id = ' . (int) $auth_id : 'auth_option_id IN (' . implode(', ', array_map('intval', $auth_id)) . ')';
- }
-
- if ($forum_id !== false)
- {
- $sql[] = (!is_array($forum_id)) ? 'forum_id = ' . (int) $forum_id : 'forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
+ $this->option_ids = array();
+ while ($row = $db->sql_fetchrow($result))
+ {
+ $this->option_ids[$row['auth_option']] = $row['auth_option_id'];
+ }
+ $db->sql_freeresult($result);
}
- if ($ug_id !== false)
+ // Set any flags as required
+ foreach ($auth as $auth_option => $setting)
{
- $sql[] = (!is_array($ug_id)) ? $id_field . ' = ' . (int) $ug_id : $id_field . ' IN (' . implode(', ', array_map('intval', $ug_id)) . ')';
- }
-
- $sql = "DELETE FROM $table
- WHERE " . implode(' AND ', $sql);
- $db->sql_query($sql);
-
- $this->acl_clear_prefetch();
- }
-
- /**
- * Display permission mask (assign to template)
- */
- function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true)
- {
- global $template, $user, $db, $phpbb_root_path, $phpEx, $SID;
-
- // Define names for template loops, might be able to be set
- $tpl_pmask = 'p_mask';
- $tpl_fmask = 'f_mask';
- $tpl_category = 'category';
- $tpl_mask = 'mask';
+ $flag = substr($auth_option, 0, strpos($auth_option, '_') + 1);
- $l_acl_type = (isset($user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)])) ? $user->lang['ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type)] : 'ACL_TYPE_' . (($local) ? 'LOCAL' : 'GLOBAL') . '_' . strtoupper($permission_type);
-
- // Get names
- if ($user_mode == 'user')
- {
- $sql = 'SELECT user_id as ug_id, username as ug_name
- FROM ' . USERS_TABLE . '
- WHERE user_id IN (' . implode(', ', array_keys($hold_ary)) . ')
- ORDER BY username ASC';
- }
- else
- {
- $sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type
- FROM ' . GROUPS_TABLE . '
- WHERE group_id IN (' . implode(', ', array_keys($hold_ary)) . ')
- ORDER BY group_type DESC, group_name ASC';
+ if (!isset($auth[$flag]) || !$auth[$flag])
+ {
+ $auth[$flag] = $setting;
+ }
}
+
+ $sql = 'SELECT auth_option_id, auth_setting
+ FROM ' . ACL_PRESETS_DATA_TABLE . '
+ WHERE preset_id = ' . $preset_id;
$result = $db->sql_query($sql);
- $ug_names_ary = array();
+ $cur_auth = array();
while ($row = $db->sql_fetchrow($result))
{
- $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['ug_name']] : $row['ug_name']);
+ $cur_auth[$row['auth_option_id']] = $row['auth_setting'];
}
$db->sql_freeresult($result);
- // Get used forums
- $forum_ids = array();
- foreach ($hold_ary as $ug_id => $row)
- {
- $forum_ids = array_merge($forum_ids, array_keys($row));
- }
- $forum_ids = array_unique($forum_ids);
-
- $forum_names_ary = array();
- if ($local)
- {
- $forum_names_ary = make_forum_select(false, false, true, false, false, true);
- }
- else
- {
- $forum_names_ary[0] = $l_acl_type;
- }
+ $sql_ary = array();
- // Now obtain memberships
- $user_groups_default = $user_groups_custom = array();
- if ($user_mode == 'user' && $group_display)
+ foreach ($auth as $auth_option => $setting)
{
- $sql = 'SELECT group_id, group_name, group_type
- FROM ' . GROUPS_TABLE . '
- ORDER BY group_type DESC, group_name ASC';
- $result = $db->sql_query($sql);
+ $auth_option_id = (int) $this->option_ids[$auth_option];
- $groups = array();
- while ($row = $db->sql_fetchrow($result))
+ switch ($setting)
{
- $groups[$row['group_id']] = $row;
- }
- $db->sql_freeresult($result);
-
- $memberships = group_memberships(false, array_keys($hold_ary), false);
+ case ACL_UNSET:
+ if (isset($cur_auth[$auth_option_id]))
+ {
+ $sql_ary['delete'][] = 'DELETE FROM ' . ACL_PRESETS_DATA_TABLE . '
+ WHERE auth_option_id = ' . $auth_option_id . '
+ AND preset_id = ' . $preset_id;
+ }
+ break;
- foreach ($memberships as $row)
- {
- if ($groups[$row['group_id']]['group_type'] == GROUP_SPECIAL)
- {
- $user_groups_default[$row['user_id']][] = $user->lang['G_' . $groups[$row['group_id']]['group_name']];
- }
- else
- {
- $user_groups_custom[$row['user_id']][] = $groups[$row['group_id']]['group_name'];
- }
+ default:
+ if (!isset($cur_auth[$auth_option_id]))
+ {
+ $sql_ary['insert'][] = array(
+ 'preset_id' => (int) $preset_id,
+ 'auth_option_id' => (int) $auth_option_id,
+ 'auth_setting' => (int) $setting
+ );
+ }
+ else if ($cur_auth[$auth_option_id] != $setting)
+ {
+ $sql_ary['update'][] = 'UPDATE ' . ACL_PRESETS_DATA_TABLE . '
+ SET auth_setting = ' . (int) $setting . '
+ WHERE preset_id = ' . $preset_id . '
+ AND auth_option_id = ' . $auth_option_id;
+ }
+ break;
}
- unset($memberships, $groups);
}
+ unset($cur_auth);
- // If we only have one forum id to display, we switch the complete interface to group by user/usergroup instead of grouping by forum
- // To achive this, we need to switch the array a bit
- if (sizeof($forum_ids) == 1)
+ foreach ($sql_ary as $sql_type => $sql_subary)
{
- $hold_ary_temp = $hold_ary;
- $hold_ary = array();
- foreach ($hold_ary_temp as $ug_id => $row)
- {
- foreach ($row as $forum_id => $auth_row)
- {
- $hold_ary[$forum_id][$ug_id] = $auth_row;
- }
- }
- unset($hold_ary_temp);
-
- foreach ($hold_ary as $forum_id => $forum_array)
+ switch ($sql_type)
{
- $content_array = $categories = array();
- $this->build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary));
+ case 'insert':
+ switch (SQL_LAYER)
+ {
+ case 'mysql':
+ case 'mysql4':
+ case 'mysqli':
+ $db->sql_query('INSERT INTO ' . ACL_PRESETS_DATA_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_subary));
+ break;
- $template->assign_block_vars($tpl_pmask, array(
- 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],
- 'CATEGORIES' => implode('</th><th>', $categories),
+ default:
+ foreach ($sql_subary as $ary)
+ {
+ $db->sql_query('INSERT INTO ' . ACL_PRESETS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $ary));
+ }
+ break;
+ }
+ break;
- 'L_ACL_TYPE' => $l_acl_type,
+ case 'update':
+ case 'delete':
+ foreach ($sql_subary as $sql)
+ {
+ $db->sql_query($sql);
+ }
+ break;
+ }
+ }
- 'S_LOCAL' => ($local) ? true : false,
- 'S_GLOBAL' => (!$local) ? true : false,
- 'S_NUM_CATS' => sizeof($categories),
- 'S_VIEW' => ($mode == 'view') ? true : false,
- 'S_NUM_OBJECTS' => sizeof($content_array),
- 'S_USER_MODE' => ($user_mode == 'user') ? true : false,
- 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false)
- );
+ $this->acl_clear_prefetch();
+ }
- foreach ($content_array as $ug_id => $ug_array)
- {
- $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(
- 'NAME' => $ug_names_ary[$ug_id],
- 'UG_ID' => $ug_id,
- 'FORUM_ID' => $forum_id)
- );
+ /**
+ * Remove local permission
+ */
+ function acl_delete($mode, $ug_id = false, $forum_id = false, $auth_id = false)
+ {
+ global $db;
- $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id);
- }
- }
- }
- else
+ if ($ug_id === false && $forum_id === false && $auth_ids === false)
{
- foreach ($ug_names_ary as $ug_id => $ug_name)
- {
- if (!isset($hold_ary[$ug_id]))
- {
- continue;
- }
+ return;
+ }
- $content_array = $categories = array();
- $this->build_permission_array($hold_ary[$ug_id], $content_array, $categories, array_keys($forum_names_ary));
+ $table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE;
+ $id_field = $mode . '_id';
- $template->assign_block_vars($tpl_pmask, array(
- 'NAME' => $ug_name,
- 'CATEGORIES' => implode('</th><th>', $categories),
+ $sql = array();
- 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && sizeof($user_groups_default[$ug_id])) ? implode(', ', $user_groups_default[$ug_id]) : '',
- 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && sizeof($user_groups_custom[$ug_id])) ? implode(', ', $user_groups_custom[$ug_id]) : '',
- 'L_ACL_TYPE' => $l_acl_type,
+ if ($auth_id !== false)
+ {
+ $sql[] = (!is_array($auth_id)) ? 'auth_option_id = ' . (int) $auth_id : 'auth_option_id IN (' . implode(', ', array_map('intval', $auth_id)) . ')';
+ }
+
+ if ($forum_id !== false)
+ {
+ $sql[] = (!is_array($forum_id)) ? 'forum_id = ' . (int) $forum_id : 'forum_id IN (' . implode(', ', array_map('intval', $forum_id)) . ')';
+ }
- 'S_LOCAL' => ($local) ? true : false,
- 'S_GLOBAL' => (!$local) ? true : false,
- 'S_NUM_CATS' => sizeof($categories),
- 'S_VIEW' => ($mode == 'view') ? true : false,
- 'S_NUM_OBJECTS' => sizeof($content_array),
- 'S_USER_MODE' => ($user_mode == 'user') ? true : false,
- 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false)
- );
+ if ($ug_id !== false)
+ {
+ $sql[] = (!is_array($ug_id)) ? $id_field . ' = ' . (int) $ug_id : $id_field . ' IN (' . implode(', ', array_map('intval', $ug_id)) . ')';
+ }
- foreach ($content_array as $forum_id => $forum_array)
- {
- $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array(
- 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'],
- 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'],
- 'UG_ID' => $ug_id,
- 'FORUM_ID' => $forum_id)
- );
+ $sql = "DELETE FROM $table
+ WHERE " . implode(' AND ', $sql);
+ $db->sql_query($sql);
- $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id);
- }
- }
- }
+ $this->acl_clear_prefetch();
}
/**
@@ -898,9 +898,9 @@ class auth_admin extends auth
foreach ($cat_array['permissions'] as $permission => $allowed)
{
$template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array(
- 'S_YES' => ($allowed == 1) ? true : false,
- 'S_NO' => ($allowed == 0) ? true : false,
- 'S_UNSET' => ($allowed == -1) ? true : false,
+ 'S_YES' => ($allowed == ACL_YES) ? true : false,
+ 'S_NO' => ($allowed == ACL_NO) ? true : false,
+ 'S_UNSET' => ($allowed == ACL_UNSET) ? true : false,
'UG_ID' => $ug_id,
'FORUM_ID' => $forum_id,