aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2015-03-12 21:57:19 +0100
committernodiscc <nodiscc@gmail.com>2015-04-01 00:32:47 +0200
commita5752e776c9ee5ee5a711a76e8c8066ee88f7192 (patch)
tree78041a2e030cbae5a2837109e519205dab0ab85c /index.php
parent2f4ab7cae2d3b1f13641a61c03d3b159b2c77379 (diff)
downloadShaarli-a5752e776c9ee5ee5a711a76e8c8066ee88f7192.tar.gz
Shaarli-a5752e776c9ee5ee5a711a76e8c8066ee88f7192.tar.zst
Shaarli-a5752e776c9ee5ee5a711a76e8c8066ee88f7192.zip
Fix bad merge commit
Define date format in templates instead of index.php. Conflicts: index.php tpl/dailyrss.html
Diffstat (limited to 'index.php')
-rw-r--r--index.php29
1 files changed, 6 insertions, 23 deletions
diff --git a/index.php b/index.php
index 83c507bb..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.
@@ -1940,21 +1930,14 @@ function buildLinkList($PAGE,$LINKSDB)
1940 while ($i<$end && $i<count($keys)) 1930 while ($i<$end && $i<count($keys))
1941 { 1931 {
1942 $link = $linksToDisplay[$keys[$i]]; 1932 $link = $linksToDisplay[$keys[$i]];
1943 $title = $link['title'];
1944 $taglist = explode(' ',$link['tags']);
1945 uasort($taglist, 'strcasecmp');
1946 $classLi = $i%2!=0 ? '' : 'publicLinkHightLight'; // This could really be done with just a css pseudoclass.
1947 $link['description']=nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description'])))); 1933 $link['description']=nl2br(keepMultipleSpaces(text2clickable(htmlspecialchars($link['description']))));
1934 $title=$link['title'];
1935 $classLi = $i%2!=0 ? '' : 'publicLinkHightLight';
1948 $link['class'] = ($link['private']==0 ? $classLi : 'private'); 1936 $link['class'] = ($link['private']==0 ? $classLi : 'private');
1949 $link['timestamp']=linkdate2timestamp($link['linkdate']); 1937 $link['timestamp']=linkdate2timestamp($link['linkdate']);
1938 $taglist = explode(' ',$link['tags']);
1939 uasort($taglist, 'strcasecmp');
1950 $link['taglist']=$taglist; 1940 $link['taglist']=$taglist;
1951
1952 // Convert notes to absolute URLs
1953 if ($link["url"][0] === '?' && // Check for both signs of a note: starting with ? and 7 chars long. I doubt that you'll post any links that look like this.
1954 strlen($link["url"]) === 7) {
1955 $link["url"] = indexUrl() . $link["url"];
1956 }
1957
1958 $linkDisp[$keys[$i]] = $link; 1941 $linkDisp[$keys[$i]] = $link;
1959 $i++; 1942 $i++;
1960 } 1943 }