A free, self-hostable news aggregator…
Corrige bug marquer tous les favoris comme lus
Alexandre Alapetite018273e2720c
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.phpindex d92eb0ed3..d3159c4c3 100755--- a/app/controllers/entryController.php+++ b/app/controllers/entryController.php@@ -47,14 +47,21 @@ class entryController extends ActionController {} else {$typeGet = $get[0];$get = substr ($get, 2);-- if ($typeGet == 'c') {- $entryDAO->markReadCat ($get, $idMax);- $this->params = array ('get' => $nextGet);- } elseif ($typeGet == 'f') {- $entryDAO->markReadFeed ($get, $idMax);- $this->params = array ('get' => $nextGet);+ switch ($typeGet) {+ case 'c':+ $entryDAO->markReadCat ($get, $idMax);+ break;+ case 'f':+ $entryDAO->markReadFeed ($get, $idMax);+ break;+ case 's':+ $entryDAO->markReadEntries ($idMax, true);+ break;+ case 'a':+ $entryDAO->markReadEntries ($idMax);+ break;}+ $this->params = array ('get' => $nextGet);}$notif = array (diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtmlindex c71497ced..5154b4aae 100644--- a/app/layout/nav_menu.phtml+++ b/app/layout/nav_menu.phtml@@ -10,10 +10,12 @@if ($this->get_f) {$get = 'f_' . $this->get_f;$string_mark = Translate::t ('mark_feed_read');- } elseif ($this->get_c &&- $this->get_c != 'a' &&- $this->get_c != 's') {- $get = 'c_' . $this->get_c;+ } elseif ($this->get_c && $this->get_c != 'a') {+ if ($this->get_c === 's') {+ $get = 's';+ } else {+ $get = 'c_' . $this->get_c;+ }$string_mark = Translate::t ('mark_cat_read');}$nextGet = $get;diff --git a/app/models/Entry.php b/app/models/Entry.phpindex 899e98b00..6c37c3d6e 100755--- a/app/models/Entry.php+++ b/app/models/Entry.php@@ -257,11 +257,14 @@ class EntryDAO extends Model_pdo {return false;}}- public function markReadEntries ($idMax = 0) {+ public function markReadEntries ($idMax = 0, $onlyFavorites = false) {if ($idMax === 0) {$sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '. 'SET e.is_read = 1, f.cache_nbUnreads=0 '. 'WHERE e.is_read = 0 AND f.priority > 0';+ if ($onlyFavorites) {+ $sql .= ' AND e.is_favorite = 1';+ }$stm = $this->bd->prepare ($sql);if ($stm && $stm->execute ()) {return $stm->rowCount();@@ -276,6 +279,9 @@ class EntryDAO extends Model_pdo {$sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id '. 'SET e.is_read = 1 '. 'WHERE e.is_read = 0 AND e.id <= ? AND f.priority > 0';+ if ($onlyFavorites) {+ $sql .= ' AND e.is_favorite = 1';+ }$values = array ($idMax);$stm = $this->bd->prepare ($sql);if (!($stm && $stm->execute ($values))) {