aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-03-12 21:57:19 +0100
committernodiscc <nodiscc@gmail.com>2015-03-31 13:19:07 +0200
commitbec18701801cc140d760c261dd115fda1507a0dd (patch)
treecde4d11ddc75202e85b6d0f307d2b8523aa6c487
parent129ff3c2e50154d563de12c85ec7597df5bded5a (diff)
downloadShaarli-bec18701801cc140d760c261dd115fda1507a0dd.tar.gz
Shaarli-bec18701801cc140d760c261dd115fda1507a0dd.tar.zst
Shaarli-bec18701801cc140d760c261dd115fda1507a0dd.zip
Define date format in templates instead of index.php.
-rw-r--r--index.php16
-rw-r--r--tpl/daily.html2
-rw-r--r--tpl/dailyrss.html2
-rw-r--r--tpl/linklist.html4
4 files changed, 7 insertions, 17 deletions
diff --git a/index.php b/index.php
index 0d3c3301..9ab70f6c 100644
--- a/index.php
+++ b/index.php
@@ -567,16 +567,6 @@ function linkdate2iso8601($linkdate)
567 return date('c',linkdate2timestamp($linkdate)); // 'c' is for ISO 8601 date format. 567 return date('c',linkdate2timestamp($linkdate)); // 'c' is for ISO 8601 date format.
568} 568}
569 569
570/* Converts a linkdate time (YYYYMMDD_HHMMSS) of an article to a localized date format.
571 (used to display link date on screen)
572 The date format is automatically chosen according to locale/languages sniffed from browser headers (see autoLocale()). */
573function linkdate2locale($linkdate)
574{
575 return utf8_encode(strftime('%c',linkdate2timestamp($linkdate))); // %c is for automatic date format according to locale.
576 // Note that if you use a locale which is not installed on your webserver,
577 // the date will not be displayed in the chosen locale, but probably in US notation.
578}
579
580// Parse HTTP response headers and return an associative array. 570// Parse HTTP response headers and return an associative array.
581function http_parse_headers_shaarli( $headers ) 571function http_parse_headers_shaarli( $headers )
582{ 572{
@@ -1142,7 +1132,7 @@ function showDailyRSS()
1142 $l = $LINKSDB[$linkdate]; 1132 $l = $LINKSDB[$linkdate];
1143 $l['formatedDescription']=nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($l['description'])))); 1133 $l['formatedDescription']=nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($l['description']))));
1144 $l['thumbnail'] = thumbnail($l['url']); 1134 $l['thumbnail'] = thumbnail($l['url']);
1145 $l['localdate']=linkdate2locale($l['linkdate']); 1135 $l['timestamp'] = linkdate2timestamp($l['linkdate']);
1146 if (startsWith($l['url'],'?')) $l['url']=indexUrl().$l['url']; // make permalink URL absolute 1136 if (startsWith($l['url'],'?')) $l['url']=indexUrl().$l['url']; // make permalink URL absolute
1147 $links[$linkdate]=$l; 1137 $links[$linkdate]=$l;
1148 } 1138 }
@@ -1190,7 +1180,7 @@ function showDaily()
1190 $linksToDisplay[$key]['taglist']=$taglist; 1180 $linksToDisplay[$key]['taglist']=$taglist;
1191 $linksToDisplay[$key]['formatedDescription']=nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))); 1181 $linksToDisplay[$key]['formatedDescription']=nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))));
1192 $linksToDisplay[$key]['thumbnail'] = thumbnail($link['url']); 1182 $linksToDisplay[$key]['thumbnail'] = thumbnail($link['url']);
1193 $linksToDisplay[$key]['localdate'] = linkdate2locale($link['linkdate']); 1183 $linksToDisplay[$key]['timestamp'] = linkdate2timestamp($link['linkdate']);
1194 } 1184 }
1195 1185
1196 /* We need to spread the articles on 3 columns. 1186 /* We need to spread the articles on 3 columns.
@@ -1944,7 +1934,7 @@ function buildLinkList($PAGE,$LINKSDB)
1944 $title=$link['title']; 1934 $title=$link['title'];
1945 $classLi = $i%2!=0 ? '' : 'publicLinkHightLight'; 1935 $classLi = $i%2!=0 ? '' : 'publicLinkHightLight';
1946 $link['class'] = ($link['private']==0 ? $classLi : 'private'); 1936 $link['class'] = ($link['private']==0 ? $classLi : 'private');
1947 $link['localdate']=linkdate2locale($link['linkdate']); 1937 $link['timestamp']=linkdate2timestamp($link['linkdate']);
1948 $taglist = explode(' ',$link['tags']); 1938 $taglist = explode(' ',$link['tags']);
1949 uasort($taglist, 'strcasecmp'); 1939 uasort($taglist, 'strcasecmp');
1950 $link['taglist']=$taglist; 1940 $link['taglist']=$taglist;
diff --git a/tpl/daily.html b/tpl/daily.html
index c53e6f71..919795bb 100644
--- a/tpl/daily.html
+++ b/tpl/daily.html
@@ -30,7 +30,7 @@
30 </div> 30 </div>
31 {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"} 31 {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
32 <div class="dailyEntryLinkdate"> 32 <div class="dailyEntryLinkdate">
33 <a href="?{$link.linkdate|smallHash}">{$link.localdate}</a> 33 <a href="?{$link.linkdate|smallHash}">{function="strftime('%c', $link.timestamp)"}</a>
34 </div> 34 </div>
35 {/if} 35 {/if}
36 {if="$link.tags"} 36 {if="$link.tags"}
diff --git a/tpl/dailyrss.html b/tpl/dailyrss.html
index 436e1cd2..926704f4 100644
--- a/tpl/dailyrss.html
+++ b/tpl/dailyrss.html
@@ -1,6 +1,6 @@
1{loop="links"} 1{loop="links"}
2 <h3><a href="{$value.url}">{$value.title|htmlspecialchars}</a></h3> 2 <h3><a href="{$value.url}">{$value.title|htmlspecialchars}</a></h3>
3 <small>{if="!$GLOBALS['config']['HIDE_TIMESTAMPS']"}{$value.localdate|htmlspecialchars} - {/if}{if="$value.tags"}{$value.tags|htmlspecialchars}{/if}<br> 3 <small>{if="!$GLOBALS['config']['HIDE_TIMESTAMPS']"}{function="strftime('%c', $value.timestamp|htmlspecialchars)"} - {/if}{if="$value.tags"}{$value.tags|htmlspecialchars}{/if}<br>
4 {$value.url|htmlspecialchars}</small><br> 4 {$value.url|htmlspecialchars}</small><br>
5 {if="$value.thumbnail"}{$value.thumbnail}{/if}<br> 5 {if="$value.thumbnail"}{$value.thumbnail}{/if}<br>
6 {if="$value.description"}{$value.formatedDescription}{/if} 6 {if="$value.description"}{$value.formatedDescription}{/if}
diff --git a/tpl/linklist.html b/tpl/linklist.html
index 353eca52..766a80ce 100644
--- a/tpl/linklist.html
+++ b/tpl/linklist.html
@@ -44,7 +44,7 @@
44 <br> 44 <br>
45 {if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if} 45 {if="$value.description"}<div class="linkdescription">{$value.description}</div>{/if}
46 {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"} 46 {if="!$GLOBALS['config']['HIDE_TIMESTAMPS'] || isLoggedIn()"}
47 <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{$value.localdate|htmlspecialchars} - permalink</a> - </span> 47 <span class="linkdate" title="Permalink"><a href="?{$value.linkdate|smallHash}">{function="strftime('%c', $value.timestamp)"} - permalink</a> - </span>
48 {else} 48 {else}
49 <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span> 49 <span class="linkdate" title="Short link here"><a href="?{$value.linkdate|smallHash}">permalink</a> - </span>
50 {/if} 50 {/if}
@@ -53,7 +53,7 @@
53 {/if} 53 {/if}
54 <div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}" 54 <div class="linkqrcode"><a href="http://qrfree.kaywa.com/?l=1&amp;s=8&amp;d={$scripturl|urlencode}%3F{$value.linkdate|smallHash}"
55 onclick="return showQrCode(this);" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}"> 55 onclick="return showQrCode(this);" class="qrcode" data-permalink="{$scripturl}?{$value.linkdate|smallHash}">
56 <img src="images/qrcode.png#" alt="QR-Code" title="{$value.localdate|htmlspecialchars}"></a></div> - 56 <img src="images/qrcode.png#" alt="QR-Code" title="{function="strftime('%c', $value.timestamp)"}"></a></div> -
57 <a href="{$value.url|htmlspecialchars}"><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br> 57 <a href="{$value.url|htmlspecialchars}"><span class="linkurl" title="Short link">{$value.url|htmlspecialchars}</span></a><br>
58 {if="$value.tags"} 58 {if="$value.tags"}
59 <div class="linktaglist"> 59 <div class="linktaglist">