A free, self-hostable news aggregator…
Fix issue #151 : marquer lus les articles du futur
Marien Fressinaud73fe0eabbe44
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.phpindex 679a4201f..4c9eb9d1b 100755--- a/app/controllers/entryController.php+++ b/app/controllers/entryController.php@@ -36,7 +36,7 @@ class entryController extends ActionController {$is_read = Request::param ('is_read');$get = Request::param ('get');$nextGet = Request::param ('nextGet', $get);- $dateMax = Request::param ('dateMax', time ());+ $dateMax = Request::param ('dateMax', 0);$is_read = !!$is_read;diff --git a/app/models/Entry.php b/app/models/Entry.phpindex d5a150bb1..647555ae9 100755--- a/app/models/Entry.php+++ b/app/models/Entry.php@@ -251,11 +251,16 @@ class EntryDAO extends Model_pdo {}}- public function markReadEntries ($read, $dateMax) {- $sql = 'UPDATE ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id SET is_read = ? WHERE date < ? AND priority > 0';- $stm = $this->bd->prepare ($sql);+ public function markReadEntries ($read, $dateMax = 0) {+ $sql = 'UPDATE ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id SET is_read = ? WHERE priority > 0';++ $values = array ($read);+ if ($dateMax > 0) {+ $sql .= ' AND date < ?';+ $values[] = $dateMax;+ }- $values = array ($read, $dateMax);+ $stm = $this->bd->prepare ($sql);if ($stm && $stm->execute ($values)) {return true;@@ -265,11 +270,16 @@ class EntryDAO extends Model_pdo {return false;}}- public function markReadCat ($id, $read, $dateMax) {- $sql = 'UPDATE ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id SET is_read = ? WHERE category = ? AND date < ?';- $stm = $this->bd->prepare ($sql);+ public function markReadCat ($id, $read, $dateMax = 0) {+ $sql = 'UPDATE ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id SET is_read = ? WHERE category = ?';++ $values = array ($read, $id);+ if ($dateMax > 0) {+ $sql .= ' AND date < ?';+ $values[] = $dateMax;+ }- $values = array ($read, $id, $dateMax);+ $stm = $this->bd->prepare ($sql);if ($stm && $stm->execute ($values)) {return true;@@ -279,11 +289,16 @@ class EntryDAO extends Model_pdo {return false;}}- public function markReadFeed ($id, $read, $dateMax) {- $sql = 'UPDATE ' . $this->prefix . 'entry SET is_read = ? WHERE id_feed = ? AND date < ?';- $stm = $this->bd->prepare ($sql);+ public function markReadFeed ($id, $read, $dateMax = 0) {+ $sql = 'UPDATE ' . $this->prefix . 'entry SET is_read = ? WHERE id_feed = ?';- $values = array ($read, $id, $dateMax);+ $values = array ($read, $id);+ if ($dateMax > 0) {+ $sql .= ' AND date < ?';+ $values[] = $dateMax;+ }++ $stm = $this->bd->prepare ($sql);if ($stm && $stm->execute ($values)) {return true;