1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-30 02:59:29 +02:00

Merge PR #787 branch 'cyberalien/ticket/10799' into develop

* cyberalien/ticket/10799:
  [ticket/10799] Removing global variable from includejs
This commit is contained in:
Oleg Pudeyev 2012-06-11 20:12:59 -04:00
commit 1564da616b
2 changed files with 8 additions and 3 deletions

View File

@ -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); ';
}
/**

View File

@ -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'];