From 18c5f5c6e881d897fada883bf617350aa9a028a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Thu, 5 Oct 2017 20:54:01 +0200 Subject: [PATCH 1/3] [ticket/15377] Fix INCLUDECSS and INCLUDEJS PHPBB3-15377 --- phpBB/phpbb/template/twig/loader.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 607dfcd078..474357b9d1 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -22,6 +22,16 @@ class loader extends \Twig_Loader_Filesystem { protected $safe_directories = array(); + /** + * Constructor + * + * @param string|array $paths + */ + public function __construct($paths = array()) + { + parent::__construct($paths, filesystem_helper::realpath(dirname(__FILE__))); + } + /** * Set safe directories * From c2d3322e824304dc1783b9d2d0b9d0220382d915 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Fri, 6 Oct 2017 23:08:32 +0200 Subject: [PATCH 2/3] [ticket/15377] Add test PHPBB3-15377 --- tests/functional/extension_controller_test.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php index 58c3878b8b..2957749e89 100644 --- a/tests/functional/extension_controller_test.php +++ b/tests/functional/extension_controller_test.php @@ -89,6 +89,15 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c $this->phpbb_extension_manager->purge('foo/bar'); } + /** + * Check includejs/includecss when the request_uri is a subdirectory + */ + public function test_controller_template_include_js_css() + { + $crawler = self::request('GET', 'app.php/help/faq'); + $this->assertContains("./../../assets/javascript/core.js", $crawler->filter('body')->html()); + } + /** * Check the error produced by calling a controller without a required * argument. From eaeec9b50b6534105e4f970df078ad06600f359c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Calvo?= Date: Mon, 9 Oct 2017 10:38:50 +0200 Subject: [PATCH 3/3] [ticket/15377] Use __DIR__ constant PHPBB3-15377 --- phpBB/phpbb/template/twig/loader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 474357b9d1..3273520d86 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -29,7 +29,7 @@ class loader extends \Twig_Loader_Filesystem */ public function __construct($paths = array()) { - parent::__construct($paths, filesystem_helper::realpath(dirname(__FILE__))); + parent::__construct($paths, __DIR__); } /**