diff options
Diffstat (limited to 'phpBB/includes/acp/acp_permission_roles.php')
-rw-r--r-- | phpBB/includes/acp/acp_permission_roles.php | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/phpBB/includes/acp/acp_permission_roles.php b/phpBB/includes/acp/acp_permission_roles.php index aca45575d3..93aca295d7 100644 --- a/phpBB/includes/acp/acp_permission_roles.php +++ b/phpBB/includes/acp/acp_permission_roles.php @@ -1,9 +1,13 @@ <?php /** * -* @package acp -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ @@ -15,9 +19,6 @@ if (!defined('IN_PHPBB')) exit; } -/** -* @package acp -*/ class acp_permission_roles { var $u_action; @@ -25,12 +26,19 @@ class acp_permission_roles function main($id, $mode) { - global $db, $user, $auth, $template, $cache, $phpbb_container; - global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - global $request; + global $db, $user, $template, $phpbb_container; + global $phpbb_root_path, $phpEx; + global $request, $phpbb_log; + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } - include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx); - include_once($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } $this->auth_admin = new auth_admin(); @@ -40,8 +48,8 @@ class acp_permission_roles $this->tpl_name = 'acp_permission_roles'; $submit = (isset($_POST['submit'])) ? true : false; - $role_id = request_var('role_id', 0); - $action = request_var('action', ''); + $role_id = $request->variable('role_id', 0); + $action = $request->variable('action', ''); $action = (isset($_POST['add'])) ? 'add' : $action; $form_name = 'acp_permissions'; @@ -108,7 +116,7 @@ class acp_permission_roles $this->remove_role($role_id, $permission_type); $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; - add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', $role_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($permission_type) . 'ROLE_REMOVED', false, array($role_name)); trigger_error($user->lang['ROLE_DELETED'] . adm_back_link($this->u_action)); } else @@ -147,9 +155,9 @@ class acp_permission_roles trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } - $role_name = utf8_normalize_nfc(request_var('role_name', '', true)); - $role_description = utf8_normalize_nfc(request_var('role_description', '', true)); - $auth_settings = request_var('setting', array('' => 0)); + $role_name = $request->variable('role_name', '', true); + $role_description = $request->variable('role_description', '', true); + $auth_settings = $request->variable('setting', array('' => 0)); if (!$role_name) { @@ -211,7 +219,7 @@ class acp_permission_roles $this->auth_admin->acl_set_role($role_id, $auth_settings); $role_name = (!empty($user->lang[$role_name])) ? $user->lang[$role_name] : $role_name; - add_log('admin', 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), $role_name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($permission_type) . 'ROLE_' . strtoupper($action), false, array($role_name)); trigger_error($user->lang['ROLE_' . strtoupper($action) . '_SUCCESS'] . adm_back_link($this->u_action)); @@ -224,11 +232,11 @@ class acp_permission_roles { case 'add': - $options_from = request_var('options_from', 0); + $options_from = $request->variable('options_from', 0); $role_row = array( - 'role_name' => utf8_normalize_nfc(request_var('role_name', '', true)), - 'role_description' => utf8_normalize_nfc(request_var('role_description', '', true)), + 'role_name' => $request->variable('role_name', '', true), + 'role_description' => $request->variable('role_description', '', true), 'role_type' => $permission_type, ); @@ -252,7 +260,7 @@ class acp_permission_roles { $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . " + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()) . " AND auth_option <> '{$permission_type}' ORDER BY auth_option_id"; $result = $db->sql_query($sql); @@ -270,7 +278,7 @@ class acp_permission_roles case 'edit': if ($action == 'edit') - { + { $sql = 'SELECT * FROM ' . ACL_ROLES_TABLE . ' WHERE role_id = ' . $role_id; @@ -298,6 +306,7 @@ class acp_permission_roles trigger_error($user->lang['NO_ROLE_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); } + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); $template->assign_vars(array( @@ -314,7 +323,7 @@ class acp_permission_roles // We need to fill the auth options array with ACL_NO options ;) $sql = 'SELECT auth_option_id, auth_option FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char) . " + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()) . " AND auth_option <> '{$permission_type}' ORDER BY auth_option_id"; $result = $db->sql_query($sql); @@ -412,7 +421,7 @@ class acp_permission_roles $db->sql_freeresult($result); // Display assigned items? - $display_item = request_var('display_item', 0); + $display_item = $request->variable('display_item', 0); // Select existing roles $sql = 'SELECT * @@ -468,8 +477,9 @@ class acp_permission_roles */ function display_auth_options($auth_options) { - global $template, $user, $phpbb_container; + global $template, $phpbb_container; + /* @var $phpbb_permissions \phpbb\permissions */ $phpbb_permissions = $phpbb_container->get('acl.permissions'); $content_array = $categories = array(); @@ -518,7 +528,7 @@ class acp_permission_roles // Get complete auth array $sql = 'SELECT auth_option, auth_option_id FROM ' . ACL_OPTIONS_TABLE . " - WHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char); + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()); $result = $db->sql_query($sql); $auth_settings = array(); |