From 197c801746b148e6bcf7b5824e9077c185bf4e5f Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 14:10:19 +0200 Subject: [ticket/12529] Use root_path in controller\resolver to check the template dir PHPBB3-12529 --- phpBB/config/services.yml | 1 + phpBB/phpbb/controller/resolver.php | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'phpBB') diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index fdd8a33135..45ad108ef9 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -103,6 +103,7 @@ services: class: phpbb\controller\resolver arguments: - @user + - %core.root_path% - @service_container - @template diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index 233179e343..f4cebc5730 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -37,6 +37,12 @@ class resolver implements ControllerResolverInterface */ protected $template; + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + /** * Construct method * @@ -44,11 +50,12 @@ class resolver implements ControllerResolverInterface * @param ContainerInterface $container ContainerInterface object * @param \phpbb\template\template $template */ - public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\template\template $template = null) + public function __construct(\phpbb\user $user, $phpbb_root_path, ContainerInterface $container, \phpbb\template\template $template = null) { $this->user = $user; $this->container = $container; $this->template = $template; + $this->phpbb_root_path = $phpbb_root_path; } /** @@ -94,7 +101,7 @@ class resolver implements ControllerResolverInterface { $controller_style_dir = 'ext/' . $controller_dir[0] . '/' . $controller_dir[1] . '/styles'; - if (is_dir($controller_style_dir)) + if (is_dir($this->phpbb_root_path . $controller_style_dir)) { $this->template->set_style(array($controller_style_dir, 'styles')); } -- cgit v1.2.1 From 16cd1db59a3e089fd07b2b2a7586e32e73a780e9 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 11 May 2014 15:10:14 +0200 Subject: [ticket/12529] Move $phpbb_root_path to the end of the constructor PHPBB3-12529 --- phpBB/config/services.yml | 2 +- phpBB/phpbb/controller/resolver.php | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'phpBB') diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 45ad108ef9..4de47f750f 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -103,8 +103,8 @@ services: class: phpbb\controller\resolver arguments: - @user - - %core.root_path% - @service_container + - %core.root_path% - @template controller.provider: diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php index f4cebc5730..3010901024 100644 --- a/phpBB/phpbb/controller/resolver.php +++ b/phpBB/phpbb/controller/resolver.php @@ -33,7 +33,7 @@ class resolver implements ControllerResolverInterface /** * phpbb\template\template object - * @var phpbb\template\template + * @var \phpbb\template\template */ protected $template; @@ -48,9 +48,10 @@ class resolver implements ControllerResolverInterface * * @param \phpbb\user $user User Object * @param ContainerInterface $container ContainerInterface object + * @param string $phpbb_root_path Relative path to phpBB root * @param \phpbb\template\template $template */ - public function __construct(\phpbb\user $user, $phpbb_root_path, ContainerInterface $container, \phpbb\template\template $template = null) + public function __construct(\phpbb\user $user, ContainerInterface $container, $phpbb_root_path, \phpbb\template\template $template = null) { $this->user = $user; $this->container = $container; @@ -61,7 +62,7 @@ class resolver implements ControllerResolverInterface /** * Load a controller callable * - * @param Symfony\Component\HttpFoundation\Request $request Symfony Request object + * @param \Symfony\Component\HttpFoundation\Request $request Symfony Request object * @return bool|Callable Callable or false * @throws \phpbb\controller\exception */ @@ -116,7 +117,7 @@ class resolver implements ControllerResolverInterface * and should match the parameters of the method you are using as your * controller. * - * @param Symfony\Component\HttpFoundation\Request $request Symfony Request object + * @param \Symfony\Component\HttpFoundation\Request $request Symfony Request object * @param mixed $controller A callable (controller class, method) * @return bool False * @throws \phpbb\controller\exception -- cgit v1.2.1