diff options
Diffstat (limited to 'phpBB/phpbb/controller')
-rw-r--r-- | phpBB/phpbb/controller/helper.php | 30 | ||||
-rw-r--r-- | phpBB/phpbb/controller/resolver.php | 16 |
2 files changed, 23 insertions, 23 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); } /** diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 5c1f5e836e..dad2ebd06b 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -40,23 +40,23 @@ class resolver implements ControllerResolverInterface protected $container; /** - * \phpbb\style\style object - * @var \phpbb\style\style + * phpbb\template\template object + * @var phpbb\template\template */ - protected $style; + protected $template; /** * Construct method * * @param \phpbb\user $user User Object * @param ContainerInterface $container ContainerInterface object - * @param \phpbb\style\style $style + * @param \phpbb\template\template $template */ - public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\style\style $style = null) + public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\template\template $template = null) { $this->user = $user; $this->container = $container; - $this->style = $style; + $this->template = $template; } /** @@ -98,13 +98,13 @@ class resolver implements ControllerResolverInterface $controller_dir = explode('_', get_class($controller_object)); // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ... - if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext') + if (!is_null($this->template) && isset($controller_dir[3]) && $controller_dir[1] === 'ext') { $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles'; if (is_dir($controller_style_dir)) { - $this->style->set_style(array($controller_style_dir, 'styles')); + $this->template->set_style(array($controller_style_dir, 'styles')); } } |