aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.php23
-rw-r--r--tpl/daily.html67
2 files changed, 43 insertions, 47 deletions
diff --git a/index.php b/index.php
index 7843f2b8..c4c45e53 100644
--- a/index.php
+++ b/index.php
@@ -794,14 +794,16 @@ class linkdb implements Iterator, Countable, ArrayAccess
794 { 794 {
795 // FIXME: explode(' ',$searchterms) and perform a AND search. 795 // FIXME: explode(' ',$searchterms) and perform a AND search.
796 // FIXME: accept double-quotes to search for a string "as is"? 796 // FIXME: accept double-quotes to search for a string "as is"?
797 // Using mb_convert_case($val, MB_CASE_LOWER, 'UTF-8') allows us to perform searches on
798 // Unicode text. See https://github.com/shaarli/Shaarli/issues/75 for examples.
797 $filtered=array(); 799 $filtered=array();
798 $s = strtolower($searchterms); 800 $s = mb_convert_case($searchterms, MB_CASE_LOWER, 'UTF-8');
799 foreach($this->links as $l) 801 foreach($this->links as $l)
800 { 802 {
801 $found= (strpos(strtolower($l['title']),$s)!==false) 803 $found= (strpos(mb_convert_case($l['title'], MB_CASE_LOWER, 'UTF-8'),$s) !== false)
802 || (strpos(strtolower($l['description']),$s)!==false) 804 || (strpos(mb_convert_case($l['description'], MB_CASE_LOWER, 'UTF-8'),$s) !== false)
803 || (strpos(strtolower($l['url']),$s)!==false) 805 || (strpos(mb_convert_case($l['url'], MB_CASE_LOWER, 'UTF-8'),$s) !== false)
804 || (strpos(strtolower($l['tags']),$s)!==false); 806 || (strpos(mb_convert_case($l['tags'], MB_CASE_LOWER, 'UTF-8'),$s) !== false);
805 if ($found) $filtered[$l['linkdate']] = $l; 807 if ($found) $filtered[$l['linkdate']] = $l;
806 } 808 }
807 krsort($filtered); 809 krsort($filtered);
@@ -813,12 +815,14 @@ class linkdb implements Iterator, Countable, ArrayAccess
813 // e.g. print_r($mydb->filterTags('linux programming')); 815 // e.g. print_r($mydb->filterTags('linux programming'));
814 public function filterTags($tags,$casesensitive=false) 816 public function filterTags($tags,$casesensitive=false)
815 { 817 {
816 $t = str_replace(',',' ',($casesensitive?$tags:strtolower($tags))); 818 // Same as above, we use UTF-8 conversion to handle various graphemes (i.e. cyrillic, or greek)
819 // TODO: is $casesensitive ever true ?
820 $t = str_replace(',',' ',($casesensitive?$tags:mb_convert_case($tags, MB_CASE_LOWER, 'UTF-8')));
817 $searchtags=explode(' ',$t); 821 $searchtags=explode(' ',$t);
818 $filtered=array(); 822 $filtered=array();
819 foreach($this->links as $l) 823 foreach($this->links as $l)
820 { 824 {
821 $linktags = explode(' ',($casesensitive?$l['tags']:strtolower($l['tags']))); 825 $linktags = explode(' ',($casesensitive?$l['tags']:mb_convert_case($l['tags'], MB_CASE_LOWER, 'UTF-8')));
822 if (count(array_intersect($linktags,$searchtags)) == count($searchtags)) 826 if (count(array_intersect($linktags,$searchtags)) == count($searchtags))
823 $filtered[$l['linkdate']] = $l; 827 $filtered[$l['linkdate']] = $l;
824 } 828 }
@@ -1173,10 +1177,7 @@ function showDaily()
1173 $PAGE = new pageBuilder; 1177 $PAGE = new pageBuilder;
1174 $PAGE->assign('linksToDisplay',$linksToDisplay); 1178 $PAGE->assign('linksToDisplay',$linksToDisplay);
1175 $PAGE->assign('linkcount',count($LINKSDB)); 1179 $PAGE->assign('linkcount',count($LINKSDB));
1176 $PAGE->assign('col1',$columns[0]); 1180 $PAGE->assign('cols', $columns);
1177 $PAGE->assign('col1',$columns[0]);
1178 $PAGE->assign('col2',$columns[1]);
1179 $PAGE->assign('col3',$columns[2]);
1180 $PAGE->assign('day',utf8_encode(strftime('%A %d, %B %Y',linkdate2timestamp($day.'_000000')))); 1181 $PAGE->assign('day',utf8_encode(strftime('%A %d, %B %Y',linkdate2timestamp($day.'_000000'))));
1181 $PAGE->assign('previousday',$previousday); 1182 $PAGE->assign('previousday',$previousday);
1182 $PAGE->assign('nextday',$nextday); 1183 $PAGE->assign('nextday',$nextday);
diff --git a/tpl/daily.html b/tpl/daily.html
index c15a7062..b92425b5 100644
--- a/tpl/daily.html
+++ b/tpl/daily.html
@@ -7,7 +7,7 @@
7 <div class="dailyAbout"> 7 <div class="dailyAbout">
8 All links of one day<br>in a single page.<br> 8 All links of one day<br>in a single page.<br>
9 {if="$previousday"} <a href="?do=daily&day={$previousday}"><b>&lt;</b>Previous day</a>{else}<b>&lt;</b>Previous day{/if} 9 {if="$previousday"} <a href="?do=daily&day={$previousday}"><b>&lt;</b>Previous day</a>{else}<b>&lt;</b>Previous day{/if}
10 - 10 -
11 {if="$nextday"}<a href="?do=daily&day={$nextday}">Next day<b>&gt;</b></a>{else}Next day<b>&gt;</b>{/if} 11 {if="$nextday"}<a href="?do=daily&day={$nextday}">Next day<b>&gt;</b></a>{else}Next day<b>&gt;</b>{/if}
12 <br><br> 12 <br><br>
13 <a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#">Daily RSS Feed</a> 13 <a href="?do=dailyrss" title="1 RSS entry per day"><img src="images/feed-icon-14x14.png#">Daily RSS Feed</a>
@@ -15,43 +15,38 @@
15 <div class="dailyTitle"><img src="../images/floral_left.png" width="51" height="50" class="nomobile"> The Daily Shaarli <img src="../images/floral_right.png" width="51" height="50" class="nomobile"></div> 15 <div class="dailyTitle"><img src="../images/floral_left.png" width="51" height="50" class="nomobile"> The Daily Shaarli <img src="../images/floral_right.png" width="51" height="50" class="nomobile"></div>
16 <div class="dailyDate"><span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span> {$day} <span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span></div> 16 <div class="dailyDate"><span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span> {$day} <span class="nomobile">&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;&#x0097;</span></div>
17 <div class="clear"></div> 17 <div class="clear"></div>
18
19 {if="$linksToDisplay"}
20 <div id="daily_col1">
21 {loop="col1"}
22 <div class="dailyEntry">
23 <div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div>
24 {if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if}
25 <div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div>
26 {if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if}
27 <div class="dailyEntryDescription">{$value.formatedDescription}</div>
28 </div>
29 {/loop}
30 </div>
31 18
32 <div id="daily_col2"> 19 {if="$linksToDisplay"}
33 {loop="col2"} 20 {loop="cols"}
34 <div class="dailyEntry"> 21 {if="isset($value[0])"}
35 <div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div> 22 <div id="daily_col{$counter+1}">
36 {if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if} 23 {loop="value"}
37 <div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div> 24 {$link=$value}
38 {if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if} 25 <div class="dailyEntry">
39 <div class="dailyEntryDescription">{$value.formatedDescription}</div> 26 <div class="dailyEntryPermalink">
40 </div> 27 <a href="?{$link.linkdate|smallHash}">
41 {/loop} 28 <img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink">
42 </div> 29 </a>
43 30 </div>
44 <div id="daily_col3"> 31 {if="$link.tags"}
45 {loop="col3"} 32 <div class="dailyEntryTags">
46 <div class="dailyEntry"> 33 {loop="link.taglist"}
47 <div class="dailyEntryPermalink"><a href="?{$value.linkdate|smallHash}"><img src="../images/squiggle2.png" width="25" height="26" title="permalink" alt="permalink"></a></div> 34 {$value|htmlspecialchars} -
48 {if="$value.tags"}<div class="dailyEntryTags">{loop="value.taglist"}{$value|htmlspecialchars} - {/loop}</div>{/if} 35 {/loop}
49 <div class="dailyEntryTitle"><a href="{$value.url}">{$value.title|htmlspecialchars}</a></div> 36 </div>
50 {if="$value.thumbnail"}<div class="dailyEntryThumbnail">{$value.thumbnail}</div>{/if} 37 {/if}
51 <div class="dailyEntryDescription">{$value.formatedDescription}</div> 38 <div class="dailyEntryTitle">
52 </div> 39 <a href="{$link.url}">{$link.title|htmlspecialchars}</a>
40 </div>
41 {if="$link.thumbnail"}
42 <div class="dailyEntryThumbnail">{$link.thumbnail}</div>
43 {/if}
44 <div class="dailyEntryDescription">{$link.formatedDescription}</div>
45 </div>
46 {/loop}
47 </div>
48 {/if}
53 {/loop} 49 {/loop}
54 </div>
55 {else} 50 {else}
56 <div class="dailyNoEntry">No articles on this day.</div> 51 <div class="dailyNoEntry">No articles on this day.</div>
57 {/if} 52 {/if}