From da2752e4004b296ae5acdd08b7c0a758d8f61e9d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 14 Jul 2013 13:30:52 -0400 Subject: [ticket/11700] Modify all code to use the new interface names PHPBB3-11700 --- phpBB/phpbb/session.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index e0585b1523..3bff91e275 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -243,7 +243,7 @@ class phpbb_session $this->forwarded_for = ''; } - if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_interface::COOKIE)) + if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_request_interface::COOKIE)) { $this->cookie_data['u'] = request_var($config['cookie_name'] . '_u', 0, false, true); $this->cookie_data['k'] = request_var($config['cookie_name'] . '_k', '', false, true); @@ -405,9 +405,9 @@ class phpbb_session $provider = $phpbb_container->get('auth.provider.' . $method); - if (!($provider instanceof phpbb_auth_provider_interface)) + if (!($provider instanceof phpbb_auth_provider_provider_interface)) { - throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface'); + throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_provider_interface'); } $ret = $provider->validate_session($this->data); -- cgit v1.2.1 From b95fdacdd378877d277e261465da73deb06e50da Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 10 Sep 2013 14:01:09 +0200 Subject: [ticket/11700] Move all recent code to namespaces PHPBB3-11700 --- phpBB/phpbb/session.php | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 3bff91e275..782ef60c52 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -7,6 +7,8 @@ * */ +namespace phpbb; + /** * @ignore */ @@ -19,7 +21,7 @@ if (!defined('IN_PHPBB')) * Session class * @package phpBB3 */ -class phpbb_session +class session { var $cookie_data = array(); var $page = array(); @@ -197,7 +199,7 @@ class phpbb_session * This is where all session activity begins. We gather various pieces of * information from the client and server. We test to see if a session already * exists. If it does, fine and dandy. If it doesn't we'll go on to create a - * new one ... pretty logical heh? We also examine the system load (if we're + * new \one ... pretty logical heh? We also examine the system load (if we're * running on a system which makes such information readily available) and * halt if it's above an admin definable limit. * @@ -243,7 +245,7 @@ class phpbb_session $this->forwarded_for = ''; } - if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_request_interface::COOKIE)) + if ($request->is_set($config['cookie_name'] . '_sid', \phpbb\request\request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', \phpbb\request\request_interface::COOKIE)) { $this->cookie_data['u'] = request_var($config['cookie_name'] . '_u', 0, false, true); $this->cookie_data['k'] = request_var($config['cookie_name'] . '_k', '', false, true); @@ -401,13 +403,13 @@ class phpbb_session $session_expired = false; // Check whether the session is still valid if we have one - $method = basename(trim($config['auth_method'])); + $method = basename(trim($config['auth_method'])); $provider = $phpbb_container->get('auth.provider.' . $method); - if (!($provider instanceof phpbb_auth_provider_provider_interface)) + if (!($provider instanceof \phpbb\auth\provider\provider_interface)) { - throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_provider_interface'); + throw new \RuntimeException($provider . ' must implement \phpbb\auth\provider\provider_interface'); } $ret = $provider->validate_session($this->data); @@ -492,18 +494,18 @@ class phpbb_session } } - // If we reach here then no (valid) session exists. So we'll create a new one + // If we reach here then no (valid) session exists. So we'll create a new \one return $this->session_create(); } /** - * Create a new session + * Create a new \session * * If upon trying to start a session we discover there is nothing existing we * jump here. Additionally this method is called directly during login to regenerate * the session for the specific user. In this method we carry out a number of tasks; * garbage collection, (search)bot checking, banned user comparison. Basically - * though this method will result in a new session for a specific user. + * though this method will result in a new \session for a specific user. */ function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) { @@ -773,7 +775,7 @@ class phpbb_session if (!defined('IN_ERROR_HANDLER') && (!$this->session_id || !$db->sql_query($sql) || !$db->sql_affectedrows())) { - // Limit new sessions in 1 minute period (if required) + // Limit new \sessions in 1 minute period (if required) if (empty($this->data['session_time']) && $config['active_sessions']) { // $db->sql_return_on_error(false); @@ -799,7 +801,7 @@ class phpbb_session // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. - // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. + // If the session id is empty, we have a completely new \one and will set an "identifier" here. This identifier is able to be checked later. if (empty($this->data['session_id'])) { // This is a temporary variable, only set for the very first visit @@ -1022,7 +1024,7 @@ class phpbb_session { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } - phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); + \phpbb_captcha_factory::garbage_collect($config['captcha_plugin']); $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' WHERE attempt_time < ' . (time() - (int) $config['ip_login_limit_time']); -- cgit v1.2.1 From 3860b37741c21576dae2f02e3754aa322c24567f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 03:50:47 +0200 Subject: [ticket/11700] Actually "one" in comments is not a class PHPBB3-11700 --- phpBB/phpbb/session.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 6925ebbc6a..2bfa55334d 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -199,7 +199,7 @@ class session * This is where all session activity begins. We gather various pieces of * information from the client and server. We test to see if a session already * exists. If it does, fine and dandy. If it doesn't we'll go on to create a - * new \one ... pretty logical heh? We also examine the system load (if we're + * new one ... pretty logical heh? We also examine the system load (if we're * running on a system which makes such information readily available) and * halt if it's above an admin definable limit. * @@ -494,7 +494,7 @@ class session } } - // If we reach here then no (valid) session exists. So we'll create a new \one + // If we reach here then no (valid) session exists. So we'll create a new one return $this->session_create(); } @@ -801,7 +801,7 @@ class session // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. - // If the session id is empty, we have a completely new \one and will set an "identifier" here. This identifier is able to be checked later. + // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. if (empty($this->data['session_id'])) { // This is a temporary variable, only set for the very first visit -- cgit v1.2.1 From 390dc86344c23b658085bae4a719399e5eb579f0 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 16 Sep 2013 05:00:18 +0200 Subject: [ticket/11700] And some last comments with backslashes PHPBB3-11700 --- phpBB/phpbb/session.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 2bfa55334d..543369a3ab 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -499,13 +499,13 @@ class session } /** - * Create a new \session + * Create a new session * * If upon trying to start a session we discover there is nothing existing we * jump here. Additionally this method is called directly during login to regenerate * the session for the specific user. In this method we carry out a number of tasks; * garbage collection, (search)bot checking, banned user comparison. Basically - * though this method will result in a new \session for a specific user. + * though this method will result in a new session for a specific user. */ function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) { @@ -775,7 +775,7 @@ class session if (!defined('IN_ERROR_HANDLER') && (!$this->session_id || !$db->sql_query($sql) || !$db->sql_affectedrows())) { - // Limit new \sessions in 1 minute period (if required) + // Limit new sessions in 1 minute period (if required) if (empty($this->data['session_time']) && $config['active_sessions']) { // $db->sql_return_on_error(false); -- cgit v1.2.1 From 1d7f8f81935157867539d4c3991c5922afec8b55 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 17 Sep 2013 18:10:58 +0200 Subject: [ticket/11700] Get functional tests running after develop merge PHPBB3-11700 --- phpBB/phpbb/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 543369a3ab..2baf61043d 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -403,7 +403,7 @@ class session $session_expired = false; // Check whether the session is still valid if we have one - $method = basename(trim($config['auth_method'])); + $method = basename(trim($config['auth_method'])); $provider = $phpbb_container->get('auth.provider.' . $method); -- cgit v1.2.1 From f4317bc864f9c19a15de83ea30cb46a04c95a295 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 17 Sep 2013 11:41:46 -0500 Subject: [ticket/11850] Fix $user->page on pages through the controller PHPBB3-11850 --- phpBB/phpbb/session.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index dc33786666..52f621dbf6 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -40,13 +40,13 @@ class phpbb_session */ static function extract_current_page($root_path) { - global $request; + global $request, $symfony_request, $phpbb_filesystem; $page_array = array(); // First of all, get the request uri... - $script_name = htmlspecialchars_decode($request->server('PHP_SELF')); - $args = explode('&', htmlspecialchars_decode($request->server('QUERY_STRING'))); + $script_name = $symfony_request->getScriptName(); + $args = explode('&', $symfony_request->getQueryString()); // If we are unable to get the script name we use REQUEST_URI as a failover and note it within the page array for easier support... if (!$script_name) @@ -103,10 +103,19 @@ class phpbb_session } // Current page from phpBB root (for example: adm/index.php?i=10&b=2) - $page = (($page_dir) ? $page_dir . '/' : '') . $page_name . (($query_string) ? "?$query_string" : ''); + $symfony_request_path = $phpbb_filesystem->clean_path($symfony_request->getPathInfo()); + $page = (($page_dir) ? $page_dir . '/' : '') . $page_name; + if ($symfony_request_path !== '/') + { + $page .= $symfony_request_path; + } + if ($query_string) + { + $page .= '?' . $query_string; + } // The script path from the webroot to the current directory (for example: /phpBB3/adm/) : always prefixed with / and ends in / - $script_path = trim(str_replace('\\', '/', dirname($script_name))); + $script_path = $symfony_request->getBasePath(); // The script path from the webroot to the phpBB root (for example: /phpBB3/) $script_dirs = explode('/', $script_path); -- cgit v1.2.1 From 9c535da52888d60aecef9799062974e375f22f82 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 17 Sep 2013 22:00:06 -0500 Subject: [ticket/11850] page_name contains controller request rather than query string Fixing tests PHPBB3-11850 --- phpBB/phpbb/session.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb/session.php') diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 52f621dbf6..1752291cf2 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -87,6 +87,12 @@ class phpbb_session $page_name = (substr($script_name, -1, 1) == '/') ? '' : basename($script_name); $page_name = urlencode(htmlspecialchars($page_name)); + $symfony_request_path = $phpbb_filesystem->clean_path($symfony_request->getPathInfo()); + if ($symfony_request_path !== '/') + { + $page_name .= $symfony_request_path; + } + // current directory within the phpBB root (for example: adm) $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($root_path))); $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath('./'))); @@ -103,12 +109,7 @@ class phpbb_session } // Current page from phpBB root (for example: adm/index.php?i=10&b=2) - $symfony_request_path = $phpbb_filesystem->clean_path($symfony_request->getPathInfo()); $page = (($page_dir) ? $page_dir . '/' : '') . $page_name; - if ($symfony_request_path !== '/') - { - $page .= $symfony_request_path; - } if ($query_string) { $page .= '?' . $query_string; -- cgit v1.2.1