diff options
-rw-r--r-- | application/LinkDB.php | 3 | ||||
-rw-r--r-- | index.php | 12 | ||||
-rw-r--r-- | tpl/linklist.html | 11 |
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 |
@@ -1227,6 +1227,9 @@ function renderPage($conf, $pluginManager) | |||
1227 | // -------- User clicked the "Save" button when editing a link: Save link to database. | 1227 | // -------- User clicked the "Save" button when editing a link: Save link to database. |
1228 | if (isset($_POST['save_edit'])) | 1228 | if (isset($_POST['save_edit'])) |
1229 | { | 1229 | { |
1230 | $linkdate = $_POST['lf_linkdate']; | ||
1231 | $updated = isset($LINKSDB[$linkdate]) ? strval(date('Ymd_His')) : false; | ||
1232 | |||
1230 | // Go away! | 1233 | // Go away! |
1231 | if (! tokenOk($_POST['token'])) { | 1234 | if (! tokenOk($_POST['token'])) { |
1232 | die('Wrong token.'); | 1235 | die('Wrong token.'); |
@@ -1237,7 +1240,7 @@ function renderPage($conf, $pluginManager) | |||
1237 | $tags = preg_replace('/(^| )\-/', '$1', $tags); | 1240 | $tags = preg_replace('/(^| )\-/', '$1', $tags); |
1238 | // Remove duplicates. | 1241 | // Remove duplicates. |
1239 | $tags = implode(' ', array_unique(explode(' ', $tags))); | 1242 | $tags = implode(' ', array_unique(explode(' ', $tags))); |
1240 | $linkdate = $_POST['lf_linkdate']; | 1243 | |
1241 | $url = trim($_POST['lf_url']); | 1244 | $url = trim($_POST['lf_url']); |
1242 | if (! startsWith($url, 'http:') && ! startsWith($url, 'https:') | 1245 | if (! startsWith($url, 'http:') && ! startsWith($url, 'https:') |
1243 | && ! startsWith($url, 'ftp:') && ! startsWith($url, 'magnet:') | 1246 | && ! startsWith($url, 'ftp:') && ! startsWith($url, 'magnet:') |
@@ -1252,6 +1255,7 @@ function renderPage($conf, $pluginManager) | |||
1252 | 'description' => $_POST['lf_description'], | 1255 | 'description' => $_POST['lf_description'], |
1253 | 'private' => (isset($_POST['lf_private']) ? 1 : 0), | 1256 | 'private' => (isset($_POST['lf_private']) ? 1 : 0), |
1254 | 'linkdate' => $linkdate, | 1257 | 'linkdate' => $linkdate, |
1258 | 'updated' => $updated, | ||
1255 | 'tags' => str_replace(',', ' ', $tags) | 1259 | 'tags' => str_replace(',', ' ', $tags) |
1256 | ); | 1260 | ); |
1257 | // If title is empty, use the URL as title. | 1261 | // If title is empty, use the URL as title. |
@@ -1696,6 +1700,12 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager) | |||
1696 | $link['class'] = $link['private'] == 0 ? $classLi : 'private'; | 1700 | $link['class'] = $link['private'] == 0 ? $classLi : 'private'; |
1697 | $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); | 1701 | $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); |
1698 | $link['timestamp'] = $date->getTimestamp(); | 1702 | $link['timestamp'] = $date->getTimestamp(); |
1703 | if (! empty($link['updated'])) { | ||
1704 | $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['updated']); | ||
1705 | $link['updated_timestamp'] = $date->getTimestamp(); | ||
1706 | } else { | ||
1707 | $link['updated_timestamp'] = ''; | ||
1708 | } | ||
1699 | $taglist = explode(' ', $link['tags']); | 1709 | $taglist = explode(' ', $link['tags']); |
1700 | uasort($taglist, 'strcasecmp'); | 1710 | uasort($taglist, 'strcasecmp'); |
1701 | $link['taglist'] = $taglist; | 1711 | $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} |