aboutsummaryrefslogtreecommitdiff
path: root/app/Models
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2025-11-04 12:49:21 +0100
committerGravatar GitHub <noreply@github.com> 2025-11-04 12:49:21 +0100
commitb6c63d223931382aae84dc6d394cdd1bb58121bc (patch)
treef512ea0f11873f89740cb7692442d11b26d59ee3 /app/Models
parent7d4854a0a4f5665db599f18c34035786465639f3 (diff)
Better transitions between groups of articles (#8174)
fix https://github.com/FreshRSS/FreshRSS/issues/7520 fix https://github.com/FreshRSS/FreshRSS/issues/8168 fix https://github.com/FreshRSS/FreshRSS/discussions/8172
Diffstat (limited to 'app/Models')
-rw-r--r--app/Models/CategoryDAO.php3
-rw-r--r--app/Models/Context.php12
-rw-r--r--app/Models/Days.php8
-rw-r--r--app/Models/Entry.php17
4 files changed, 8 insertions, 32 deletions
diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php
index e2fc825ac..e03f69016 100644
--- a/app/Models/CategoryDAO.php
+++ b/app/Models/CategoryDAO.php
@@ -4,6 +4,7 @@ declare(strict_types=1);
class FreshRSS_CategoryDAO extends Minz_ModelPdo {
public const DEFAULTCATEGORYID = 1;
+ public const DEFAULT_CATEGORY_NAME = 'Uncategorized';
public function sqlResetSequence(): bool {
return true; // Nothing to do for MySQL
@@ -14,7 +15,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo {
$stm = $this->pdo->prepare('UPDATE `_category` SET name = :name WHERE id = :id');
if ($stm !== false) {
$stm->bindValue(':id', self::DEFAULTCATEGORYID, PDO::PARAM_INT);
- $stm->bindValue(':name', 'Uncategorized');
+ $stm->bindValue(':name', self::DEFAULT_CATEGORY_NAME);
}
return $stm !== false && $stm->execute();
}
diff --git a/app/Models/Context.php b/app/Models/Context.php
index 8cd78c779..be4a06cc8 100644
--- a/app/Models/Context.php
+++ b/app/Models/Context.php
@@ -232,10 +232,10 @@ final class FreshRSS_Context {
self::$total_important_unread = FreshRSS_Category::countUnread(self::categories(), FreshRSS_Feed::PRIORITY_IMPORTANT);
}
- self::_get(Minz_Request::paramString('get') ?: 'a');
+ self::_get(Minz_Request::paramString('get', plaintext: true) ?: 'a');
self::$state = Minz_Request::paramInt('state') ?: FreshRSS_Context::userConf()->default_state;
- $state_forced_by_user = Minz_Request::paramString('state', true) !== '';
+ $state_forced_by_user = Minz_Request::paramString('state', plaintext: true) !== '';
if (!$state_forced_by_user) {
if (FreshRSS_Context::userConf()->show_fav_unread && (self::isCurrentGet('s') || self::isCurrentGet('T') || self::isTag())) {
self::$state = FreshRSS_Entry::STATE_NOT_READ | FreshRSS_Entry::STATE_READ;
@@ -249,9 +249,9 @@ final class FreshRSS_Context {
}
self::$search = new FreshRSS_BooleanSearch(Minz_Request::paramString('search'));
- $order = Minz_Request::paramString('order', true) ?: FreshRSS_Context::userConf()->sort_order;
+ $order = Minz_Request::paramString('order', plaintext: true) ?: FreshRSS_Context::userConf()->sort_order;
self::$order = in_array($order, ['ASC', 'DESC'], true) ? $order : 'DESC';
- $sort = Minz_Request::paramString('sort', true) ?: FreshRSS_Context::userConf()->sort;
+ $sort = Minz_Request::paramString('sort', plaintext: true) ?: FreshRSS_Context::userConf()->sort;
self::$sort = in_array($sort, ['id', 'c.name', 'date', 'f.name', 'link', 'title', 'rand', 'lastUserModified', 'length'], true) ? $sort : 'id';
self::$number = Minz_Request::paramInt('nb') ?: FreshRSS_Context::userConf()->posts_per_page;
if (self::$number > FreshRSS_Context::userConf()->max_posts_per_rss) {
@@ -260,9 +260,9 @@ final class FreshRSS_Context {
FreshRSS_Context::userConf()->posts_per_page);
}
self::$offset = Minz_Request::paramInt('offset');
- $id_max = Minz_Request::paramString('idMax', true);
+ $id_max = Minz_Request::paramString('idMax', plaintext: true);
self::$id_max = ctype_digit($id_max) ? $id_max : '0';
- $continuation_id = Minz_Request::paramString('cid', true);
+ $continuation_id = Minz_Request::paramString('cid', plaintext: true);
self::$continuation_id = ctype_digit($continuation_id) ? $continuation_id : '0';
self::$sinceHours = Minz_Request::paramInt('hours');
}
diff --git a/app/Models/Days.php b/app/Models/Days.php
deleted file mode 100644
index c445c6355..000000000
--- a/app/Models/Days.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-declare(strict_types=1);
-
-class FreshRSS_Days {
- public const TODAY = 0;
- public const YESTERDAY = 1;
- public const BEFORE_YESTERDAY = 2;
-}
diff --git a/app/Models/Entry.php b/app/Models/Entry.php
index 62d4019d8..3cf6382dd 100644
--- a/app/Models/Entry.php
+++ b/app/Models/Entry.php
@@ -873,23 +873,6 @@ HTML;
$feed->applyFilterActions($this);
}
- public function isDay(int $day, int $today): bool {
- $date = $this->dateAdded(true);
- switch ($day) {
- case FreshRSS_Days::TODAY:
- $tomorrow = $today + 86400;
- return $date >= $today && $date < $tomorrow;
- case FreshRSS_Days::YESTERDAY:
- $yesterday = $today - 86400;
- return $date >= $yesterday && $date < $today;
- case FreshRSS_Days::BEFORE_YESTERDAY:
- $yesterday = $today - 86400;
- return $date < $yesterday;
- default:
- return false;
- }
- }
-
/**
* @param string $url Overridden URL. Will default to the entry URL.
* @throws Minz_Exception