diff options
Diffstat (limited to 'classes')
-rwxr-xr-x | classes/article.php | 2 | ||||
-rw-r--r-- | classes/diskcache.php | 23 | ||||
-rwxr-xr-x | classes/handler/public.php | 27 | ||||
-rwxr-xr-x | classes/pluginhost.php | 4 | ||||
-rwxr-xr-x | classes/rssutils.php | 2 |
5 files changed, 37 insertions, 21 deletions
diff --git a/classes/article.php b/classes/article.php index 2f43b9b07..62ea1f3b9 100755 --- a/classes/article.php +++ b/classes/article.php @@ -446,7 +446,7 @@ class Article extends Handler_Protected { foreach ($result as $line) { foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ENCLOSURE_ENTRY) as $plugin) { - $line = $plugin->hook_enclosure_entry($line); + $line = $plugin->hook_enclosure_entry($line, $id); } $url = $line["content_url"]; diff --git a/classes/diskcache.php b/classes/diskcache.php index 07643b9be..41609d6b5 100644 --- a/classes/diskcache.php +++ b/classes/diskcache.php @@ -3,15 +3,28 @@ class DiskCache { private $dir; public function __construct($dir) { - $this->dir = basename($dir); + $this->dir = CACHE_DIR . "/" . basename($dir); } public function getDir() { return $this->dir; } - public function isWritable() { - return is_dir($this->dir) && is_writable($this->dir); + public function makeDir() { + if (!is_dir($this->dir)) { + return mkdir($this->dir); + } + } + + public function isWritable($filename = "") { + if ($filename) { + if (file_exists($this->getFullPath($filename))) + return is_writable($this->getFullPath($filename)); + else + return is_writable($this->dir); + } else { + return is_writable($this->dir); + } } public function exists($filename) { @@ -28,7 +41,7 @@ class DiskCache { public function getFullPath($filename) { $filename = basename($filename); - return CACHE_DIR . "/" . $this->dir . "/" . $filename; + return $this->dir . "/" . $filename; } public function put($filename, $data) { @@ -54,6 +67,8 @@ class DiskCache { } public function send($filename) { + header("Content-Disposition: inline; filename=\"$filename\""); + return send_local_file($this->getFullPath($filename)); } diff --git a/classes/handler/public.php b/classes/handler/public.php index 27e984be9..901844e36 100755 --- a/classes/handler/public.php +++ b/classes/handler/public.php @@ -1202,24 +1202,21 @@ class Handler_Public extends Handler { } function cached_url() { - @$req_filename = basename($_GET['file']); + $filename = $_GET['file']; - // we don't need an extension to find the file, hash is a complete URL - $hash = preg_replace("/\.[^\.]*$/", "", $req_filename); - - if ($hash) { - - $filename = CACHE_DIR . '/images/' . $hash; - - if (file_exists($filename)) { - header("Content-Disposition: inline; filename=\"$req_filename\""); + if (strpos($filename, "/") !== FALSE) { + list ($cache_dir, $filename) = explode("/", $filename, 2); + } else { + $cache_dir = "images"; + } - send_local_file($filename); + $cache = new DiskCache($cache_dir); - } else { - header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); - echo "File not found."; - } + if ($cache->exists($filename)) { + $cache->send($filename); + } else { + header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found"); + echo "File not found."; } } diff --git a/classes/pluginhost.php b/classes/pluginhost.php index a3c12ecae..001d5bae2 100755 --- a/classes/pluginhost.php +++ b/classes/pluginhost.php @@ -470,4 +470,8 @@ class PluginHost { function get_filter_actions() { return $this->plugin_actions; } + + function get_owner_uid() { + return $this->owner_uid; + } } diff --git a/classes/rssutils.php b/classes/rssutils.php index 8a8867563..6ba5eaa0b 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -871,7 +871,7 @@ class RSSUtils { $entry_ref_id = $ref_id; if (RSSUtils::find_article_filter($article_filters, "filter")) { - Debug::log("article is filtered out, nothing to do."); + Debug::log("article is filtered out, nothing to do.", Debug::$LOG_VERBOSE); $pdo->commit(); continue; } |