aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-04-02 17:44:47 +0200
committertcit <tcit@tcit.fr>2014-04-02 17:44:47 +0200
commitd967a1fa14237648fc63c44f6a28c9c077b3e1bc (patch)
treee8c81af9d50c140f00da15e720eb3f29cdaede96 /inc/poche/Poche.class.php
parent22db488d21bc23dc28fc2d60574803525fe53b53 (diff)
downloadwallabag-d967a1fa14237648fc63c44f6a28c9c077b3e1bc.tar.gz
wallabag-d967a1fa14237648fc63c44f6a28c9c077b3e1bc.tar.zst
wallabag-d967a1fa14237648fc63c44f6a28c9c077b3e1bc.zip
Important fixes for search engine (thx @mariroz)
So sorry for the mess... :( * search only in users' own articles * sanitized what is searched * display what is searched * pagination, sorting available when searching * use existing function to query db * bad encoding caracters fixed * link to JQuery into default theme, no longer in each theme * some spaces instead of tabs
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-xinc/poche/Poche.class.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index 7d9faed1..42a2dd9a 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -604,12 +604,18 @@ class Poche
604 ); 604 );
605 break; 605 break;
606 606
607 case 'search': 607 case 'search':
608 if (isset($_GET['search'])){ 608 if (isset($_GET['search'])){
609 $search = $_GET['search']; 609 $search = filter_var($_GET['search'], FILTER_SANITIZE_STRING);
610 $tpl_vars['entries'] = $this->store->search($search); 610 $tpl_vars['entries'] = $this->store->search($search,$this->user->getId());
611 $tpl_vars['nb_results'] = count($tpl_vars['entries']); 611 $count = count($tpl_vars['entries']);
612 } 612 $this->pagination->set_total($count);
613 $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')),
614 $this->pagination->page_links('?view=' . $view . '?search=' . $search . '&sort=' . $_SESSION['sort'] . '&' ));
615 $tpl_vars['page_links'] = $page_links;
616 $tpl_vars['nb_results'] = $count;
617 $tpl_vars['search_term'] = $search;
618 }
613 break; 619 break;
614 case 'view': 620 case 'view':
615 $entry = $this->store->retrieveOneById($id, $this->user->getId()); 621 $entry = $this->store->retrieveOneById($id, $this->user->getId());