diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/app.php | 1 | ||||
-rw-r--r-- | phpBB/common.php | 19 | ||||
-rw-r--r-- | phpBB/config/services.yml | 16 | ||||
-rw-r--r-- | phpBB/includes/bbcode.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 27 | ||||
-rw-r--r-- | phpBB/includes/functions_content.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_messenger.php | 4 | ||||
-rw-r--r-- | phpBB/install/index.php | 4 | ||||
-rw-r--r-- | phpBB/phpbb/filesystem.php | 145 | ||||
-rw-r--r-- | phpBB/phpbb/path_helper.php | 175 | ||||
-rw-r--r-- | phpBB/phpbb/template/asset.php | 10 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/environment.php | 22 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/node/includeasset.php | 2 | ||||
-rw-r--r-- | phpBB/phpbb/template/twig/twig.php | 22 |
14 files changed, 238 insertions, 217 deletions
diff --git a/phpBB/app.php b/phpBB/app.php index f1023ff1b5..7dc778e3a8 100644 --- a/phpBB/app.php +++ b/phpBB/app.php @@ -25,6 +25,7 @@ $auth->acl($user->data); $user->setup('app'); $http_kernel = $phpbb_container->get('http_kernel'); +$symfony_request = $phpbb_container->get('symfony_request'); $response = $http_kernel->handle($symfony_request); $response->send(); $http_kernel->terminate($symfony_request, $response); diff --git a/phpBB/common.php b/phpBB/common.php index 80375f7a9c..6bb3509ea1 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -47,19 +47,7 @@ if (!defined('PHPBB_INSTALLED')) // Eliminate . and .. from the path require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); - require($phpbb_root_path . 'phpbb/symfony_request.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/deactivated_super_global.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/type_cast_helper_interface.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/type_cast_helper.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/request_interface.' . $phpEx); - require($phpbb_root_path . 'phpbb/request/request.' . $phpEx); - $phpbb_filesystem = new phpbb\filesystem( - new phpbb\symfony_request( - new phpbb\request\request() - ), - $phpbb_root_path, - $phpEx - ); + $phpbb_filesystem = new phpbb\filesystem(); $script_path = $phpbb_filesystem->clean_path($script_path); $url = (($secure) ? 'https://' : 'http://') . $server_name; @@ -121,16 +109,13 @@ $db = $phpbb_container->get('dbal.conn'); // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function -// Create a Symfony Request object from our phpbb_request object -$symfony_request = $phpbb_container->get('symfony_request'); -$phpbb_filesystem = $phpbb_container->get('filesystem'); - // Grab global variables, re-cache if necessary $config = $phpbb_container->get('config'); set_config(null, null, null, $config); set_config_count(null, null, null, $config); $phpbb_log = $phpbb_container->get('log'); +$phpbb_path_helper = $phpbb_container->get('path_helper'); // load extensions $phpbb_extension_manager = $phpbb_container->get('ext.manager'); diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index e33db0c2bc..51ae5c454d 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -169,11 +169,6 @@ services: filesystem: class: phpbb\filesystem - arguments: - - @symfony_request - - %core.root_path% - - %core.php_ext% - - %core.adm_relative_path% groupposition.legend: class: phpbb\groupposition\legend @@ -251,6 +246,15 @@ services: - %tables.notifications% - %tables.user_notifications% + path_helper: + class: phpbb\path_helper + arguments: + - @symfony_request + - @filesystem + - %core.root_path% + - %core.php_ext% + - %core.adm_relative_path% + php_ini: class: phpbb\php\ini @@ -265,7 +269,7 @@ services: template: class: phpbb\template\twig\twig arguments: - - @filesystem + - @path_helper - @config - @user - @template_context diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index cd2ca7ffce..c4076a0120 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -126,13 +126,13 @@ class bbcode */ function bbcode_cache_init() { - global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_filesystem; + global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_path_helper; if (empty($this->template_filename)) { $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); - $template = new phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); + $template = new phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new phpbb\template\context(), $phpbb_extension_manager); $template->set_style(); $template->set_filenames(array('bbcode.html' => 'bbcode.html')); $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 869396f6b7..e1f96c0b1e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1063,31 +1063,32 @@ else */ function phpbb_clean_path($path) { - global $phpbb_container; + global $phpbb_path_helper, $phpbb_container; - if ($phpbb_container) + if (!$phpbb_path_helper && $phpbb_container) { - $phpbb_filesystem = $phpbb_container->get('filesystem'); + $phpbb_path_helper = $phpbb_container->get('path_helper'); } - else + else if (!$phpbb_path_helper) { // The container is not yet loaded, use a new instance - if (!class_exists('\phpbb\filesystem')) + if (!class_exists('\phpbb\path_helper')) { global $phpbb_root_path, $phpEx; - require($phpbb_root_path . 'includes/filesystem.' . $phpEx); + require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); } - $phpbb_filesystem = new phpbb\filesystem( + $phpbb_path_helper = new phpbb\path_helper( new phpbb\symfony_request( new phpbb\request\request() ), + new phpbb\filesystem(), $phpbb_root_path, $phpEx ); } - return $phpbb_filesystem->clean_path($path); + return $phpbb_path_helper->clean_path($path); } // functions used for building option fields @@ -2452,7 +2453,7 @@ function phpbb_on_page($template, $user, $base_url, $num_items, $per_page, $star */ function append_sid($url, $params = false, $is_amp = true, $session_id = false) { - global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem; + global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; global $phpbb_dispatcher; if ($params === '' || (is_array($params) && empty($params))) @@ -2462,9 +2463,9 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) } // Update the root path with the correct relative web path - if ($phpbb_filesystem instanceof \phpbb\filesystem) + if ($phpbb_path_helper instanceof \phpbb\path_helper) { - $url = $phpbb_filesystem->update_web_root_path($url); + $url = $phpbb_path_helper->update_web_root_path($url); } $append_sid_overwrite = false; @@ -5283,8 +5284,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 // This path is sent with the base template paths in the assign_vars() // call below. We need to correct it in case we are accessing from a // controller because the web paths will be incorrect otherwise. - $phpbb_filesystem = $phpbb_container->get('filesystem'); - $corrected_path = $phpbb_filesystem->get_web_root_path(); + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; // Send a proper content-language to the output diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 7ecc99b39c..863450a4b2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -834,7 +834,7 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user, $phpbb_filesystem; + global $config, $user, $phpbb_path_helper; if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) { @@ -842,7 +842,7 @@ function smiley_text($text, $force_option = false) } else { - $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_filesystem->get_web_root_path(); + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text); } } diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f8b01bc770..5b343e616e 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -626,14 +626,14 @@ class messenger */ protected function setup_template() { - global $config, $phpbb_filesystem, $user, $phpbb_extension_manager; + global $config, $phpbb_path_helper, $user, $phpbb_extension_manager; if ($this->template instanceof \phpbb\template\template) { return; } - $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new \phpbb\template\context(), $phpbb_extension_manager); + $this->template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context(), $phpbb_extension_manager); } /** diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 2a3bb36bf6..161dc78173 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -244,8 +244,8 @@ $config = new \phpbb\config\config(array( 'load_tplcompile' => '1' )); -$phpbb_filesystem = $phpbb_container->get('filesystem'); -$template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new \phpbb\template\context()); +$phpbb_path_helper = $phpbb_container->get('path_helper'); +$template = new \phpbb\template\twig\twig($phpbb_path_helper, $config, $user, new \phpbb\template\context()); $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); $paths = array_filter($paths, 'is_dir'); $template->set_custom_style('adm', $paths); diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php index 662b6b866e..dbfaebe0fa 100644 --- a/phpBB/phpbb/filesystem.php +++ b/phpBB/phpbb/filesystem.php @@ -23,151 +23,6 @@ if (!defined('IN_PHPBB')) */ class filesystem { - /** @var \phpbb\symfony_request */ - protected $symfony_request; - - /** @var string */ - protected $phpbb_root_path; - - /** @var string */ - protected $adm_relative_path; - - /** @var string */ - protected $php_ext; - - /** @var string */ - protected $web_root_path; - - /** - * Constructor - * - * @param \phpbb\symfony_request $symfony_request - * @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, $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; - } - - /** - * Get the phpBB root path - * - * @return string - */ - public function get_phpbb_root_path() - { - 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 - * - * 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 string $path The path to be updated - * @return string - */ - public function update_web_root_path($path) - { - $web_root_path = $this->get_web_root_path($this->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 - * - * @return string - */ - public function get_web_root_path() - { - if ($this->symfony_request === null) - { - return $this->phpbb_root_path; - } - - if (null !== $this->web_root_path) - { - return $this->web_root_path; - } - - // Path info (e.g. /foo/bar) - $path_info = $this->clean_path($this->symfony_request->getPathInfo()); - - // Full request URI (e.g. phpBB/app.php/foo/bar) - $request_uri = $this->symfony_request->getRequestUri(); - - // Script name URI (e.g. phpBB/app.php) - $script_name = $this->symfony_request->getScriptName(); - - /* - * If the path info is empty (single /), then we're not using - * a route like app.php/foo/bar - */ - if ($path_info === '/') - { - return $this->web_root_path = $this->phpbb_root_path; - } - - // How many corrections might we need? - $corrections = substr_count($path_info, '/'); - - /* - * 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) - { - /* - * 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); - } - - /* - * 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); - } - /** * Eliminates useless . and .. components from specified path. * diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php new file mode 100644 index 0000000000..b2ed11a927 --- /dev/null +++ b/phpBB/phpbb/path_helper.php @@ -0,0 +1,175 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +namespace phpbb; + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* A class with various functions that are related to paths, files and the filesystem +* @package phpBB3 +*/ +class path_helper +{ + /** @var \phpbb\symfony_request */ + protected $symfony_request; + + /** @var \phpbb\filesystem */ + protected $filesystem; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $adm_relative_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $web_root_path; + + /** + * Constructor + * + * @param \phpbb\symfony_request $symfony_request + * @param \phpbb\filesystem $filesystem + * @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\filesystem $filesystem, $phpbb_root_path, $php_ext, $adm_relative_path = null) + { + $this->symfony_request = $symfony_request; + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->adm_relative_path = $adm_relative_path; + } + + /** + * Get the phpBB root path + * + * @return string + */ + public function get_phpbb_root_path() + { + 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 + * + * 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 string $path The path to be updated + * @return string + */ + public function update_web_root_path($path) + { + $web_root_path = $this->get_web_root_path($this->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 + * + * @return string + */ + public function get_web_root_path() + { + if ($this->symfony_request === null) + { + return $this->phpbb_root_path; + } + + if (null !== $this->web_root_path) + { + return $this->web_root_path; + } + + // Path info (e.g. /foo/bar) + $path_info = $this->filesystem->clean_path($this->symfony_request->getPathInfo()); + + // Full request URI (e.g. phpBB/app.php/foo/bar) + $request_uri = $this->symfony_request->getRequestUri(); + + // Script name URI (e.g. phpBB/app.php) + $script_name = $this->symfony_request->getScriptName(); + + /* + * If the path info is empty (single /), then we're not using + * a route like app.php/foo/bar + */ + if ($path_info === '/') + { + return $this->web_root_path = $this->phpbb_root_path; + } + + // How many corrections might we need? + $corrections = substr_count($path_info, '/'); + + /* + * 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) + { + /* + * 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); + } + + /* + * 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); + } +} diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php index 0e0b6b4782..27564bf347 100644 --- a/phpBB/phpbb/template/asset.php +++ b/phpBB/phpbb/template/asset.php @@ -21,17 +21,17 @@ class asset { protected $components = array(); - /** @var \phpbb\filesystem **/ - protected $phpbb_filesystem; + /** @var \phpbb\path_helper **/ + protected $path_helper; /** * Constructor * * @param string $url URL */ - public function __construct($url, \phpbb\filesystem $phpbb_filesystem) + public function __construct($url, \phpbb\path_helper $path_helper) { - $this->phpbb_filesystem = $phpbb_filesystem; + $this->path_helper = $path_helper; $this->set_url($url); } @@ -119,7 +119,7 @@ class asset */ public function get_url() { - return $this->phpbb_filesystem->update_web_root_path($this->join_url($this->components)); + return $this->path_helper->update_web_root_path($this->join_url($this->components)); } /** diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index e0ee23dcd9..a6c0e476f0 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -25,8 +25,8 @@ class environment extends \Twig_Environment /** @var \phpbb\config\config */ protected $phpbb_config; - /** @var \phpbb\filesystem */ - protected $phpbb_filesystem; + /** @var \phpbb\path_helper */ + protected $phpbb_path_helper; /** @var string */ protected $phpbb_root_path; @@ -42,19 +42,19 @@ class environment extends \Twig_Environment * * @param \phpbb\config\config $phpbb_config * @param array $phpbb_extensions Array of enabled extensions (name => path) - * @param \phpbb\filesystem + * @param \phpbb\path_helper * @param string $phpbb_root_path * @param Twig_LoaderInterface $loader * @param array $options Array of options to pass to Twig */ - public function __construct($phpbb_config, $phpbb_extensions, \phpbb\filesystem $phpbb_filesystem, \Twig_LoaderInterface $loader = null, $options = array()) + public function __construct($phpbb_config, $phpbb_extensions, \phpbb\path_helper $path_helper, \Twig_LoaderInterface $loader = null, $options = array()) { $this->phpbb_config = $phpbb_config; $this->phpbb_extensions = $phpbb_extensions; - $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(); + $this->phpbb_path_helper = $path_helper; + $this->phpbb_root_path = $this->phpbb_path_helper->get_phpbb_root_path(); + $this->web_root_path = $this->phpbb_path_helper->get_web_root_path(); return parent::__construct($loader, $options); } @@ -102,13 +102,13 @@ class environment extends \Twig_Environment } /** - * Get the phpbb_filesystem object + * Get the phpbb path helper object * - * @return \phpbb\filesystem + * @return \phpbb\path_helper */ - public function get_filesystem() + public function get_path_helper() { - return $this->phpbb_filesystem; + return $this->phpbb_path_helper; } /** diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php index f15fd6296b..f6c9dc9c58 100644 --- a/phpBB/phpbb/template/twig/node/includeasset.php +++ b/phpBB/phpbb/template/twig/node/includeasset.php @@ -35,7 +35,7 @@ abstract class includeasset extends \Twig_Node ->write("\$asset_file = ") ->subcompile($this->getNode('expr')) ->raw(";\n") - ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_filesystem());\n") + ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper());\n") ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") ->indent() ->write("\$asset_path = \$asset->get_path();") diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 2da7405743..9df9310427 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -33,10 +33,10 @@ class twig extends \phpbb\template\base private $cachepath = ''; /** - * phpBB filesystem - * @var \phpbb\filesystem + * phpBB path helper + * @var \phpbb\path_helper */ - protected $phpbb_filesystem; + protected $path_helper; /** * phpBB root path @@ -79,17 +79,17 @@ class twig extends \phpbb\template\base /** * Constructor. * - * @param \phpbb\filesystem $phpbb_filesystem + * @param \phpbb\path_helper $path_helper * @param \phpbb\config\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 */ - public function __construct(\phpbb\filesystem $phpbb_filesystem, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) + public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null) { - $this->phpbb_filesystem = $phpbb_filesystem; - $this->phpbb_root_path = $phpbb_filesystem->get_phpbb_root_path(); - $this->php_ext = $phpbb_filesystem->get_php_ext(); + $this->path_helper = $path_helper; + $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); + $this->php_ext = $path_helper->get_php_ext(); $this->config = $config; $this->user = $user; $this->context = $context; @@ -103,7 +103,7 @@ class 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_filesystem, + $this->path_helper, $loader, array( 'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath, @@ -125,9 +125,9 @@ class twig extends \phpbb\template\base $this->twig->setLexer($lexer); // Add admin namespace - if ($this->phpbb_filesystem->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/')) + if ($this->path_helper->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/')) { - $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/', 'admin'); + $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->path_helper->get_adm_relative_path() . 'style/', 'admin'); } } |