|
|
@@ -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 API
|
|
|
list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault);
|
|
|
|
|
|
$stm = $this->bd->prepare($sql);
|