diff options
Diffstat (limited to 'app/Models/EntryDAO.php')
| -rw-r--r-- | app/Models/EntryDAO.php | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 23874a8e1..f9bf57220 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -1112,19 +1112,34 @@ SQL; string $order = 'DESC', string $firstId = '', int $date_min = 0): array { $search = ' '; $values = []; - if ($state & FreshRSS_Entry::STATE_NOT_READ) { - if (!($state & FreshRSS_Entry::STATE_READ)) { - $search .= 'AND ' . $alias . 'is_read=0 '; + if ($state & FreshRSS_Entry::STATE_ANDS) { + if ($state & FreshRSS_Entry::STATE_NOT_READ) { + if (!($state & FreshRSS_Entry::STATE_READ)) { + $search .= 'AND (' . $alias . 'is_read=0) '; + } + } elseif ($state & FreshRSS_Entry::STATE_READ) { + $search .= 'AND (' . $alias . 'is_read=1) '; + } + if ($state & FreshRSS_Entry::STATE_FAVORITE) { + if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { + $search .= 'AND (' . $alias . 'is_favorite=1) '; + } + } elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { + $search .= 'AND (' . $alias . 'is_favorite=0) '; } - } elseif ($state & FreshRSS_Entry::STATE_READ) { - $search .= 'AND ' . $alias . 'is_read=1 '; } - if ($state & FreshRSS_Entry::STATE_FAVORITE) { - if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) { - $search .= 'AND ' . $alias . 'is_favorite=1 '; + if ($state & FreshRSS_Entry::STATE_ORS) { + if (trim($search) === '') { + $search = 'AND (1=0) '; + } + if ($state & FreshRSS_Entry::STATE_OR_NOT_READ) { + $search = rtrim($search, ') '); + $search .= ' OR ' . $alias . 'is_read=0) '; + } + if ($state & FreshRSS_Entry::STATE_OR_FAVORITE) { + $search = rtrim($search, ') '); + $search .= ' OR ' . $alias . 'is_favorite=1) '; } - } elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) { - $search .= 'AND ' . $alias . 'is_favorite=0 '; } switch ($order) { |
