From e6436444db9e1bcc13c02c132f327e80d6584df0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 10 Apr 2013 20:55:12 +0200 Subject: Fix bug #49 : les flux sans auteur sont traités normalement désormais MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index e16161842..812227f89 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -33,9 +33,11 @@ class feedController extends ActionController { 'description' => $feed->description (), 'lastUpdate' => time () ); + if ($feedDAO->addFeed ($values)) { $entryDAO = new EntryDAO (); $entries = $feed->entries (); + foreach ($entries as $entry) { $values = $entry->toArray (); $entryDAO->addEntry ($values); -- cgit v1.2.3 From 42100a83223b93060eedc482eda94a890ee01e4a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 10 Apr 2013 21:43:53 +0200 Subject: Fix issue #40 : test des erreurs SimplePie --- app/App_FrontController.php | 1 + app/controllers/feedController.php | 7 +++++++ app/models/Exception/FeedException.php | 7 +++++++ app/models/Feed.php | 4 ++++ 4 files changed, 19 insertions(+) create mode 100644 app/models/Exception/FeedException.php (limited to 'app/controllers') diff --git a/app/App_FrontController.php b/app/App_FrontController.php index fff238bf2..8a5dcdcba 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -24,6 +24,7 @@ class App_FrontController extends FrontController { } private function loadModels () { + include (APP_PATH . '/models/Exception/FeedException.php'); include (APP_PATH . '/models/RSSConfiguration.php'); include (APP_PATH . '/models/Days.php'); include (APP_PATH . '/models/Category.php'); diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 812227f89..c205801af 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -58,6 +58,13 @@ class feedController extends ActionController { ); Session::_param ('notification', $notif); } + } catch (FeedException $e) { + Log::record ($e->getMessage (), Log::ERROR); + $notif = array ( + 'type' => 'bad', + 'content' => 'Un problème interne a été rencontré, le flux n\'a pas pu être ajouté' + ); + Session::_param ('notification', $notif); } catch (FileNotExistException $e) { Log::record ($e->getMessage (), Log::ERROR); // notif diff --git a/app/models/Exception/FeedException.php b/app/models/Exception/FeedException.php new file mode 100644 index 000000000..3fe0f4ea0 --- /dev/null +++ b/app/models/Exception/FeedException.php @@ -0,0 +1,7 @@ +set_cache_location (CACHE_PATH); $feed->init (); + if ($feed->error()) { + throw new FeedException ($feed->error); + } + $subscribe_url = $feed->subscribe_url (); if (!is_null ($subscribe_url) && $subscribe_url != $this->url) { $this->_url ($subscribe_url); -- cgit v1.2.3 From 8938c2547d2bbdba9ee83d293b515d34034fd101 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 10 Apr 2013 22:20:45 +0200 Subject: Catch FeedException lors de l'actualisation --- app/controllers/feedController.php | 30 +++++++++++++++++------------- public/theme/base.css | 2 +- 2 files changed, 18 insertions(+), 14 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index c205801af..77893e547 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -98,23 +98,27 @@ class feedController extends ActionController { $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old); $i = 0; - foreach ($feeds as $feed) { - $feed->load (); - $entries = $feed->entries (); - - foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min) { - $values = $entry->toArray (); - $entryDAO->addEntry ($values); + try { + foreach ($feeds as $feed) { + $feed->load (); + $entries = $feed->entries (); + + foreach ($entries as $entry) { + if ($entry->date (true) >= $date_min) { + $values = $entry->toArray (); + $entryDAO->addEntry ($values); + } } - } - $feedDAO->updateLastUpdate ($feed->id ()); + $feedDAO->updateLastUpdate ($feed->id ()); - $i++; - if ($i >= 10) { - break; + $i++; + if ($i >= 10) { + break; + } } + } catch (FeedException $e) { + Log::record ($e->getMessage (), Log::ERROR); } $entryDAO->cleanOldEntries ($nb_month_old); diff --git a/public/theme/base.css b/public/theme/base.css index 7e2ce0520..98d387150 100644 --- a/public/theme/base.css +++ b/public/theme/base.css @@ -693,7 +693,7 @@ input, select, textarea { width: 30px; height: 40px; vertical-align: middle; - line-height: 35px; + line-height: 40px; font-size: 12px; } .flux_header .item.website { -- cgit v1.2.3 From b9f883be693ecaf0c956c64b9f3bd52f854cb04a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 11 Apr 2013 19:48:52 +0200 Subject: Gestion des flux https invalides + amélioration mise à jour MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 30 +++++++++++++++--------------- app/models/Feed.php | 2 +- lib/SimplePie/SimplePie/File.php | 1 + 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 77893e547..3fbb20835 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -98,27 +98,27 @@ class feedController extends ActionController { $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old); $i = 0; - try { - foreach ($feeds as $feed) { + foreach ($feeds as $feed) { + try { $feed->load (); - $entries = $feed->entries (); + } catch (FeedException $e) { + Log::record ($e->getMessage (), Log::ERROR); + } + $entries = $feed->entries (); - foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min) { - $values = $entry->toArray (); - $entryDAO->addEntry ($values); - } + foreach ($entries as $entry) { + if ($entry->date (true) >= $date_min) { + $values = $entry->toArray (); + $entryDAO->addEntry ($values); } + } - $feedDAO->updateLastUpdate ($feed->id ()); + $feedDAO->updateLastUpdate ($feed->id ()); - $i++; - if ($i >= 10) { - break; - } + $i++; + if ($i >= 10) { + break; } - } catch (FeedException $e) { - Log::record ($e->getMessage (), Log::ERROR); } $entryDAO->cleanOldEntries ($nb_month_old); diff --git a/app/models/Feed.php b/app/models/Feed.php index da75ae8c8..056cbf626 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -124,7 +124,7 @@ class Feed extends Model { ); } else { $feed = new SimplePie (); - $feed->set_feed_url ($this->url); + $feed->set_feed_url (preg_replace ('/&/', '&', $this->url)); $feed->set_cache_location (CACHE_PATH); $feed->init (); diff --git a/lib/SimplePie/SimplePie/File.php b/lib/SimplePie/SimplePie/File.php index b7d1a2ac9..063ad955e 100644 --- a/lib/SimplePie/SimplePie/File.php +++ b/lib/SimplePie/SimplePie/File.php @@ -107,6 +107,7 @@ class SimplePie_File curl_setopt($fp, CURLOPT_REFERER, $url); curl_setopt($fp, CURLOPT_USERAGENT, $useragent); curl_setopt($fp, CURLOPT_HTTPHEADER, $headers2); + curl_setopt($fp, CURLOPT_SSL_VERIFYPEER, false); if (!ini_get('open_basedir') && !ini_get('safe_mode') && version_compare(SimplePie_Misc::get_curl_version(), '7.15.2', '>=')) { curl_setopt($fp, CURLOPT_FOLLOWLOCATION, 1); -- cgit v1.2.3 From 61943f1661383bf8017b4c2a76fd11618e4adae0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 11 Apr 2013 20:32:10 +0200 Subject: Plus possible d'ajouter un flux déjà existant + meilleure gestion actualisation / import OPML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 60 +++++++++++++++++++++++--------------- app/models/Category.php | 4 --- app/models/Entry.php | 2 -- app/models/Feed.php | 18 ++++++++++-- 4 files changed, 52 insertions(+), 32 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 3fbb20835..d2a2f29f5 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -34,7 +34,13 @@ class feedController extends ActionController { 'lastUpdate' => time () ); - if ($feedDAO->addFeed ($values)) { + if ($feedDAO->searchByUrl ($values['url'])) { + $notif = array ( + 'type' => 'bad', + 'content' => 'Vous êtes déjà abonné à ' . $feed->name () . '' + ); + Session::_param ('notification', $notif); + } elseif ($feedDAO->addFeed ($values)) { $entryDAO = new EntryDAO (); $entries = $feed->entries (); @@ -101,19 +107,19 @@ class feedController extends ActionController { foreach ($feeds as $feed) { try { $feed->load (); - } catch (FeedException $e) { - Log::record ($e->getMessage (), Log::ERROR); - } - $entries = $feed->entries (); + $entries = $feed->entries (); - foreach ($entries as $entry) { - if ($entry->date (true) >= $date_min) { - $values = $entry->toArray (); - $entryDAO->addEntry ($values); + foreach ($entries as $entry) { + if ($entry->date (true) >= $date_min) { + $values = $entry->toArray (); + $entryDAO->addEntry ($values); + } } - } - $feedDAO->updateLastUpdate ($feed->id ()); + $feedDAO->updateLastUpdate ($feed->id ()); + } catch (FeedException $e) { + Log::record ($e->getMessage (), Log::ERROR); + } $i++; if ($i >= 10) { @@ -153,20 +159,26 @@ class feedController extends ActionController { $i = 0; foreach ($feeds as $feed) { - $feed->load (); + try { + $feed->load (); - // Enregistrement du flux - $values = array ( - 'id' => $feed->id (), - 'url' => $feed->url (), - 'category' => $feed->category (), - 'name' => $feed->name (), - 'website' => $feed->website (), - 'description' => $feed->description (), - 'lastUpdate' => 0 - ); + // Enregistrement du flux + $values = array ( + 'id' => $feed->id (), + 'url' => $feed->url (), + 'category' => $feed->category (), + 'name' => $feed->name (), + 'website' => $feed->website (), + 'description' => $feed->description (), + 'lastUpdate' => 0 + ); - $feedDAO->addFeed ($values); + if (!$feedDAO->searchByUrl ($values['url'])) { + $feedDAO->addFeed ($values); + } + } catch (FeedException $e) { + Log::record ($e->getMessage (), Log::ERROR); + } } Request::forward (array ( @@ -203,7 +215,7 @@ class feedController extends ActionController { $catDAO = new CategoryDAO (); foreach ($categories as $cat) { - if (!$catDAO->searchByName ()) { + if (!$catDAO->searchByName ($cat->name ())) { $values = array ( 'id' => $cat->id (), 'name' => $cat->name (), diff --git a/app/models/Category.php b/app/models/Category.php index a153b8838..ae803591f 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -130,8 +130,6 @@ class CategoryDAO extends Model_pdo { if (isset ($cat[0])) { return $cat[0]; } else { - $info = $stm->errorInfo(); - Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } @@ -148,8 +146,6 @@ class CategoryDAO extends Model_pdo { if (isset ($cat[0])) { return $cat[0]; } else { - $info = $stm->errorInfo(); - Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } diff --git a/app/models/Entry.php b/app/models/Entry.php index 4c672bcf3..c8d05c5eb 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -372,8 +372,6 @@ class EntryDAO extends Model_pdo { if (isset ($entry[0])) { return $entry[0]; } else { - $info = $stm->errorInfo(); - Log::record ('SQL error : ' . $info[2], Log::ERROR); return false; } } diff --git a/app/models/Feed.php b/app/models/Feed.php index 056cbf626..2e6782921 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -287,8 +287,22 @@ class FeedDAO extends Model_pdo { if (isset ($feed[$id])) { return $feed[$id]; } else { - $info = $stm->errorInfo(); - Log::record ('SQL error : ' . $info[2], Log::ERROR); + return false; + } + } + public function searchByUrl ($url) { + $sql = 'SELECT * FROM feed WHERE url=?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($url); + + $stm->execute ($values); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $feed = current (HelperFeed::daoToFeed ($res)); + + if (isset ($feed)) { + return $feed; + } else { return false; } } -- cgit v1.2.3 From e2171de4e6b090fbbad07d8852a068ec7ca050c0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 11 Apr 2013 21:27:29 +0200 Subject: Fix issue #37 : possibilité de sortir un site du flux principal (utile pour les sites qui publient beaucoup) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 4 +++- app/controllers/indexController.php | 4 +--- app/models/Entry.php | 23 ++++++++++------------- app/models/Feed.php | 11 +++++++++++ app/views/configure/feed.phtml | 15 ++++++++++----- 5 files changed, 35 insertions(+), 22 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 243c155f9..01ed4d414 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -88,10 +88,12 @@ class configureController extends ActionController { if (Request::isPost () && $this->view->flux) { $cat = Request::param ('category', 0); $path = Request::param ('path_entries', ''); + $priority = Request::param ('priority', 0); $values = array ( 'category' => $cat, - 'pathEntries' => $path + 'pathEntries' => $path, + 'priority' => $priority ); if ($feedDAO->updateFeed ($id, $values)) { diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index c83f7f1d2..1eba7231f 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -76,9 +76,7 @@ class indexController extends ActionController { try { $this->view->entryPaginator = $entryDAO->getPaginator ($entries); - } catch (CurrentPagePaginationException $e) { - - } + } catch (CurrentPagePaginationException $e) { } $this->view->cat_aside = $catDAO->listCategories (); $this->view->nb_favorites = $entryDAO->countFavorites (); diff --git a/app/models/Entry.php b/app/models/Entry.php index c8d05c5eb..770b27eed 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -272,7 +272,7 @@ class EntryDAO extends Model_pdo { } public function markReadEntries ($read, $dateMax) { - $sql = 'UPDATE entry SET is_read = ? WHERE date < ?'; + $sql = 'UPDATE entry e INNER JOIN feed f ON e.id_feed = f.id SET is_read = ? WHERE date < ? AND priority > 0'; $stm = $this->bd->prepare ($sql); $values = array ($read, $dateMax); @@ -377,19 +377,15 @@ class EntryDAO extends Model_pdo { } public function listEntries ($mode, $search = false, $order = 'high_to_low') { - $where = ''; + $where = ' WHERE priority > 0'; if ($mode == 'not_read') { - $where = ' WHERE is_read=0'; + $where .= ' AND is_read=0'; } $values = array(); if ($search) { $values[] = '%'.$search.'%'; - if ($mode == 'not_read') { - $where = ' AND title LIKE ?'; - } else { - $where = ' WHERE title LIKE ?'; - } + $where .= ' AND title LIKE ?'; } if ($order == 'low_to_high') { @@ -398,7 +394,7 @@ class EntryDAO extends Model_pdo { $order = ''; } - $sql = 'SELECT COUNT(*) AS count FROM entry' . $where; + $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id' . $where; $stm = $this->bd->prepare ($sql); $stm->execute ($values); $res = $stm->fetchAll (PDO::FETCH_ASSOC); @@ -407,7 +403,8 @@ class EntryDAO extends Model_pdo { $deb = ($this->currentPage () - 1) * $this->nbItemsPerPage; $fin = $this->nbItemsPerPage; - $sql = 'SELECT * FROM entry' . $where + $sql = 'SELECT * FROM entry e' + . ' INNER JOIN feed f ON e.id_feed = f.id' . $where . ' ORDER BY date' . $order . ' LIMIT ' . $deb . ', ' . $fin; $stm = $this->bd->prepare ($sql); @@ -553,7 +550,7 @@ class EntryDAO extends Model_pdo { } public function count () { - $sql = 'SELECT COUNT(*) AS count FROM entry'; + $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE priority > 0'; $stm = $this->bd->prepare ($sql); $stm->execute (); $res = $stm->fetchAll (PDO::FETCH_ASSOC); @@ -562,11 +559,11 @@ class EntryDAO extends Model_pdo { } public function countNotRead () { - $sql = 'SELECT COUNT(*) AS count FROM entry WHERE is_read=0'; + $sql = 'SELECT COUNT(*) AS count FROM entry e INNER JOIN feed f ON e.id_feed = f.id WHERE is_read=0 AND priority > 0'; $stm = $this->bd->prepare ($sql); $stm->execute (); $res = $stm->fetchAll (PDO::FETCH_ASSOC); - + Log::record ('not read : ' . $res[0]['count'], Log::NOTICE); return $res[0]['count']; } diff --git a/app/models/Feed.php b/app/models/Feed.php index 2e6782921..50632f5a7 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -9,6 +9,7 @@ class Feed extends Model { private $website = ''; private $description = ''; private $lastUpdate = 0; + private $priority = 10; private $pathEntries = ''; private $httpAuth = ''; @@ -48,6 +49,9 @@ class Feed extends Model { public function lastUpdate () { return $this->lastUpdate; } + public function priority () { + return $this->priority; + } public function pathEntries () { return $this->pathEntries; } @@ -108,6 +112,12 @@ class Feed extends Model { public function _lastUpdate ($value) { $this->lastUpdate = $value; } + public function _priority ($value) { + if (!is_int (intval ($value))) { + $value = 10; + } + $this->priority = $value; + } public function _pathEntries ($value) { $this->pathEntries = $value; } @@ -382,6 +392,7 @@ class HelperFeed { $list[$key]->_website ($dao['website']); $list[$key]->_description ($dao['description']); $list[$key]->_lastUpdate ($dao['lastUpdate']); + $list[$key]->_priority ($dao['priority']); $list[$key]->_pathEntries ($dao['pathEntries']); $list[$key]->_httpAuth ($dao['httpAuth']); diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 2adc5c839..adea27e52 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -9,28 +9,25 @@
Informations -
-
-
flux->nbEntries (); ?>
- + Catégorie - gestion
@@ -45,6 +42,15 @@
Avancé +
+ +
+ +
+
@@ -52,7 +58,6 @@ Permet de récupérer les flux tronqués (attention, demande plus de temps !)
- + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + + diff --git a/public/theme/icons/share.svg b/public/theme/icons/share.svg new file mode 100644 index 000000000..443321882 --- /dev/null +++ b/public/theme/icons/share.svg @@ -0,0 +1,34 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From a4beb7b772fdc3c8c894b93611bfb030c9456f07 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 13 Apr 2013 14:26:13 +0200 Subject: Correction faute dans about + ajout options mise à jour et marquer comme lu pour un flux spécifiée MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 32 +++++++++++++++++++++++++++----- app/layout/aside_flux.phtml | 7 +++++-- app/views/index/about.phtml | 2 +- 3 files changed, 33 insertions(+), 8 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 3e6ae4800..d2a2184eb 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -97,7 +97,16 @@ class feedController extends ActionController { $feedDAO = new FeedDAO (); $entryDAO = new EntryDAO (); - $feeds = $feedDAO->listFeedsOrderUpdate (); + $id = Request::param ('id'); + $feeds = array (); + if ($id) { + $feed = $feedDAO->searchById ($id); + if ($feed) { + $feeds = array ($feed); + } + } else { + $feeds = $feedDAO->listFeedsOrderUpdate (); + } // pour ne pas ajouter des entrées trop anciennes $nb_month_old = $this->view->conf->oldEntries (); @@ -130,10 +139,23 @@ class feedController extends ActionController { $entryDAO->cleanOldEntries ($nb_month_old); // notif - $notif = array ( - 'type' => 'good', - 'content' => $i . ' flux ont été mis à jour' - ); + if ($i == 1) { + $feed = reset ($feeds); + $notif = array ( + 'type' => 'good', + 'content' => '' . $feed->name () . ' a été mis à jour' + ); + } elseif ($i > 0) { + $notif = array ( + 'type' => 'good', + 'content' => $i . ' flux ont été mis à jour' + ); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => 'Aucun flux n\'a pu être mis à jour' + ); + } Session::_param ('notification', $notif); Request::forward (array (), true); diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index b12edfbc7..3a6ecb304 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -74,11 +74,14 @@ diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml index ad3eb6cc6..73f5f4001 100644 --- a/app/views/index/about.phtml +++ b/app/views/index/about.phtml @@ -20,5 +20,5 @@

FreshRSS est un agrégateur de flux RSS à auto-héberger à l'image de RSSLounge, TinyTinyRSS ou Leed. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. L'objectif étant d'offrir une alternative sérieuse au futur feu-Google Reader.

Crédits

- Les icônes sont issus du projet GNOME. La police Open Sans utilisée a été créée par Steve Matteson. Les favicons sont récupérés grâce au site getFavicon. FreshRSS repose sur Minz, un framework PHP. + Des éléments de design sont issus du projet Bootstrap bien que FreshRSS n'utilise pas ce framework. Les icônes sont issues du projet GNOME. La police Open Sans utilisée a été créée par Steve Matteson. Les favicons sont récupérés grâce au site getFavicon. FreshRSS repose sur Minz, un framework PHP. -- cgit v1.2.3 From 9b9543109e36a5409fe71eb084cfac680dfc7cbd Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 13 Apr 2013 15:27:36 +0200 Subject: Fix issue #39 : actualisation de tous les flux grâce à Ajax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 8 ++++-- app/controllers/indexController.php | 1 + app/controllers/javascriptController.php | 9 ++++--- app/layout/nav_menu.phtml | 2 +- app/views/javascript/actualize.phtml | 46 ++++++++++++++++++++++++++++++++ public/theme/freshrss.css | 20 ++++++++++++++ 6 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 app/views/javascript/actualize.phtml (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index d2a2184eb..83fc19e20 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -156,9 +156,13 @@ class feedController extends ActionController { 'content' => 'Aucun flux n\'a pu être mis à jour' ); } - Session::_param ('notification', $notif); - Request::forward (array (), true); + if (Request::param ('ajax', 0) == 0) { + Session::_param ('notification', $notif); + Request::forward (array (), true); + } else { + $this->view->_useLayout (false); + } } public function massiveImportAction () { diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index a11c26044..8fa911631 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -8,6 +8,7 @@ class indexController extends ActionController { public function indexAction () { View::appendScript (Url::display ('/scripts/shortcut.js')); View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main'))); + View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'actualize'))); $entryDAO = new EntryDAO (); $feedDAO = new FeedDAO (); diff --git a/app/controllers/javascriptController.php b/app/controllers/javascriptController.php index 8060f560c..071cf65a4 100755 --- a/app/controllers/javascriptController.php +++ b/app/controllers/javascriptController.php @@ -5,8 +5,11 @@ class javascriptController extends ActionController { $this->view->_useLayout (false); header('Content-type: text/javascript'); } - - public function mainAction () { - + + public function mainAction () {} + + public function actualizeAction () { + $feedDAO = new FeedDAO (); + $this->view->feeds = $feedDAO->listFeeds (); } } diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 90fe4aea1..5d7dd3091 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -1,7 +1,7 @@ + Partage +
+ +
+ +
+
+
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index cd0ff0504..6889a8b51 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -80,6 +80,12 @@ if (isset ($this->entryPaginator)) {
  • Par mail
  • + conf->urlShaarli (); + if ($shaarli) { + ?> +
  • Shaarli
  • +
    diff --git a/public/install.php b/public/install.php index fca4ff38e..7065e3a77 100644 --- a/public/install.php +++ b/public/install.php @@ -91,32 +91,13 @@ function saveStep2 () { $file_data = PUBLIC_PATH . '/data/Configuration.array.php'; - $conf = array ( - 'posts_per_page' => 20, - 'default_view' => 'not_read', - 'display_posts' => 'no', - 'sort_order' => 'low_to_high', - 'old_entries' => $_SESSION['old_entries'], - 'mail_login' => $_SESSION['mail_login'], - 'shortcuts' => array ( - 'mark_read' => 'r', - 'mark_favorite' => 'f', - 'go_website' => 'space', - 'next_entry' => 'j', - 'prev_entry' => 'k', - 'next_page' => 'right', - 'prev_page' => 'left', - ), - 'mark_when' => array ( - 'article' => 'yes', - 'site' => 'yes', - 'page' => 'no', - ), - ); $f = fopen ($file_data, 'w'); writeLine ($f, ' $_SESSION['old_entries'], + 'mail_login' => $_SESSION['mail_login'] + )); writeLine ($f, ');'); fclose ($f); -- cgit v1.2.3 From 392672ab2771c6d22f55017c4ed64a0e00945b23 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 17 Apr 2013 19:05:53 +0200 Subject: Fix issue #58 : possibilité de vider une catégorie MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 1 + app/controllers/feedController.php | 38 +++++++++++++++++++++++++++------ app/models/Category.php | 14 ++++++++++++ app/models/Feed.php | 14 ++++++++++++ app/views/configure/categorize.phtml | 11 +++++++--- 5 files changed, 68 insertions(+), 10 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 428768b9b..9f4a8b24a 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -56,6 +56,7 @@ class configureController extends ActionController { } $this->view->categories = $catDAO->listCategories (); + $this->view->defaultCategory = $catDAO->getDefault (); View::prependTitle ('Gestion des catégories - '); } diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index fb0f790fd..7a34430ea 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -228,19 +228,43 @@ class feedController extends ActionController { array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')) ); } else { + $type = Request::param ('type', 'feed'); $id = Request::param ('id'); $feedDAO = new FeedDAO (); - $feedDAO->deleteFeed ($id); + if ($type == 'category') { + if ($feedDAO->deleteFeedByCategory ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => 'La catégorie a été vidée' + ); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => 'Un problème est survenu' + ); + } + } else { + if ($feedDAO->deleteFeed ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => 'Le flux a été supprimé' + ); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => 'Un problème est survenu' + ); + } + } - // notif - $notif = array ( - 'type' => 'good', - 'content' => 'Le flux a été supprimé' - ); Session::_param ('notification', $notif); - Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + if ($type == 'category') { + Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } else { + Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + } } } diff --git a/app/models/Category.php b/app/models/Category.php index ae803591f..7ce572e71 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -158,6 +158,20 @@ class CategoryDAO extends Model_pdo { return HelperCategory::daoToCategory ($stm->fetchAll (PDO::FETCH_ASSOC)); } + public function getDefault () { + $sql = 'SELECT * FROM category WHERE id="000000"'; + $stm = $this->bd->prepare ($sql); + + $stm->execute (); + $res = $stm->fetchAll (PDO::FETCH_ASSOC); + $cat = HelperCategory::daoToCategory ($res); + + if (isset ($cat[0])) { + return $cat[0]; + } else { + return false; + } + } public function checkDefault () { $def_cat = $this->searchById ('000000'); diff --git a/app/models/Feed.php b/app/models/Feed.php index 070f044a9..222e22256 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -283,6 +283,20 @@ class FeedDAO extends Model_pdo { return false; } } + public function deleteFeedByCategory ($id) { + $sql = 'DELETE FROM feed WHERE category=?'; + $stm = $this->bd->prepare ($sql); + + $values = array ($id); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); + return false; + } + } public function searchById ($id) { $sql = 'SELECT * FROM feed WHERE id=?'; diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 943dd489e..660ddef20 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -6,13 +6,18 @@ Gestion des catégories - gestion des flux +

    Lors de la suppression d'une catégorie, ses flux seront automatiquement classés dans defaultCategory->name (); ?>.

    + categories as $cat) { $i++; ?>
    - +
    - id () == '000000') { ?> - ne peut pas être supprimé + Vider ? (nbFeed (); ?> flux) + id () == $this->defaultCategory->id ()) { ?> + ne peut pas être supprimée
    -- cgit v1.2.3 From 244026874aba991e7feb37f74a61b192f1bda5ac Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 17 Apr 2013 19:24:21 +0200 Subject: Fix issue #61 : amélioration import OPML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 23 +++++++++++++++++++---- lib/lib_rss.php | 6 +++++- 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 7a34430ea..c67609d57 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -190,6 +190,7 @@ class feedController extends ActionController { $nb_month_old = $this->view->conf->oldEntries (); $date_min = time () - (60 * 60 * 24 * 30 * $nb_month_old); + $error = false; $i = 0; foreach ($feeds as $feed) { try { @@ -207,17 +208,31 @@ class feedController extends ActionController { ); if (!$feedDAO->searchByUrl ($values['url'])) { - $feedDAO->addFeed ($values); + if (!$feedDAO->addFeed ($values)) { + $error = true; + } } } catch (FeedException $e) { + $error = true; Log::record ($e->getMessage (), Log::ERROR); } } + if ($error) { + $res = 'Les flux ont été importés mais des erreurs sont survenus'; + } else { + $res = 'Les flux ont été importés'; + } + $notif = array ( + 'type' => 'good', + 'content' => $res + ); + Session::_param ('notification', $notif); + Request::forward (array ( - 'c' => 'feed', - 'a' => 'actualize' - )); + 'c' => 'configure', + 'a' => 'importExport' + ), true); } } diff --git a/lib/lib_rss.php b/lib/lib_rss.php index b9202755b..81a98590e 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -124,7 +124,11 @@ function opml_import ($xml) { } if ($title) { - $cat = new Category ($title); + $catDAO = new CategoryDAO (); + $cat = $catDAO->searchByName ($title); + if ($cat === false) { + $cat = new Category ($title); + } $categories[] = $cat; $feeds = array_merge ($feeds, getFeedsOutline ($outline, $cat->id ())); -- cgit v1.2.3 From a2b5e8f3ce597fbcec0c25b68c551a526d2bf3ec Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 17 Apr 2013 19:31:20 +0200 Subject: Fix issue #60 : export OPML dans un fichier téléchargeable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 3 ++- app/views/configure/importExport.phtml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 9f4a8b24a..18a56c066 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -184,7 +184,8 @@ class configureController extends ActionController { View::_title ('feeds_opml.xml'); $this->view->_useLayout (false); - header('Content-type: text/xml'); + header('Content-Type: text/xml; charset=utf-8'); + header('Content-disposition: attachment; filename=feeds_opml.xml'); $feedDAO = new FeedDAO (); $catDAO = new CategoryDAO (); diff --git a/app/views/configure/importExport.phtml b/app/views/configure/importExport.phtml index cd677c1eb..34bee4a07 100644 --- a/app/views/configure/importExport.phtml +++ b/app/views/configure/importExport.phtml @@ -29,7 +29,7 @@
    ou - + Exporter
    -- cgit v1.2.3