diff --git a/change_log.txt b/change_log.txt index 71c32d7f..f1362d43 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,7 +1,8 @@ 12/29/2009 - use sha1() for filepath encoding - updates on nocache_hash handling -- internal change on merging some data +- internal change on merging some data +- fixed cache filename for custom resources 12/28/2009 - update for security fixes diff --git a/libs/sysplugins/smarty_internal_cacheresource_file.php b/libs/sysplugins/smarty_internal_cacheresource_file.php index 6e903924..d8f39642 100644 --- a/libs/sysplugins/smarty_internal_cacheresource_file.php +++ b/libs/sysplugins/smarty_internal_cacheresource_file.php @@ -37,8 +37,8 @@ class Smarty_Internal_CacheResource_File { * @return integer |booelan the template timestamp or false if the file does not exist */ public function getCachedTimestamp($template) - { - //return @filemtime($template->getCachedFilepath()); + { + // return @filemtime ($template->getCachedFilepath()); return ($template->getCachedFilepath() && file_exists($template->getCachedFilepath())) ? filemtime($template->getCachedFilepath()) : false ; } @@ -161,9 +161,10 @@ class Smarty_Internal_CacheResource_File { */ private function buildCachedFilepath ($source_file_path, $cache_id, $compile_id) { + $_source_file_path = str_replace(':', '.', $source_file_path); $_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null; $_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null; - $_filepath = sha1($source_file_path); + $_filepath = sha1($_source_file_path); // if use_sub_dirs, break file into directories if ($this->smarty->use_sub_dirs) { $_filepath = substr($_filepath, 0, 2) . DS @@ -186,7 +187,7 @@ class Smarty_Internal_CacheResource_File { if (strpos('/\\', substr($_cache_dir, -1)) === false) { $_cache_dir .= DS; } - return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($source_file_path) . '.php'; + return $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php'; } }