aboutsummaryrefslogtreecommitdiff
path: root/app/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers')
-rwxr-xr-xapp/controllers/entryController.php8
-rwxr-xr-xapp/controllers/feedController.php11
2 files changed, 15 insertions, 4 deletions
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php
index 8016d719f..fa34ad429 100755
--- a/app/controllers/entryController.php
+++ b/app/controllers/entryController.php
@@ -36,23 +36,23 @@ class entryController extends ActionController {
$is_read = Request::param ('is_read');
$get = Request::param ('get');
$nextGet = Request::param ('nextGet', $get);
- $dateMax = Request::param ('dateMax', 0);
+ $idMax = Request::param ('idMax', 0);
$is_read = !!$is_read;
$entryDAO = new EntryDAO ();
if ($id == false) {
if (!$get) {
- $entryDAO->markReadEntries ($dateMax);
+ $entryDAO->markReadEntries ($idMax);
} else {
$typeGet = $get[0];
$get = substr ($get, 2);
if ($typeGet == 'c') {
- $entryDAO->markReadCat ($get, $dateMax);
+ $entryDAO->markReadCat ($get, $idMax);
$this->params = array ('get' => $nextGet);
} elseif ($typeGet == 'f') {
- $entryDAO->markReadFeed ($get, $dateMax);
+ $entryDAO->markReadFeed ($get, $idMax);
$this->params = array ('get' => $nextGet);
}
}
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php
index 8b3667668..cd252b086 100755
--- a/app/controllers/feedController.php
+++ b/app/controllers/feedController.php
@@ -20,6 +20,15 @@ class feedController extends ActionController {
$this->catDAO->checkDefault ();
}
+ private static function entryDateComparer($e1, $e2) {
+ $d1 = $e1->date(true);
+ $d2 = $e2->date(true);
+ if ($d1 === $d2) {
+ return 0;
+ }
+ return ($d1 < $d2) ? -1 : 1;
+ }
+
public function addAction () {
if (Request::isPost ()) {
$url = Request::param ('url_rss');
@@ -75,6 +84,7 @@ class feedController extends ActionController {
} else {
$entryDAO = new EntryDAO ();
$entries = $feed->entries ();
+ usort($entries, 'self::entryDateComparer');
// on calcule la date des articles les plus anciens qu'on accepte
$nb_month_old = $this->view->conf->oldEntries ();
@@ -173,6 +183,7 @@ class feedController extends ActionController {
try {
$feed->load ();
$entries = $feed->entries ();
+ usort($entries, 'self::entryDateComparer');
//For this feed, check last n entry GUIDs already in database
$existingGuids = array_fill_keys ($entryDAO->listLastGuidsByFeed ($feed->id (), count($entries) + 10), 1);