From a674170bf779ab373ef52fe4dd491c2401c4033b Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 1 Jul 2009 22:55:43 -0700 Subject: 2 fixes: 1) Include the url in the cache key so that if the Gallery moves, we don't use old cached entries. 2) Use the relative path to files in the comments that we embed in our files so that we don't leak local paths. --- modules/gallery/libraries/Gallery_View.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'modules') diff --git a/modules/gallery/libraries/Gallery_View.php b/modules/gallery/libraries/Gallery_View.php index 32d79ac3..8a0be7f2 100644 --- a/modules/gallery/libraries/Gallery_View.php +++ b/modules/gallery/libraries/Gallery_View.php @@ -72,13 +72,16 @@ class Gallery_View_Core extends View { */ protected function combine_files($files, $type) { $links = array(); - $key = array(); + + // Include the url in the cache key so that if the Gallery moves, we don't use old cached + // entries. + $key = array(url::abs_file("")); foreach (array_keys($files) as $file) { $path = DOCROOT . $file; if (file_exists($path)) { $stats = stat($path); - $links[] = $path; + $links[$file] = $path; // 7 == size, 9 == mtime, see http://php.net/stat $key[] = "$file $stats[7] $stats[9]"; } else { @@ -92,11 +95,11 @@ class Gallery_View_Core extends View { if (empty($contents)) { $contents = ""; - foreach ($links as $link) { + foreach ($links as $file => $link) { if ($type == "css") { - $contents .= "/* $link */\n" . $this->process_css($link) . "\n"; + $contents .= "/* $file */\n" . $this->process_css($link) . "\n"; } else { - $contents .= "/* $link */\n" . file_get_contents($link) . "\n"; + $contents .= "/* $file */\n" . file_get_contents($link) . "\n"; } } -- cgit v1.2.3