diff options
author | Thomas Citharel <tcit@tcit.fr> | 2015-07-17 22:54:57 +0200 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2015-07-17 22:54:57 +0200 |
commit | 4a746679c899e44c214605561db2aeb5001f07cd (patch) | |
tree | 4d03c5e5e45464ba0770f307f6d0de72636c4e0f /inc/poche/Poche.class.php | |
parent | 7473f0cc4ab15ef8ff28169c5dec44b53131b1c3 (diff) | |
download | wallabag-4a746679c899e44c214605561db2aeb5001f07cd.tar.gz wallabag-4a746679c899e44c214605561db2aeb5001f07cd.tar.zst wallabag-4a746679c899e44c214605561db2aeb5001f07cd.zip |
secure database functions
Diffstat (limited to 'inc/poche/Poche.class.php')
-rwxr-xr-x | inc/poche/Poche.class.php | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php index e0c9abbb..15d83bfe 100755 --- a/inc/poche/Poche.class.php +++ b/inc/poche/Poche.class.php | |||
@@ -599,7 +599,7 @@ class Poche | |||
599 | 599 | ||
600 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id); | 600 | $count = $this->store->getEntriesByViewCount($view, $this->user->getId(), $id); |
601 | 601 | ||
602 | if ($count > 0) { | 602 | if ($count && $count > 0) { |
603 | $this->pagination->set_total($count); | 603 | $this->pagination->set_total($count); |
604 | $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), | 604 | $page_links = str_replace(array('previous', 'next'), array(_('previous'), _('next')), |
605 | $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' )); | 605 | $this->pagination->page_links('?view=' . $view . '&sort=' . $_SESSION['sort'] . (($id)?'&id='.$id:'') . '&' )); |
@@ -903,14 +903,18 @@ class Poche | |||
903 | */ | 903 | */ |
904 | public function export() | 904 | public function export() |
905 | { | 905 | { |
906 | $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; | 906 | $filename = "wallabag-export-".$this->user->getId()."-".date("Y-m-d").".json"; |
907 | header('Content-Disposition: attachment; filename='.$filename); | 907 | header('Content-Disposition: attachment; filename='.$filename); |
908 | 908 | ||
909 | $entries = $this->store->retrieveAllWithTags($this->user->getId()); | 909 | $entries = $this->store->retrieveAllWithTags($this->user->getId()); |
910 | echo $this->tpl->render('export.twig', array( | 910 | if ($entries) { |
911 | 'export' => Tools::renderJson($entries), | 911 | echo $this->tpl->render('export.twig', array( |
912 | )); | 912 | 'export' => Tools::renderJson($entries), |
913 | Tools::logm('export view'); | 913 | )); |
914 | Tools::logm('export view'); | ||
915 | } else { | ||
916 | Tools::logm('error accessing database while exporting'); | ||
917 | } | ||
914 | } | 918 | } |
915 | 919 | ||
916 | /** | 920 | /** |
@@ -986,7 +990,7 @@ class Poche | |||
986 | if (0 == $limit) { | 990 | if (0 == $limit) { |
987 | $limit = count($entries); | 991 | $limit = count($entries); |
988 | } | 992 | } |
989 | if (count($entries) > 0) { | 993 | if ($entries && count($entries) > 0) { |
990 | for ($i = 0; $i < min(count($entries), $limit); $i++) { | 994 | for ($i = 0; $i < min(count($entries), $limit); $i++) { |
991 | $entry = $entries[$i]; | 995 | $entry = $entries[$i]; |
992 | $newItem = $feed->createNewItem(); | 996 | $newItem = $feed->createNewItem(); |
@@ -998,7 +1002,10 @@ class Poche | |||
998 | $feed->addItem($newItem); | 1002 | $feed->addItem($newItem); |
999 | } | 1003 | } |
1000 | } | 1004 | } |
1001 | 1005 | else | |
1006 | { | ||
1007 | Tools::logm("database error while generating feeds"); | ||
1008 | } | ||
1002 | $feed->genarateFeed(); | 1009 | $feed->genarateFeed(); |
1003 | exit; | 1010 | exit; |
1004 | } | 1011 | } |