summaryrefslogtreecommitdiff
path: root/modules/gallery/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r--modules/gallery/libraries/Gallery_View.php13
-rw-r--r--modules/gallery/libraries/HtmlPurifier.php43
2 files changed, 51 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";
}
}
diff --git a/modules/gallery/libraries/HtmlPurifier.php b/modules/gallery/libraries/HtmlPurifier.php
new file mode 100644
index 00000000..f9d5353b
--- /dev/null
+++ b/modules/gallery/libraries/HtmlPurifier.php
@@ -0,0 +1,43 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 Bharat Mediratta
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+class HtmlPurifier_Core {
+ private static $_instance;
+
+ public function __construct($name = NULL, $data = NULL, $type = NULL) {
+ parent::__construct($name, $data, $type);
+ $this->set_global("csrf", access::csrf_token());
+ }
+
+ static function instance($config=null) {
+ require_once(dirname(__file__) . "/HTMLPurifier/HTMLPurifier.auto.php");
+ if (self::$_instance == NULL) {
+ $config = isset($config) ? $config : Kohana::config('purifier');
+ $purifier_config = HTMLPurifier_Config::createDefault();
+ foreach ($config as $category => $key_value) {
+ foreach ($key_value as $key => $value) {
+ $purifier_config->set("$category.$key", $value);
+ }
+ }
+ self::$_instance = new HtmlPurifier($purifier_config);
+ }
+
+ return self::$_instance;
+ }
+}