diff options
Diffstat (limited to 'phpBB/includes/acp')
-rw-r--r-- | phpBB/includes/acp/acp_board.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permission_roles.php | 328 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_permissions.php | 148 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_profile.php | 20 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_search.php | 10 | ||||
-rw-r--r-- | phpBB/includes/acp/auth.php | 60 | ||||
-rw-r--r-- | phpBB/includes/acp/info/acp_permissions.php | 1 |
7 files changed, 224 insertions, 347 deletions
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 3fd97d2471..4abe3d0837 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -103,7 +103,7 @@ class acp_board 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'type' => 'text:4:4', 'explain' => true), 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'type' => 'text:4:4', 'explain' => true), 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), - 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), + 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'legend2' => 'GENERAL_OPTIONS', 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'type' => 'radio:yes_no', 'explain' => false), @@ -138,7 +138,7 @@ class acp_board 'legend2' => 'POSTING', 'bump_type' => false, - 'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true), + 'edit_time' => array('lang' => 'EDIT_TIME', 'type' => 'text:3:3', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'type' => 'radio:yes_no', 'explain' => true), 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'type' => 'text:3:4', 'explain' => true), 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index 5701ebb699..1088d9d2fb 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -14,7 +14,6 @@ class acp_permission_roles { var $u_action; - var $pre_selection_array; function main($id, $mode) { @@ -36,24 +35,6 @@ class acp_permission_roles $action = request_var('action', ''); $action = (isset($_POST['add'])) ? 'add' : $action; - // Define pre-selection array - $this->pre_selection_array = array( - 1 => array('lang' => 'PRE_ONLY_SPECIAL_GUEST', 'type' => GROUP_SPECIAL, 'name' => array('BOTS', 'GUESTS', 'INACTIVE', 'INACTIVE_COPPA'), 'negate' => false), - 2 => array('lang' => 'PRE_ONLY_SPECIAL_REGISTERED', 'type' => GROUP_SPECIAL, 'name' => array('ADMINISTRATORS', 'SUPER_MODERATORS', 'REGISTERED', 'REGISTERED_COPPA'), 'negate' => false), - 3 => array('lang' => 'PRE_NOT_SPECIAL_GUEST', 'type' => GROUP_SPECIAL, 'name' => array('BOTS', 'GUESTS', 'INACTIVE', 'INACTIVE_COPPA'), 'negate' => true), - 4 => array('lang' => 'PRE_NOT_SPECIAL_REGISTERED', 'type' => GROUP_SPECIAL, 'name' => array('ADMINISTRATORS', 'SUPER_MODERATORS', 'REGISTERED', 'REGISTERED_COPPA'), 'negate' => true), - 5 => array('lang' => 'PRE_ALL_SPECIAL', 'type' => GROUP_SPECIAL, 'negate' => false), - 6 => array('lang' => 'PRE_NOT_SPECIAL', 'type' => GROUP_SPECIAL, 'negate' => true), - 7 => array('lang' => 'PRE_ALL_FREE', 'type' => GROUP_FREE, 'negate' => false), - 8 => array('lang' => 'PRE_NOT_FREE', 'type' => GROUP_FREE, 'negate' => true), - 9 => array('lang' => 'PRE_ALL_CLOSED', 'type' => GROUP_CLOSED, 'negate' => false), - 10 => array('lang' => 'PRE_NOT_CLOSED', 'type' => GROUP_CLOSED, 'negate' => true), - 11 => array('lang' => 'PRE_ALL_HIDDEN', 'type' => GROUP_HIDDEN, 'negate' => false), - 12 => array('lang' => 'PRE_NOT_HIDDEN', 'type' => GROUP_HIDDEN, 'negate' => true), - 13 => array('lang' => 'PRE_ALL_OPEN', 'type' => GROUP_OPEN, 'negate' => false), - 14 => array('lang' => 'PRE_NOT_OPEN', 'type' => GROUP_OPEN, 'negate' => true), - ); - switch ($mode) { case 'admin_roles': @@ -151,8 +132,6 @@ class acp_permission_roles $role_name = request_var('role_name', '', true); $role_description = request_var('role_description', '', true); - $role_group_ids = request_var('role_group_ids', array(0)); - $pre_select = request_var('pre_select', 'custom'); $auth_settings = request_var('setting', array('' => 0)); if (!$role_name) @@ -160,99 +139,6 @@ class acp_permission_roles trigger_error($user->lang['NO_ROLE_NAME_SPECIFIED'] . adm_back_link($this->u_action)); } - // Adjust group array if we have a pre-selection - if ($pre_select != 'custom') - { - $pre_select = (int) $pre_select; - - if (!$pre_select || !isset($this->pre_selection_array[$pre_select])) - { - $role_group_ids = array(0); - } - else - { - $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_type']][$row['group_id']] = $row['group_name']; - } - $db->sql_freeresult($result); - - // Build role_group_ids - $role_group_ids = array(); - - $row = $this->pre_selection_array[$pre_select]; - - if (!$row['negate'] && !isset($row['name'])) - { - if (isset($groups[$row['type']])) - { - foreach ($groups[$row['type']] as $group_id => $group_name) - { - $role_group_ids[] = $group_id; - } - } - } - else if ($row['negate'] && !isset($row['name'])) - { - $group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE); - unset($group_types[array_search($row['type'], $group_types)]); - - foreach ($group_types as $type) - { - if (!isset($groups[$type])) - { - continue; - } - - foreach ($groups[$type] as $group_id => $group_name) - { - $role_group_ids[] = $group_id; - } - } - } - else if (!$row['negate'] && isset($row['name'])) - { - foreach ($groups[$row['type']] as $group_id => $group_name) - { - if (in_array($group_name, $row['name'])) - { - $role_group_ids[] = $group_id; - } - } - } - else if ($row['negate'] && isset($row['name'])) - { - $group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE); - - foreach ($group_types as $type) - { - if (!isset($groups[$type])) - { - continue; - } - - foreach ($groups[$type] as $group_id => $group_name) - { - if ($type != $row['type']) - { - $role_group_ids[] = $group_id; - } - else if (!in_array($group_name, $row['name'])) - { - $role_group_ids[] = $group_id; - } - } - } - } - } - } - // if we add/edit a role we check the name to be unique among the settings... $sql = 'SELECT role_id FROM ' . ACL_ROLES_TABLE . " @@ -268,17 +154,10 @@ class acp_permission_roles trigger_error(sprintf($user->lang['ROLE_NAME_ALREADY_EXIST'], $role_name) . adm_back_link($this->u_action)); } - // If role_group_ids include "every user/group" we do not need to set it... - if (in_array(0, $role_group_ids)) - { - $role_group_ids = array(0); - } - $sql_ary = array( 'role_name' => (string) $role_name, 'role_description' => (string) $role_description, 'role_type' => (string) $permission_type, - 'role_group_ids' => (string) implode(':', $role_group_ids), ); if ($action == 'edit') @@ -329,7 +208,6 @@ class acp_permission_roles 'role_name' => request_var('role_name', '', true), 'role_description' => request_var('role_description', '', true), 'role_type' => $permission_type, - 'role_group_ids' => implode(':', request_var('role_group_ids', array(0))), ); if ($options_from) @@ -401,14 +279,8 @@ class acp_permission_roles trigger_error($user->lang['NO_PRESET_SELECTED'] . adm_back_link($this->u_action)); } - // Build group options array (with pre-selection) - $s_preselect_options = $s_group_options = array(); - $this->build_group_options($role_row['role_group_ids'], $s_preselect_options, $s_group_options); - $template->assign_vars(array( - 'S_EDIT' => true, - 'S_PRESELECT_OPTIONS' => $s_preselect_options, - 'S_GROUP_OPTIONS' => $s_group_options, + 'S_EDIT' => true, 'U_ACTION' => $this->u_action . "&action={$action}&role_id={$role_id}", 'U_BACK' => $this->u_action, @@ -418,7 +290,7 @@ class acp_permission_roles 'L_ACL_TYPE' => $user->lang['ACL_TYPE_' . strtoupper($permission_type)], ) ); - + // We need to fill the auth options array with ACL_UNSET options ;) $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " @@ -480,7 +352,7 @@ class acp_permission_roles $sql = 'SELECT role_id, role_order FROM ' . ACL_ROLES_TABLE . " WHERE role_type = '" . $db->sql_escape($permission_type) . "' - ORDER BY role_order"; + ORDER BY role_order ASC"; $result = $db->sql_query($sql); if ($row = $db->sql_fetchrow($result)) @@ -498,6 +370,9 @@ class acp_permission_roles } $db->sql_freeresult($result); + // Display assigned items? + $display_item = request_var('display_item', 0); + // Select existing roles $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . " @@ -505,47 +380,13 @@ class acp_permission_roles ORDER BY role_order ASC"; $result = $db->sql_query($sql); - $roles = $groups = $group_ids = $group_info = array(); - while ($row = $db->sql_fetchrow($result)) - { - $roles[] = $row; - if ($row['role_group_ids']) - { - $groups[$row['role_id']] = explode(':', $row['role_group_ids']); - $group_ids = array_merge($group_ids, $groups[$row['role_id']]); - } - } - $db->sql_freeresult($result); - - if (sizeof($group_ids)) - { - $sql = 'SELECT group_id, group_type, group_name - FROM ' . GROUPS_TABLE . ' - WHERE group_id IN (' . implode(', ', array_map('intval', $group_ids)) . ')'; - $result = $db->sql_query($sql); - - while ($row = $db->sql_fetchrow($result)) - { - $group_info[$row['group_id']] = array( - 'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'], - 'group_special' => ($row['group_type'] == GROUP_SPECIAL) ? true : false, - ); - } - $db->sql_freeresult($result); - } - - // Display assigned items? - $display_item = request_var('display_item', 0); - $s_role_options = ''; - foreach ($roles as $row) + while ($row = $db->sql_fetchrow($result)) { $template->assign_block_vars('roles', array( 'ROLE_NAME' => $row['role_name'], 'ROLE_DESCRIPTION' => nl2br($row['role_description']), - 'S_GROUP' => ($row['role_group_ids']) ? true : false, - 'U_EDIT' => $this->u_action . '&action=edit&role_id=' . $row['role_id'], 'U_REMOVE' => $this->u_action . '&action=remove&role_id=' . $row['role_id'], 'U_MOVE_UP' => $this->u_action . '&action=move_up&order=' . $row['role_order'], @@ -553,18 +394,6 @@ class acp_permission_roles 'U_DISPLAY_ITEMS' => ($row['role_id'] == $display_item) ? '' : $this->u_action . '&display_item=' . $row['role_id'] . '#assigned_to') ); - if (isset($groups[$row['role_id']]) && sizeof($groups[$row['role_id']])) - { - foreach ($groups[$row['role_id']] as $group_id) - { - $template->assign_block_vars('roles.groups', array( - 'S_SPECIAL_GROUP' => $group_info[$group_id]['group_special'], - 'GROUP_NAME' => $group_info[$group_id]['group_name'], - 'U_GROUP' => $phpbb_root_path . "memberlist.$phpEx$SID&mode=group&g=$group_id") - ); - } - } - $s_role_options .= '<option value="' . $row['role_id'] . '">' . $row['role_name'] . '</option>'; if ($display_item == $row['role_id']) @@ -574,6 +403,7 @@ class acp_permission_roles ); } } + $db->sql_freeresult($result); $template->assign_vars(array( 'S_ROLE_OPTIONS' => $s_role_options) @@ -633,146 +463,6 @@ class acp_permission_roles } } - - /** - * Build user-friendly group options - */ - function build_group_options($role_group_ids, &$s_preselect_options, &$s_group_options) - { - global $db, $user, $template; - - $groups = $selected_groups = array(); - - $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_type']][$row['group_id']] = $row['group_name']; - } - $db->sql_freeresult($result); - - $selected_group_ids = explode(':', $role_group_ids); - - // First of all, build the group options for the custom interface... - $s_group_options = ''; - foreach ($groups as $group_type => $group_row) - { - foreach ($group_row as $group_id => $group_name) - { - if (in_array($group_id, $selected_group_ids)) - { - $selected_groups[$group_type][$group_id] = $group_name; - } - $s_group_options .= '<option value="' . $group_id . '"' . ((in_array($group_id, $selected_group_ids)) ? ' selected="selected"' : '') . (($group_type == GROUP_SPECIAL) ? ' class="sep"' : '') . '>' . (($group_type == GROUP_SPECIAL) ? $user->lang['G_' . $group_name] : $group_name) . '</option>'; - } - } - - // Build preselect array... - $one_selected_item = false; - - $s_preselect_options = '<option value="0"' . ((!$role_group_ids) ? ' selected="selected"' : '') . '>' . $user->lang['EVERY_USER_GROUP'] . '</option>'; - if (!$role_group_ids) - { - $one_selected_item = true; - } - - // Build pre-selection dropdown field - foreach ($this->pre_selection_array as $option_id => $row) - { - if (!$row['negate'] && !isset($row['name'])) - { - $s_selected = false; - if (sizeof($selected_groups) == 1 && isset($selected_groups[$row['type']]) && sizeof($selected_groups[$row['type']]) == sizeof($groups[$row['type']])) - { - $s_selected = true; - } - } - else if ($row['negate'] && !isset($row['name'])) - { - $group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE); - unset($group_types[array_search($row['type'], $group_types)]); - - $s_selected = true; - if (isset($selected_groups[$row['type']])) - { - $s_selected = false; - } - - foreach ($group_types as $type) - { - if (!isset($selected_groups[$type]) || sizeof($selected_groups[$type]) != sizeof($groups[$type])) - { - $s_selected = false; - } - } - } - else if (!$row['negate'] && isset($row['name'])) - { - $s_selected = false; - if (sizeof($selected_groups) == 1 && isset($selected_groups[$row['type']]) && sizeof($selected_groups[$row['type']]) == sizeof($row['name'])) - { - $s_selected = true; - - foreach ($row['name'] as $name) - { - if (!in_array($name, $selected_groups[$row['type']])) - { - $s_selected = false; - } - } - } - } - else if ($row['negate'] && isset($row['name'])) - { - $group_types = array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE); - unset($group_types[array_search($row['type'], $group_types)]); - - $s_selected = true; - if (isset($selected_groups[$row['type']])) - { - foreach ($row['name'] as $name) - { - if (in_array($name, $selected_groups[$row['type']])) - { - $s_selected = false; - } - } - } - - if ($s_selected) - { - foreach ($group_types as $type) - { - if (!isset($groups[$type])) - { - continue; - } - - if (!isset($selected_groups[$type]) || sizeof($selected_groups[$type]) != sizeof($groups[$type])) - { - $s_selected = false; - } - } - } - } - - if ($s_selected) - { - $one_selected_item = true; - } - - $s_preselect_options .= '<option value="' . $option_id . '"' . (($s_selected) ? ' selected="selected"' : '') . '>' . $user->lang[$row['lang']] . '</option>'; - } - - $s_preselect_options .= '<option value="custom"' . ((!$one_selected_item) ? ' selected="selected"' : '') . '>' . $user->lang['CUSTOM'] . '</option>'; - - $template->assign_var('S_CUSTOM_GROUP_IDS', ($one_selected_item) ? false : true); - } - /** * Remove role */ @@ -811,7 +501,7 @@ class acp_permission_roles // Get role assignments $hold_ary = $auth_admin->get_role_mask($role_id); - // Re-assign permisisons + // Re-assign permissions foreach ($hold_ary as $forum_id => $forum_ary) { if (isset($forum_ary['users'])) diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index e46a3ffaca..44c73e8cf1 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -31,6 +31,25 @@ class acp_permissions $this->tpl_name = 'acp_permissions'; + // Trace has other vars + if ($mode == 'trace') + { + $user_id = request_var('u', 0); + $forum_id = request_var('f', 0); + $permission = request_var('auth', ''); + + $this->tpl_name = 'permission_trace'; + + if ($user_id && isset($auth_admin->option_ids[$permission]) && $auth->acl_get('a_viewauth')) + { + $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $user->lang['acl_' . $permission]['lang']); + $this->permission_trace($user_id, $forum_id, $permission); + return; + } + + trigger_error('NO_MODE'); + } + // Set some vars $action = request_var('action', array('' => 0)); $action = key($action); @@ -854,6 +873,135 @@ class acp_permissions } unset($perms); } + + /** + * Display a complete trace tree for the selected permission to determine where settings are set/unset + */ + function permission_trace($user_id, $forum_id, $permission) + { + global $db, $template, $user, $auth; + + $sql = 'SELECT username + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $username = (string) $db->sql_fetchfield('username'); + $db->sql_freeresult($result); + + if (!$username) + { + trigger_error('NO_USERS'); + } + + $template->assign_vars(array( + 'PERMISSION' => $user->lang['acl_' . $permission]['lang'], + 'PERMISSION_USERNAME' => $username) + ); + + $template->assign_block_vars('trace', array( + 'WHO' => $user->lang['DEFAULT'], + 'INFORMATION' => $user->lang['TRACE_DEFAULT'], + + 'S_SETTING_UNSET' => true, + 'S_TOTAL_UNSET' => true) + ); + + $sql = 'SELECT DISTINCT g.group_name, g.group_id, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id) + WHERE ug.user_id = ' . $user_id . ' + ORDER BY g.group_type DESC, g.group_id DESC'; + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[$row['group_id']] = array( + 'auth_setting' => ACL_UNSET, + 'group_name' => ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'] + ); + } + $db->sql_freeresult($result); + + if (sizeof($groups)) + { + // Get group auth settings + $hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id); + + foreach ($hold_ary as $group_id => $forum_ary) + { + $groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission]; + } + unset($hold_ary); + + $total = ACL_UNSET; + foreach ($groups as $id => $row) + { + switch ($row['auth_setting']) + { + case ACL_UNSET: + $information = $user->lang['TRACE_GROUP_UNSET']; + break; + + case ACL_YES: + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_GROUP_YES_TOTAL_NO'] : $user->lang['TRACE_GROUP_YES_TOTAL_UNSET']); + $total = ($total == ACL_UNSET) ? ACL_YES : $total; + break; + + case ACL_NO: + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NO_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_GROUP_NO_TOTAL_NO'] : $user->lang['TRACE_GROUP_NO_TOTAL_UNSET']); + $total = ACL_NO; + break; + } + + $template->assign_block_vars('trace', array( + 'WHO' => $row['group_name'], + 'INFORMATION' => $information, + + 'S_SETTING_UNSET' => ($row['auth_setting'] == ACL_UNSET) ? true : false, + 'S_SETTING_YES' => ($row['auth_setting'] == ACL_YES) ? true : false, + 'S_SETTING_NO' => ($row['auth_setting'] == ACL_NO) ? true : false, + 'S_TOTAL_UNSET' => ($total == ACL_UNSET) ? true : false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NO' => ($total == ACL_NO) ? true : false) + ); + } + } + + // Get user specific permission... + $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id); + $auth_setting = (!sizeof($hold_ary)) ? ACL_UNSET : $hold_ary[$user_id][$forum_id][$permission]; + + switch ($auth_setting) + { + case ACL_UNSET: + $information = ($total == ACL_UNSET) ? $user->lang['TRACE_USER_UNSET_TOTAL_UNSET'] : $user->lang['TRACE_USER_KEPT']; + $total = ($total == ACL_UNSET) ? ACL_NO : $total; + break; + + case ACL_YES: + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_USER_YES_TOTAL_NO'] : $user->lang['TRACE_USER_YES_TOTAL_UNSET']); + $total = ($total == ACL_UNSET) ? ACL_YES : $total; + break; + + case ACL_NO: + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NO_TOTAL_YES'] : (($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO'] : $user->lang['TRACE_USER_NO_TOTAL_UNSET']); + $total = ACL_NO; + break; + } + + $template->assign_block_vars('trace', array( + 'WHO' => $username, + 'INFORMATION' => $information, + + 'S_SETTING_UNSET' => ($auth_setting == ACL_UNSET) ? true : false, + 'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false, + 'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false, + 'S_TOTAL_UNSET' => ($total == ACL_UNSET) ? true : false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NO' => ($total == ACL_NO) ? true : false) + ); + } } ?>
\ No newline at end of file diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 35fef141fd..db9b78b1fc 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -959,35 +959,39 @@ class acp_profile if ($action == 'create') { + /** + * @todo Adjust for every database + */ + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident "; switch ($field_type) { case FIELD_STRING: - $sql .= ' VARCHAR(255) DEFAULT NULL NULL'; + $sql .= ' VARCHAR(255) '; break; case FIELD_DATE: - $sql .= 'VARCHAR(10) DEFAULT NULL NULL'; + $sql .= 'VARCHAR(10) '; break; case FIELD_TEXT: - $sql .= "TEXT NULL, - ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, - ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; + $sql .= "TEXT"; +// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, +// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; break; case FIELD_BOOL: - $sql .= 'TINYINT(2) DEFAULT NULL NULL'; + $sql .= 'TINYINT(2) '; break; case FIELD_DROPDOWN: - $sql .= 'MEDIUMINT(8) DEFAULT NULL NULL'; + $sql .= 'MEDIUMINT(8) '; break; case FIELD_INT: - $sql .= 'BIGINT(20) DEFAULT NULL NULL'; + $sql .= 'BIGINT(20) '; break; } diff --git a/phpBB/includes/acp/acp_search.php b/phpBB/includes/acp/acp_search.php index 855bdea0f6..468d7894d5 100644 --- a/phpBB/includes/acp/acp_search.php +++ b/phpBB/includes/acp/acp_search.php @@ -183,7 +183,15 @@ class acp_search global $db, $user, $auth, $template, $cache; global $config, $SID, $phpbb_root_path, $phpbb_admin_path, $phpEx; - $action = (isset($_REQUEST['action']) && is_array($_REQUEST['action'])) ? key(request_var('action', array('' => false))) : request_var('action', ''); + if (isset($_REQUEST['action']) && is_array($_REQUEST['action'])) + { + $action = request_var('action', array('' => false)); + $action = key($action); + } + else + { + $action = request_var('action', ''); + } $this->state = explode(',', $config['search_indexing_state']); if ($action) diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 183e4a1db7..0aeffeb47e 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -239,7 +239,10 @@ class auth_admin extends auth $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); - + + // Allow trace for viewing permissions and in user mode + $show_trace = ($mode == 'view' && $user_mode == 'user') ? true : false; + // Get names if ($user_mode == 'user') { @@ -293,7 +296,6 @@ class auth_admin extends auth while ($row = $db->sql_fetchrow($result)) { $roles[$row['role_id']] = $row; - $roles[$row['role_id']]['groups'] = ($row['role_group_ids']) ? explode(':', $row['role_group_ids']) : array(); } $db->sql_freeresult($result); @@ -412,16 +414,13 @@ class auth_admin extends auth $s_role_options = ''; foreach ($roles as $role_id => $role_row) { - if ($role_id == $current_role_id || !sizeof($role_row['groups']) || ($user_mode == 'group' && in_array($ug_id, $role_row['groups']))) - { - $title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : ''; - $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>'; - } + $title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : ''; + $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>'; } if ($s_role_options) { - $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_ROLE'] . '</option>' . $s_role_options; + $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['NO_ROLE_ASSIGNED'] . '</option>' . $s_role_options; } $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( @@ -431,7 +430,7 @@ class auth_admin extends auth 'FORUM_ID' => $forum_id) ); - $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id); + $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace); } } } @@ -472,10 +471,8 @@ class auth_admin extends auth $s_role_options = ''; foreach ($roles as $role_id => $role_row) { - if ($role_id == $current_role_id || !sizeof($role_row['groups']) || ($user_mode == 'group' && in_array($ug_id, $role_row['groups']))) - { - $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . '>' . $role_row['role_name'] . '</option>'; - } + $title = ($role_row['role_description']) ? ' title="' . nl2br($role_row['role_description']) . '"' : ''; + $s_role_options .= '<option value="' . $role_id . '"' . (($role_id == $current_role_id) ? ' selected="selected"' : '') . $title . '>' . $role_row['role_name'] . '</option>'; } if ($s_role_options) @@ -483,15 +480,40 @@ class auth_admin extends auth $s_role_options = '<option value="0"' . ((!$current_role_id) ? ' selected="selected"' : '') . '>' . $user->lang['SELECT_ROLE'] . '</option>' . $s_role_options; } + if (!$forum_id) + { + $folder_image = ''; + } + else + { + if ($forum_names_ary[$forum_id]['forum_status'] == ITEM_LOCKED) + { + $folder_image = '<img src="images/icon_folder_lock_small.gif" width="19" height="18" alt="' . $user->lang['FORUM_LOCKED'] . '" />'; + } + else + { + switch ($forum_names_ary[$forum_id]['forum_type']) + { + case FORUM_LINK: + $folder_image = '<img src="images/icon_folder_link_small.gif" width="22" height="18" alt="' . $user->lang['FORUM_LINK'] . '" />'; + break; + + default: + $folder_image = ($forum_names_ary[$forum_id]['left_id'] + 1 != $forum_names_ary[$forum_id]['right_id']) ? '<img src="images/icon_folder_sub_small.gif" width="22" height="18" alt="' . $user->lang['SUBFORUM'] . '" />' : '<img src="images/icon_folder_small.gif" width="19" height="18" alt="' . $user->lang['FOLDER'] . '" />'; + } + } + } + $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'], + 'FOLDER_IMAGE' => $folder_image, 'S_ROLE_OPTIONS' => $s_role_options, '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); + $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, $show_trace); } } } @@ -703,6 +725,7 @@ class auth_admin extends auth $id_field = $ug_type . '_id'; // Get any flags as required + reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); @@ -833,6 +856,7 @@ class auth_admin extends auth global $db; // Get any-flag as required + reset($auth); $flag = key($auth); $flag = substr($flag, 0, strpos($flag, '_') + 1); @@ -1011,9 +1035,9 @@ class auth_admin extends auth * Assign category to template * used by display_mask() */ - function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id) + function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $show_trace = false) { - global $template, $user; + global $template, $user, $phpbb_admin_path, $phpEx, $SID; foreach ($category_array as $cat => $cat_array) { @@ -1024,7 +1048,7 @@ class auth_admin extends auth 'CAT_NAME' => $user->lang['permission_cat'][$cat]) ); - + foreach ($cat_array['permissions'] as $permission => $allowed) { $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( @@ -1037,6 +1061,8 @@ class auth_admin extends auth 'FIELD_NAME' => $permission, 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', + 'U_TRACE' => ($show_trace) ? "{$phpbb_admin_path}index.$phpEx$SID&i=permissions&mode=trace&u=$ug_id&f=$forum_id&auth=$permission" : '', + 'PERMISSION' => $user->lang['acl_' . $permission]['lang']) ); } diff --git a/phpBB/includes/acp/info/acp_permissions.php b/phpBB/includes/acp/info/acp_permissions.php index 17bdef94dc..313d191d3c 100644 --- a/phpBB/includes/acp/info/acp_permissions.php +++ b/phpBB/includes/acp/info/acp_permissions.php @@ -21,6 +21,7 @@ class acp_permissions_info 'version' => '1.0.0', 'modes' => array( 'intro' => array('title' => 'ACP_PERMISSIONS', 'auth' => 'acl_a_authusers || acl_a_authgroups || acl_a_viewauth'), + 'trace' => array('title' => 'ACP_PERMISSION_TRACE', 'auth' => 'acl_a_viewauth', 'display' => false), 'setting_user_global' => array('title' => 'ACP_USERS_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_aauth || acl_a_mauth || acl_a_uauth)'), 'setting_user_local' => array('title' => 'ACP_USERS_FORUM_PERMISSIONS', 'auth' => 'acl_a_authusers && (acl_a_mauth || acl_a_fauth)'), |