aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Entry.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-12-31 13:13:03 +0100
committerGravatar GitHub <noreply@github.com> 2021-12-31 13:13:03 +0100
commitf13ef3b102e2724367572f37a1fc57400b443280 (patch)
treea489b3df19374ee47975afdb1ee635009853b7df /app/Models/Entry.php
parent8fc43d5a5676479f60901e6e0360b7caf3d0351a (diff)
Fix article filter (#4092)
#fix https://github.com/FreshRSS/FreshRSS/issues/4057 Several search filters where missing for the automatic article actions
Diffstat (limited to 'app/Models/Entry.php')
-rw-r--r--app/Models/Entry.php44
1 files changed, 31 insertions, 13 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index f75c0d704..d3aa13327 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -260,27 +260,35 @@ class FreshRSS_Entry extends Minz_Model {
}
foreach ($booleanSearch->searches() as $filter) {
$ok = true;
+ if ($ok && $filter->getMinDate()) {
+ $ok &= strnatcmp($this->id, $filter->getMinDate() . '000000') >= 0;
+ }
+ if ($ok && $filter->getNotMinDate()) {
+ $ok &= strnatcmp($this->id, $filter->getNotMinDate() . '000000') < 0;
+ }
+ if ($ok && $filter->getMaxDate()) {
+ $ok &= strnatcmp($this->id, $filter->getMaxDate() . '000000') <= 0;
+ }
+ if ($ok && $filter->getNotMaxDate()) {
+ $ok &= strnatcmp($this->id, $filter->getNotMaxDate() . '000000') > 0;
+ }
if ($ok && $filter->getMinPubdate()) {
$ok &= $this->date >= $filter->getMinPubdate();
}
+ if ($ok && $filter->getNotMinPubdate()) {
+ $ok &= $this->date < $filter->getNotMinPubdate();
+ }
if ($ok && $filter->getMaxPubdate()) {
$ok &= $this->date <= $filter->getMaxPubdate();
}
- if ($ok && $filter->getMinDate()) {
- $ok &= strnatcmp($this->id, $filter->getMinDate() . '000000') >= 0;
- }
- if ($ok && $filter->getMaxDate()) {
- $ok &= strnatcmp($this->id, $filter->getMaxDate() . '000000') <= 0;
+ if ($ok && $filter->getNotMaxPubdate()) {
+ $ok &= $this->date > $filter->getNotMaxPubdate();
}
- if ($ok && $filter->getInurl()) {
- foreach ($filter->getInurl() as $url) {
- $ok &= stripos($this->link, $url) !== false;
- }
+ if ($ok && $filter->getFeedIds()) {
+ $ok &= in_array($this->feedId, $filter->getFeedIds());
}
- if ($ok && $filter->getNotInurl()) {
- foreach ($filter->getNotInurl() as $url) {
- $ok &= stripos($this->link, $url) === false;
- }
+ if ($ok && $filter->getNotFeedIds()) {
+ $ok &= !in_array($this->feedId, $filter->getFeedIds());
}
if ($ok && $filter->getAuthor()) {
foreach ($filter->getAuthor() as $author) {
@@ -324,6 +332,16 @@ class FreshRSS_Entry extends Minz_Model {
$ok &= !$found;
}
}
+ if ($ok && $filter->getInurl()) {
+ foreach ($filter->getInurl() as $url) {
+ $ok &= stripos($this->link, $url) !== false;
+ }
+ }
+ if ($ok && $filter->getNotInurl()) {
+ foreach ($filter->getNotInurl() as $url) {
+ $ok &= stripos($this->link, $url) === false;
+ }
+ }
if ($ok && $filter->getSearch()) {
foreach ($filter->getSearch() as $needle) {
$ok &= (stripos($this->title, $needle) !== false || stripos($this->content, $needle) !== false);