From 9a0f688b376bd8c95356f4226a960a0fbc466422 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Wed, 12 Aug 2015 10:49:40 -0300 Subject: Initial code for showing cached bookmarks --- data/templates/default/bookmarks.tpl.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'data/templates/default/bookmarks.tpl.php') diff --git a/data/templates/default/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php index 2a3d169..35bbcdb 100644 --- a/data/templates/default/bookmarks.tpl.php +++ b/data/templates/default/bookmarks.tpl.php @@ -337,6 +337,20 @@ if ($currenttag!= '') { } } + // Local cache + $cacheLink = null; + if ($GLOBALS['cacheFolder'] != null && $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; + + if (file_exists($assetFile)) { + $assetLink = $GLOBALS['cacheUrl'] . '/' . $assetHash; + $cacheLink = "| Cache"; + } + } + // Copy link if ($userservice->isLoggedOn() && ($currentUser->getId() != $row['uId']) @@ -425,6 +439,7 @@ if ($currenttag!= '') { . $copy . "\n" . $edit . "\n" . $update . "\n" + . $cacheLink ."\n" . " \n"; echo $privateNoteField != '' ? '
'.$privateNoteField."
\n" -- cgit v1.2.3