diff options
author | Vjacheslav Trushkin <cyberalien@gmail.com> | 2012-05-01 18:25:11 +0300 |
---|---|---|
committer | Vjacheslav Trushkin <cyberalien@gmail.com> | 2012-05-01 18:25:11 +0300 |
commit | 63b41913a472a688b5b85bdbbd01e45366449781 (patch) | |
tree | 6bae19d35335c90d52cb3dc98e977d852b511a87 /phpBB/includes/template | |
parent | 2a92fee06d22eb54ee9373adca1c3b50b1d3e3d7 (diff) | |
download | forums-63b41913a472a688b5b85bdbbd01e45366449781.tar forums-63b41913a472a688b5b85bdbbd01e45366449781.tar.gz forums-63b41913a472a688b5b85bdbbd01e45366449781.tar.bz2 forums-63b41913a472a688b5b85bdbbd01e45366449781.tar.xz forums-63b41913a472a688b5b85bdbbd01e45366449781.zip |
[ticket/10799] Removing global variable from includejs
Removing global $phpbb_root_path from includejs implementation
PHPBB3-10799
Diffstat (limited to 'phpBB/includes/template')
-rw-r--r-- | phpBB/includes/template/filter.php | 4 | ||||
-rw-r--r-- | phpBB/includes/template/template.php | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/phpBB/includes/template/filter.php b/phpBB/includes/template/filter.php index 4a2593b757..ad2e35de6a 100644 --- a/phpBB/includes/template/filter.php +++ b/phpBB/includes/template/filter.php @@ -905,12 +905,12 @@ class phpbb_template_filter extends php_user_filter if (substr($filename, 0, strlen($this->phpbb_root_path)) != $this->phpbb_root_path) { // Absolute path, include as is - return ' $_template->_js_include(\'' . addslashes($filename) . '\', false); '; + return ' $_template->_js_include(\'' . addslashes($filename) . '\', false, false); '; } // Relative path, remove root path from it $filename = substr($filename, strlen($this->phpbb_root_path)); - return ' global $phpbb_root_path; $_template->_js_include($phpbb_root_path . \'' . addslashes($filename) . '\', false); '; + return ' $_template->_js_include(\'' . addslashes($filename) . '\', false, true); '; } /** diff --git a/phpBB/includes/template/template.php b/phpBB/includes/template/template.php index e6512c8417..8ab3c44be3 100644 --- a/phpBB/includes/template/template.php +++ b/phpBB/includes/template/template.php @@ -496,14 +496,19 @@ class phpbb_template * * @param string $file file name * @param bool $locate True if file needs to be located + * @param bool $relative True if path is relative to phpBB root directory. Ignored if $locate == true */ - public function _js_include($file, $locate = false) + public function _js_include($file, $locate = false, $relative = false) { // Locate file if ($locate) { $file = $this->locator->get_first_file_location(array($file), true, true); } + else if ($relative) + { + $file = $this->phpbb_root_path . $file; + } $file .= (strpos($file, '?') === false) ? '?' : '&'; $file .= 'assets_version=' . $this->config['assets_version']; |