From 4bdef6fd21a5dcab455b0cd1ee2652de606929c3 Mon Sep 17 00:00:00 2001 From: MateBartus Date: Thu, 12 Mar 2015 00:25:00 +0100 Subject: [ticket/13697] Moving filesystem related functions to filesystem service * Moving filesystem service to \phpbb\filesystem namespace * Wraping Symfony's Filesystem component * Moving filesystem related functions from includes/functions.php into \phpbb\filesystem\filesystem Functions moved (and deprecated): - phpbb_chmod - phpbb_is_writable - phpbb_is_absolute - phpbb_own_realpath - phpbb_realpath * Adding interface for filesystem service PHPBB3-13697 --- phpBB/phpbb/template/twig/loader.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'phpBB/phpbb/template/twig/loader.php') diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 2f8ffaa776..df8183c019 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -20,6 +20,24 @@ class loader extends \Twig_Loader_Filesystem { protected $safe_directories = array(); + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param string|array $paths + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $paths = array()) + { + $this->filesystem = $filesystem; + + parent::__construct($paths); + } + /** * Set safe directories * @@ -49,7 +67,7 @@ class loader extends \Twig_Loader_Filesystem */ public function addSafeDirectory($directory) { - $directory = phpbb_realpath($directory); + $directory = $this->filesystem->realpath($directory); if ($directory !== false) { @@ -118,7 +136,7 @@ class loader extends \Twig_Loader_Filesystem // can now check if we're within a "safe" directory // Find the real path of the directory the file is in - $directory = phpbb_realpath(dirname($file)); + $directory = $this->filesystem->realpath(dirname($file)); if ($directory === false) { -- cgit v1.2.1 From 7a5fbd0257d7b15b8230fa6c60581cc197cb1a47 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Sun, 2 Oct 2016 19:24:45 +0200 Subject: [ticket/14807] Updates Twig PHPBB3-14807 --- phpBB/phpbb/template/twig/loader.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'phpBB/phpbb/template/twig/loader.php') diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index 8b12188a77..b2261dd8cd 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -12,6 +12,7 @@ */ namespace phpbb\template\twig; +use Twig_Loader_Filesystem; /** * Twig Template loader @@ -100,6 +101,16 @@ class loader extends \Twig_Loader_Filesystem return; } + /** + * Adds a realpath call to fix a BC break in Twig 1.26 (https://github.com/twigphp/Twig/issues/2145) + * + * {@inheritdoc} + */ + public function addPath($path, $namespace = self::MAIN_NAMESPACE) + { + return parent::addPath($this->filesystem->realpath($path), $namespace); + } + /** * Find the template * -- cgit v1.2.1 From b2711371f1267a1314ccf1de976d5432c03a2357 Mon Sep 17 00:00:00 2001 From: Tristan Darricau Date: Mon, 10 Oct 2016 09:14:24 +0200 Subject: [ticket/14807] s9e/textformatter 0.8.1 PHPBB3-14807 --- phpBB/phpbb/template/twig/loader.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/template/twig/loader.php') diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index b2261dd8cd..d2b42852ce 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -12,7 +12,6 @@ */ namespace phpbb\template\twig; -use Twig_Loader_Filesystem; /** * Twig Template loader -- cgit v1.2.1