diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2015-10-16 11:59:13 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2015-10-16 11:59:13 -0300 |
commit | ee8d18f0f9dafd2b148a28a2647f62559c76a960 (patch) | |
tree | cba65009ee06f38d53dd0a660ec8d875872ab72d /data | |
parent | fe2e4cb55f12fb15a5b9b4638305fedf47271c01 (diff) | |
download | semanticscuttle-ee8d18f0f9dafd2b148a28a2647f62559c76a960.tar.gz semanticscuttle-ee8d18f0f9dafd2b148a28a2647f62559c76a960.tar.bz2 |
Cached bookmarks: remove $cacheFolder
Diffstat (limited to 'data')
-rw-r--r-- | data/config.default.php | 7 | ||||
-rw-r--r-- | data/templates/default/bookmarks.tpl.php | 19 |
2 files changed, 15 insertions, 11 deletions
diff --git a/data/config.default.php b/data/config.default.php index dd220ac..95df176 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -788,15 +788,10 @@ $allowUnittestMode = false; * copy exists. * * You should download SemanticScuttle bookmarks using a tool like - * https://git.sarava.org/?p=httruta.git + * https://git.fluxo.info/?p=httruta.git */ /** - * Set to the filesystem folder where your bookmark cache resides. - */ -$cacheFolder = null; - -/** * Set to the base public URL of you cache folder. */ $cacheUrl = null; 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 = "| <a href=\"$assetLink\">Cache</a>"; + // 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 = "| <a href=\"$assetLink\">Cache</a>"; + } + + curl_close($fp); } } |