Skip to content

A free, self-hostable news aggregator…

Change feed order in a category (#3131)

Alexis Degrugillieree31722072a8
diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php
index 6f675ead0..61f93d0b7 100644
--- a/app/Models/FeedDAO.php
+++ b/app/Models/FeedDAO.php
@@ -357,14 +357,18 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
}
public function listByCategory($cat) {
- $sql = 'SELECT * FROM `_feed` WHERE category=? ORDER BY name';
+ $sql = 'SELECT * FROM `_feed` WHERE category=?';
$stm = $this->pdo->prepare($sql);
- $values = array($cat);
+ $stm->execute(array($cat));
- $stm->execute($values);
+ $feeds = self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC));
- return self::daoToFeed($stm->fetchAll(PDO::FETCH_ASSOC));
+ usort($feeds, function ($a, $b) {
+ return strnatcasecmp($a->name(), $b->name());
+ });
+
+ return $feeds;
}
public function countEntries($id) {