diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-09-06 20:35:18 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-09-06 20:35:54 -0400 |
commit | 3a6b3d7c2b38b244d5c725ce1c7829328dae770f (patch) | |
tree | a05c248c1f3e99ad2ebbfb16f12427f059cd6e9e /phpBB/phpbb/controller/helper.php | |
parent | d5808f13e5fa70ecc802c2a5a11c3143746c93f0 (diff) | |
parent | 8d6b03c438392cebed941491684ff835bf7136a8 (diff) | |
download | forums-3a6b3d7c2b38b244d5c725ce1c7829328dae770f.tar forums-3a6b3d7c2b38b244d5c725ce1c7829328dae770f.tar.gz forums-3a6b3d7c2b38b244d5c725ce1c7829328dae770f.tar.bz2 forums-3a6b3d7c2b38b244d5c725ce1c7829328dae770f.tar.xz forums-3a6b3d7c2b38b244d5c725ce1c7829328dae770f.zip |
[feature/oauth] Merge branch 'develop' of git://github.com/phpbb/phpbb3 into feature/oauth
Conflicts:
phpBB/composer.json
phpBB/composer.lock
phpBB/develop/create_schema_files.php
phpBB/includes/ucp/ucp_register.php
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/controller/helper.php')
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 74410ddfd1..4d240f9380 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -36,6 +36,12 @@ class phpbb_controller_helper protected $user; /** + * Request object + * @var phpbb_request + */ + protected $request; + + /** * phpBB root path * @var string */ @@ -55,10 +61,11 @@ class phpbb_controller_helper * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP extension */ - public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext) + public function __construct(phpbb_template $template, phpbb_user $user, phpbb_request_interface $request, $phpbb_root_path, $php_ext) { $this->template = $template; $this->user = $user; + $this->request = $request; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } @@ -102,22 +109,16 @@ class phpbb_controller_helper $route = substr($route, 0, $route_delim); } - if (is_array($params) && !empty($params)) - { - $params = array_merge(array( - 'controller' => $route, - ), $params); - } - else if (is_string($params) && $params) - { - $params = 'controller=' . $route . (($is_amp) ? '&' : '&') . $params; - } - else - { - $params = array('controller' => $route); - } + $request_uri = $this->request->variable('REQUEST_URI', '', false, phpbb_request::SERVER); + $script_name = $this->request->variable('SCRIPT_NAME', '', false, phpbb_request::SERVER); + + // If the app.php file is being used (no rewrite) keep it in the URL. + // Otherwise, don't include it. + $route_prefix = $this->phpbb_root_path; + $parts = explode('/', $script_name); + $route_prefix .= strpos($request_uri, $script_name) === 0 ? array_pop($parts) . '/' : ''; - return append_sid($this->phpbb_root_path . 'app.' . $this->php_ext . $route_params, $params, $is_amp, $session_id); + return append_sid($route_prefix . "$route" . $route_params, $params, $is_amp, $session_id); } /** |