]> projects.mako.cc - scuttle/commitdiff
updated scuttle to add archive.org wayback links
authorBenjamin Mako Hill <mako@atdot.cc>
Fri, 4 Aug 2023 05:08:13 +0000 (07:08 +0200)
committerBenjamin Mako Hill <mako@atdot.cc>
Fri, 21 Jun 2024 09:38:37 +0000 (19:38 +1000)
config.inc.php.example
templates/bookmarks.tpl.php

index f690aee8e8e510fb308ecf911585ef8587cf90cc..c55666a29bcfb192ef3a97506c9988b002b65d5b 100644 (file)
@@ -139,4 +139,7 @@ $email_blacklist   = array(
                       '/mailinator\.com/i'
                      );
 
+$archive_links = TRUE;
+$archive_base_url = "https://web.archive.org";
+
 include_once 'debug.inc.php';
index a53559074d03f57f9a69358a7b52dabd3113d601..fa40561b56c47e42873a44612741336ff2beeb8f 100644 (file)
@@ -89,6 +89,12 @@ if (count($bookmarks) > 0) {
 
         $address = filter($row['bAddress']);
         
+        // Internet Archive WayBack Links
+        $archive_link = '';
+        if ($GLOBALS["archive_links"]) { 
+            $archive_link = ' - <a href="' . $GLOBALS['archive_base_url'] . "/" . date("YmdHis", strtotime($row['bDatetime'])) . "/" . $address . '">' . T_('Archived Link') . '</a>';
+        }
+        
         // Redirection option
         if ($GLOBALS['useredir']) {
             $address = $GLOBALS['url_redir'] . $address;
@@ -101,9 +107,9 @@ if (count($bookmarks) > 0) {
             echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
         }
         if ($row['bDatetime'] == $row['bModified']) {
-            echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";
+            echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit . $archive_link ."</div>\n";
         } else {
-            echo '<div class="meta"><span id="date-updated">updated: '. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . '</span>, <span id="date-original">original: '. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . "</span>" . $cats . $copy . $edit ."</div>\n";
+            echo '<div class="meta"><span id="date-updated">updated: '. date($GLOBALS['shortdate'], strtotime($row['bModified'])) . '</span>, <span id="date-original">original: '. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . "</span>" . $cats . $copy . $edit . $archive_link ."</div>\n";
         }
         echo "</li>\n";
     }

Benjamin Mako Hill || Want to submit a patch?