From f30b87519e9ead41525e1979cbce874e8a84e2b8 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 9 Sep 2013 17:28:56 -0500 Subject: [ticket/11832] Inject dependencies for phpbb_get_web_root_path (also moving) Function moved from phpbb_get_web_root_path to filesystem::get_web_root_path PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 27cab48fb0..a85a254865 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -6,6 +6,9 @@ * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ + +use Symfony\Component\HttpFoundation\Request; + /** * @ignore */ @@ -20,6 +23,72 @@ if (!defined('IN_PHPBB')) */ class phpbb_filesystem { + /** @var string */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param string $phpbb_root_path + */ + public function __construct($phpbb_root_path) + { + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Get the phpBB root path + * + * @return string + */ + public function get_phpbb_root_path() + { + return $this->phpbb_root_path; + } + + /** + * Get a relative root path from the current URL + * + * @param Request $symfony_request Symfony Request object + * @return string + */ + function get_web_root_path(Request $symfony_request = null) + { + if ($symfony_request === null) + { + return ''; + } + + static $path; + if (null !== $path) + { + return $path; + } + + $path_info = $symfony_request->getPathInfo(); + if ($path_info === '/') + { + $path = $this->phpbb_root_path; + return $path; + } + + $path_info = $this->clean_path($path_info); + + // Do not count / at start of path + $corrections = substr_count(substr($path_info, 1), '/'); + + // When URL Rewriting is enabled, app.php is optional. We have to + // correct for it not being there + if (strpos($symfony_request->getRequestUri(), $symfony_request->getScriptName()) === false) + { + $corrections -= 1; + } + + $path = $this->phpbb_root_path . str_repeat('../', $corrections); + + return $path; + } + /** * Eliminates useless . and .. components from specified path. * -- cgit v1.2.1 From 6692db892f538d3a72f1dbd06af9a94f24a9da9a Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Mon, 9 Sep 2013 18:19:50 -0500 Subject: [ticket/11832] update_web_root_path helper and tests PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index a85a254865..e8fd03d103 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -46,17 +46,40 @@ class phpbb_filesystem return $this->phpbb_root_path; } + /** + * Update a path to the correct relative root path + * + * This replaces $phpbb_root_path . some_url with + * get_web_root_path() . some_url OR if $phpbb_root_path + * is not at the beginning of $path, just prepends the + * web root path + * + * @param Request $symfony_request Symfony Request object + * @return string + */ + public function update_web_root_path($path, Request $symfony_request = null) + { + $web_root_path = $this->get_web_root_path($symfony_request); + + if (strpos($path, $this->phpbb_root_path) === 0) + { + $path = substr($path, strlen($this->phpbb_root_path)); + } + + return $web_root_path . $path; + } + /** * Get a relative root path from the current URL * * @param Request $symfony_request Symfony Request object * @return string */ - function get_web_root_path(Request $symfony_request = null) + public function get_web_root_path(Request $symfony_request = null) { if ($symfony_request === null) { - return ''; + return $this->phpbb_root_path; } static $path; @@ -68,8 +91,7 @@ class phpbb_filesystem $path_info = $symfony_request->getPathInfo(); if ($path_info === '/') { - $path = $this->phpbb_root_path; - return $path; + return $path = $this->phpbb_root_path; } $path_info = $this->clean_path($path_info); @@ -84,9 +106,7 @@ class phpbb_filesystem $corrections -= 1; } - $path = $this->phpbb_root_path . str_repeat('../', $corrections); - - return $path; + return $path = $this->phpbb_root_path . str_repeat('../', $corrections); } /** -- cgit v1.2.1 From 3a4efa79592616ac099e95d07e9aed52bc5a19a3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 10 Sep 2013 11:15:24 -0500 Subject: [ticket/11832] More extensive testing PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index e8fd03d103..6c037b2656 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -26,6 +26,9 @@ class phpbb_filesystem /** @var string */ protected $phpbb_root_path; + /** @var string */ + protected $web_root_path; + /** * Constructor * @@ -82,16 +85,15 @@ class phpbb_filesystem return $this->phpbb_root_path; } - static $path; - if (null !== $path) + if (null !== $this->web_root_path) { - return $path; + return $this->web_root_path; } $path_info = $symfony_request->getPathInfo(); if ($path_info === '/') { - return $path = $this->phpbb_root_path; + return $this->web_root_path = $this->phpbb_root_path; } $path_info = $this->clean_path($path_info); @@ -106,7 +108,7 @@ class phpbb_filesystem $corrections -= 1; } - return $path = $this->phpbb_root_path . str_repeat('../', $corrections); + return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections); } /** -- cgit v1.2.1 From b06c8a80d15c52dd53b12065d5e6e9d56f203ceb Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 12 Sep 2013 10:25:49 -0500 Subject: [ticket/11832] Fix the web path corrections Add some real life examples to test PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 44 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 10 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 6c037b2656..a2dfab40e5 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -90,25 +90,49 @@ class phpbb_filesystem return $this->web_root_path; } - $path_info = $symfony_request->getPathInfo(); + // Path info (e.g. /foo/bar) + $path_info = $this->clean_path($symfony_request->getPathInfo()); + + // Full request URI (e.g. phpBB/index.php/foo/bar) + $request_uri = $symfony_request->getRequestUri(); + + // Script name URI (e.g. phpBB/index.php) + $script_name = $symfony_request->getScriptName(); + + /* + * If the path info is empty (single /), then we're not using + * a route like index.php/foo/bar + */ if ($path_info === '/') { return $this->web_root_path = $this->phpbb_root_path; } - $path_info = $this->clean_path($path_info); - - // Do not count / at start of path - $corrections = substr_count(substr($path_info, 1), '/'); + // How many corrections might we need? + $corrections = substr_count($path_info, '/'); - // When URL Rewriting is enabled, app.php is optional. We have to - // correct for it not being there - if (strpos($symfony_request->getRequestUri(), $symfony_request->getScriptName()) === false) + /* + * If the script name (e.g. phpBB/app.php) exists in the + * requestUri (e.g. phpBB/app.php/foo/template), then we + * are have a non-rewritten URL. + */ + if (strpos($request_uri, $script_name) === 0) { - $corrections -= 1; + /* + * Append ../ to the end of the phpbb_root_path as many times + * as / exists in path_info + */ + return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections); } - return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections); + /* + * If we're here it means we're at a re-written path, so we must + * correct the relative path for web URLs. We must append ../ + * to the end of the root path as many times as / exists in path_info + * less one time (because the script, e.g. /app.php, doesn't exist in + * the URL) + */ + return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections - 1); } /** -- cgit v1.2.1 From 4c00c77739cc20db26d5f87bf26a9a953bc92d3a Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 12 Sep 2013 11:08:40 -0500 Subject: [ticket/11832] Changing comments to say app.php rather than index.php PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index a2dfab40e5..5d70b88a29 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -93,15 +93,15 @@ class phpbb_filesystem // Path info (e.g. /foo/bar) $path_info = $this->clean_path($symfony_request->getPathInfo()); - // Full request URI (e.g. phpBB/index.php/foo/bar) + // Full request URI (e.g. phpBB/app.php/foo/bar) $request_uri = $symfony_request->getRequestUri(); - // Script name URI (e.g. phpBB/index.php) + // Script name URI (e.g. phpBB/app.php) $script_name = $symfony_request->getScriptName(); /* * If the path info is empty (single /), then we're not using - * a route like index.php/foo/bar + * a route like app.php/foo/bar */ if ($path_info === '/') { -- cgit v1.2.1 From aa710df2db2512f6065f91dcf8b5fc7d100edf41 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 13 Sep 2013 09:52:02 -0500 Subject: [ticket/11832] Create phpbb_symfony_request to handle initiating symfony_request Now symfony_request is also a service (removed the function phpbb_create_symfony_request). Inject symfony request into filesystem Cleanup for the tests PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 26 ++++++++++++----------- phpBB/phpbb/symfony_request.php | 46 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 phpBB/phpbb/symfony_request.php (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 5d70b88a29..e6c36375af 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -7,8 +7,6 @@ * */ -use Symfony\Component\HttpFoundation\Request; - /** * @ignore */ @@ -23,6 +21,9 @@ if (!defined('IN_PHPBB')) */ class phpbb_filesystem { + /** @var phpbb_symfony_request */ + protected $symfony_request; + /** @var string */ protected $phpbb_root_path; @@ -32,10 +33,12 @@ class phpbb_filesystem /** * Constructor * + * @param phpbb_symfony_request $symfony_request * @param string $phpbb_root_path */ - public function __construct($phpbb_root_path) + public function __construct(phpbb_symfony_request $symfony_request, $phpbb_root_path) { + $this->symfony_request = $symfony_request; $this->phpbb_root_path = $phpbb_root_path; } @@ -57,12 +60,12 @@ class phpbb_filesystem * is not at the beginning of $path, just prepends the * web root path * - * @param Request $symfony_request Symfony Request object + * @param string $path The path to be updated * @return string */ - public function update_web_root_path($path, Request $symfony_request = null) + public function update_web_root_path($path) { - $web_root_path = $this->get_web_root_path($symfony_request); + $web_root_path = $this->get_web_root_path($this->symfony_request); if (strpos($path, $this->phpbb_root_path) === 0) { @@ -75,12 +78,11 @@ class phpbb_filesystem /** * Get a relative root path from the current URL * - * @param Request $symfony_request Symfony Request object * @return string */ - public function get_web_root_path(Request $symfony_request = null) + public function get_web_root_path() { - if ($symfony_request === null) + if ($this->symfony_request === null) { return $this->phpbb_root_path; } @@ -91,13 +93,13 @@ class phpbb_filesystem } // Path info (e.g. /foo/bar) - $path_info = $this->clean_path($symfony_request->getPathInfo()); + $path_info = $this->clean_path($this->symfony_request->getPathInfo()); // Full request URI (e.g. phpBB/app.php/foo/bar) - $request_uri = $symfony_request->getRequestUri(); + $request_uri = $this->symfony_request->getRequestUri(); // Script name URI (e.g. phpBB/app.php) - $script_name = $symfony_request->getScriptName(); + $script_name = $this->symfony_request->getScriptName(); /* * If the path info is empty (single /), then we're not using diff --git a/phpBB/phpbb/symfony_request.php b/phpBB/phpbb/symfony_request.php new file mode 100644 index 0000000000..29ab8c000e --- /dev/null +++ b/phpBB/phpbb/symfony_request.php @@ -0,0 +1,46 @@ +set_var($value, $value, gettype($value), true); + }; + + $get_parameters = $phpbb_request->get_super_global(phpbb_request_interface::GET); + $post_parameters = $phpbb_request->get_super_global(phpbb_request_interface::POST); + $server_parameters = $phpbb_request->get_super_global(phpbb_request_interface::SERVER); + $files_parameters = $phpbb_request->get_super_global(phpbb_request_interface::FILES); + $cookie_parameters = $phpbb_request->get_super_global(phpbb_request_interface::COOKIE); + + array_walk_recursive($get_parameters, $sanitizer); + array_walk_recursive($post_parameters, $sanitizer); + + parent::__construct($get_parameters, $post_parameters, array(), $cookie_parameters, $files_parameters, $server_parameters); + } +} -- cgit v1.2.1 From b4a374dc73eda55db1c67b87bd65a73f79411ef5 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 13 Sep 2013 10:58:03 -0500 Subject: [ticket/11832] Fix INCLUDE(JS/CSS) PHPBB3-11832 --- phpBB/phpbb/filesystem.php | 33 +++++++++++++++++++++++-- phpBB/phpbb/template/twig/environment.php | 33 +++++++++++++++++++++++-- phpBB/phpbb/template/twig/node/includeasset.php | 2 +- phpBB/phpbb/template/twig/twig.php | 25 +++++++++++-------- 4 files changed, 78 insertions(+), 15 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index e6c36375af..433fa9a62b 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -27,6 +27,12 @@ class phpbb_filesystem /** @var string */ protected $phpbb_root_path; + /** @var string */ + protected $adm_relative_path; + + /** @var string */ + protected $php_ext; + /** @var string */ protected $web_root_path; @@ -34,12 +40,15 @@ class phpbb_filesystem * Constructor * * @param phpbb_symfony_request $symfony_request - * @param string $phpbb_root_path + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP extension (php) */ - public function __construct(phpbb_symfony_request $symfony_request, $phpbb_root_path) + public function __construct(phpbb_symfony_request $symfony_request, $phpbb_root_path, $php_ext, $adm_relative_path = null) { $this->symfony_request = $symfony_request; $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->adm_relative_path = $adm_relative_path; } /** @@ -52,6 +61,26 @@ class phpbb_filesystem return $this->phpbb_root_path; } + /** + * Get the adm root path + * + * @return string + */ + public function get_adm_relative_path() + { + return $this->adm_relative_path; + } + + /** + * Get the php extension + * + * @return string + */ + public function get_php_ext() + { + return $this->php_ext; + } + /** * Update a path to the correct relative root path * diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index 9a40dc2b15..612519db69 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -23,9 +23,15 @@ class phpbb_template_twig_environment extends Twig_Environment /** @var phpbb_config */ protected $phpbb_config; + /** @var phpbb_filesystem */ + protected $phpbb_filesystem; + /** @var string */ protected $phpbb_root_path; + /** @var string */ + protected $web_root_path; + /** @var array **/ protected $namespace_look_up_order = array('__main__'); @@ -38,11 +44,14 @@ class phpbb_template_twig_environment extends Twig_Environment * @param Twig_LoaderInterface $loader * @param array $options Array of options to pass to Twig */ - public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array()) + public function __construct($phpbb_config, $phpbb_extensions, phpbb_filesystem $phpbb_filesystem, Twig_LoaderInterface $loader = null, $options = array()) { $this->phpbb_config = $phpbb_config; $this->phpbb_extensions = $phpbb_extensions; - $this->phpbb_root_path = $phpbb_root_path; + + $this->phpbb_filesystem = $phpbb_filesystem; + $this->phpbb_root_path = $this->phpbb_filesystem->get_phpbb_root_path(); + $this->web_root_path = $this->phpbb_filesystem->get_web_root_path(); return parent::__construct($loader, $options); } @@ -79,6 +88,26 @@ class phpbb_template_twig_environment extends Twig_Environment return $this->phpbb_root_path; } + /** + * Get the web root path + * + * @return string + */ + public function get_web_root_path() + { + return $this->web_root_path; + } + + /** + * Get the phpbb_filesystem object + * + * @return phpbb_filesystem + */ + public function get_filesystem() + { + return $this->phpbb_filesystem; + } + /** * Get the namespace look up order * diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 0808e2b10e..2dcd2003a3 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -37,7 +37,7 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") - ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n") + ->write("\$local_file = \$this->getEnvironment()->get_web_root_path() . \$asset_path;\n") ->write("if (!file_exists(\$local_file)) {\n") ->indent() ->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n") diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 5746cc64a3..3aa063ffc6 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -30,6 +30,12 @@ class phpbb_template_twig extends phpbb_template_base */ private $cachepath = ''; + /** + * phpBB filesystem + * @var phpbb_filesystem + */ + protected $phpbb_filesystem; + /** * phpBB root path * @var string @@ -71,24 +77,23 @@ class phpbb_template_twig extends phpbb_template_base /** * Constructor. * - * @param string $phpbb_root_path phpBB root path - * @param string $php_ext php extension (typically 'php') + * @param phpbb_filesystem $phpbb_filesystem * @param phpbb_config $config * @param phpbb_user $user * @param phpbb_template_context $context template context * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked - * @param string $adm_relative_path relative path to adm directory */ - public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null) + public function __construct(phpbb_filesystem $phpbb_filesystem, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null) { - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; + $this->phpbb_filesystem = $phpbb_filesystem; + $this->phpbb_root_path = $phpbb_filesystem->get_phpbb_root_path(); + $this->php_ext = $phpbb_filesystem->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; $this->extension_manager = $extension_manager; - $this->cachepath = $phpbb_root_path . 'cache/twig/'; + $this->cachepath = $this->phpbb_root_path . 'cache/twig/'; // Initiate the loader, __main__ namespace paths will be setup later in set_style_names() $loader = new phpbb_template_twig_loader(''); @@ -96,7 +101,7 @@ class phpbb_template_twig extends phpbb_template_base $this->twig = new phpbb_template_twig_environment( $this->config, ($this->extension_manager) ? $this->extension_manager->all_enabled() : array(), - $this->phpbb_root_path, + $this->phpbb_filesystem, $loader, array( 'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath, @@ -118,9 +123,9 @@ class phpbb_template_twig extends phpbb_template_base $this->twig->setLexer($lexer); // Add admin namespace - if ($adm_relative_path !== null && is_dir($this->phpbb_root_path . $adm_relative_path . 'style/')) + if ($this->phpbb_filesystem->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/')) { - $this->twig->getLoader()->setPaths($this->phpbb_root_path . $adm_relative_path . 'style/', 'admin'); + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/', 'admin'); } } -- cgit v1.2.1 From 9e8babbf6eae65aa894cb0d8c4b452133ac344a8 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 15 Sep 2013 16:42:02 -0500 Subject: [ticket/11832] get_url() from phpbb_template_asset should return web path PHPBB3-11832 --- phpBB/phpbb/template/asset.php | 9 +++++++-- phpBB/phpbb/template/twig/node/includeasset.php | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb') diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 7c322cd971..2b10dd8848 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -19,13 +19,18 @@ class phpbb_template_asset { protected $components = array(); + /** @var phpbb_filesystem **/ + protected $phpbb_filesystem; + /** * Constructor * * @param string $url URL */ - public function __construct($url) + public function __construct($url, phpbb_filesystem $phpbb_filesystem) { + $this->phpbb_filesystem = $phpbb_filesystem; + $this->set_url($url); } @@ -112,7 +117,7 @@ class phpbb_template_asset */ public function get_url() { - return $this->join_url($this->components); + return $this->phpbb_filesystem->update_web_root_path($this->join_url($this->components)); } /** diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index 2dcd2003a3..8629395898 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -33,11 +33,11 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$asset = new phpbb_template_asset(\$asset_file);\n") + ->write("\$asset = new phpbb_template_asset(\$asset_file, \$this->getEnvironment()->get_filesystem());\n") ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") - ->write("\$local_file = \$this->getEnvironment()->get_web_root_path() . \$asset_path;\n") + ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n") ->write("if (!file_exists(\$local_file)) {\n") ->indent() ->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n") -- cgit v1.2.1