diff options
Diffstat (limited to 'app/Models/Entry.php')
| -rw-r--r-- | app/Models/Entry.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 9d9f880fd..0fb82a203 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -625,6 +625,10 @@ HTML; } public function matches(FreshRSS_BooleanSearch $booleanSearch): bool { + static $databaseDao = null; + if (!($databaseDao instanceof FreshRSS_DatabaseDAO)) { + $databaseDao = FreshRSS_Factory::createDatabaseDAO(); + } $ok = true; foreach ($booleanSearch->searches() as $filter) { if ($filter instanceof FreshRSS_BooleanSearch) { @@ -695,7 +699,7 @@ HTML; } if ($ok && $filter->getAuthor() !== null) { foreach ($filter->getAuthor() as $author) { - $ok &= stripos(implode(';', $this->authors), $author) !== false; + $ok &= $databaseDao::strilike(implode(';', $this->authors), $author); } } if ($ok && $filter->getAuthorRegex() !== null) { @@ -705,7 +709,7 @@ HTML; } if ($ok && $filter->getNotAuthor() !== null) { foreach ($filter->getNotAuthor() as $author) { - $ok &= stripos(implode(';', $this->authors), $author) === false; + $ok &= !$databaseDao::strilike(implode(';', $this->authors), $author); } } if ($ok && $filter->getNotAuthorRegex() !== null) { @@ -715,7 +719,7 @@ HTML; } if ($ok && $filter->getIntitle() !== null) { foreach ($filter->getIntitle() as $title) { - $ok &= stripos($this->title, $title) !== false; + $ok &= $databaseDao::strilike($this->title, $title); } } if ($ok && $filter->getIntitleRegex() !== null) { @@ -725,7 +729,7 @@ HTML; } if ($ok && $filter->getNotIntitle() !== null) { foreach ($filter->getNotIntitle() as $title) { - $ok &= stripos($this->title, $title) === false; + $ok &= !$databaseDao::strilike($this->title, $title); } } if ($ok && $filter->getNotIntitleRegex() !== null) { @@ -735,7 +739,7 @@ HTML; } if ($ok && $filter->getIntext() !== null) { foreach ($filter->getIntext() as $content) { - $ok &= stripos($this->content, $content) !== false; + $ok &= $databaseDao::strilike($this->content, $content); } } if ($ok && $filter->getIntextRegex() !== null) { @@ -745,7 +749,7 @@ HTML; } if ($ok && $filter->getNotIntext() !== null) { foreach ($filter->getNotIntext() as $content) { - $ok &= stripos($this->content, $content) === false; + $ok &= !$databaseDao::strilike($this->content, $content); } } if ($ok && $filter->getNotIntextRegex() !== null) { @@ -758,7 +762,7 @@ HTML; $found = false; foreach ($this->tags as $tag1) { $tag1 = ltrim($tag1, '#'); - if (strcasecmp($tag1, $tag2) === 0) { + if ($databaseDao::strilike($tag1, $tag2)) { $found = true; break; } @@ -784,7 +788,7 @@ HTML; $found = false; foreach ($this->tags as $tag1) { $tag1 = ltrim($tag1, '#'); - if (strcasecmp($tag1, $tag2) === 0) { + if ($databaseDao::strilike($tag1, $tag2)) { $found = true; break; } @@ -827,12 +831,12 @@ HTML; } if ($ok && $filter->getSearch() !== null) { foreach ($filter->getSearch() as $needle) { - $ok &= (stripos($this->title, $needle) !== false || stripos($this->content, $needle) !== false); + $ok &= ($databaseDao::strilike($this->title, $needle) || $databaseDao::strilike($this->content, $needle)); } } if ($ok && $filter->getNotSearch() !== null) { foreach ($filter->getNotSearch() as $needle) { - $ok &= (stripos($this->title, $needle) === false && stripos($this->content, $needle) === false); + $ok &= (!$databaseDao::strilike($this->title, $needle) && !$databaseDao::strilike($this->content, $needle)); } } if ($ok && $filter->getSearchRegex() !== null) { |
