From 26a6d215d0897afa82eea9b0cc0fca79d4544da5 Mon Sep 17 00:00:00 2001 From: Meik Sievertsen Date: Sat, 18 Feb 2006 13:54:12 +0000 Subject: - 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 --- phpBB/includes/acp/auth.php | 598 ++++++++++++++++++++++---------------------- 1 file changed, 299 insertions(+), 299 deletions(-) (limited to 'phpBB/includes/acp/auth.php') 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 @@ -204,6 +204,186 @@ class auth_admin extends auth return $hold_ary; } + /** + * 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('', $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('', $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 */ @@ -384,12 +564,24 @@ class auth_admin extends auth } /** - * Set a preset ACL record + * Set a user or group ACL record */ - function acl_set_preset($preset_id, &$auth) + function acl_set($ug_type, &$forum_id, &$ug_id, &$auth) { global $db; + // One or more forums + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // One or more users + if (!is_array($ug_id)) + { + $ug_id = array($ug_id); + } + if (!sizeof($this->option_ids)) { $sql = 'SELECT auth_option_id, auth_option @@ -404,6 +596,9 @@ class auth_admin extends auth $db->sql_freeresult($result); } + $ug_id_sql = 'IN (' . implode(', ', array_map('intval', $ug_id)) . ')'; + $forum_sql = 'IN (' . implode(', ', array_map('intval', $forum_id)) . ') '; + // Set any flags as required foreach ($auth as $auth_option => $setting) { @@ -415,52 +610,78 @@ class auth_admin extends auth } } - $sql = 'SELECT auth_option_id, auth_setting - FROM ' . ACL_PRESETS_DATA_TABLE . ' - WHERE preset_id = ' . $preset_id; + if ($ug_type == 'user') + { + $sql = 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting + FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o + WHERE a.auth_option_id = o.auth_option_id + AND a.forum_id $forum_sql + AND a.user_id $ug_id_sql"; + } + else + { + $sql = 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting + FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o + WHERE a.auth_option_id = o.auth_option_id + AND a.forum_id $forum_sql + AND a.group_id $ug_id_sql"; + } $result = $db->sql_query($sql); $cur_auth = array(); while ($row = $db->sql_fetchrow($result)) { - $cur_auth[$row['auth_option_id']] = $row['auth_setting']; + $cur_auth[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting']; } $db->sql_freeresult($result); - $sql_ary = array(); + $table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = $ug_type . '_id'; - foreach ($auth as $auth_option => $setting) + $sql_ary = array(); + foreach ($forum_id as $forum) { - $auth_option_id = (int) $this->option_ids[$auth_option]; + $forum = (int) $forum; - switch ($setting) + foreach ($auth as $auth_option => $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; + $auth_option_id = (int) $this->option_ids[$auth_option]; - 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; + switch ($setting) + { + case ACL_UNSET: + if (isset($cur_auth[$forum][$auth_option_id])) + { + $sql_ary['delete'][] = "DELETE FROM $table + WHERE forum_id = $forum + AND auth_option_id = $auth_option_id + AND $id_field $ug_id_sql"; + } + break; + + default: + if (!isset($cur_auth[$forum][$auth_option_id])) + { + foreach ($ug_id as $id) + { + $sql_ary['insert'][] = array( + $id_field => (int) $id, + 'forum_id' => (int) $forum, + 'auth_option_id' => (int) $auth_option_id, + 'auth_setting' => (int) $setting + ); + } + } + else if ($cur_auth[$forum][$auth_option_id] != $setting) + { + $sql_ary['update'][] = "UPDATE $table + SET auth_setting = " . (int) $setting . " + WHERE $id_field $ug_id_sql + AND forum_id = $forum + AND auth_option_id = $auth_option_id"; + } + break; + } } } unset($cur_auth); @@ -475,13 +696,13 @@ class auth_admin extends auth case 'mysql': case 'mysql4': case 'mysqli': - $db->sql_query('INSERT INTO ' . ACL_PRESETS_DATA_TABLE . ' ' . $db->sql_build_array('MULTI_INSERT', $sql_subary)); + $db->sql_query("INSERT INTO $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)); + $db->sql_query("INSERT INTO $table " . $db->sql_build_array('INSERT', $ary)); } break; } @@ -499,26 +720,14 @@ class auth_admin extends auth $this->acl_clear_prefetch(); } - + /** - * Set a user or group ACL record + * Set a preset ACL record */ - function acl_set($ug_type, &$forum_id, &$ug_id, &$auth) + function acl_set_preset($preset_id, &$auth) { global $db; - // One or more forums - if (!is_array($forum_id)) - { - $forum_id = array($forum_id); - } - - // One or more users - if (!is_array($ug_id)) - { - $ug_id = array($ug_id); - } - if (!sizeof($this->option_ids)) { $sql = 'SELECT auth_option_id, auth_option @@ -533,9 +742,6 @@ class auth_admin extends auth $db->sql_freeresult($result); } - $ug_id_sql = 'IN (' . implode(', ', array_map('intval', $ug_id)) . ')'; - $forum_sql = 'IN (' . implode(', ', array_map('intval', $forum_id)) . ') '; - // Set any flags as required foreach ($auth as $auth_option => $setting) { @@ -547,78 +753,52 @@ class auth_admin extends auth } } - if ($ug_type == 'user') - { - $sql = 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting - FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o - WHERE a.auth_option_id = o.auth_option_id - AND a.forum_id $forum_sql - AND a.user_id $ug_id_sql"; - } - else - { - $sql = 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting - FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o - WHERE a.auth_option_id = o.auth_option_id - AND a.forum_id $forum_sql - AND a.group_id $ug_id_sql"; - } + $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['forum_id']][$row['auth_option_id']] = $row['auth_setting']; + $cur_auth[$row['auth_option_id']] = $row['auth_setting']; } $db->sql_freeresult($result); - $table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; - $id_field = $ug_type . '_id'; - $sql_ary = array(); - foreach ($forum_id as $forum) + + foreach ($auth as $auth_option => $setting) { - $forum = (int) $forum; + $auth_option_id = (int) $this->option_ids[$auth_option]; - foreach ($auth as $auth_option => $setting) + switch ($setting) { - $auth_option_id = (int) $this->option_ids[$auth_option]; - - switch ($setting) - { - case ACL_UNSET: - if (isset($cur_auth[$forum][$auth_option_id])) - { - $sql_ary['delete'][] = "DELETE FROM $table - WHERE forum_id = $forum - AND auth_option_id = $auth_option_id - AND $id_field $ug_id_sql"; - } - break; + 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[$forum][$auth_option_id])) - { - foreach ($ug_id as $id) - { - $sql_ary['insert'][] = array( - $id_field => (int) $id, - 'forum_id' => (int) $forum, - 'auth_option_id' => (int) $auth_option_id, - 'auth_setting' => (int) $setting - ); - } - } - else if ($cur_auth[$forum][$auth_option_id] != $setting) - { - $sql_ary['update'][] = "UPDATE $table - SET auth_setting = " . (int) $setting . " - WHERE $id_field $ug_id_sql - AND forum_id = $forum - AND auth_option_id = $auth_option_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); @@ -633,13 +813,13 @@ class auth_admin extends auth case 'mysql': case 'mysql4': case 'mysqli': - $db->sql_query("INSERT INTO $table " . $db->sql_build_array('MULTI_INSERT', $sql_subary)); + $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 $table " . $db->sql_build_array('INSERT', $ary)); + $db->sql_query('INSERT INTO ' . ACL_PRESETS_DATA_TABLE . ' ' . $db->sql_build_array('INSERT', $ary)); } break; } @@ -697,186 +877,6 @@ class auth_admin extends auth $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'; - - $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('', $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('', $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); - } - } - } - } - /** * Assign category to template * used by display_mask() @@ -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, -- cgit v1.2.1