mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/11215] Make controller helper url() method use correct format
PHPBB3-11215
This commit is contained in:
parent
9d48ee446b
commit
913e5a1f2e
2 changed files with 18 additions and 16 deletions
|
@ -90,6 +90,7 @@ services:
|
||||||
arguments:
|
arguments:
|
||||||
- @template
|
- @template
|
||||||
- @user
|
- @user
|
||||||
|
- @request
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,12 @@ class phpbb_controller_helper
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Request object
|
||||||
|
* @var phpbb_request
|
||||||
|
*/
|
||||||
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB root path
|
* phpBB root path
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -55,10 +61,11 @@ class phpbb_controller_helper
|
||||||
* @param string $phpbb_root_path phpBB root path
|
* @param string $phpbb_root_path phpBB root path
|
||||||
* @param string $php_ext PHP extension
|
* @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 $request, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
$this->request = $request;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
}
|
}
|
||||||
|
@ -102,22 +109,16 @@ class phpbb_controller_helper
|
||||||
$route = substr($route, 0, $route_delim);
|
$route = substr($route, 0, $route_delim);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($params) && !empty($params))
|
$request_uri = $this->request->variable('REQUEST_URI', '', false, phpbb_request::SERVER);
|
||||||
{
|
$script_name = $this->request->variable('SCRIPT_NAME', '', false, phpbb_request::SERVER);
|
||||||
$params = array_merge(array(
|
|
||||||
'controller' => $route,
|
|
||||||
), $params);
|
|
||||||
}
|
|
||||||
else if (is_string($params) && $params)
|
|
||||||
{
|
|
||||||
$params = 'controller=' . $route . (($is_amp) ? '&' : '&') . $params;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$params = array('controller' => $route);
|
|
||||||
}
|
|
||||||
|
|
||||||
return append_sid($this->phpbb_root_path . 'app.' . $this->php_ext . $route_params, $params, $is_amp, $session_id);
|
// 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($route_prefix . "$route" . $route_params, $params, $is_amp, $session_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue