A free, self-hostable news aggregator…
Suppression multiples requêtes count
Alexandre Alapetite58cb842966f4
diff --git a/app/App_FrontController.php b/app/App_FrontController.phpindex 5569d73a3..950956555 100644--- a/app/App_FrontController.php+++ b/app/App_FrontController.php@@ -43,10 +43,6 @@ class App_FrontController extends FrontController {private function loadParamsView () {$this->conf = Session::param ('conf', new RSSConfiguration ());View::_param ('conf', $this->conf);-- $entryDAO = new EntryDAO ();- View::_param ('nb_not_read', $entryDAO->countNotRead ());-Session::_param ('language', $this->conf->language ());}diff --git a/app/controllers/indexController.php b/app/controllers/indexController.phpindex 2f86034ee..e99ae2e44 100755--- a/app/controllers/indexController.php+++ b/app/controllers/indexController.php@@ -2,7 +2,6 @@class indexController extends ActionController {private $get = false;- private $nb_not_read = 0;private $nb_not_read_cat = 0;public function indexAction () {@@ -56,19 +55,12 @@ class indexController extends ActionController {}}- $nb_not_read = $this->view->nb_not_read;- if($nb_not_read > 0) {- View::appendTitle (' (' . $nb_not_read . ')');- }- View::prependTitle (' - ');-$entryDAO = new EntryDAO ();$feedDAO = new FeedDAO ();$catDAO = new CategoryDAO ();$this->view->cat_aside = $catDAO->listCategories ();$this->view->nb_favorites = $entryDAO->countUnreadReadFavorites ();- $this->view->nb_total = $entryDAO->count ();$this->view->currentName = '';$this->view->get_c = '';@@ -78,6 +70,12 @@ class indexController extends ActionController {$error = $this->checkAndProcessType ($type);// mise à jour des titres+ $this->view->nb_not_read = HelperCategory::CountUnreads($this->view->cat_aside, 1);+ if ($this->view->nb_not_read > 0) {+ View::appendTitle (' (' . $this->view->nb_not_read . ')');+ }+ View::prependTitle (' - ');+$this->view->rss_title = $this->view->currentName . ' - ' . $this->view->rss_title;View::prependTitle ($this->view->currentName .@@ -166,8 +164,11 @@ class indexController extends ActionController {$this->view->get_c = $type['type'];return false;} elseif ($type['type'] == 'c') {- $catDAO = new CategoryDAO ();- $cat = $catDAO->searchById ($type['id']);+ $cat = isset($this->view->cat_aside[$type['id']]) ? $this->view->cat_aside[$type['id']] : null;+ if ($cat === null) {+ $catDAO = new CategoryDAO ();+ $cat = $catDAO->searchById ($type['id']);+ }if ($cat) {$this->view->currentName = $cat->name ();$this->nb_not_read_cat = $cat->nbNotRead ();@@ -177,8 +178,11 @@ class indexController extends ActionController {return true;}} elseif ($type['type'] == 'f') {- $feedDAO = new FeedDAO ();- $feed = $feedDAO->searchById ($type['id']);+ $feed = HelperCategory::findFeed($this->view->cat_aside, $type['id']);+ if (empty($feed)) {+ $feedDAO = new FeedDAO ();+ $feed = $feedDAO->searchById ($type['id']);+ }if ($feed) {$this->view->currentName = $feed->name ();$this->nb_not_read_cat = $feed->nbNotRead ();diff --git a/app/i18n/en.php b/app/i18n/en.phpindex 2f9232160..0a9ca2cb0 100644--- a/app/i18n/en.php+++ b/app/i18n/en.php@@ -19,7 +19,7 @@ return array ('import_export_opml' => 'Import / export (OPML)','subscription_management' => 'Subscriptions management',- 'all_feeds' => 'Main stream (%d)',+ 'all_feeds' => 'Main stream','favorite_feeds' => 'Favourites (%d)','not_read' => '%d unread','not_reads' => '%d unread',diff --git a/app/i18n/fr.php b/app/i18n/fr.phpindex 922bda134..063c0cad7 100644--- a/app/i18n/fr.php+++ b/app/i18n/fr.php@@ -19,7 +19,7 @@ return array ('import_export_opml' => 'Importer / exporter (OPML)','subscription_management' => 'Gestion des abonnements',- 'all_feeds' => 'Flux principal (%d)',+ 'all_feeds' => 'Flux principal','favorite_feeds' => 'Favoris (%d)','not_read' => '%d non lu','not_reads' => '%d non lus',diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtmlindex aa1624f69..511bb4564 100644--- a/app/layout/aside_flux.phtml+++ b/app/layout/aside_flux.phtml@@ -15,7 +15,7 @@<div class="category all"><a data-unread="<?php echo $this->nb_not_read; ?>" class="btn<?php echo $this->get_c == 'all' ? ' active' : ''; ?>" href="<?php echo _url ('index', 'index'); ?>"><i class="icon i_all"></i>- <?php echo Translate::t ('all_feeds', $this->nb_total); ?>+ <?php echo Translate::t ('all_feeds'); ?></a></div></li>