A free, self-hostable news aggregator…
Minor syntax changes for: New toggle buttons to filter articles
Alexandre Alapetitef25783ef5de2
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.phpindex 285ad431f..73893a88d 100644--- a/app/Models/EntryDAO.php+++ b/app/Models/EntryDAO.php@@ -406,7 +406,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {return isset ($entries[0]) ? $entries[0] : null;}- private function sqlListWhere($type = 'a', $id = '', $state = null , $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {+ private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {if (!$state) {$state = FreshRSS_Entry::STATE_ALL;}@@ -418,8 +418,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {$where .= 'f.priority > 0 ';$joinFeed = true;break;- case 's':- // This is deprecated. The favorite button does not exist anymore+ case 's': //Deprecated: use $state instead$where .= 'e1.is_favorite = 1 ';break;case 'c':@@ -443,21 +442,17 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {$where .= 'AND e1.is_read = 0 ';}}- if ($state & FreshRSS_Entry::STATE_READ) {- if (!($state & FreshRSS_Entry::STATE_NOT_READ)) {- $where .= 'AND e1.is_read = 1 ';- }- }- if ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) {- if (!($state & FreshRSS_Entry::STATE_FAVORITE)) {- $where .= 'AND e1.is_favorite = 0 ';- }+ elseif ($state & FreshRSS_Entry::STATE_READ) {+ $where .= 'AND e1.is_read = 1 ';}if ($state & FreshRSS_Entry::STATE_FAVORITE) {if (!($state & FreshRSS_Entry::STATE_NOT_FAVORITE)) {$where .= 'AND e1.is_favorite = 1 ';}}+ elseif ($state & FreshRSS_Entry::STATE_NOT_FAVORITE) {+ $where .= 'AND e1.is_favorite = 0 ';+ }switch ($order) {case 'DESC':@@ -539,7 +534,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {. ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/}- public function listWhere($type = 'a', $id = '', $state = null, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {+ public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) {list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault);$sql = 'SELECT e.id, e.guid, e.title, e.author, UNCOMPRESS(e.content_bin) AS content, e.link, e.date, e.is_read, e.is_favorite, e.id_feed, e.tags '@@ -555,7 +550,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {return self::daoToEntry ($stm->fetchAll (PDO::FETCH_ASSOC));}- public function listIdsWhere($type = 'a', $id = '', $state = null, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For API+ public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For APIlist($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault);$stm = $this->bd->prepare($sql);diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtmlindex 58e561754..9990448ba 100644--- a/app/layout/nav_menu.phtml+++ b/app/layout/nav_menu.phtml@@ -9,11 +9,11 @@<?php if ($this->loginOk) { ?><?php $url_state = $this->url;if ($this->state & FreshRSS_Entry::STATE_READ) {- $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_READ;+ $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;$checked = 'true';$class = 'active';} else {- $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_READ;+ $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;$checked = 'false';$class = '';}@@ -28,11 +28,11 @@</a><?phpif ($this->state & FreshRSS_Entry::STATE_NOT_READ) {- $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_NOT_READ;+ $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_READ;$checked = 'true';$class = 'active';} else {- $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_NOT_READ;+ $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_READ;$checked = 'false';$class = '';}@@ -46,11 +46,11 @@</a><?phpif ($this->state & FreshRSS_Entry::STATE_FAVORITE) {- $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_FAVORITE;+ $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_FAVORITE;$checked = 'true';$class = 'active';} else {- $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_FAVORITE;+ $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_FAVORITE;$checked = 'false';$class = '';}@@ -64,11 +64,11 @@</a><?phpif ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) {- $url_state['params']['state'] = $this->state - FreshRSS_Entry::STATE_NOT_FAVORITE;+ $url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_FAVORITE;$checked = 'true';$class = 'active';} else {- $url_state['params']['state'] = $this->state + FreshRSS_Entry::STATE_NOT_FAVORITE;+ $url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_FAVORITE;$checked = 'false';$class = '';}