diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-07-01 22:55:43 -0700 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-07-01 22:55:43 -0700 |
commit | a674170bf779ab373ef52fe4dd491c2401c4033b (patch) | |
tree | 47fdcae6d9041a415052e3bfd67412908840367c /modules/gallery/libraries/Gallery_View.php | |
parent | 588f991d558e86a07389e27c9ca9b1b4ab0f9fe7 (diff) |
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.
Diffstat (limited to 'modules/gallery/libraries/Gallery_View.php')
-rw-r--r-- | modules/gallery/libraries/Gallery_View.php | 13 |
1 files changed, 8 insertions, 5 deletions
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"; } } |