mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/15253] Use storage helper methods instead of filesystem methods
PHPBB3-15253
This commit is contained in:
@@ -20,24 +20,6 @@ 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, $this->filesystem->realpath(dirname(__FILE__)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set safe directories
|
||||
*
|
||||
@@ -67,7 +49,7 @@ class loader extends \Twig_Loader_Filesystem
|
||||
*/
|
||||
public function addSafeDirectory($directory)
|
||||
{
|
||||
$directory = $this->filesystem->realpath($directory);
|
||||
$directory = \phpbb\storage\helper::realpath($directory);
|
||||
|
||||
if ($directory !== false)
|
||||
{
|
||||
@@ -107,7 +89,7 @@ class loader extends \Twig_Loader_Filesystem
|
||||
*/
|
||||
public function addPath($path, $namespace = self::MAIN_NAMESPACE)
|
||||
{
|
||||
return parent::addPath($this->filesystem->realpath($path), $namespace);
|
||||
return parent::addPath(\phpbb\storage\helper::realpath($path), $namespace);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -147,7 +129,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 = $this->filesystem->realpath(dirname($file));
|
||||
$directory = \phpbb\storage\helper::realpath(dirname($file));
|
||||
|
||||
if ($directory === false)
|
||||
{
|
||||
|
Reference in New Issue
Block a user