From ee8d18f0f9dafd2b148a28a2647f62559c76a960 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 16 Oct 2015 11:59:13 -0300 Subject: Cached bookmarks: remove $cacheFolder --- data/templates/default/bookmarks.tpl.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'data/templates') diff --git a/data/templates/default/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php index 35bbcdb..27b27ee 100644 --- a/data/templates/default/bookmarks.tpl.php +++ b/data/templates/default/bookmarks.tpl.php @@ -339,15 +339,24 @@ if ($currenttag!= '') { // Local cache $cacheLink = null; - if ($GLOBALS['cacheFolder'] != null && $GLOBALS['cacheUrl'] != null) { + if ($GLOBALS['cacheUrl'] != null) { // Hashing discussion at http://linuxprocess.free.fr/MHonArc/Oct-2005/msg00016.html $assetHash = sha1($row['bAddress'] . "\n"); $assetHash = substr($assetHash, 0, 2) . '/' . substr($assetHash, 2, 2) . '/' . $assetHash; - $assetFile = $GLOBALS['cacheFolder'] . '/' . $assetHash; + $assetLink = $GLOBALS['cacheUrl'] . '/' . $assetHash; - if (file_exists($assetFile)) { - $assetLink = $GLOBALS['cacheUrl'] . '/' . $assetHash; - $cacheLink = "| Cache"; + // Check if the link exists + if ($fp = curl_init($assetLink)) { + curl_setopt($fp, CURLOPT_NOBODY, true); + curl_exec($fp); + + $retcode = curl_getinfo($fp, CURLINFO_HTTP_CODE); + + if ($retcode == 200) { + $cacheLink = "| Cache"; + } + + curl_close($fp); } } -- cgit v1.2.3