summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclasses/article.php2
-rw-r--r--classes/diskcache.php4
-rwxr-xr-xclasses/handler/public.php2
-rw-r--r--include/functions.php15
4 files changed, 7 insertions, 16 deletions
diff --git a/classes/article.php b/classes/article.php
index 43b25f94f..2f43b9b07 100755
--- a/classes/article.php
+++ b/classes/article.php
@@ -676,7 +676,7 @@ class Article extends Handler_Protected {
while ($line = $sth->fetch()) {
if (file_exists(CACHE_DIR . '/images/' . sha1($line["content_url"]))) {
- $line["content_url"] = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($line["content_url"]);
+ $line["content_url"] = DiskCache::getUrl(sha1($line["content_url"]));
}
array_push($rv, $line);
diff --git a/classes/diskcache.php b/classes/diskcache.php
index d21148041..9dbc010c6 100644
--- a/classes/diskcache.php
+++ b/classes/diskcache.php
@@ -56,4 +56,8 @@ class DiskCache {
public function send($filename) {
return send_local_file($this->getFullPath($filename));
}
+
+ static public function getUrl($filename) {
+ return get_self_url_prefix() . "/public.php?op=cached_url&file=" . $filename;
+ }
}
diff --git a/classes/handler/public.php b/classes/handler/public.php
index 0e990bec7..97c61cfd3 100755
--- a/classes/handler/public.php
+++ b/classes/handler/public.php
@@ -1202,7 +1202,7 @@ class Handler_Public extends Handler {
}
function cached_url() {
- @$req_filename = basename($_GET['hash']);
+ @$req_filename = basename($_GET['file']);
// we don't need an extension to find the file, hash is a complete URL
$hash = preg_replace("/\.[^\.]*$/", "", $req_filename);
diff --git a/include/functions.php b/include/functions.php
index 80ae3fe7e..b63f8725e 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1258,20 +1258,7 @@
if (file_exists($cached_filename)) {
- // this is strictly cosmetic
- if ($entry->tagName == 'img') {
- $suffix = ".png";
- } else if ($entry->parentNode && $entry->parentNode->tagName == "picture") {
- $suffix = ".png";
- } else if ($entry->parentNode && $entry->parentNode->tagName == "video") {
- $suffix = ".mp4";
- } else if ($entry->parentNode && $entry->parentNode->tagName == "audio") {
- $suffix = ".ogg";
- } else {
- $suffix = "";
- }
-
- $src = get_self_url_prefix() . '/public.php?op=cached_url&hash=' . sha1($src) . $suffix;
+ $src = DiskCache::getUrl(sha1($src));
if ($entry->hasAttribute('poster'))
$entry->setAttribute('poster', $src);