diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2008-05-29 12:25:56 +0000 |
| commit | 2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04 (patch) | |
| tree | 3b7ea329bf35eab5ddab9b0b5eb790e45e283a5c /phpBB/includes/template.php | |
| parent | 91b4fe1868ca2c4d81111943f781e3cfd0262ef2 (diff) | |
| download | forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.gz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.bz2 forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.tar.xz forums-2f4a618900e2c3b6ea14c68cbeb5897cd2ac1a04.zip | |
ok... i hope i haven't messed too much with the code and everything is still working.
Changes:
- Ascraeus now uses constants for the phpbb root path and the php extension. This ensures more security for external applications and modifications (no more overwriting of root path and extension possible through insecure mods and register globals enabled) as well as no more globalizing needed.
- A second change implemented here is an additional short-hand-notation for append_sid(). It is allowed to omit the root path and extension now (for example calling append_sid('memberlist')) - in this case the root path and extension get added automatically. The hook is called after these are added.
git-svn-id: file:///svn/phpbb/trunk@8572 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/template.php')
| -rw-r--r-- | phpBB/includes/template.php | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/phpBB/includes/template.php b/phpBB/includes/template.php index e5f57cfdc2..bcaa0eb5f4 100644 --- a/phpBB/includes/template.php +++ b/phpBB/includes/template.php @@ -46,12 +46,12 @@ class template */ public function set_template() { - global $phpbb_root_path, $user; + global $user; - if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template')) + if (file_exists(PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template')) { - $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'; - $this->cachepath = $phpbb_root_path . 'cache/tpl_' . $user->theme['template_path'] . '_'; + $this->root = PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template'; + $this->cachepath = PHPBB_ROOT_PATH . 'cache/tpl_' . $user->theme['template_path'] . '_'; } else { @@ -69,10 +69,8 @@ class template */ public function set_custom_template($template_path, $template_name) { - global $phpbb_root_path; - $this->root = $template_path; - $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . $template_name . '_'; + $this->cachepath = PHPBB_ROOT_PATH . 'cache/ctpl_' . $template_name . '_'; return true; } @@ -199,9 +197,9 @@ class template */ private function _tpl_load(&$handle) { - global $user, $phpEx, $config; + global $user, $config; - $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . $phpEx; + $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . '.' . PHP_EXT; $recompile = (($config['load_tplcompile'] && @filemtime($filename) < filemtime($this->files[$handle])) || !file_exists($filename) || @filesize($filename) === 0) ? true : false; @@ -211,11 +209,11 @@ class template return $filename; } - global $db, $phpbb_root_path; + global $db; if (!class_exists('template_compile')) { - include($phpbb_root_path . 'includes/functions_template.' . $phpEx); + include(PHPBB_ROOT_PATH . 'includes/functions_template.' . PHP_EXT); } $compile = new template_compile($this); @@ -247,7 +245,7 @@ class template { do { - if ($row['template_mtime'] < filemtime($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename'])) + if ($row['template_mtime'] < filemtime(PHPBB_ROOT_PATH . 'styles/' . $user->theme['template_path'] . '/template/' . $row['template_filename'])) { if ($row['template_filename'] == $this->filename[$handle]) { @@ -271,7 +269,7 @@ class template else { // Only bother compiling if it doesn't already exist - if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . $phpEx)) + if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . '.' . PHP_EXT)) { $this->filename[$row['template_filename']] = $row['template_filename']; $compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data']))); |
