diff options
| author | 2013-12-03 22:53:51 +0100 | |
|---|---|---|
| committer | 2013-12-03 22:53:51 +0100 | |
| commit | 018273e2720c481c699ecc5cca1cdc90599921f7 (patch) | |
| tree | e3112653abfb687dd65763839a3fc4fefff14030 | |
| parent | 0425432271fb709d94194cfd5ca922038c175573 (diff) | |
Corrige bug marquer tous les favoris comme lus
Corrige https://github.com/marienfressinaud/FreshRSS/issues/270
| -rwxr-xr-x | app/controllers/entryController.php | 21 | ||||
| -rw-r--r-- | app/layout/nav_menu.phtml | 10 | ||||
| -rwxr-xr-x | app/models/Entry.php | 8 |
3 files changed, 27 insertions, 12 deletions
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index 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.phtml index 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.php index 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))) { |
