remove assign "now" in index.tpl

This commit is contained in:
mohrt
2001-11-29 15:25:24 +00:00
parent a898e86975
commit 3992dfacbd
4 changed files with 36 additions and 24 deletions

View File

@@ -419,7 +419,8 @@ class Smarty
function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null) function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null)
{ {
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
return $$this->cache_handler_func('clear', $tpl_file, $cache_id, $compile_id); $funcname = $this->cache_handler_func;
return $funcname('clear', $this, $dummy, $tpl_file, $cache_id, $compile_id);
} else { } else {
return $this->_rm_auto($this->cache_dir, $tpl_file, $compile_id . $cache_id); return $this->_rm_auto($this->cache_dir, $tpl_file, $compile_id . $cache_id);
} }
@@ -433,7 +434,8 @@ class Smarty
function clear_all_cache() function clear_all_cache()
{ {
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
return $$this->cache_handler_func('clear'); $funcname = $this->cache_handler_func;
return $funcname('clear', $this, $dummy);
} else { } else {
return $this->_rm_auto($this->cache_dir); return $this->_rm_auto($this->cache_dir);
} }
@@ -1247,9 +1249,10 @@ function _run_insert_handler($args)
$results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results; $results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results;
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
// use cache_write_handler function // use cache_handler function
return $$this->cache_handler_func('write', $tpl_file, $cache_id, $compile_id, $results, $this); $funcname = $this->cache_handler_func;
} else { return $funcname('write', $this, $results, $tpl_file, $cache_id, $compile_id);
} else {
// use local cache file // use local cache file
$cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $compile_id . $cache_id); $cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $compile_id . $cache_id);
$this->_write_file($cache_file, $results, true); $this->_write_file($cache_file, $results, true);
@@ -1271,8 +1274,9 @@ function _run_insert_handler($args)
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
// use cache_read_handler function // use cache_handler function
$$this->cache_handler_func('read', $tpl_file, $cache_id, $compile_id, $results, $this); $funcname = $this->cache_handler_func;
$funcname('read', $this, $results, $tpl_file, $cache_id, $compile_id);
} else { } else {
// use local file cache // use local file cache
@@ -1281,12 +1285,16 @@ function _run_insert_handler($args)
$results = $this->_read_file($cache_file); $results = $this->_read_file($cache_file);
} }
if(empty($results)) {
// nothing to parse (error?), regenerate cache
return false;
}
$cache_split = explode("\n",$results,2); $cache_split = explode("\n",$results,2);
$cache_header = $cache_split[0]; $cache_header = $cache_split[0];
if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') { if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') {
$cache_info = unserialize(substr($cache_header, 24)); $cache_info = unserialize(substr($cache_header, 24));
$cache_timestamp = $cache_info['timestamp']; $cache_timestamp = $cache_info['timestamp'];
@@ -1318,7 +1326,7 @@ function _run_insert_handler($args)
$results = $cache_split[1]; $results = $cache_split[1];
return true; return true;
} else { } else {
// no cache info header, pre Smarty 1.4.6 format. regenerate // no cache info header, regenerate cache
return false; return false;
} }
} }

View File

@@ -7,8 +7,6 @@ $smarty = new Smarty;
$smarty->compile_check = true; $smarty->compile_check = true;
$smarty->debugging = true; $smarty->debugging = true;
$smarty->assign("now", time());
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill"); $smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
$smarty->assign("FirstName",array("John","Mary","James","Henry")); $smarty->assign("FirstName",array("John","Mary","James","Henry"));
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case")); $smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));

View File

@@ -7,8 +7,6 @@ $smarty = new Smarty;
$smarty->compile_check = true; $smarty->compile_check = true;
$smarty->debugging = true; $smarty->debugging = true;
$smarty->assign("now", time());
$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill"); $smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill");
$smarty->assign("FirstName",array("John","Mary","James","Henry")); $smarty->assign("FirstName",array("John","Mary","James","Henry"));
$smarty->assign("LastName",array("Doe","Smith","Johnson","Case")); $smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));

View File

@@ -419,7 +419,8 @@ class Smarty
function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null) function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null)
{ {
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
return $$this->cache_handler_func('clear', $tpl_file, $cache_id, $compile_id); $funcname = $this->cache_handler_func;
return $funcname('clear', $this, $dummy, $tpl_file, $cache_id, $compile_id);
} else { } else {
return $this->_rm_auto($this->cache_dir, $tpl_file, $compile_id . $cache_id); return $this->_rm_auto($this->cache_dir, $tpl_file, $compile_id . $cache_id);
} }
@@ -433,7 +434,8 @@ class Smarty
function clear_all_cache() function clear_all_cache()
{ {
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
return $$this->cache_handler_func('clear'); $funcname = $this->cache_handler_func;
return $funcname('clear', $this, $dummy);
} else { } else {
return $this->_rm_auto($this->cache_dir); return $this->_rm_auto($this->cache_dir);
} }
@@ -1247,9 +1249,10 @@ function _run_insert_handler($args)
$results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results; $results = 'SMARTY_CACHE_INFO_HEADER'.serialize($this->_cache_info)."\n".$results;
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
// use cache_write_handler function // use cache_handler function
return $$this->cache_handler_func('write', $tpl_file, $cache_id, $compile_id, $results, $this); $funcname = $this->cache_handler_func;
} else { return $funcname('write', $this, $results, $tpl_file, $cache_id, $compile_id);
} else {
// use local cache file // use local cache file
$cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $compile_id . $cache_id); $cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $compile_id . $cache_id);
$this->_write_file($cache_file, $results, true); $this->_write_file($cache_file, $results, true);
@@ -1271,8 +1274,9 @@ function _run_insert_handler($args)
if (!empty($this->cache_handler_func)) { if (!empty($this->cache_handler_func)) {
// use cache_read_handler function // use cache_handler function
$$this->cache_handler_func('read', $tpl_file, $cache_id, $compile_id, $results, $this); $funcname = $this->cache_handler_func;
$funcname('read', $this, $results, $tpl_file, $cache_id, $compile_id);
} else { } else {
// use local file cache // use local file cache
@@ -1281,12 +1285,16 @@ function _run_insert_handler($args)
$results = $this->_read_file($cache_file); $results = $this->_read_file($cache_file);
} }
if(empty($results)) {
// nothing to parse (error?), regenerate cache
return false;
}
$cache_split = explode("\n",$results,2); $cache_split = explode("\n",$results,2);
$cache_header = $cache_split[0]; $cache_header = $cache_split[0];
if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') { if (substr($cache_header, 0, 24) == 'SMARTY_CACHE_INFO_HEADER') {
$cache_info = unserialize(substr($cache_header, 24)); $cache_info = unserialize(substr($cache_header, 24));
$cache_timestamp = $cache_info['timestamp']; $cache_timestamp = $cache_info['timestamp'];
@@ -1318,7 +1326,7 @@ function _run_insert_handler($args)
$results = $cache_split[1]; $results = $cache_split[1];
return true; return true;
} else { } else {
// no cache info header, pre Smarty 1.4.6 format. regenerate // no cache info header, regenerate cache
return false; return false;
} }
} }