diff options
author | Mario Vavti <mario@mariovavti.com> | 2018-12-04 11:39:14 +0100 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2018-12-04 11:39:14 +0100 |
commit | 5d9f993352ae51ac3873355d3e2d25e36ac97461 (patch) | |
tree | a9956b0beeb39e4406ba22b67f35eb4b2f8519e7 | |
parent | 42aeb19562b9e72436a72e090772da669e34fd66 (diff) | |
parent | eaa52c19a87ef90a16978b22c9757287cb6fba6f (diff) | |
download | volse-hubzilla-5d9f993352ae51ac3873355d3e2d25e36ac97461.tar.gz volse-hubzilla-5d9f993352ae51ac3873355d3e2d25e36ac97461.tar.bz2 volse-hubzilla-5d9f993352ae51ac3873355d3e2d25e36ac97461.zip |
Merge branch 'dev' of https://framagit.org/hubzilla/core into dev
-rw-r--r-- | Zotlabs/Module/Photo.php | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/Zotlabs/Module/Photo.php b/Zotlabs/Module/Photo.php index d85db7307..ddff3a68e 100644 --- a/Zotlabs/Module/Photo.php +++ b/Zotlabs/Module/Photo.php @@ -139,7 +139,7 @@ class Photo extends \Zotlabs\Web\Controller { $resolution = 1; } - $r = q("SELECT uid, photo_usage, expires, display_path FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", + $r = q("SELECT uid, photo_usage, display_path FROM photo WHERE resource_id = '%s' AND imgscale = %d LIMIT 1", dbesc($photo), intval($resolution) ); @@ -156,20 +156,17 @@ class Photo extends \Zotlabs\Web\Controller { if(! in_array($resolution,[4,5,6])) $allowed = (-1); if($u === PHOTO_CACHE) { - // Cached image leak protection - if(! (local_channel() || $cache_mode['leak'])) { - header("Location: " . $r[0]['display_path']); - killme(); - } - // Revalidate cache - if($cache_mode['on'] && strtotime($r[0]['expires']) - 60 < time()) { - $cache = array( - 'url' => $r[0]['display_path'], - 'uid' => $r[0]['uid'] - ); + // Validate cache + $cache = array( + 'resid' => $photo, + 'uid' => $r[0]['uid'], + 'status' => false + ); + if($cache_mode['on']) call_hooks('cache_url_hook', $cache); - if(! $cache['status']) - http_status_exit(404,'not found'); + if(! $cache['status']) { + header("Location: " . htmlspecialchars_decode($r[0]['display_path'])); + killme(); } } } @@ -184,7 +181,7 @@ class Photo extends \Zotlabs\Web\Controller { dbesc($photo), intval($resolution) ); - + $exists = (($e) ? true : false); if($exists && $allowed) { |