aboutsummaryrefslogtreecommitdiffstats
path: root/include/template.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-10-27 00:21:15 +0000
committerrvelices <rv-github@modusoptimus.com>2006-10-27 00:21:15 +0000
commit5cce84ff1c62812e25f6252877ae46b1d3381b62 (patch)
tree8cebe64bdc1b8aa09d4f7a502679500ef20aa657 /include/template.php
parent12182ddcfeced9934f45f20a3859049066ce0726 (diff)
fix: make_filename for absolute path under windows (c:\)
improvement: you don't have to call assign_block_vars('a' before calling assign_block_vars('a.b' git-svn-id: http://piwigo.org/svn/trunk@1579 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/template.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/include/template.php b/include/template.php
index df9c9a013..b262bf46c 100644
--- a/include/template.php
+++ b/include/template.php
@@ -222,7 +222,7 @@ class Template {
for ($i = 0; $i < $blockcount; $i++)
{
$str .= '[\'' . $blocks[$i] . '.\']';
- eval('$lastiteration = sizeof(' . $str . ') - 1;');
+ eval('$lastiteration = isset('.$str.') ? sizeof('.$str.')-1:0;');
$str .= '[' . $lastiteration . ']';
}
// Now we add the block that we're actually assigning to.
@@ -278,8 +278,9 @@ class Template {
function make_filename($filename)
{
// Check if it's an absolute or relative path.
- // if (substr($filename, 0, 1) != '/')
- if (preg_match('/^[a-z_]/i', $filename))
+ if (substr($filename, 0, 1) != '/'
+ and substr($filename, 0, 1) != '\\' //Windows UNC path
+ and !preg_match('/^[a-z]:\\\/i', $filename) )
{
$filename = $this->root.'/'.$filename;
}
@@ -316,6 +317,7 @@ class Template {
$filename = $this->files[$handle];
$str = implode("", @file($filename));
+
if (empty($str))
{
die("Template->loadfile(): File $filename for handle $handle is empty");