summaryrefslogtreecommitdiff
path: root/app/models/Entry.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-03 23:15:20 +0100
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2013-12-03 23:15:20 +0100
commite177b288f5125f9a34059ae8111d02c7f6d51c61 (patch)
tree05930391d0b1803bafb2f67954b24f230d7588c2 /app/models/Entry.php
parentde923b57f44930e424acc7b1a8364365ca15fd84 (diff)
Corrige bug marquage favoris pour f.priority = 0
https://github.com/marienfressinaud/FreshRSS/issues/270
Diffstat (limited to 'app/models/Entry.php')
-rwxr-xr-xapp/models/Entry.php18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/models/Entry.php b/app/models/Entry.php
index 6c37c3d6e..33d0c66bb 100755
--- a/app/models/Entry.php
+++ b/app/models/Entry.php
@@ -257,13 +257,15 @@ class EntryDAO extends Model_pdo {
return false;
}
}
- public function markReadEntries ($idMax = 0, $onlyFavorites = false) {
+ public function markReadEntries ($idMax = 0, $favorites = 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';
+ . 'WHERE e.is_read = 0 AND ';
+ if ($favorites) {
+ $sql .= 'e.is_favorite = 1';
+ } else {
+ $sql .= 'f.priority > 0';
}
$stm = $this->bd->prepare ($sql);
if ($stm && $stm->execute ()) {
@@ -278,9 +280,11 @@ 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';
+ . 'WHERE e.is_read = 0 AND e.id <= ? AND ';
+ if ($favorites) {
+ $sql .= 'e.is_favorite = 1';
+ } else {
+ $sql .= 'f.priority > 0';
}
$values = array ($idMax);
$stm = $this->bd->prepare ($sql);