diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 09062c43b08..60be6344276 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -132,6 +132,7 @@
Changelog
[Change] Ability to define column split in FAQ/BBCode help (Bug #31405)
[Change] Changed behaviour of group_create() function to support specifying additional group columns
[Change] Hide avatar when avatar-type is not allowed (Bug #46785 - Patch by cYbercOsmOnauT and nickvergessen)
+ [Change] INCLUDEPHP not depending on phpbb_root_path (Bug #45805 - Patch by nickvergessen)
[Feature] Add confirmation for deactivating styles (Bug #14304 - Patch by leviatan21)
[Feature] Backported 3.2 captcha plugins.
[Feature] Introduced new ACM plugins:
diff --git a/phpBB/includes/functions_template.php b/phpBB/includes/functions_template.php
index d9d9abfe46e..a951579db5c 100644
--- a/phpBB/includes/functions_template.php
+++ b/phpBB/includes/functions_template.php
@@ -640,7 +640,7 @@ function compile_tag_include($tag_args)
*/
function compile_tag_include_php($tag_args)
{
- return "include('" . $tag_args . "');";
+ return "\$this->_php_include('$tag_args');";
}
/**
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index 0098c484bdc..02637838497 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -55,7 +55,7 @@ function set_template()
{
$this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
$this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_';
-
+
if ($user->theme['template_inherits_id'])
{
$this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template';
@@ -105,13 +105,13 @@ function set_filenames($filename_array)
$this->filename[$handle] = $filename;
$this->files[$handle] = $this->root . '/' . $filename;
-
+
if ($this->inherit_root)
{
$this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
}
}
-
+
return true;
}
@@ -209,7 +209,7 @@ function assign_display($handle, $template_var = '', $return_content = true, $in
return true;
}
-
+
/**
* Load a compiled template if possible, if not, recompile it
* @access private
@@ -220,7 +220,7 @@ function _tpl_load(&$handle)
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx;
$this->files_template[$handle] = $user->theme['template_id'];
-
+
$recompile = false;
if (!file_exists($filename) || @filesize($filename) === 0)
{
@@ -236,7 +236,7 @@ function _tpl_load(&$handle)
}
$recompile = (@filemtime($filename) < filemtime($this->files[$handle])) ? true : false;
}
-
+
// Recompile page if the original template is newer, otherwise load the compiled version
if (!$recompile)
{
@@ -249,14 +249,14 @@ function _tpl_load(&$handle)
{
include($phpbb_root_path . 'includes/functions_template.' . $phpEx);
}
-
+
// Inheritance - we point to another template file for this one. Equality is also used for store_db
if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
{
$this->files[$handle] = $this->files_inherit[$handle];
$this->files_template[$handle] = $user->theme['template_inherits_id'];
}
-
+
$compile = new template_compile($this);
// If we don't have a file assigned to this handle, die.
@@ -282,7 +282,7 @@ function _tpl_load(&$handle)
$ids[] = $user->theme['template_inherits_id'];
}
$ids[] = $user->theme['template_id'];
-
+
foreach ($ids as $id)
{
$sql = 'SELECT *
@@ -290,7 +290,7 @@ function _tpl_load(&$handle)
WHERE template_id = ' . $id . "
AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "'
OR template_included " . $db->sql_like_expression($db->any_char . $this->filename[$handle] . ':' . $db->any_char) . ')';
-
+
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
@@ -298,7 +298,7 @@ function _tpl_load(&$handle)
}
$db->sql_freeresult($result);
}
-
+
if (sizeof($rows))
{
foreach ($rows as $row)
@@ -326,7 +326,7 @@ function _tpl_load(&$handle)
{
$this->files_template[$row['template_filename']] = $user->theme['template_id'];
}
-
+
if ($force_reload || $row['template_mtime'] < filemtime($file))
{
if ($row['template_filename'] == $this->filename[$handle])
@@ -468,7 +468,7 @@ function assign_block_vars($blockname, $vararray)
{
unset($this->_tpldata[$blockname][($s_row_count - 1)]['S_LAST_ROW']);
}
-
+
// Add a new iteration to this block with the variable assignments we were given.
$this->_tpldata[$blockname][] = $vararray;
}
@@ -511,7 +511,7 @@ function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert'
// Nested blocks are not supported
return false;
}
-
+
// Change key to zero (change first position) if false and to last position if true
if ($key === false || $key === true)
{
@@ -614,6 +614,25 @@ function _tpl_include($filename, $include = true)
eval(' ?>' . $this->compiled_code[$handle] . '_php_include(): File ' . htmlspecialchars($file) . ' does not exist or is empty';
+ return;
+ }
+ include($file);
+ }
}
?>
\ No newline at end of file