From b6c63d223931382aae84dc6d394cdd1bb58121bc Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 4 Nov 2025 12:49:21 +0100 Subject: 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 --- app/Models/CategoryDAO.php | 3 ++- app/Models/Context.php | 12 ++++++------ app/Models/Days.php | 8 -------- app/Models/Entry.php | 17 ----------------- 4 files changed, 8 insertions(+), 32 deletions(-) delete mode 100644 app/Models/Days.php (limited to 'app/Models') 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 @@ -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 -- cgit v1.2.3