phpBB

Code Changes

File: phpbb/template/twig/loader.php

  Unmodified   Added   Modified   Removed
Line 16Line 16
/**
* Twig Template loader
*/

/**
* Twig Template loader
*/

class loader extends \Twig_Loader_Filesystem

class loader extends \Twig\Loader\FilesystemLoader

{
protected $safe_directories = array();


{
protected $safe_directories = array();


Line 42Line 42
	* Set safe directories
*
* @param array $directories Array of directories that are safe (empty to clear)

	* Set safe directories
*
* @param array $directories Array of directories that are safe (empty to clear)

	* @return \Twig_Loader_Filesystem

	* @return \Twig\Loader\FilesystemLoader

	*/
public function setSafeDirectories($directories = array())
{

	*/
public function setSafeDirectories($directories = array())
{

Line 63Line 63
	* Add safe directory
*
* @param string $directory Directory that should be added

	* Add safe directory
*
* @param string $directory Directory that should be added

	* @return \Twig_Loader_Filesystem

	* @return \Twig\Loader\FilesystemLoader

	*/
public function addSafeDirectory($directory)
{

	*/
public function addSafeDirectory($directory)
{

Line 113Line 113
	/**
* Find the template
*

	/**
* Find the template
*

	* Override for Twig_Loader_Filesystem::findTemplate to add support
* for loading from safe directories.

	 * Override for \Twig\Loader\FilesystemLoader::findTemplate
* to add support for loading from safe directories.

	*/
protected function findTemplate($name, $throw = true)
{

	*/
protected function findTemplate($name, $throw = true)
{

Line 139Line 139
			// Try validating the name (which may throw an exception)
$this->validateName($name);
}

			// Try validating the name (which may throw an exception)
$this->validateName($name);
}

		catch (\Twig_Error_Loader $e)

		catch (\Twig\Error\LoaderError $e)

		{
if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0)
{

		{
if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0)
{