aboutsummaryrefslogtreecommitdiff
path: root/data/templates/default/bookmarks.tpl.php
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-03-25 19:42:25 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-03-25 19:42:25 -0300
commite5ebe4e5519c48b225b03b5532eb8c5643b7afea (patch)
treeabdb4aeef39d30cdbb7fbe51ab02a53672c2953c /data/templates/default/bookmarks.tpl.php
parent6eee6f93b6a6255982f261e7edd122a5bc760f32 (diff)
downloadsemanticscuttle-e5ebe4e5519c48b225b03b5532eb8c5643b7afea.tar.gz
semanticscuttle-e5ebe4e5519c48b225b03b5532eb8c5643b7afea.tar.bz2
Cache: PDF support
Diffstat (limited to 'data/templates/default/bookmarks.tpl.php')
-rw-r--r--data/templates/default/bookmarks.tpl.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/data/templates/default/bookmarks.tpl.php b/data/templates/default/bookmarks.tpl.php
index 4fa8d8b..19ab6a8 100644
--- a/data/templates/default/bookmarks.tpl.php
+++ b/data/templates/default/bookmarks.tpl.php
@@ -344,6 +344,7 @@ if ($currenttag!= '') {
$assetHash = sha1($row['bAddress'] . "\n");
$assetHash = substr($assetHash, 0, 2) . '/' . substr($assetHash, 2, 2) . '/' . $assetHash;
$assetLink = $GLOBALS['cacheUrl'] . '/' . $assetHash;
+ $assetPdf = $assetLink .'/screenshot.pdf';
// Check if the link exists
if ($fp = curl_init($assetLink)) {
@@ -354,6 +355,20 @@ if ($currenttag!= '') {
if ($retcode != 404) {
$cacheLink = "| <a href=\"$assetLink\">Cache</a>";
+
+ // Check if PDF is available
+ if ($fp = curl_init($assetPdf)) {
+ curl_setopt($fp, CURLOPT_NOBODY, true);
+ curl_exec($fp);
+
+ $retcode = curl_getinfo($fp, CURLINFO_HTTP_CODE);
+
+ if ($retcode != 404) {
+ $cacheLink .= " | <a href=\"$assetPdf\">PDF</a>";
+ }
+
+ curl_close($fp);
+ }
}
curl_close($fp);