diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-30 18:24:46 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-09-30 18:24:46 -0500 |
commit | a6df011a107132390ecc35b80ab0e88bc31fd103 (patch) | |
tree | c91b2a90f4c3cef95c1f734aa0b6b0da4007e2ac /phpBB/includes | |
parent | 2ee22d4615a86a33d3c65f94d7a9c4b99dfb1b7e (diff) | |
parent | 179f41475b555d0a3314d779d0d7423f66f0fb95 (diff) | |
download | forums-a6df011a107132390ecc35b80ab0e88bc31fd103.tar forums-a6df011a107132390ecc35b80ab0e88bc31fd103.tar.gz forums-a6df011a107132390ecc35b80ab0e88bc31fd103.tar.bz2 forums-a6df011a107132390ecc35b80ab0e88bc31fd103.tar.xz forums-a6df011a107132390ecc35b80ab0e88bc31fd103.zip |
Merge branch 'develop' of github.com:phpbb/phpbb3 into ticket/11850
# By Nils Adermann (68) and others
# Via Andreas Fischer (12) and others
* 'develop' of github.com:phpbb/phpbb3: (102 commits)
[ticket/11876] Replace MD5 with SHA256.
[ticket/11876] Move checksum generation from build PHP files to phing build.xml
[develop-olympus] Build against 3.0.12 instead of 3.0.12-RC3. Tag exists now.
[prep-release-3.0.12] Update changelog for 3.0.12 release.
[ticket/11873] Add unit test for large password input.
[ticket/11873] Do not hash very large passwords in order to safe resources.
[ticket/11862] Correct var names in user_delete() events due to prune-users
[develop-olympus] Use 3.0.13-dev as build version. Use latest 3.0.12 RC tag.
[prep-release-3.0.12] Bumping version number for 3.0.12 final.
[ticket/11852] Add class file
[ticket/11852] Move tests to folder with new class name
[ticket/11852] Split filesystem and path_helper into 2 classes
[ticket/11868] Add @depends to test
[ticket/11868] Add functional test for registration
[ticket/11868] Replace phpbb_request_interface references
[ticket/11866] Only single backslash in .md files
[ticket/11866] Remove outdated and broken develop script
[ticket/11866] More namespaces
[ticket/11866] Update some occurances of phpbb_db_ to new Namespace
[ticket/11865] Convert old class name to namespaced version
...
Conflicts:
tests/security/extract_current_page_test.php
tests/session/testable_facade.php
Diffstat (limited to 'phpBB/includes')
48 files changed, 348 insertions, 288 deletions
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index d0e8ff3882..55459739ca 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1472,7 +1472,7 @@ class acp_attachments $ip_list = array_unique(explode("\n", $ips)); $ip_list_log = implode(', ', $ip_list); - $ip_exclude = (int) $request->variable('ipexclude', false, false, phpbb_request_interface::POST); + $ip_exclude = (int) $request->variable('ipexclude', false, false, \phpbb\request\request_interface::POST); $iplist = array(); $hostlist = array(); diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 9c430b5a0b..dca39df38c 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -275,7 +275,7 @@ class acp_bbcodes if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'], diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 62e8044765..8f2548166b 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -688,7 +688,7 @@ class acp_board foreach ($auth_providers as $key => $value) { - if (!($value instanceof phpbb_auth_provider_interface)) + if (!($value instanceof \phpbb\auth\provider\provider_interface)) { continue; } diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php index b9dd6664f4..e28a8d6451 100644 --- a/phpBB/includes/acp/acp_bots.php +++ b/phpBB/includes/acp/acp_bots.php @@ -355,7 +355,7 @@ class acp_bots if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate')) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'], )); diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 5d191b3d0f..fc08a5fb94 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -28,7 +28,7 @@ class acp_database global $cache, $db, $user, $auth, $template, $table_prefix; global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx; - $this->db_tools = new phpbb_db_tools($db); + $this->db_tools = new \phpbb\db\tools($db); $user->add_lang('acp/database'); diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 379e779c2c..b41f4d4e81 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -58,13 +58,13 @@ class acp_extensions // If they've specified an extension, let's load the metadata manager and validate it. if ($ext_name) { - $md_manager = new phpbb_extension_metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path); + $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path); try { $md_manager->get_metadata('all'); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { trigger_error($e); } @@ -120,7 +120,7 @@ class acp_extensions } } } - catch (phpbb_db_migration_exception $e) + catch (\phpbb\db\migration\exception $e) { $template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user)); } @@ -188,7 +188,7 @@ class acp_extensions } } } - catch (phpbb_db_migration_exception $e) + catch (\phpbb\db\migration\exception $e) { $template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user)); } @@ -217,7 +217,7 @@ class acp_extensions * @param $phpbb_extension_manager An instance of the extension manager * @return null */ - public function list_enabled_exts(phpbb_extension_manager $phpbb_extension_manager) + public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager) { foreach ($phpbb_extension_manager->all_enabled() as $name => $location) { @@ -236,7 +236,7 @@ class acp_extensions 'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name), )); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), @@ -251,7 +251,7 @@ class acp_extensions * @param $phpbb_extension_manager An instance of the extension manager * @return null */ - public function list_disabled_exts(phpbb_extension_manager $phpbb_extension_manager) + public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager) { foreach ($phpbb_extension_manager->all_disabled() as $name => $location) { @@ -270,7 +270,7 @@ class acp_extensions 'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name), )); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), @@ -285,7 +285,7 @@ class acp_extensions * @param $phpbb_extension_manager An instance of the extension manager * @return null */ - public function list_available_exts(phpbb_extension_manager $phpbb_extension_manager) + public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager) { $uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured()); @@ -305,7 +305,7 @@ class acp_extensions 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), )); } - catch(phpbb_extension_exception $e) + catch(\phpbb\extension\exception $e) { $this->template->assign_block_vars('disabled', array( 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e), diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 970b033995..258aabcc0d 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -55,7 +55,6 @@ class acp_forums $total = request_var('total', 0); $this->display_progress_bar($start, $total); - exit; break; case 'delete': @@ -269,7 +268,7 @@ class acp_forums if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array('success' => ($move_forum_name !== false))); } diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index e6a36c97a8..ad29a5521b 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -324,7 +324,7 @@ class acp_groups $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the group_ prefix - $avatar_data = phpbb_avatar_manager::clean_row($group_row); + $avatar_data = \phpbb\avatar\manager::clean_row($group_row); } @@ -891,7 +891,7 @@ class acp_groups break; } } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { trigger_error($user->lang($exception->getMessage()) . adm_back_link($this->u_action), E_USER_WARNING); } @@ -919,7 +919,7 @@ class acp_groups break; } } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { trigger_error($user->lang($exception->getMessage()) . adm_back_link($this->u_action), E_USER_WARNING); } @@ -943,7 +943,7 @@ class acp_groups if (($action == 'move_up' || $action == 'move_down') && $request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array('success' => true)); } @@ -961,7 +961,7 @@ class acp_groups $template->assign_block_vars('legend', array( 'GROUP_NAME' => $group_name, 'GROUP_COLOUR' => ($row['group_colour']) ? '#' . $row['group_colour'] : '', - 'GROUP_TYPE' => $user->lang[phpbb_groupposition_legend::group_type_language($row['group_type'])], + 'GROUP_TYPE' => $user->lang[\phpbb\groupposition\legend::group_type_language($row['group_type'])], 'U_MOVE_DOWN' => "{$this->u_action}&field=legend&action=move_down&g=" . $row['group_id'], 'U_MOVE_UP' => "{$this->u_action}&field=legend&action=move_up&g=" . $row['group_id'], @@ -1004,7 +1004,7 @@ class acp_groups if ($row['group_id']) { $group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']; - $group_type = $user->lang[phpbb_groupposition_teampage::group_type_language($row['group_type'])]; + $group_type = $user->lang[\phpbb\groupposition\teampage::group_type_language($row['group_type'])]; } else { diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index db4b4263b0..5b23f9c3a0 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -338,7 +338,7 @@ class acp_icons $image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array(); // Ok, add the relevant bits if we are adding new codes to existing emoticons... - if ($request->variable('add_additional_code', false, false, phpbb_request_interface::POST)) + if ($request->variable('add_additional_code', false, false, \phpbb\request\request_interface::POST)) { $add_image = request_var('add_image', ''); $add_code = utf8_normalize_nfc(request_var('add_code', '', true)); @@ -354,7 +354,7 @@ class acp_icons $image_width[$add_image] = request_var('add_width', 0); $image_height[$add_image] = request_var('add_height', 0); - if ($request->variable('add_display_on_posting', false, false, phpbb_request_interface::POST)) + if ($request->variable('add_display_on_posting', false, false, \phpbb\request\request_interface::POST)) { $image_display_on_posting[$add_image] = 1; } @@ -785,7 +785,7 @@ class acp_icons if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $notice, diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 2be1ccfc41..013aab670f 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -161,7 +161,7 @@ class acp_language 'method' => $method) ); - $hidden_data .= build_hidden_fields(array('entry' => $request->variable('entry', $request_default, true, phpbb_request_interface::POST))); + $hidden_data .= build_hidden_fields(array('entry' => $request->variable('entry', $request_default, true, \phpbb\request\request_interface::POST))); $template->assign_vars(array( 'S_UPLOAD' => true, @@ -218,7 +218,7 @@ class acp_language trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); } - $entry_value = $request->variable('entry', $request_default, true, phpbb_request_interface::POST); + $entry_value = $request->variable('entry', $request_default, true, \phpbb\request\request_interface::POST); if (!$lang_id || !$entry_value) { diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index d86521532c..229bf135ff 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -35,8 +35,8 @@ class acp_logs $forum_id = request_var('f', 0); $topic_id = request_var('t', 0); $start = request_var('start', 0); - $deletemark = $request->variable('delmarked', false, false, phpbb_request_interface::POST); - $deleteall = $request->variable('delall', false, false, phpbb_request_interface::POST); + $deletemark = $request->variable('delmarked', false, false, \phpbb\request\request_interface::POST); + $deleteall = $request->variable('delall', false, false, \phpbb\request\request_interface::POST); $marked = request_var('mark', array(0)); // Sort keys diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php index 7a1d30196d..6792886d2a 100644 --- a/phpBB/includes/acp/acp_modules.php +++ b/phpBB/includes/acp/acp_modules.php @@ -375,7 +375,7 @@ class acp_modules { if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang('ERROR'), 'MESSAGE_TEXT' => implode('<br />', $errors), @@ -565,7 +565,7 @@ class acp_modules { // Skip entries we do not need if we know the module we are // looking for - if ($module && strpos($cur_module, $module) === false) + if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false) { continue; } diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index ed7159996a..e7dc03db5c 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -679,7 +679,7 @@ class acp_permissions list($ug_id, ) = each($psubmit); list($forum_id, ) = each($psubmit[$ug_id]); - $settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, phpbb_request_interface::POST); + $settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id])) { trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING); @@ -688,7 +688,7 @@ class acp_permissions $auth_settings = $settings[$ug_id][$forum_id]; // Do we have a role we want to set? - $roles = $request->variable('role', array(0 => array(0 => 0)), false, phpbb_request_interface::POST); + $roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); $assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0; // Do the admin want to set these permissions to other items too? @@ -760,8 +760,8 @@ class acp_permissions trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); } - $auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, phpbb_request_interface::POST); - $auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, phpbb_request_interface::POST); + $auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); + $auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); $ug_ids = $forum_ids = array(); // We need to go through the auth settings @@ -1103,7 +1103,7 @@ class acp_permissions { if ($user_id != $user->data['user_id']) { - $auth2 = new phpbb_auth(); + $auth2 = new \phpbb\auth\auth(); $auth2->acl($userdata); $auth_setting = $auth2->acl_get($permission); } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 849160f1fa..4e8145009f 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -245,7 +245,7 @@ class acp_profile if ($request->is_ajax()) { - $json_response = new phpbb_json_response(); + $json_response = new \phpbb\json_response(); $json_response->send(array( 'text' => $user->lang('DEACTIVATE'), )); @@ -277,7 +277,7 @@ class acp_profile if ($request->is_ajax()) { - $json_response = new phpbb_json_response(); + $json_response = new \phpbb\json_response(); $json_response->send(array( 'text' => $user->lang('ACTIVATE'), )); @@ -510,7 +510,7 @@ class acp_profile $cp->vars['field_default_value_month'] = $now['mon']; $cp->vars['field_default_value_year'] = $now['year']; $var = 'now'; - $request->overwrite('field_default_value', $var, phpbb_request_interface::POST); + $request->overwrite('field_default_value', $var, \phpbb\request\request_interface::POST); } else { @@ -520,7 +520,7 @@ class acp_profile $cp->vars['field_default_value_month'] = request_var('field_default_value_month', 0); $cp->vars['field_default_value_year'] = request_var('field_default_value_year', 0); $var = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']); - $request->overwrite('field_default_value', $var, phpbb_request_interface::POST); + $request->overwrite('field_default_value', $var, \phpbb\request\request_interface::POST); } else { diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php index 6b06d03f52..73e1de44d9 100644 --- a/phpBB/includes/acp/acp_ranks.php +++ b/phpBB/includes/acp/acp_ranks.php @@ -125,7 +125,7 @@ class acp_ranks if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'], diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index cbfd578d87..8853200ddc 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1604,7 +1604,7 @@ class acp_users || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) { // We also need to check if the user has the permission to cloak. - $user_auth = new phpbb_auth(); + $user_auth = new \phpbb\auth\auth(); $user_auth->acl($user_row); $session_sql_ary = array( @@ -1742,7 +1742,7 @@ class acp_users $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the user_ prefix - $avatar_data = phpbb_avatar_manager::clean_row($user_row); + $avatar_data = \phpbb\avatar\manager::clean_row($user_row); if ($submit) { diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php index 4ade9cab13..f5f90fb5b8 100644 --- a/phpBB/includes/acp/auth.php +++ b/phpBB/includes/acp/auth.php @@ -19,7 +19,7 @@ if (!defined('IN_PHPBB')) * ACP Permission/Auth class * @package phpBB3 */ -class auth_admin extends phpbb_auth +class auth_admin extends \phpbb\auth\auth { /** * Init auth settings @@ -130,7 +130,7 @@ class auth_admin extends phpbb_auth { if ($user->data['user_id'] != $userdata['user_id']) { - $auth2 = new phpbb_auth(); + $auth2 = new \phpbb\auth\auth(); $auth2->acl($userdata); } else diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 0c567dd012..c4076a0120 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -126,13 +126,13 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_filesystem; + global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $template = new phpbb_template_twig($phpbb_filesystem, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); + $template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); $template->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php index c0c355f33b..80f5b65967 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php @@ -140,7 +140,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha $config_old = $config; - $config = new phpbb_config(array()); + $config = new \phpbb\config\config(array()); foreach ($config_old as $key => $value) { $config->set($key, $value); diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index 6843f25d72..82333f739e 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -112,7 +112,7 @@ class phpbb_captcha_qa { global $db; - $db_tool = new phpbb_db_tools($db); + $db_tool = new \phpbb\db\tools($db); return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE); } @@ -295,7 +295,7 @@ class phpbb_captcha_qa { global $db; - $db_tool = new phpbb_db_tools($db); + $db_tool = new \phpbb\db\tools($db); $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 89c562fde6..e1f96c0b1e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -24,13 +24,13 @@ if (!defined('IN_PHPBB')) function set_var(&$result, $var, $type, $multibyte = false) { // no need for dependency injection here, if you have the object, call the method yourself! - $type_cast_helper = new phpbb_request_type_cast_helper(); + $type_cast_helper = new \phpbb\request\type_cast_helper(); $type_cast_helper->set_var($result, $var, $type, $multibyte); } /** -* Wrapper function of phpbb_request::variable which exists for backwards compatability. -* See {@link phpbb_request_interface::variable phpbb_request_interface::variable} for +* Wrapper function of \phpbb\request\request::variable which exists for backwards compatability. +* See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for * documentation of this function's use. * * @deprecated @@ -38,20 +38,20 @@ function set_var(&$result, $var, $type, $multibyte = false) * If the value is an array this may be an array of indizes which will give * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") * then specifying array("var", 1) as the name will return "a". -* If you pass an instance of {@link phpbb_request_interface phpbb_request_interface} +* If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface} * as this parameter it will overwrite the current request class instance. If you do * not do so, it will create its own instance (but leave superglobals enabled). * @param mixed $default A default value that is returned if the variable was not set. * This function will always return a value of the same type as the default. * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks -* @param bool $cookie This param is mapped to phpbb_request_interface::COOKIE as the last param for -* phpbb_request_interface::variable for backwards compatability reasons. -* @param phpbb_request_interface|null|false If an instance of phpbb_request_interface is given the instance is stored in +* @param bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for +* \phpbb\request\request_interface::variable for backwards compatability reasons. +* @param \phpbb\request\request_interface|null|false If an instance of \phpbb\request\request_interface is given the instance is stored in * a static variable and used for all further calls where this parameters is null. Until -* the function is called with an instance it automatically creates a new phpbb_request +* the function is called with an instance it automatically creates a new \phpbb\request\request * instance on every call. By passing false this per-call instantiation can be restored -* after having passed in a phpbb_request_interface instance. +* after having passed in a \phpbb\request\request_interface instance. * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. @@ -62,7 +62,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $ // the only real code is the function call which maps this function to a method. static $static_request = null; - if ($request instanceof phpbb_request_interface) + if ($request instanceof \phpbb\request\request_interface) { $static_request = $request; @@ -88,10 +88,10 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $ { // false param: enable super globals, so the created request class does not // make super globals inaccessible everywhere outside this function. - $tmp_request = new phpbb_request(new phpbb_request_type_cast_helper(), false); + $tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false); } - return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? phpbb_request_interface::COOKIE : phpbb_request_interface::REQUEST); + return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST); } /** @@ -110,7 +110,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $ * * @deprecated */ -function set_config($config_name, $config_value, $is_dynamic = false, phpbb_config $set_config = null) +function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null) { static $config = null; @@ -140,7 +140,7 @@ function set_config($config_name, $config_value, $is_dynamic = false, phpbb_conf * * @deprecated */ -function set_config_count($config_name, $increment, $is_dynamic = false, phpbb_config $set_config = null) +function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null) { static $config = null; @@ -442,6 +442,13 @@ function phpbb_hash($password) */ function phpbb_check_hash($password, $hash) { + if (strlen($password) > 4096) + { + // If the password is too huge, we will simply reject it + // and not let the server try to hash it. + return false; + } + $itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; if (strlen($hash) == 34) { @@ -1056,31 +1063,32 @@ else */ function phpbb_clean_path($path) { - global $phpbb_container; + global $phpbb_path_helper, $phpbb_container; - if ($phpbb_container) + if (!$phpbb_path_helper && $phpbb_container) { - $phpbb_filesystem = $phpbb_container->get('filesystem'); + $phpbb_path_helper = $phpbb_container->get('path_helper'); } - else + else if (!$phpbb_path_helper) { // The container is not yet loaded, use a new instance - if (!class_exists('phpbb_filesystem')) + if (!class_exists('\phpbb\path_helper')) { global $phpbb_root_path, $phpEx; - require($phpbb_root_path . 'includes/filesystem.' . $phpEx); + require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); } - $phpbb_filesystem = new phpbb_filesystem( - new phpbb_symfony_request( - new phpbb_request() + $phpbb_path_helper = new phpbb\path_helper( + new phpbb\symfony_request( + new phpbb\request\request() ), + new phpbb\filesystem(), $phpbb_root_path, $phpEx ); } - return $phpbb_filesystem->clean_path($path); + return $phpbb_path_helper->clean_path($path); } // functions used for building option fields @@ -1258,7 +1266,7 @@ function tz_select($default = '', $truncate = false) /** * Options to pick a timezone and date/time * -* @param phpbb_user $user Object of the current user +* @param \phpbb\user $user Object of the current user * @param string $default A timezone to select * @param boolean $truncate Shall we truncate the options text * @@ -1277,7 +1285,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) foreach ($unsorted_timezones as $timezone) { $tz = new DateTimeZone($timezone); - $dt = new phpbb_datetime($user, 'now', $tz); + $dt = new \phpbb\datetime($user, 'now', $tz); $offset = $dt->getOffset(); $current_time = $dt->format($user->lang['DATETIME_FORMAT'], true); $offset_string = phpbb_format_timezone_offset($offset); @@ -1396,7 +1404,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); unset($tracking_topics['tf']); @@ -1405,7 +1413,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ $tracking_topics['l'] = base_convert($post_time - $config['board_startdate'], 10, 36); $user->set_cookie('track', tracking_serialize($tracking_topics), $post_time + 31536000); - $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), phpbb_request_interface::COOKIE); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), \phpbb\request\request_interface::COOKIE); unset($tracking_topics); @@ -1508,7 +1516,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); foreach ($forum_id as $f_id) @@ -1539,7 +1547,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000); - $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), phpbb_request_interface::COOKIE); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE); unset($tracking); } @@ -1596,7 +1604,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); $topic_id36 = base_convert($topic_id, 10, 36); @@ -1610,7 +1618,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ // If the cookie grows larger than 10000 characters we will remove the smallest value // This can result in old topics being unread - but most of the time it should be accurate... - if (strlen($request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE)) > 10000) + if (strlen($request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE)) > 10000) { //echo 'Cookie grown too large' . print_r($tracking, true); @@ -1655,7 +1663,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $ } $user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000); - $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), phpbb_request_interface::COOKIE); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE); } return; @@ -1793,7 +1801,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis if (!isset($tracking_topics) || !sizeof($tracking_topics)) { - $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } @@ -1990,7 +1998,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); if (!$user->data['is_registered']) @@ -2205,6 +2213,32 @@ function tracking_unserialize($string, $max_depth = 3) } // Pagination functions +/** +* Generate a pagination link based on the url and the page information +* +* @param string $base_url is url prepended to all links generated within the function +* If you use page numbers inside your controller route, base_url should contains a placeholder (%d) +* for the page. Also be sure to specify the pagination path information into the start_name argument +* @param string $on_page is the page for which we want to generate the link +* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20) +* If you use page numbers inside your controller route, start name should be the string +* that should be removed for the first page (example: /page/%d) +* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce +* @return URL for the requested page +*/ +function phpbb_generate_page_link($base_url, $on_page, $start_name, $per_page) +{ + + if (strpos($start_name, '%d') !== false) + { + return ($on_page > 1) ? sprintf($base_url, (int) $on_page) : str_replace($start_name, '', $base_url); + } + else + { + $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); + return ($on_page > 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 1) * $per_page) : $base_url; + } +} /** * Generate template rendered pagination @@ -2212,8 +2246,12 @@ function tracking_unserialize($string, $max_depth = 3) * * @param object $template the template object * @param string $base_url is url prepended to all links generated within the function +* If you use page numbers inside your controller route, base_url should contains a placeholder (%d) +* for the page. Also be sure to specify the pagination path information into the start_name argument * @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->) * @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20) +* If you use page numbers inside your controller route, start name should be the string +* that should be removed for the first page (example: /page/%d) * @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce * @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce * @param int $start_item the item which should be considered currently active, used to determine the page we're on @@ -2233,7 +2271,6 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam } $on_page = floor($start_item / $per_page) + 1; - $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&'); if ($reverse_count) { @@ -2261,11 +2298,14 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam $end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages; } + $u_previous_page = $u_next_page = ''; if ($on_page != 1) { + $u_previous_page = phpbb_generate_page_link($base_url, $on_page - 1, $start_name, $per_page); + $template->assign_block_vars($block_var_name, array( 'PAGE_NUMBER' => '', - 'PAGE_URL' => $base_url . $url_delim . $start_name . '=' . (($on_page - 2) * $per_page), + 'PAGE_URL' => $u_previous_page, 'S_IS_CURRENT' => false, 'S_IS_PREV' => true, 'S_IS_NEXT' => false, @@ -2279,15 +2319,13 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam $at_page = 1; do { - $page_url = $base_url . (($at_page == 1) ? '' : $url_delim . $start_name . '=' . (($at_page - 1) * $per_page)); - // We decide whether to display the ellipsis during the loop. The ellipsis is always // displayed as either the second or penultimate item in the list. So are we at either // of those points and of course do we even need to display it, i.e. is the list starting // on at least page 3 and ending three pages before the final item. $template->assign_block_vars($block_var_name, array( 'PAGE_NUMBER' => $at_page, - 'PAGE_URL' => $page_url, + 'PAGE_URL' => phpbb_generate_page_link($base_url, $at_page, $start_name, $per_page), 'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page), 'S_IS_NEXT' => false, 'S_IS_PREV' => false, @@ -2317,9 +2355,11 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam if ($on_page != $total_pages) { + $u_next_page = phpbb_generate_page_link($base_url, $on_page + 1, $start_name, $per_page); + $template->assign_block_vars($block_var_name, array( 'PAGE_NUMBER' => '', - 'PAGE_URL' => $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page), + 'PAGE_URL' => $u_next_page, 'S_IS_CURRENT' => false, 'S_IS_PREV' => false, 'S_IS_NEXT' => true, @@ -2344,13 +2384,11 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam } $tpl_prefix = ($tpl_prefix == 'PAGINATION') ? '' : $tpl_prefix . '_'; - $previous_page = ($on_page != 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 2) * $per_page) : ''; - $template_array = array( $tpl_prefix . 'BASE_URL' => $base_url, $tpl_prefix . 'PER_PAGE' => $per_page, - 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page, - 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '', + 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page != 1) ? $u_previous_page : '', + 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '', $tpl_prefix . 'TOTAL_PAGES' => $total_pages, $tpl_prefix . 'CURRENT_PAGE' => $on_page, ); @@ -2415,7 +2453,7 @@ function phpbb_on_page($template, $user, $base_url, $num_items, $per_page, $star */ function append_sid($url, $params = false, $is_amp = true, $session_id = false) { - global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem; + global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; global $phpbb_dispatcher; if ($params === '' || (is_array($params) && empty($params))) @@ -2425,9 +2463,9 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) } // Update the root path with the correct relative web path - if ($phpbb_filesystem instanceof phpbb_filesystem) + if ($phpbb_path_helper instanceof \phpbb\path_helper) { - $url = $phpbb_filesystem->update_web_root_path($url); + $url = $phpbb_path_helper->update_web_root_path($url); } $append_sid_overwrite = false; @@ -3106,7 +3144,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo return false; } - $confirm = ($user->lang['YES'] === $request->variable('confirm', '', true, phpbb_request_interface::POST)); + $confirm = ($user->lang['YES'] === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST)); if ($check && $confirm) { @@ -3183,7 +3221,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo if ($request->is_ajax()) { $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id; - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_BODY' => $template->assign_display('body'), 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title], @@ -4425,7 +4463,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) { global $refresh_data; - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $msg_title, 'MESSAGE_TEXT' => $msg_text, @@ -4931,7 +4969,7 @@ function phpbb_http_login($param) $username = null; foreach ($username_keys as $k) { - if ($request->is_set($k, phpbb_request_interface::SERVER)) + if ($request->is_set($k, \phpbb\request\request_interface::SERVER)) { $username = htmlspecialchars_decode($request->server($k)); break; @@ -4941,7 +4979,7 @@ function phpbb_http_login($param) $password = null; foreach ($password_keys as $k) { - if ($request->is_set($k, phpbb_request_interface::SERVER)) + if ($request->is_set($k, \phpbb\request\request_interface::SERVER)) { $password = htmlspecialchars_decode($request->server($k)); break; @@ -5042,13 +5080,13 @@ function phpbb_quoteattr($data, $entities = null) * * sid is always omitted. * -* @param phpbb_request $request Request object +* @param \phpbb\request\request $request Request object * @param array $exclude A list of variable names that should not be forwarded * @return string HTML with hidden fields */ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null) { - $names = $request->variable_names(phpbb_request_interface::GET); + $names = $request->variable_names(\phpbb\request\request_interface::GET); $hidden = ''; foreach ($names as $name) { @@ -5070,7 +5108,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null) // here. To avoid exposing cookies, skip variables that are // overwritten somewhere other than GET entirely. $value = $request->variable($name, '', true); - $get_value = $request->variable($name, '', true, phpbb_request_interface::GET); + $get_value = $request->variable($name, '', true, \phpbb\request\request_interface::GET); if ($value === $get_value) { $escaped_value = phpbb_quoteattr($value); @@ -5246,8 +5284,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 // This path is sent with the base template paths in the assign_vars() // call below. We need to correct it in case we are accessing from a // controller because the web paths will be incorrect otherwise. - $phpbb_filesystem = $phpbb_container->get('filesystem'); - $corrected_path = $phpbb_filesystem->get_web_root_path(); + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; // Send a proper content-language to the output @@ -5272,7 +5310,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 } } - $dt = new phpbb_datetime($user, 'now', $user->timezone); + $dt = new \phpbb\datetime($user, 'now', $user->timezone); $timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset()); $timezone_name = $user->timezone->getName(); if (isset($user->lang['timezones'][$timezone_name])) @@ -5620,7 +5658,7 @@ function exit_handler() } /** -* Handler for init calls in phpBB. This function is called in phpbb_user::setup(); +* Handler for init calls in phpBB. This function is called in \phpbb\user::setup(); * This function supports hooks. */ function phpbb_user_session_handler() @@ -5671,7 +5709,7 @@ function phpbb_to_numeric($input) * Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name. * * If $dbms is a valid 3.1 db driver class name, returns it unchanged. -* Otherwise prepends phpbb_db_driver_ to the dbms to convert a 3.0 dbms +* Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms * to 3.1 db driver class name. * * @param string $dbms dbms parameter @@ -5684,24 +5722,24 @@ function phpbb_convert_30_dbms_to_31($dbms) // true for mysqli class. // However, per the docblock any valid 3.1 driver name should be // recognized by this function, and have priority over 3.0 dbms. - if (class_exists('phpbb_db_driver_' . $dbms)) + if (class_exists('phpbb\db\driver\\' . $dbms)) { - return 'phpbb_db_driver_' . $dbms; + return 'phpbb\db\driver\\' . $dbms; } if (class_exists($dbms)) { - // Additionally we could check that $dbms extends phpbb_db_driver. + // Additionally we could check that $dbms extends phpbb\db\driver\driver. // http://php.net/manual/en/class.reflectionclass.php // Beware of possible performance issues: // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance // We could check for interface implementation in all paths or - // only when we do not prepend phpbb_db_driver_. + // only when we do not prepend phpbb\db\driver\. /* $reflection = new \ReflectionClass($dbms); - if ($reflection->isSubclassOf('phpbb_db_driver')) + if ($reflection->isSubclassOf('phpbb\db\driver\driver')) { return $dbms; } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index fc29492ac1..722d3c9c67 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2348,9 +2348,9 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr * via admin_permissions. Changes of usernames and group names * must be carried through for the moderators table. * -* @param phpbb_db_driver $db Database connection -* @param phpbb_cache_driver_interface Cache driver -* @param phpbb_auth $auth Authentication object +* @param \phpbb\db\driver\driver $db Database connection +* @param \phpbb\cache\driver\driver_interface Cache driver +* @param \phpbb\auth\auth $auth Authentication object * @return null */ function phpbb_cache_moderators($db, $cache, $auth) @@ -2571,8 +2571,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id /** * Removes moderators and administrators from foe lists. * -* @param phpbb_db_driver $db Database connection -* @param phpbb_auth $auth Authentication object +* @param \phpbb\db\driver\driver $db Database connection +* @param \phpbb\auth\auth $auth Authentication object * @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore * @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore * @return null diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php index 7cbfa17a0e..667d27fd20 100644 --- a/phpBB/includes/functions_container.php +++ b/phpBB/includes/functions_container.php @@ -26,7 +26,7 @@ if (!defined('IN_PHPBB')) * Used to bootstrap the container. * * @param string $config_file -* @return phpbb_db_driver +* @return \phpbb\db\driver\driver */ function phpbb_bootstrap_db_connection($config_file) { @@ -121,7 +121,7 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext) $other_config_path = $phpbb_root_path . 'install/update/new/config/'; $config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/'; - $core = new phpbb_di_extension_core($config_path); + $core = new \phpbb\di\extension\core($config_path); $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); $container->setParameter('core.root_path', $phpbb_root_path); @@ -152,12 +152,12 @@ function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path) return phpbb_create_compiled_container( $config_file, array( - new phpbb_di_extension_config($config_file), - new phpbb_di_extension_core($config_path), + new phpbb\di\extension\config($config_file), + new phpbb\di\extension\core($config_path), ), array( - new phpbb_di_pass_collection_pass(), - new phpbb_di_pass_kernel_pass(), + new phpbb\di\pass\collection_pass(), + new phpbb\di\pass\kernel_pass(), ), $phpbb_root_path, $php_ext @@ -260,13 +260,13 @@ function phpbb_create_default_container($phpbb_root_path, $php_ext) return phpbb_create_dumped_container_unless_debug( $config_file, array( - new phpbb_di_extension_config($config_file), - new phpbb_di_extension_core($phpbb_root_path . 'config'), - new phpbb_di_extension_ext($installed_exts), + new \phpbb\di\extension\config($config_file), + new \phpbb\di\extension\core($phpbb_root_path . 'config'), + new \phpbb\di\extension\ext($installed_exts), ), array( - new phpbb_di_pass_collection_pass(), - new phpbb_di_pass_kernel_pass(), + new \phpbb\di\pass\collection_pass(), + new \phpbb\di\pass\kernel_pass(), ), $phpbb_root_path, $php_ext diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 5fa37f60bd..863450a4b2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -727,37 +727,58 @@ function make_clickable($text, $server_url = false, $class = 'postlink') $server_url = generate_board_url(); } - static $magic_url_match; - static $magic_url_replace; static $static_class; + static $magic_url_match_args; - if (!is_array($magic_url_match) || $static_class != $class) + if (!is_array($magic_url_match_args) || $static_class != $class) { $static_class = $class; $class = ($static_class) ? ' class="' . $static_class . '"' : ''; $local_class = ($static_class) ? ' class="' . $static_class . '-local"' : ''; - $magic_url_match = $magic_url_replace = array(); - // Be sure to not let the matches cross over. ;) + $magic_url_match_args = array(); // relative urls for this board - $magic_url_match[] = '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie'; - $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')"; + $magic_url_match_args[] = array( + '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#i', + MAGIC_URL_LOCAL, + $local_class, + ); // matches a xxxx://aaaaa.bbb.cccc. ... - $magic_url_match[] = '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#ie'; - $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')"; + $magic_url_match_args[] = array( + '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#i', + MAGIC_URL_FULL, + $class, + ); // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing - $magic_url_match[] = '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#ie'; - $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_WWW, '\$1', '\$2', '', '$class')"; + $magic_url_match_args[] = array( + '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#i', + MAGIC_URL_WWW, + $class, + ); // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. - $magic_url_match[] = '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/ie'; - $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_EMAIL, '\$1', '\$2', '', '')"; + $magic_url_match_args[] = array( + '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/i', + MAGIC_URL_EMAIL, + '', + ); } - return preg_replace($magic_url_match, $magic_url_replace, $text); + foreach ($magic_url_match_args as $magic_args) + { + if (preg_match($magic_args[0], $text, $matches)) + { + $text = preg_replace_callback($magic_args[0], function($matches) use ($magic_args) + { + return make_clickable_callback($magic_args[1], $matches[1], $matches[2], $matches[3], $magic_args[2]); + }, $text); + } + } + + return $text; } /** @@ -813,7 +834,7 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user, $phpbb_filesystem; + global $config, $user, $phpbb_path_helper; if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) { @@ -821,7 +842,7 @@ function smiley_text($text, $force_option = false) } else { - $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_filesystem->get_web_root_path(); + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text); } } diff --git a/phpBB/includes/functions_database_helper.php b/phpBB/includes/functions_database_helper.php index 1b508e6a02..923e542690 100644 --- a/phpBB/includes/functions_database_helper.php +++ b/phpBB/includes/functions_database_helper.php @@ -22,14 +22,14 @@ if (!defined('IN_PHPBB')) * * The only supported table is bookmarks. * -* @param phpbb_db_driver $db Database object +* @param \phpbb\db\driver\driver $db Database object * @param string $table Table on which to perform the update * @param string $column Column whose values to change * @param array $from_values An array of values that should be changed * @param int $to_value The new value * @return null */ -function phpbb_update_rows_avoiding_duplicates(phpbb_db_driver $db, $table, $column, $from_values, $to_value) +function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value) { $sql = "SELECT $column, user_id FROM $table @@ -107,14 +107,14 @@ function phpbb_update_rows_avoiding_duplicates(phpbb_db_driver $db, $table, $col * * The only supported table is topics_watch. * -* @param phpbb_db_driver $db Database object +* @param \phpbb\db\driver\driver $db Database object * @param string $table Table on which to perform the update * @param string $column Column whose values to change * @param array $from_values An array of values that should be changed * @param int $to_value The new value * @return null */ -function phpbb_update_rows_avoiding_duplicates_notify_status(phpbb_db_driver $db, $table, $column, $from_values, $to_value) +function phpbb_update_rows_avoiding_duplicates_notify_status(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value) { $sql = "SELECT $column, user_id, notify_status FROM $table diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b1dac64bec..c6ab5df90f 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -71,7 +71,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED'] ); - $json_response = new phpbb_json_response(); + $json_response = new \phpbb\json_response(); $json_response->send($data); } @@ -104,7 +104,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else if ($config['load_anon_lastread'] || $user->data['is_registered']) { - $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); if (!$user->data['is_registered']) @@ -346,7 +346,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED'] ); - $json_response = new phpbb_json_response(); + $json_response = new \phpbb\json_response(); $json_response->send($data); } @@ -1164,7 +1164,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { - if ($uid != $user_id || $request->variable('unwatch', '', false, phpbb_request_interface::GET) != $mode) + if ($uid != $user_id || $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); @@ -1229,7 +1229,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { - if ($uid != $user_id || $request->variable('watch', '', false, phpbb_request_interface::GET) != $mode) + if ($uid != $user_id || $request->variable('watch', '', false, \phpbb\request\request_interface::GET) != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>'); @@ -1272,8 +1272,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, } else { - if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode) || - (isset($_GET['watch']) && $request->variable('watch', '', false, phpbb_request_interface::GET) == $mode)) + if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) == $mode) || + (isset($_GET['watch']) && $request->variable('watch', '', false, \phpbb\request\request_interface::GET) == $mode)) { login_box(); } @@ -1352,7 +1352,7 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank */ function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false) { - $row = phpbb_avatar_manager::clean_row($user_row); + $row = \phpbb\avatar\manager::clean_row($user_row); return phpbb_get_avatar($row, $alt, $ignore_config); } @@ -1367,14 +1367,14 @@ function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = */ function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false) { - $row = phpbb_avatar_manager::clean_row($user_row); + $row = \phpbb\avatar\manager::clean_row($user_row); return phpbb_get_avatar($row, $alt, $ignore_config); } /** * Get avatar * -* @param array $row Row cleaned by phpbb_avatar_driver::clean_row +* @param array $row Row cleaned by \phpbb\avatar\driver\driver::clean_row * @param string $alt Optional language string for alt tag within image, can be a language key or text * @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP * diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 0a8000ea3d..e7a1d2bff5 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -596,7 +596,7 @@ function phpbb_parse_range_request($request_array, $filesize) /** * Increments the download count of all provided attachments * -* @param phpbb_db_driver $db The database object +* @param \phpbb\db\driver\driver $db The database object * @param array|int $ids The attach_id of each attachment * * @return null @@ -617,8 +617,8 @@ function phpbb_increment_downloads($db, $ids) /** * Handles authentication when downloading attachments from a post or topic * -* @param phpbb_db_driver $db The database object -* @param phpbb_auth $auth The authentication object +* @param \phpbb\db\driver\driver $db The database object +* @param \phpbb\auth\auth $auth The authentication object * @param int $topic_id The id of the topic that we are downloading from * * @return null @@ -651,8 +651,8 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id) /** * Handles authentication when downloading attachments from PMs * -* @param phpbb_db_driver $db The database object -* @param phpbb_auth $auth The authentication object +* @param \phpbb\db\driver\driver $db The database object +* @param \phpbb\auth\auth $auth The authentication object * @param int $user_id The user id * @param int $msg_id The id of the PM that we are downloading from * @@ -678,7 +678,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) /** * Checks whether a user can download from a particular PM * -* @param phpbb_db_driver $db The database object +* @param \phpbb\db\driver\driver $db The database object * @param int $user_id The user id * @param int $msg_id The id of the PM that we are downloading from * diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index bd0ffaaf00..bfd669fdfa 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -28,7 +28,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'firebird', 'MODULE' => 'interbase', 'DELIM' => ';;', - 'DRIVER' => 'phpbb_db_driver_firebird', + 'DRIVER' => 'phpbb\db\driver\firebird', 'AVAILABLE' => true, '2.0.x' => false, ), @@ -39,7 +39,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mysql_41', 'MODULE' => 'mysqli', 'DELIM' => ';', - 'DRIVER' => 'phpbb_db_driver_mysqli', + 'DRIVER' => 'phpbb\db\driver\mysqli', 'AVAILABLE' => true, '2.0.x' => true, ), @@ -48,7 +48,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mysql', 'MODULE' => 'mysql', 'DELIM' => ';', - 'DRIVER' => 'phpbb_db_driver_mysql', + 'DRIVER' => 'phpbb\db\driver\mysql', 'AVAILABLE' => true, '2.0.x' => true, ), @@ -57,7 +57,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mssql', 'MODULE' => 'mssql', 'DELIM' => 'GO', - 'DRIVER' => 'phpbb_db_driver_mssql', + 'DRIVER' => 'phpbb\db\driver\mssql', 'AVAILABLE' => true, '2.0.x' => true, ), @@ -66,7 +66,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mssql', 'MODULE' => 'odbc', 'DELIM' => 'GO', - 'DRIVER' => 'phpbb_db_driver_mssql_odbc', + 'DRIVER' => 'phpbb\db\driver\mssql_odbc', 'AVAILABLE' => true, '2.0.x' => true, ), @@ -75,7 +75,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'mssql', 'MODULE' => 'sqlsrv', 'DELIM' => 'GO', - 'DRIVER' => 'phpbb_db_driver_mssqlnative', + 'DRIVER' => 'phpbb\db\driver\mssqlnative', 'AVAILABLE' => true, '2.0.x' => false, ), @@ -84,7 +84,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'oracle', 'MODULE' => 'oci8', 'DELIM' => '/', - 'DRIVER' => 'phpbb_db_driver_oracle', + 'DRIVER' => 'phpbb\db\driver\oracle', 'AVAILABLE' => true, '2.0.x' => false, ), @@ -93,7 +93,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'postgres', 'MODULE' => 'pgsql', 'DELIM' => ';', - 'DRIVER' => 'phpbb_db_driver_postgres', + 'DRIVER' => 'phpbb\db\driver\postgres', 'AVAILABLE' => true, '2.0.x' => true, ), @@ -102,7 +102,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'SCHEMA' => 'sqlite', 'MODULE' => 'sqlite', 'DELIM' => ';', - 'DRIVER' => 'phpbb_db_driver_sqlite', + 'DRIVER' => 'phpbb\db\driver\sqlite', 'AVAILABLE' => true, '2.0.x' => false, ), @@ -184,7 +184,7 @@ function dbms_select($default = '', $only_20x_options = false) */ function get_tables(&$db) { - $db_tools = new phpbb_db_tools($db); + $db_tools = new \phpbb\db\tools($db); return $db_tools->sql_list_tables(); } @@ -206,14 +206,14 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $db->sql_return_on_error(true); // Check that we actually have a database name before going any further..... - if ($dbms_details['DRIVER'] != 'phpbb_db_driver_sqlite' && $dbms_details['DRIVER'] != 'phpbb_db_driver_oracle' && $dbname === '') + if ($dbms_details['DRIVER'] != 'phpbb\db\driver\sqlite' && $dbms_details['DRIVER'] != 'phpbb\db\driver\oracle' && $dbname === '') { $error[] = $lang['INST_ERR_DB_NO_NAME']; return false; } // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea - if ($dbms_details['DRIVER'] == 'phpbb_db_driver_sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) + if ($dbms_details['DRIVER'] == 'phpbb\db\driver\sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) { $error[] = $lang['INST_ERR_DB_FORUM_PATH']; return false; @@ -222,8 +222,8 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, // Check the prefix length to ensure that index names are not too long and does not contain invalid characters switch ($dbms_details['DRIVER']) { - case 'phpbb_db_driver_mysql': - case 'phpbb_db_driver_mysqli': + case 'phpbb\db\driver\mysql': + case 'phpbb\db\driver\mysqli': if (strspn($table_prefix, '-./\\') !== 0) { $error[] = $lang['INST_ERR_PREFIX_INVALID']; @@ -232,22 +232,22 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, // no break; - case 'phpbb_db_driver_postgres': + case 'phpbb\db\driver\postgres': $prefix_length = 36; break; - case 'phpbb_db_driver_mssql': - case 'phpbb_db_driver_mssql_odbc': - case 'phpbb_db_driver_mssqlnative': + case 'phpbb\db\driver\mssql': + case 'phpbb\db\driver\mssql_odbc': + case 'phpbb\db\driver\mssqlnative': $prefix_length = 90; break; - case 'phpbb_db_driver_sqlite': + case 'phpbb\db\driver\sqlite': $prefix_length = 200; break; - case 'phpbb_db_driver_firebird': - case 'phpbb_db_driver_oracle': + case 'phpbb\db\driver\firebird': + case 'phpbb\db\driver\oracle': $prefix_length = 6; break; } @@ -285,21 +285,21 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, // Make sure that the user has selected a sensible DBAL for the DBMS actually installed switch ($dbms_details['DRIVER']) { - case 'phpbb_db_driver_mysqli': + case 'phpbb\db\driver\mysqli': if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) { $error[] = $lang['INST_ERR_DB_NO_MYSQLI']; } break; - case 'phpbb_db_driver_sqlite': + case 'phpbb\db\driver\sqlite': if (version_compare(sqlite_libversion(), '2.8.2', '<')) { $error[] = $lang['INST_ERR_DB_NO_SQLITE']; } break; - case 'phpbb_db_driver_firebird': + case 'phpbb\db\driver\firebird': // check the version of FB, use some hackery if we can't get access to the server info if ($db->service_handle !== false && function_exists('ibase_server_info')) { @@ -380,7 +380,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, } break; - case 'phpbb_db_driver_oracle': + case 'phpbb\db\driver\oracle': if ($unicode_check) { $sql = "SELECT * @@ -402,7 +402,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, } break; - case 'phpbb_db_driver_postgres': + case 'phpbb\db\driver\postgres': if ($unicode_check) { $sql = "SHOW server_encoding;"; @@ -507,7 +507,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test 'adm_relative_path' => 'adm/', - 'acm_type' => 'phpbb_cache_driver_file', + 'acm_type' => 'phpbb\cache\driver\file', ); foreach ($config_data_array as $key => $value) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 13e25b4f5e..5b343e616e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -27,7 +27,7 @@ class messenger var $mail_priority = MAIL_NORMAL_PRIORITY; var $use_queue = true; - /** @var phpbb_template */ + /** @var \phpbb\template\template */ protected $template; var $eol = "\n"; @@ -626,14 +626,14 @@ class messenger */ protected function setup_template() { - global $config, $phpbb_filesystem, $user, $phpbb_extension_manager; + global $config, $phpbb_path_helper, $user, $phpbb_extension_manager; - if ($this->template instanceof phpbb_template) + if ($this->template instanceof \phpbb\template\template) { return; } - $this->template = new phpbb_template_twig($phpbb_filesystem, $config, $user, new phpbb_template_context(), $phpbb_extension_manager); + $this->template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context(), $phpbb_extension_manager); } /** @@ -700,7 +700,7 @@ class queue { global $db, $config, $phpEx, $phpbb_root_path, $user; - $lock = new phpbb_lock_flock($this->cache_file); + $lock = new \phpbb\lock\flock($this->cache_file); $lock->acquire(); // avoid races, check file existence once @@ -870,7 +870,7 @@ class queue return; } - $lock = new phpbb_lock_flock($this->cache_file); + $lock = new \phpbb\lock\flock($this->cache_file); $lock->acquire(); if (file_exists($this->cache_file)) @@ -987,12 +987,12 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) $smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']); // Ok we have error checked as much as we can to this point let's get on it already. - if (!class_exists('phpbb_error_collector')) + if (!class_exists('\phpbb\error_collector')) { global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/error_collector.' . $phpEx); } - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); $smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20); $collector->uninstall(); @@ -1706,12 +1706,12 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) // Reference: http://bugs.php.net/bug.php?id=15841 $headers = implode($eol, $headers); - if (!class_exists('phpbb_error_collector')) + if (!class_exists('\phpbb\error_collector')) { include($phpbb_root_path . 'includes/error_collector.' . $phpEx); } - $collector = new phpbb_error_collector; + $collector = new \phpbb\error_collector; $collector->install(); // On some PHP Versions mail() *may* fail if there are newlines within the subject. diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php index 80477684a8..b33f3d6866 100644 --- a/phpBB/includes/functions_module.php +++ b/phpBB/includes/functions_module.php @@ -499,12 +499,12 @@ class p_master * the style paths for the extension (the ext author can change them * if necessary). */ - $module_dir = explode('_', get_class($this->module)); + $module_dir = explode('\\', get_class($this->module)); - // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (isset($module_dir[3]) && $module_dir[1] === 'ext') + // 0 vendor, 1 extension name, ... + if (isset($module_dir[1])) { - $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style'; + $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/adm/style'; if (is_dir($module_style_dir)) { @@ -973,7 +973,7 @@ class p_master */ protected function get_short_name($basename) { - if (substr($basename, 0, 6) === 'phpbb_') + if (substr($basename, 0, 6) === 'phpbb\\' || strpos($basename, '\\') !== false) { return $basename; } @@ -990,6 +990,6 @@ class p_master */ protected function is_full_class($basename) { - return (preg_match('/^(phpbb|ucp|mcp|acp)_/', $basename)); + return (strpos($basename, '\\') !== false || preg_match('/^(ucp|mcp|acp)_/', $basename)); } } diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 5fc6de8e02..a2a79e032f 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -343,7 +343,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id) $userdata = $db->sql_fetchrow($result); $db->sql_freeresult($result); - $auth2 = new phpbb_auth(); + $auth2 = new \phpbb\auth\auth(); $auth2->acl($userdata); if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_')) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 4f31a85e83..4181896eca 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -713,7 +713,7 @@ class fileupload } $this->common_checks($file); - $request->overwrite('local', $upload, phpbb_request_interface::FILES); + $request->overwrite('local', $upload, \phpbb\request\request_interface::FILES); return $file; } diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php index a89ab7b126..fdde302e3b 100644 --- a/phpBB/includes/functions_url_matcher.php +++ b/phpBB/includes/functions_url_matcher.php @@ -22,13 +22,13 @@ if (!defined('IN_PHPBB')) /** * Create a new UrlMatcher class and dump it into the cache file * -* @param phpbb_extension_finder $finder Extension finder +* @param \phpbb\extension\finder $finder Extension finder * @param RequestContext $context Symfony RequestContext object * @param string $root_path Root path * @param string $php_ext PHP extension * @return null */ -function phpbb_get_url_matcher(phpbb_extension_finder $finder, RequestContext $context, $root_path, $php_ext) +function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path, $php_ext) { if (defined('DEBUG')) { @@ -46,14 +46,14 @@ function phpbb_get_url_matcher(phpbb_extension_finder $finder, RequestContext $c /** * Create a new UrlMatcher class and dump it into the cache file * -* @param phpbb_extension_finder $finder Extension finder +* @param \phpbb\extension\finder $finder Extension finder * @param string $root_path Root path * @param string $php_ext PHP extension * @return null */ -function phpbb_create_dumped_url_matcher(phpbb_extension_finder $finder, $root_path, $php_ext) +function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext) { - $provider = new phpbb_controller_provider(); + $provider = new \phpbb\controller\provider(); $routes = $provider->import_paths_from_finder($finder)->find(); $dumper = new PhpMatcherDumper($routes); $cached_url_matcher_dump = $dumper->dump(array( @@ -66,13 +66,13 @@ function phpbb_create_dumped_url_matcher(phpbb_extension_finder $finder, $root_p /** * Create a non-cached UrlMatcher * -* @param phpbb_extension_finder $finder Extension finder +* @param \phpbb\extension\finder $finder Extension finder * @param RequestContext $context Symfony RequestContext object * @return UrlMatcher */ -function phpbb_create_url_matcher(phpbb_extension_finder $finder, RequestContext $context) +function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context) { - $provider = new phpbb_controller_provider(); + $provider = new \phpbb\controller\provider(); $routes = $provider->import_paths_from_finder($finder)->find(); return new UrlMatcher($routes, $context); } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 4fcce67801..0a0656377c 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -388,12 +388,13 @@ function user_delete($mode, $user_ids, $retain_username = true) * Event before a user is deleted * * @event core.delete_user_before - * @var string mode Mode of deletion (retain/delete posts) - * @var int user_id ID of the deleted user - * @var mixed post_username Guest username that is being used or false + * @var string mode Mode of deletion (retain/delete posts) + * @var array user_ids IDs of the deleted user + * @var mixed retain_username True if username should be retained + * or false if not * @since 3.1-A1 */ - $vars = array('mode', 'user_id', 'post_username'); + $vars = array('mode', 'user_ids', 'retain_username'); extract($phpbb_dispatcher->trigger_event('core.delete_user_before', compact($vars))); // Before we begin, we will remove the reports the user issued. @@ -616,12 +617,13 @@ function user_delete($mode, $user_ids, $retain_username = true) * Event after a user is deleted * * @event core.delete_user_after - * @var string mode Mode of deletion (retain/delete posts) - * @var int user_id ID of the deleted user - * @var mixed post_username Guest username that is being used or false + * @var string mode Mode of deletion (retain/delete posts) + * @var array user_ids IDs of the deleted user + * @var mixed retain_username True if username should be retained + * or false if not * @since 3.1-A1 */ - $vars = array('mode', 'user_id', 'post_username'); + $vars = array('mode', 'user_ids', 'retain_username'); extract($phpbb_dispatcher->trigger_event('core.delete_user_after', compact($vars))); // Reset newest user info if appropriate @@ -2150,8 +2152,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (!sizeof($error)) { - $current_legend = phpbb_groupposition_legend::GROUP_DISABLED; - $current_teampage = phpbb_groupposition_teampage::GROUP_DISABLED; + $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED; + $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED; $legend = $phpbb_container->get('groupposition.legend'); $teampage = $phpbb_container->get('groupposition.teampage'); @@ -2162,7 +2164,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $current_legend = $legend->get_group_value($group_id); $current_teampage = $teampage->get_group_value($group_id); } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { trigger_error($user->lang($exception->getMessage())); } @@ -2170,7 +2172,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow if (!empty($group_attributes['group_legend'])) { - if (($group_id && ($current_legend == phpbb_groupposition_legend::GROUP_DISABLED)) || !$group_id) + if (($group_id && ($current_legend == \phpbb\groupposition\legend::GROUP_DISABLED)) || !$group_id) { // Old group currently not in the legend or new group, add at the end. $group_attributes['group_legend'] = 1 + $legend->get_group_count(); @@ -2181,22 +2183,22 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow $group_attributes['group_legend'] = $current_legend; } } - else if ($group_id && ($current_legend != phpbb_groupposition_legend::GROUP_DISABLED)) + else if ($group_id && ($current_legend != \phpbb\groupposition\legend::GROUP_DISABLED)) { // Group is removed from the legend try { $legend->delete_group($group_id, true); } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { trigger_error($user->lang($exception->getMessage())); } - $group_attributes['group_legend'] = phpbb_groupposition_legend::GROUP_DISABLED; + $group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED; } else { - $group_attributes['group_legend'] = phpbb_groupposition_legend::GROUP_DISABLED; + $group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED; } // Unset the objects, we don't need them anymore. @@ -2296,13 +2298,13 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow // Remove the group from the teampage, only if unselected and we are editing a group, // which is currently displayed. - if (!$group_teampage && $group_id && $current_teampage != phpbb_groupposition_teampage::GROUP_DISABLED) + if (!$group_teampage && $group_id && $current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED) { try { $teampage->delete_group($group_id); } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { trigger_error($user->lang($exception->getMessage())); } @@ -2320,24 +2322,24 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow try { - if ($group_teampage && $current_teampage == phpbb_groupposition_teampage::GROUP_DISABLED) + if ($group_teampage && $current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED) { $teampage->add_group($group_id); } if ($group_teampage) { - if ($current_teampage == phpbb_groupposition_teampage::GROUP_DISABLED) + if ($current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED) { $teampage->add_group($group_id); } } - else if ($group_id && ($current_teampage != phpbb_groupposition_teampage::GROUP_DISABLED)) + else if ($group_id && ($current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED)) { $teampage->delete_group($group_id); } } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { trigger_error($user->lang($exception->getMessage())); } @@ -2472,7 +2474,7 @@ function group_delete($group_id, $group_name = false) $legend->delete_group($group_id); unset($legend); } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { // The group we want to delete does not exist. // No reason to worry, we just continue the deleting process. @@ -2485,7 +2487,7 @@ function group_delete($group_id, $group_name = false) $teampage->delete_group($group_id); unset($teampage); } - catch (phpbb_groupposition_exception $exception) + catch (\phpbb\groupposition\exception $exception) { // The group we want to delete does not exist. // No reason to worry, we just continue the deleting process. diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index 841a0afddb..6df3320a97 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -36,8 +36,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info) // Fixes a "bug" that makes forum_view use the same ordering as topic_view $request->overwrite('sk', null); $request->overwrite('sd', null); - $request->overwrite('sk', null, phpbb_request_interface::POST); - $request->overwrite('sd', null, phpbb_request_interface::POST); + $request->overwrite('sk', null, \phpbb\request\request_interface::POST); + $request->overwrite('sd', null, \phpbb\request\request_interface::POST); } $forum_id = $forum_info['forum_id']; diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 275edbe55a..4f27d32a5a 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -462,7 +462,7 @@ function mcp_move_topic($topic_ids) if (!$to_forum_id || $additional_msg) { - $request->overwrite('confirm', null, phpbb_request_interface::POST); + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); $request->overwrite('confirm_key', null); } @@ -694,7 +694,7 @@ function mcp_restore_topic($topic_ids) } $topic_id = $request->variable('t', 0); - if (!$request->is_set('quickmod', phpbb_request_interface::REQUEST)) + if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST)) { $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); @@ -823,7 +823,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' } $topic_id = $request->variable('t', 0); - if (!$request->is_set('quickmod', phpbb_request_interface::REQUEST)) + if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST)) { $redirect = $request->variable('redirect', "index.$phpEx"); $redirect = reapply_sid($redirect); @@ -1136,7 +1136,7 @@ function mcp_fork_topic($topic_ids) if ($additional_msg) { - $request->overwrite('confirm', null, phpbb_request_interface::POST); + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); $request->overwrite('confirm_key', null); } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 1fa89af8e1..db461d07fa 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -729,7 +729,7 @@ class mcp_queue if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $message, @@ -877,7 +877,7 @@ class mcp_queue if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $message, @@ -937,9 +937,9 @@ class mcp_queue { $additional_msg = $user->lang['NO_REASON_DISAPPROVAL']; - $request->overwrite('confirm', null, phpbb_request_interface::POST); - $request->overwrite('confirm_key', null, phpbb_request_interface::POST); - $request->overwrite('confirm_key', null, phpbb_request_interface::REQUEST); + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); + $request->overwrite('confirm_key', null, \phpbb\request\request_interface::POST); + $request->overwrite('confirm_key', null, \phpbb\request\request_interface::REQUEST); } else { @@ -1212,7 +1212,7 @@ class mcp_queue if ($request->is_ajax()) { - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'MESSAGE_TITLE' => $user->lang['INFORMATION'], 'MESSAGE_TEXT' => $message, diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index bb21d3d377..3ffd75ac78 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -253,7 +253,7 @@ class mcp_warn // Check if can send a notification if ($config['allow_privmsg']) { - $auth2 = new phpbb_auth(); + $auth2 = new \phpbb\auth\auth(); $auth2->acl($user_row); $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false; unset($auth2); @@ -365,7 +365,7 @@ class mcp_warn // Check if can send a notification if ($config['allow_privmsg']) { - $auth2 = new phpbb_auth(); + $auth2 = new \phpbb\auth\auth(); $auth2->acl($user_row); $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false; unset($auth2); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 44960dd78d..3e348801c7 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1545,7 +1545,7 @@ class parse_message extends bbcode_firstpass global $request; $this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true)); - $attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, phpbb_request_interface::POST); + $attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, \phpbb\request\request_interface::POST); $this->attachment_data = array(); $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php index 5a5653e0b2..b86c4c8d52 100644 --- a/phpBB/includes/ucp/ucp_auth_link.php +++ b/phpBB/includes/ucp/ucp_auth_link.php @@ -46,7 +46,7 @@ class ucp_auth_link $s_hidden_fields = array(); add_form_key('ucp_auth_link'); - $submit = $request->variable('submit', false, false, phpbb_request_interface::POST); + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); // This path is only for primary actions if (!sizeof($error) && $submit) @@ -59,7 +59,7 @@ class ucp_auth_link if (!sizeof($error)) { // Any post data could be necessary for auth (un)linking - $link_data = $request->get_super_global(phpbb_request_interface::POST); + $link_data = $request->get_super_global(\phpbb\request\request_interface::POST); // The current user_id is also necessary $link_data['user_id'] = $user->data['user_id']; @@ -67,7 +67,7 @@ class ucp_auth_link // Tell the provider that the method is auth_link not login_link $link_data['link_method'] = 'auth_link'; - if ($request->variable('link', 0, false, phpbb_request_interface::POST)) + if ($request->variable('link', 0, false, \phpbb\request\request_interface::POST)) { $error[] = $auth_provider->link_account($link_data); } diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 6f78136f11..a75d2e9bfc 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -34,8 +34,8 @@ class ucp_groups $return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>'); $mark_ary = request_var('mark', array(0)); - $submit = $request->variable('submit', false, false, phpbb_request_interface::POST); - $delete = $request->variable('delete', false, false, phpbb_request_interface::POST); + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); + $delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST); $error = $data = array(); switch ($mode) @@ -465,7 +465,7 @@ class ucp_groups $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the group_ prefix - $avatar_data = phpbb_avatar_manager::clean_row($group_row); + $avatar_data = \phpbb\avatar\manager::clean_row($group_row); } // Did we submit? diff --git a/phpBB/includes/ucp/ucp_login_link.php b/phpBB/includes/ucp/ucp_login_link.php index 4620eb9b9e..80a553953d 100644 --- a/phpBB/includes/ucp/ucp_login_link.php +++ b/phpBB/includes/ucp/ucp_login_link.php @@ -72,8 +72,8 @@ class ucp_login_link { if ($request->is_set_post('login')) { - $login_username = $request->variable('login_username', '', false, phpbb_request_interface::POST); - $login_password = $request->untrimmed_variable('login_password', '', true, phpbb_request_interface::POST); + $login_username = $request->variable('login_username', '', false, \phpbb\request\request_interface::POST); + $login_password = $request->untrimmed_variable('login_password', '', true, \phpbb\request\request_interface::POST); $login_result = $auth_provider->login($login_username, $login_password); @@ -153,7 +153,7 @@ class ucp_login_link { global $request; - $var_names = $request->variable_names(phpbb_request_interface::GET); + $var_names = $request->variable_names(\phpbb\request\request_interface::GET); $login_link_data = array(); $string_start_length = strlen('login_link_'); @@ -162,7 +162,7 @@ class ucp_login_link if (strpos($var_name, 'login_link_') === 0) { $key_name = substr($var_name, $string_start_length); - $login_link_data[$key_name] = $request->variable($var_name, '', false, phpbb_request_interface::GET); + $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::GET); } } diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 615b567134..b859413d92 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -296,7 +296,7 @@ class ucp_main } else { - $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE); + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); } diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 72c41776b3..2f22f6cf9c 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -163,11 +163,11 @@ class ucp_notifications * Output all the notification types to the template * * @param string $block - * @param phpbb_notification_manager $phpbb_notifications - * @param phpbb_template $template - * @param phpbb_user $user + * @param \phpbb\notification\manager $phpbb_notifications + * @param \phpbb\template\template $template + * @param \phpbb\user $user */ - public function output_notification_types($subscriptions, $block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user) + public function output_notification_types($subscriptions, $block = 'notification_types', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user) { $notification_methods = $phpbb_notifications->get_subscription_methods(); @@ -210,11 +210,11 @@ class ucp_notifications * Output all the notification methods to the template * * @param string $block - * @param phpbb_notification_manager $phpbb_notifications - * @param phpbb_template $template - * @param phpbb_user $user + * @param \phpbb\notification\manager $phpbb_notifications + * @param \phpbb\template\template $template + * @param \phpbb\user $user */ - public function output_notification_methods($block = 'notification_methods', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user) + public function output_notification_methods($block = 'notification_methods', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user) { $notification_methods = $phpbb_notifications->get_subscription_methods(); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index e55569fdd5..8ae7acaa11 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -34,9 +34,9 @@ class ucp_profile $user->add_lang('posting'); - $preview = $request->variable('preview', false, false, phpbb_request_interface::POST); - $submit = $request->variable('submit', false, false, phpbb_request_interface::POST); - $delete = $request->variable('delete', false, false, phpbb_request_interface::POST); + $preview = $request->variable('preview', false, false, \phpbb\request\request_interface::POST); + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); + $delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST); $error = $data = array(); $s_hidden_fields = ''; @@ -567,7 +567,7 @@ class ucp_profile $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); // This is normalised data, without the user_ prefix - $avatar_data = phpbb_avatar_manager::clean_row($user->data); + $avatar_data = \phpbb\avatar\manager::clean_row($user->data); if ($submit) { diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 44621e6dea..1f9ab23326 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -516,7 +516,7 @@ class ucp_register { global $request; - $var_names = $request->variable_names(phpbb_request_interface::POST); + $var_names = $request->variable_names(\phpbb\request\request_interface::POST); $login_link_data = array(); $string_start_length = strlen('login_link_'); @@ -525,7 +525,7 @@ class ucp_register if (strpos($var_name, 'login_link_') === 0) { $key_name = substr($var_name, $string_start_length); - $login_link_data[$key_name] = $request->variable($var_name, '', false, phpbb_request_interface::POST); + $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::POST); } } diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index bdbf693ddd..b3def63896 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -71,7 +71,7 @@ class ucp_remind } // Check users permissions - $auth2 = new phpbb_auth(); + $auth2 = new \phpbb\auth\auth(); $auth2->acl($user_row); if (!$auth2->acl_get('u_chgpasswd')) diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php index a669c450a4..6bb3cdc145 100644 --- a/phpBB/includes/ucp/ucp_zebra.php +++ b/phpBB/includes/ucp/ucp_zebra.php @@ -229,7 +229,7 @@ class ucp_zebra { $message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('<br />', $error); - $json_response = new phpbb_json_response; + $json_response = new \phpbb\json_response; $json_response->send(array( 'success' => $updated, |