diff options
Diffstat (limited to 'phpBB/phpbb/controller/helper.php')
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index f1cc29f21b..6e45374643 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -38,6 +38,12 @@ class helper protected $user; /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** * phpBB root path * @var string */ @@ -53,14 +59,16 @@ class helper * Constructor * * @param \phpbb\template\template $template Template object - * @param \phpbb\user $user User object + * @param \phpbb\user $user User object + * @param \phpbb\config\config $config Config object * @param string $phpbb_root_path phpBB root path * @param string $php_ext PHP extension */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext) { $this->template = $template; $this->user = $user; + $this->config = $config; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } @@ -104,22 +112,14 @@ class 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 + // If enable_mod_rewrite is false, we need to include app.php + $route_prefix = $this->phpbb_root_path; + if (empty($this->config['enable_mod_rewrite'])) { - $params = array('controller' => $route); + $route_prefix .= 'app.' . $this->php_ext . '/'; } - 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); } /** |