From 5cce84ff1c62812e25f6252877ae46b1d3381b62 Mon Sep 17 00:00:00 2001 From: rvelices Date: Fri, 27 Oct 2006 00:21:15 +0000 Subject: 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 --- include/template.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'include/template.php') 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"); -- cgit v1.2.3