summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-08-19 20:58:18 +0200
committerGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2014-08-19 20:58:18 +0200
commit50075bfbdcd6a7be010eb82ce1fffac0ea283de7 (patch)
tree4613176d3fe655954101024008bd1bea4b0ae232
parent5c2f3349fa4341533aad6294c896b32c4befd58f (diff)
Improvement for ASC order
https://github.com/marienfressinaud/FreshRSS/issues/495
-rw-r--r--app/Models/EntryDAO.php2
-rw-r--r--app/layout/nav_menu.phtml14
2 files changed, 10 insertions, 6 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index a9ffa138b..488b70fb6 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -230,7 +230,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo {
}
$this->bd->beginTransaction();
- $sql = 'UPDATE `' . $this->prefix . 'entry` '
+ $sql = 'UPDATE `' . $this->prefix . 'entry` '
. 'SET is_read=1 '
. 'WHERE id_feed=? AND is_read=0 AND id <= ?';
$values = array($id, $idMax);
diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml
index 73a921c5d..25833c16d 100644
--- a/app/layout/nav_menu.phtml
+++ b/app/layout/nav_menu.phtml
@@ -164,11 +164,15 @@
break;
}
}
- if ($this->order === 'ASC') {
- $idMax = 0;
- } else {
- $p = isset($this->entries[0]) ? $this->entries[0] : null;
- $idMax = $p === null ? '0' : $p->id();
+
+ $p = isset($this->entries[0]) ? $this->entries[0] : null;
+ $idMax = $p === null ? (time() - 1) . '000000' : $p->id();
+
+ if ($this->order === 'ASC') { //In this case we do not know but we guess idMax
+ $idMax2 = (time() - 1) . '000000';
+ if (strcmp($idMax2, $idMax) > 0) {
+ $idMax = $idMax2;
+ }
}
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));