aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/template.php
diff options
context:
space:
mode:
authorNils Adermann <naderman@naderman.de>2010-03-03 23:32:09 +0100
committerNils Adermann <naderman@naderman.de>2010-03-03 23:32:09 +0100
commit693a2dc99bf07aeac1865d4a48ddf2589317ac7a (patch)
tree8bd926d3671dc9de0a72d4025aaa625a18ba51e1 /phpBB/includes/template.php
parentb68de2323d6444b4b3685a98bbcb9500a38e45cb (diff)
parentac329275662f737f03f485107cb69412739c1afa (diff)
downloadforums-693a2dc99bf07aeac1865d4a48ddf2589317ac7a.tar
forums-693a2dc99bf07aeac1865d4a48ddf2589317ac7a.tar.gz
forums-693a2dc99bf07aeac1865d4a48ddf2589317ac7a.tar.bz2
forums-693a2dc99bf07aeac1865d4a48ddf2589317ac7a.tar.xz
forums-693a2dc99bf07aeac1865d4a48ddf2589317ac7a.zip
Merge branch 'develop-olympus' into develop
I simply used the develop-olympus version of all files that conflicted. Afterall there should not have been anything new in develop yet.
Diffstat (limited to 'phpBB/includes/template.php')
-rw-r--r--phpBB/includes/template.php28
1 files changed, 23 insertions, 5 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php
index af5c9d3a47..f1c8094a9b 100644
--- a/phpBB/includes/template.php
+++ b/phpBB/includes/template.php
@@ -90,7 +90,7 @@ class template
* Set custom template location (able to use directory outside of phpBB)
* @access public
*/
- function set_custom_template($template_path, $template_name, $template_mode = 'template')
+ function set_custom_template($template_path, $template_name, $fallback_template_path = false)
{
global $phpbb_root_path, $user;
@@ -103,13 +103,25 @@ class template
$this->root = $template_path;
$this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
- // As the template-engine is used for more than the template (emails, etc.), we should not set $user->theme in all cases, but only on the real template.
- if ($template_mode == 'template')
+ if ($fallback_template_path !== false)
{
- $user->theme['template_storedb'] = false;
- $user->theme['template_inherits_id'] = false;
+ if (substr($fallback_template_path, -1) == '/')
+ {
+ $fallback_template_path = substr($fallback_template_path, 0, -1);
+ }
+
+ $this->inherit_root = $fallback_template_path;
+ $this->orig_tpl_inherits_id = true;
+ }
+ else
+ {
+ $this->orig_tpl_inherits_id = false;
}
+ // the database does not store the path or name of a custom template
+ // so there is no way we can properly store custom templates there
+ $this->orig_tpl_storedb = false;
+
$this->_rootref = &$this->_tpldata['.'][0];
return true;
@@ -254,6 +266,12 @@ class template
trigger_error("template->_tpl_load(): No file specified for handle $handle", E_USER_ERROR);
}
+ // reload these settings to have the values they had when this object was initialised
+ // using set_template or set_custom_template, they might otherwise have been overwritten
+ // by other template class instances in between.
+ $user->theme['template_storedb'] = $this->orig_tpl_storedb;
+ $user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id;
+
$filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx;
$this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;