diff options
Diffstat (limited to 'phpBB/phpbb/controller/helper.php')
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 74410ddfd1..07483a91eb 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -7,6 +7,8 @@ * */ +namespace phpbb\controller; + /** * @ignore */ @@ -21,21 +23,27 @@ use Symfony\Component\HttpFoundation\Response; * Controller helper class, contains methods that do things for controllers * @package phpBB3 */ -class phpbb_controller_helper +class helper { /** * Template object - * @var phpbb_template + * @var \phpbb\template\template */ protected $template; /** * User object - * @var phpbb_user + * @var \phpbb\user */ protected $user; /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** * phpBB root path * @var string */ @@ -50,15 +58,17 @@ class phpbb_controller_helper /** * Constructor * - * @param phpbb_template $template Template object - * @param phpbb_user $user User object + * @param \phpbb\template\template $template Template 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, 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; } @@ -102,22 +112,14 @@ 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 + // 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); } /** |