aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--application/LinkDB.php3
-rw-r--r--index.php12
-rw-r--r--tpl/linklist.html11
3 files changed, 23 insertions, 3 deletions
diff --git a/application/LinkDB.php b/application/LinkDB.php
index d80434bf..de9e73b0 100644
--- a/application/LinkDB.php
+++ b/application/LinkDB.php
@@ -12,8 +12,9 @@
12 * 12 *
13 * Available keys: 13 * Available keys:
14 * - description: description of the entry 14 * - description: description of the entry
15 * - linkdate: date of the creation of this entry, in the form YYYYMMDD_HHMMSS 15 * - linkdate: creation date of this entry, format: YYYYMMDD_HHMMSS
16 * (e.g.'20110914_192317') 16 * (e.g.'20110914_192317')
17 * - updated: last modification date of this entry, format: YYYYMMDD_HHMMSS
17 * - private: Is this link private? 0=no, other value=yes 18 * - private: Is this link private? 0=no, other value=yes
18 * - tags: tags attached to this entry (separated by spaces) 19 * - tags: tags attached to this entry (separated by spaces)
19 * - title Title of the link 20 * - title Title of the link
diff --git a/index.php b/index.php
index 9f50d153..5bc13d49 100644
--- a/index.php
+++ b/index.php
@@ -1245,6 +1245,9 @@ function renderPage($conf, $pluginManager)
1245 // -------- User clicked the "Save" button when editing a link: Save link to database. 1245 // -------- User clicked the "Save" button when editing a link: Save link to database.
1246 if (isset($_POST['save_edit'])) 1246 if (isset($_POST['save_edit']))
1247 { 1247 {
1248 $linkdate = $_POST['lf_linkdate'];
1249 $updated = isset($LINKSDB[$linkdate]) ? strval(date('Ymd_His')) : false;
1250
1248 // Go away! 1251 // Go away!
1249 if (! tokenOk($_POST['token'])) { 1252 if (! tokenOk($_POST['token'])) {
1250 die('Wrong token.'); 1253 die('Wrong token.');
@@ -1255,7 +1258,7 @@ function renderPage($conf, $pluginManager)
1255 $tags = preg_replace('/(^| )\-/', '$1', $tags); 1258 $tags = preg_replace('/(^| )\-/', '$1', $tags);
1256 // Remove duplicates. 1259 // Remove duplicates.
1257 $tags = implode(' ', array_unique(explode(' ', $tags))); 1260 $tags = implode(' ', array_unique(explode(' ', $tags)));
1258 $linkdate = $_POST['lf_linkdate']; 1261
1259 $url = trim($_POST['lf_url']); 1262 $url = trim($_POST['lf_url']);
1260 if (! startsWith($url, 'http:') && ! startsWith($url, 'https:') 1263 if (! startsWith($url, 'http:') && ! startsWith($url, 'https:')
1261 && ! startsWith($url, 'ftp:') && ! startsWith($url, 'magnet:') 1264 && ! startsWith($url, 'ftp:') && ! startsWith($url, 'magnet:')
@@ -1270,6 +1273,7 @@ function renderPage($conf, $pluginManager)
1270 'description' => $_POST['lf_description'], 1273 'description' => $_POST['lf_description'],
1271 'private' => (isset($_POST['lf_private']) ? 1 : 0), 1274 'private' => (isset($_POST['lf_private']) ? 1 : 0),
1272 'linkdate' => $linkdate, 1275 'linkdate' => $linkdate,
1276 'updated' => $updated,
1273 'tags' => str_replace(',', ' ', $tags) 1277 'tags' => str_replace(',', ' ', $tags)
1274 ); 1278 );
1275 // If title is empty, use the URL as title. 1279 // If title is empty, use the URL as title.
@@ -1633,6 +1637,12 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1633 $link['class'] = $link['private'] == 0 ? $classLi : 'private'; 1637 $link['class'] = $link['private'] == 0 ? $classLi : 'private';
1634 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); 1638 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
1635 $link['timestamp'] = $date->getTimestamp(); 1639 $link['timestamp'] = $date->getTimestamp();
1640 if (! empty($link['updated'])) {
1641 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['updated']);
1642 $link['updated_timestamp'] = $date->getTimestamp();
1643 } else {
1644 $link['updated_timestamp'] = '';
1645 }
1636 $taglist = explode(' ', $link['tags']); 1646 $taglist = explode(' ', $link['tags']);
1637 uasort($taglist, 'strcasecmp'); 1647 uasort($taglist, 'strcasecmp');
1638 $link['taglist'] = $taglist; 1648 $link['taglist'] = $taglist;
diff --git a/tpl/linklist.html b/tpl/linklist.html
index 2316f145..9979f12a 100644
--- a/tpl/linklist.html
+++ b/tpl/linklist.html
@@ -89,7 +89,16 @@
89 <br> 89 <br>
90 {if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if} 90 {if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if}
91 {if="!$hide_timestamps || isLoggedIn()"} 91 {if="!$hide_timestamps || isLoggedIn()"}
92 <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{function="strftime('%c', $value.timestamp)"} - permalink</a> - </span> 92 {$updated=$value.updated_timestamp ? 'Edited: '. strftime('%c', $value.updated_timestamp) : 'Permalink'}
93 <span class="linkdate" title="Permalink">
94 <a href="?{$value.linkdate|smallHash}">
95 <span title="{$updated}">
96 {function="strftime('%c', $value.timestamp)"}
97 {if="$value.updated_timestamp"}*{/if}
98 </span>
99 - permalink
100 </a> -
101 </span>
93 {else} 102 {else}
94 <span class="linkdate" title="Short link here"><a href="?{$value.shorturl}">permalink</a> - </span> 103 <span class="linkdate" title="Short link here"><a href="?{$value.shorturl}">permalink</a> - </span>
95 {/if} 104 {/if}