summaryrefslogtreecommitdiff
path: root/classes/handler/public.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2019-08-14 08:25:09 +0300
committerAndrew Dolgov <[email protected]>2019-08-14 08:25:09 +0300
commit65450f8a2bbf325d26177c2589c3a9bbe67d8f80 (patch)
tree932b65b145294955ac4628cd9b0536c83c392ce6 /classes/handler/public.php
parentb0fbae938dbc7c66c7829a86f7dd0fe6fb689908 (diff)
parentfdb6066bf67751ebb388a3de082d80f5444e3681 (diff)
Merge branch 'master' of git.tt-rss.org:fox/tt-rss
Diffstat (limited to 'classes/handler/public.php')
-rwxr-xr-xclasses/handler/public.php29
1 files changed, 13 insertions, 16 deletions
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 0e990bec7..901844e36 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -382,7 +382,7 @@ class Handler_Public extends Handler {
$line = $p->hook_render_article($line);
}
- $line['content'] = rewrite_cached_urls($line['content']);
+ $line['content'] = DiskCache::rewriteUrls($line['content']);
$enclosures = Article::get_article_enclosures($line["id"]);
@@ -1202,24 +1202,21 @@ class Handler_Public extends Handler {
}
function cached_url() {
- @$req_filename = basename($_GET['hash']);
+ $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.";
}
}