aboutsummaryrefslogtreecommitdiff
path: root/app/models/Entry.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/Entry.php')
-rwxr-xr-xapp/models/Entry.php8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/models/Entry.php b/app/models/Entry.php
index c4856af8b..052e5abff 100755
--- a/app/models/Entry.php
+++ b/app/models/Entry.php
@@ -578,7 +578,9 @@ class EntryDAO extends Model_pdo {
$stm = $this->bd->prepare ($sql);
$stm->execute ();
$res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
- return array('total' => $res[0], 'unread' => $res[1], 'read' => $res[0] - $res[1]);
+ $all = empty($res[0]) ? 0 : $res[0];
+ $unread = empty($res[1]) ? 0 : $res[1];
+ return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread);
}
public function count ($minPriority = null) {
$sql = 'SELECT COUNT(e.id) AS count FROM ' . $this->prefix . 'entry e INNER JOIN ' . $this->prefix . 'feed f ON e.id_feed = f.id';
@@ -607,7 +609,9 @@ class EntryDAO extends Model_pdo {
$stm = $this->bd->prepare ($sql);
$stm->execute ();
$res = $stm->fetchAll (PDO::FETCH_COLUMN, 0);
- return array('all' => $res[0], 'unread' => $res[1], 'read' => $res[0] - $res[1]);
+ $all = empty($res[0]) ? 0 : $res[0];
+ $unread = empty($res[1]) ? 0 : $res[1];
+ return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread);
}
public function optimizeTable() {