From a6982216253d1356621916bb2b7734320fedec0d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 24 Apr 2013 22:14:49 +0200 Subject: Fix issue #55 : affichage des tags associés aux articles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Entry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'app/models') diff --git a/app/models/Entry.php b/app/models/Entry.php index 230b457bf..3daec5aa9 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -216,7 +216,7 @@ class Entry extends Model { class EntryDAO extends Model_pdo { public function addEntry ($valuesTmp) { - $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, lastUpdate) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; + $sql = 'INSERT INTO entry(id, guid, title, author, content, link, date, is_read, is_favorite, is_public, id_feed, lastUpdate, tags) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'; $stm = $this->bd->prepare ($sql); $values = array ( @@ -232,6 +232,7 @@ class EntryDAO extends Model_pdo { $valuesTmp['is_public'], $valuesTmp['id_feed'], $valuesTmp['lastUpdate'], + $valuesTmp['tags'], ); if ($stm && $stm->execute ($values)) { -- cgit v1.2.3 From 70d75f0cf5304c1f8ef121538f9e4e166bb7b755 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 27 Apr 2013 16:45:16 +0200 Subject: Possibilité de choisir la langue à utiliser + fin traduction en anglais (bug #38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/App_FrontController.php | 6 ++++-- app/controllers/configureController.php | 6 ++++++ app/i18n/en.php | 5 +++-- app/i18n/fr.php | 1 + app/models/RSSConfiguration.php | 26 ++++++++++++++++++++++++-- app/views/configure/display.phtml | 12 ++++++++++++ 6 files changed, 50 insertions(+), 6 deletions(-) (limited to 'app/models') diff --git a/app/App_FrontController.php b/app/App_FrontController.php index 177e83b66..8b515873a 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -11,12 +11,12 @@ class App_FrontController extends FrontController { $this->loadModels (); Session::init (); // lancement de la session doit se faire après chargement des modèles sinon bug (pourquoi ?) - Session::_param ('language', 'fr'); - Translate::init (); $this->loadParamsView (); $this->loadStylesAndScripts (); $this->loadNotifications (); + + Translate::init (); } private function loadLibs () { @@ -41,6 +41,8 @@ class App_FrontController extends FrontController { $entryDAO = new EntryDAO (); View::_param ('nb_not_read', $entryDAO->countNotRead ()); + + Session::_param ('language', $this->conf->language ()); } private function loadStylesAndScripts () { diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 11b55f4b0..81a8e97d7 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -124,6 +124,7 @@ class configureController extends ActionController { public function displayAction () { if (Request::isPost ()) { + $language = Request::param ('language', 'en'); $nb = Request::param ('posts_per_page', 10); $view = Request::param ('default_view', 'all'); $display = Request::param ('display_posts', 'no'); @@ -135,6 +136,7 @@ class configureController extends ActionController { $openPage = Request::param ('mark_open_page', 'no'); $urlShaarli = Request::param ('shaarli', ''); + $this->view->conf->_language ($language); $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); $this->view->conf->_displayPosts ($display); @@ -149,6 +151,7 @@ class configureController extends ActionController { $this->view->conf->_urlShaarli ($urlShaarli); $values = array ( + 'language' => $this->view->conf->language (), 'posts_per_page' => $this->view->conf->postsPerPage (), 'default_view' => $this->view->conf->defaultView (), 'display_posts' => $this->view->conf->displayPosts (), @@ -164,6 +167,9 @@ class configureController extends ActionController { Session::_param ('conf', $this->view->conf); Session::_param ('mail', $this->view->conf->mailLogin ()); + Session::_param ('language', $this->view->conf->language ()); + Translate::reset (); + // notif $notif = array ( 'type' => 'good', diff --git a/app/i18n/en.php b/app/i18n/en.php index 23b2ae17b..203904c9d 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -131,6 +131,7 @@ return array ( 'think_to_add' => 'Think to add RSS feeds!', 'general_configuration' => 'General configuration', + 'language' => 'Language', 'delete_articles_every' => 'Remove articles every', 'month' => 'months', 'persona_connection_email' => 'Login mail address (use Persona)', @@ -180,9 +181,9 @@ return array ( 'github_or_email' => 'on Github or by mail', 'license' => 'License', 'agpl3' => 'AGPL 3', - 'freshrss_description' => '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.', + 'freshrss_description' => 'FreshRSS is a RSS feeds aggregator to self-host like RSSLounge, TinyTinyRSS or Leed. It is light and easy to take in hand while being powerful and configurable tool. Objective is to provide a serious alternative to Google Reader.', 'credits' => 'Credits', - 'credits_content' => '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.', + 'credits_content' => 'Some design elements come from Bootstrap although FreshRSS doesn\'t use this framework. Icons come from GNOME project. Open Sans font police used has been created by Steve Matteson. Favicons are collected with getFavicon API. FreshRSS is based on Minz, a PHP framework.', // DATE 'january' => 'january', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 39208cef8..0473a8f94 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -131,6 +131,7 @@ return array ( 'think_to_add' => 'Pensez à en ajouter !', 'general_configuration' => 'Configuration générale', + 'language' => 'Langue', 'delete_articles_every' => 'Supprimer les articles tous les', 'month' => 'mois', 'persona_connection_email' => 'Adresse mail de connexion (utilise Persona)', diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index ca56ec3a8..00fe3fe52 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -1,6 +1,11 @@ 'English', + 'fr' => 'Français', + ); + private $language; private $posts_per_page; private $default_view; private $display_posts; @@ -13,6 +18,7 @@ class RSSConfiguration extends Model { public function __construct () { $confDAO = new RSSConfigurationDAO (); + $this->_language ($confDAO->language); $this->_postsPerPage ($confDAO->posts_per_page); $this->_defaultView ($confDAO->default_view); $this->_displayPosts ($confDAO->display_posts); @@ -24,6 +30,12 @@ class RSSConfiguration extends Model { $this->_urlShaarli ($confDAO->url_shaarli); } + public function availableLanguages () { + return $this->available_languages; + } + public function language () { + return $this->language; + } public function postsPerPage () { return $this->posts_per_page; } @@ -60,7 +72,13 @@ class RSSConfiguration extends Model { public function urlShaarli () { return $this->url_shaarli; } - + + public function _language ($value) { + if (!isset ($this->available_languages[$value])) { + $value = 'en'; + } + $this->language = $value; + } public function _postsPerPage ($value) { if (is_int (intval ($value))) { $this->posts_per_page = $value; @@ -122,6 +140,7 @@ class RSSConfiguration extends Model { } class RSSConfigurationDAO extends Model_array { + public $language = 'en'; public $posts_per_page = 20; public $default_view = 'not_read'; public $display_posts = 'no'; @@ -146,7 +165,10 @@ class RSSConfigurationDAO extends Model_array { public function __construct () { parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php'); - + + if (isset ($this->array['language'])) { + $this->language = $this->array['language']; + } if (isset ($this->array['posts_per_page'])) { $this->posts_per_page = $this->array['posts_per_page']; } diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index fcae83d9a..be67896dc 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -6,6 +6,18 @@
+
+ +
+ +
+
+
-- cgit v1.2.3 From 10b9797da7696babc092354c3a156ff1683e0e0d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 27 Apr 2013 18:58:09 +0200 Subject: L'installateur gère désormais l'internationalisation et détecte la langue préférée de l'utilisateur (fix bug #38) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/i18n/en.php | 52 +++++++++++ app/i18n/fr.php | 52 +++++++++++ app/models/Category.php | 2 +- public/install.php | 231 ++++++++++++++++++++++++++++++++++++------------ 4 files changed, 278 insertions(+), 59 deletions(-) (limited to 'app/models') diff --git a/app/i18n/en.php b/app/i18n/en.php index 203904c9d..921f86ddc 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -51,6 +51,7 @@ return array ( 'error_occurred' => 'An error occured', 'error_occurred_update' => 'An error occured during update', + 'default_category' => 'Uncategorized', 'categories_updated' => 'Categories have been updated', 'categories_management' => 'Categories management', 'feed_updated' => 'Feed has been updated', @@ -214,4 +215,55 @@ return array ( // format for date() function, %s allows to indicate month in letter 'format_date' => '%s dS Y', 'format_date_hour' => '%s dS Y \a\t H\.i', + + // INSTALLATION + 'freshrss_installation' => 'Installation - FreshRSS', + 'freshrss' => 'FreshRSS', + 'installation_step' => 'Installation - step %d', + 'steps' => 'Steps', + 'checks' => 'Checks', + 'bdd_configuration' => 'Database configuration', + 'this_is_the_end' => 'This is the end', + + 'ok' => 'Ok!', + 'congratulations' => 'Congratulations!', + 'attention' => 'Attention!', + 'damn' => 'Damn!', + 'oops' => 'Oops!', + 'next_step' => 'Go to the next step', + + 'language_defined' => 'Language has been defined.', + 'choose_language' => 'Choose a language for FreshRSS', + + 'javascript_is_better' => 'FreshRSS is more pleasant with Javascript enabled', + 'php_is_ok' => 'Your PHP version is %s and it\'s compatible with FreshRSS', + 'php_is_nok' => 'Your PHP version is %s. You must have at least version %s', + 'minz_is_ok' => 'You have Minz framework', + 'minz_is_nok' => 'You haven\'t Minz framework. You should execute build.sh script or download it on Github and install in %s directory the content of its /lib directory.', + 'curl_is_ok' => 'You have version %s of cURL', + 'curl_is_nok' => 'You haven\'t cURL', + 'pdomysql_is_ok' => 'You have PDO and its driver for MySQL', + 'pdomysql_is_nok' => 'You haven\'t PDO or its driver for MySQL', + 'cache_is_ok' => 'Permissions on cache directory are good', + 'log_is_ok' => 'Permissions on logs directory are good', + 'conf_is_ok' => 'Permissions on configuration directory are good', + 'data_is_ok' => 'Permissions on data directory are good', + 'file_is_nok' => 'Check permissions on %s directory. HTTP server must have rights to write into', + 'fix_errors_before' => 'Fix errors before skip to the next step.', + + 'general_conf_is_ok' => 'General configuration has been saved.', + 'random_string' => 'Random string', + 'change_value' => 'You should change this value by any other', + 'base_url' => 'Base URL', + 'do_not_change_if_doubt' => 'Don\'t change if you doubt about it', + + 'bdd_conf_is_ok' => 'Database configuration has been saved.', + 'host' => 'Host', + 'username' => 'Username', + 'password' => 'Password', + 'bdd' => 'Database', + + 'installation_is_ok' => 'Installation process is finished. You must delete install.php file to access FreshRSS... or simply click on following button :)', + 'finish_installation' => 'Finish installation', + 'install_not_deleted' => 'Something was going wrong, you muste delete %s file manually.', ); diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 0473a8f94..3178f3687 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -51,6 +51,7 @@ return array ( 'error_occurred' => 'Une erreur est survenue', 'error_occurred_update' => 'Une erreur est survenue lors de la mise à jour', + 'default_category' => 'Sans catégorie', 'categories_updated' => 'Les catégories ont été mises à jour', 'categories_management' => 'Gestion des catégories', 'feed_updated' => 'Le flux a été mis à jour', @@ -214,4 +215,55 @@ return array ( // format pour la fonction date(), %s permet d'indiquer le mois en toutes lettres 'format_date' => 'd %s Y', 'format_date_hour' => '\l\e d %s Y \à H\:i', + + // INSTALLATION + 'freshrss_installation' => 'Installation - FreshRSS', + 'freshrss' => 'FreshRSS', + 'installation_step' => 'Installation - étape %d', + 'steps' => 'Étapes', + 'checks' => 'Vérifications', + 'bdd_configuration' => 'Configuration de la base de données', + 'this_is_the_end' => 'This is the end', + + 'ok' => 'Ok !', + 'congratulations' => 'Félicitations !', + 'attention' => 'Attention !', + 'damn' => 'Arf !', + 'oops' => 'Oups !', + 'next_step' => 'Passer à l\'étape suivante', + + 'language_defined' => 'La langue a bien été définie.', + 'choose_language' => 'Choisissez la langue pour FreshRSS', + + 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec le Javascript d\'activé', + 'php_is_ok' => 'Votre version de PHP est la %s et est compatible avec FreshRSS', + 'php_is_nok' => 'Votre version de PHP est la %s. Vous devriez avoir au moins la version %s', + 'minz_is_ok' => 'Vous disposez du framework Minz', + 'minz_is_nok' => 'Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script build.sh ou bien la télécharger sur Github et installer dans le répertoire %s le contenu de son répertoire /lib.', + 'curl_is_ok' => 'Vous disposez de cURL dans sa version %s', + 'curl_is_nok' => 'Vous ne disposez pas de cURL', + 'pdomysql_is_ok' => 'Vous disposez de PDO et de son driver pour MySQL', + 'pdomysql_is_nok' => 'Vous ne disposez pas de PDO ou de son driver pour MySQL', + 'cache_is_ok' => 'Les droits sur le répertoire de cache sont bons', + 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', + 'conf_is_ok' => 'Les droits sur le répertoire de configuration sont bons', + 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', + 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire %s. Le serveur HTTP doit être capable d\'écrire dedans', + 'fix_errors_before' => 'Veuillez corriger les erreurs avant de passer à l\'étape suivante.', + + 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', + 'random_string' => 'Chaîne aléatoire', + 'change_value' => 'Vous devriez changer cette valeur par n\'importe quelle autre', + 'base_url' => 'Base de l\'url', + 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', + + 'bdd_conf_is_ok' => 'La configuration de la base de données a été enregistrée.', + 'host' => 'Hôte', + 'username' => 'Nom utilisateur', + 'password' => 'Mot de passe', + 'bdd' => 'Base de données', + + 'installation_is_ok' => 'L\'installation s\'est bien passée. Il faut maintenant supprimer le fichier install.php pour pouvoir accéder à FreshRSS... ou simplement cliquer sur le bouton ci-dessous :)', + 'finish_installation' => 'Terminer l\'installation', + 'install_not_deleted' => 'Quelque chose s\'est mal passé, vous devez supprimer le fichier %s à la main.', ); diff --git a/app/models/Category.php b/app/models/Category.php index 7ce572e71..273559b1e 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -176,7 +176,7 @@ class CategoryDAO extends Model_pdo { $def_cat = $this->searchById ('000000'); if (!$def_cat) { - $cat = new Category ('Sans catégorie'); + $cat = new Category (Translate::t ('default_category')); $cat->_id ('000000'); $values = array ( diff --git a/public/install.php b/public/install.php index 7065e3a77..e83b74eb8 100644 --- a/public/install.php +++ b/public/install.php @@ -70,7 +70,66 @@ function writeArray ($f, $array) { } } +// gestion internationalisation +$translates = array (); +$actual = 'en'; +function initTranslate () { + global $translates; + global $actual; + + $l = getBetterLanguage ('en'); + if (isset ($_SESSION['language'])) { + $l = $_SESSION['language']; + } + $actual = $l; + + $file = APP_PATH . '/i18n/' . $actual . '.php'; + if (file_exists ($file)) { + $translates = include ($file); + } +} +function getBetterLanguage ($fallback) { + $available = availableLanguages (); + $accept = $_SERVER['HTTP_ACCEPT_LANGUAGE']; + $language = strtolower (substr ($accept, 0, 2)); + + if (isset ($available[$language])) { + return $language; + } else { + return $fallback; + } +} +function availableLanguages () { + return array ( + 'en' => 'English', + 'fr' => 'Français' + ); +} +function _t ($key) { + global $translates; + $translate = $key; + if (isset ($translates[$key])) { + $translate = $translates[$key]; + } + + $args = func_get_args (); + unset($args[0]); + + return vsprintf ($translate, $args); +} + /*** SAUVEGARDES ***/ +function saveLanguage () { + if (!empty ($_POST)) { + if (!isset ($_POST['language'])) { + return false; + } + + $_SESSION['language'] = $_POST['language']; + + header ('Location: index.php?step=1'); + } +} function saveStep2 () { if (!empty ($_POST)) { if (empty ($_POST['sel']) || @@ -95,6 +154,7 @@ function saveStep2 () { writeLine ($f, ' $_SESSION['language'], 'old_entries' => $_SESSION['old_entries'], 'mail_login' => $_SESSION['mail_login'] )); @@ -149,10 +209,13 @@ function deleteInstall () { /*** VÉRIFICATIONS ***/ function checkStep () { + $s0 = checkStep0 (); $s1 = checkStep1 (); $s2 = checkStep2 (); $s3 = checkStep3 (); - if (STEP > 1 && $s1['all'] != 'ok') { + if (STEP > 0 && $s0['all'] != 'ok') { + header ('Location: index.php?step=0'); + } elseif (STEP > 1 && $s1['all'] != 'ok') { header ('Location: index.php?step=1'); } elseif (STEP > 2 && $s2['all'] != 'ok') { header ('Location: index.php?step=2'); @@ -160,6 +223,16 @@ function checkStep () { header ('Location: index.php?step=3'); } } +function checkStep0 () { + $languages = availableLanguages (); + $language = isset ($_SESSION['language']) && + isset ($languages[$_SESSION['language']]); + + return array ( + 'language' => $language ? 'ok' : 'ko', + 'all' => $language ? 'ok' : 'ko' + ); +} function checkStep1 () { $php = version_compare (PHP_VERSION, '5.1.0') >= 0; $minz = file_exists (LIB_PATH . '/minz'); @@ -234,64 +307,98 @@ function checkBD () { } /*** AFFICHAGE ***/ +function printStep0 () { + global $actual; +?> + +

+ + + + +
+ +
+ +
+
+ +
+
+ + + + + +
+
+ + - + -

Ok ! Votre version de PHP est la et est compatible avec FreshRSS

+

-

Arf ! Votre version de PHP est la . Vous devriez avoir au moins la version 5.1.0

+

-

Ok ! Vous disposez du framework Minz

+

-

Arf ! Vous ne disposez pas de la librairie Minz. Vous devriez exécuter le script build.sh ou bien la télécharger sur Github et installer dans le répertoire le contenu de son répertoire /lib.

+

-

Ok ! Vous disposez de cURL dans sa version

+

-

Arf ! Vous ne disposez pas de cURL

+

-

Ok ! Vous disposez de PDO et de son driver pour MySQL

+

-

Arf ! Vous ne disposez pas de PDO ou de son driver pour MySQL

+

-

Ok ! Les droits sur le répertoire de cache sont bons

+

-

Arf ! Veuillez vérifier les droits sur le répertoire . Le serveur HTTP doit être capable d'écrire dedans

+

-

Ok ! Les droits sur le répertoire des logs sont bons

+

-

Arf ! Veuillez vérifier les droits sur le répertoire . Le serveur HTTP doit être capable d'écrire dedans

+

-

Ok ! Les droits sur le répertoire de configuration sont bons

+

-

Arf ! Veuillez vérifier les droits sur le répertoire . Le serveur HTTP doit être capable d'écrire dedans

+

-

Ok ! Les droits sur le répertoire de data sont bons

+

-

Arf ! Veuillez vérifier les droits sur le répertoire . Le serveur HTTP doit être capable d'écrire dedans

+

- Passer à l'étape suivante + - Veuillez corriger les erreurs avant de passer à l'étape suivante. +

-

Ok ! La configuration générale a été enregistrée.

+

- Configuration générale +
- +
- Vous devriez changer cette valeur par n'importe quelle autre +
@@ -315,40 +422,40 @@ function printStep2 () { $url = substr ($_SERVER['PHP_SELF'], 0, -10); ?>
- +
- Laissez tel quel dans le doute +
- +
- +
- +
- mois +
- +
- - + +
- - + + - Passer à l'étape suivante +
@@ -359,34 +466,34 @@ function printStep2 () { function printStep3 () { ?> -

Ok ! La configuration de la base de données a été enregistrée.

+

- Configuration de la base de données +
- +
- +
- +
- +
@@ -394,10 +501,10 @@ function printStep3 () {
- - + + - Passer à l'étape suivante +
@@ -407,23 +514,27 @@ function printStep3 () { function printStep4 () { ?> -

Félicitations ! L'installation s'est bien passée. Il faut maintenant supprimer le fichier install.php pour pouvoir accéder à FreshRSS... ou simplement cliquer sur le bouton ci-dessous ;)

- Terminer l'installation +

+ -

Oups ! Quelque chose s'est mal passé, vous devriez supprimer le fichier à la main.

+

- Installation - FreshRSS + <?php echo _t ('freshrss_installation'); ?> @@ -451,25 +562,29 @@ case 5:
-

FreshRSS

-

Installation - étape

+

+

Date: Sat, 27 Apr 2013 21:08:29 +0200 Subject: Fix issue #26 : possibilité de s'abonner à des flux derrière authentification HTTP + correction quelques traductions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 10 +++++++++- app/controllers/feedController.php | 12 +++++++++++- app/i18n/en.php | 7 ++++--- app/i18n/fr.php | 3 ++- app/layout/aside_feed.phtml | 8 ++++++++ app/models/Feed.php | 27 ++++++++++++++++++++++----- app/views/configure/feed.phtml | 11 ++++++----- 7 files changed, 62 insertions(+), 16 deletions(-) (limited to 'app/models') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 81a8e97d7..f4d1a38e7 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -90,11 +90,19 @@ class configureController extends ActionController { $cat = Request::param ('category', 0); $path = Request::param ('path_entries', ''); $priority = Request::param ('priority', 0); + $user = Request::param ('http_user', ''); + $pass = Request::param ('http_pass', ''); + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } $values = array ( 'category' => $cat, 'pathEntries' => $path, - 'priority' => $priority + 'priority' => $priority, + 'httpAuth' => $httpAuth ); if ($feedDAO->updateFeed ($id, $values)) { diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 1232ddff4..c235e8b0f 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -16,11 +16,20 @@ class feedController extends ActionController { if (Request::isPost ()) { $url = Request::param ('url_rss'); $cat = Request::param ('category'); + $user = Request::param ('username'); + $pass = Request::param ('password'); $params = array (); try { $feed = new Feed ($url); $feed->_category ($cat); + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } + $feed->_httpAuth ($httpAuth); + $feed->load (); $feedDAO = new FeedDAO (); @@ -31,7 +40,8 @@ class feedController extends ActionController { 'name' => $feed->name (), 'website' => $feed->website (), 'description' => $feed->description (), - 'lastUpdate' => time () + 'lastUpdate' => time (), + 'httpAuth' => $feed->httpAuth (), ); if ($feedDAO->searchByUrl ($values['url'])) { diff --git a/app/i18n/en.php b/app/i18n/en.php index 921f86ddc..1bb7c2213 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -9,7 +9,7 @@ return array ( 'configuration' => 'Configuration', 'general_and_reading' => 'General and reading', 'categories' => 'Categories', - 'category' => 'Catégory', + 'category' => 'Category', 'shortcuts' => 'Shortcuts', 'about' => 'About', @@ -88,7 +88,7 @@ return array ( 'cancel' => 'Cancel', 'back_to_rss_feeds' => '← Go back to your RSS feeds', - 'feeds_moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under %s.', + 'feeds_moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under %s.', 'category_number' => 'Category n°%d', 'ask_empty' => 'Clear ?', 'number_feeds' => '%d feeds', @@ -123,6 +123,7 @@ return array ( 'no' => 'No', 'css_path_on_website' => 'Articles CSS path on original website', 'retrieve_truncated_feeds' => 'Retrieves truncated RSS feeds (attention, requires more time!)', + 'http_authentication' => 'HTTP Authentication', 'http_username' => 'HTTP username', 'http_password' => 'HTTP password', 'blank_to_disable' => 'Leave blank to disable', @@ -198,7 +199,7 @@ return array ( 'september' => 'september', 'october' => 'october', 'november' => 'november', - 'december' => 'décember', + 'december' => 'december', // special format for date() function 'Jan' => '\J\a\n\u\a\r\y', 'Feb' => '\F\e\b\r\u\a\r\y', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 3178f3687..c5bba9d07 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -123,7 +123,8 @@ return array ( 'no' => 'Non', 'css_path_on_website' => 'Chemin CSS des articles sur le site d\'origine', 'retrieve_truncated_feeds' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)', - 'http_username' => 'Username HTTP', + 'http_authentication' => 'Authentification HTTP', + 'http_username' => 'Identifiant HTTP', 'http_password' => 'Mot de passe HTTP', 'blank_to_disable' => 'Laissez vide pour désactiver', 'not_yet_implemented' => 'Pas encore implémenté', diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index ff03b5552..4be37868d 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -21,6 +21,14 @@ + + +
  • + +
  • +
  • + +
  • diff --git a/app/models/Feed.php b/app/models/Feed.php index 222e22256..08cf7425f 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -59,9 +59,13 @@ class Feed extends Model { if ($raw) { return $this->httpAuth; } else { + $pos_colon = strpos ($this->httpAuth, ':'); + $user = substr ($this->httpAuth, 0, $pos_colon); + $pass = substr ($this->httpAuth, $pos_colon + 1); + return array ( - 'username' => '', - 'password' => '' + 'username' => $user, + 'password' => $pass ); } } @@ -134,7 +138,12 @@ class Feed extends Model { ); } else { $feed = new SimplePie (); - $feed->set_feed_url (preg_replace ('/&/', '&', $this->url)); + $url = preg_replace ('/&/', '&', $this->url); + if ($this->httpAuth != '') { + $url = preg_replace ('#((.+)://)(.+)#', '${1}' . $this->httpAuth . '@${3}', $url); + } + + $feed->set_feed_url ($url); $feed->set_cache_location (CACHE_PATH); $feed->init (); @@ -144,6 +153,9 @@ class Feed extends Model { $subscribe_url = $feed->subscribe_url (); if (!is_null ($subscribe_url) && $subscribe_url != $this->url) { + if ($this->httpAuth != '') { + $subscribe_url = preg_replace ('#((.+)://)((.+)@)(.+)#', '${1}${5}', $subscribe_url); + } $this->_url ($subscribe_url); } $title = $feed->get_title (); @@ -205,7 +217,7 @@ class Feed extends Model { class FeedDAO extends Model_pdo { public function addFeed ($valuesTmp) { - $sql = 'INSERT INTO feed (id, url, category, name, website, description, lastUpdate, priority, error) VALUES(?, ?, ?, ?, ?, ?, ?, 10, 0)'; + $sql = 'INSERT INTO feed (id, url, category, name, website, description, lastUpdate, priority, httpAuth, error) VALUES(?, ?, ?, ?, ?, ?, ?, 10, ?, 0)'; $stm = $this->bd->prepare ($sql); $values = array ( @@ -216,6 +228,7 @@ class FeedDAO extends Model_pdo { $valuesTmp['website'], $valuesTmp['description'], $valuesTmp['lastUpdate'], + base64_encode ($valuesTmp['httpAuth']), ); if ($stm && $stm->execute ($values)) { @@ -231,6 +244,10 @@ class FeedDAO extends Model_pdo { $set = ''; foreach ($valuesTmp as $key => $v) { $set .= $key . '=?, '; + + if ($key == 'httpAuth') { + $valuesTmp[$key] = base64_encode ($v); + } } $set = substr ($set, 0, -2); @@ -408,7 +425,7 @@ class HelperFeed { $list[$key]->_lastUpdate ($dao['lastUpdate']); $list[$key]->_priority ($dao['priority']); $list[$key]->_pathEntries ($dao['pathEntries']); - $list[$key]->_httpAuth ($dao['httpAuth']); + $list[$key]->_httpAuth (base64_decode ($dao['httpAuth'])); if (isset ($dao['id'])) { $list[$key]->_id ($dao['id']); diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 73b70ec4c..0d9c5cae6 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -58,20 +58,21 @@
    - +
    @@ -82,5 +83,5 @@
    -
    +
    -- cgit v1.2.3 From 21dc4ceace513a0d6cd934f5fc4bb9cc643bb570 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 27 Apr 2013 22:33:14 +0200 Subject: Fix issue #64 : stockage des favicons en local --- app/layout/aside_feed.phtml | 2 +- app/layout/aside_flux.phtml | 2 +- app/models/Feed.php | 10 ++++++++++ app/views/index/index.phtml | 2 +- lib/lib_rss.php | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 3 deletions(-) (limited to 'app/models') diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 4be37868d..ec4993a70 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -43,7 +43,7 @@ feeds as $feed) { ?>
  • - + name (); ?>
  • diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 60fcbe457..d2e5341e3 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -87,7 +87,7 @@ nbNotRead (); ?> - + 0 ? '' : ''; ?> 0 ? '(' . $not_read . ') ' : ''; ?> diff --git a/app/models/Feed.php b/app/models/Feed.php index 08cf7425f..97cbe55d1 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -77,6 +77,16 @@ class Feed extends Model { $feedDAO = new FeedDAO (); return $feedDAO->countNotRead ($this->id ()); } + public function favicon () { + $file = '/data/favicons/' . $this->id () . '.ico'; + + $favicon_url = Url::display ($file); + if (!file_exists (PUBLIC_PATH . $file)) { + $favicon_url = dowload_favicon ($this->website (), $this->id ()); + } + + return $favicon_url; + } public function _id ($value) { $this->id = $value; diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index a7b67bcbc..c9be7169d 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -49,7 +49,7 @@ if (isset ($this->entryPaginator)) { feed (true); ?> -
  • name (); ?>
  • +
  • name (); ?>
  • title (); ?>
  • date (); ?>
  • diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 76c304064..e004b7498 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -152,3 +152,41 @@ function get_content_by_parsing ($url, $path) { throw new Exception (); } } + +/* Télécharge le favicon d'un site, le place sur le serveur et retourne l'URL */ +function dowload_favicon ($website, $id) { + $url = 'http://g.etfv.co/' . $website; + $favicons_dir = PUBLIC_PATH . '/data/favicons'; + $dest = $favicons_dir . '/' . $id . '.ico'; + $favicon_url = '/data/favicons/' . $id . '.ico'; + + if (!is_dir ($favicons_dir)) { + if (!mkdir ($favicons_dir, 0755, true)) { + return $url; + } + } + + if (!file_exists ($dest)) { + $c = curl_init ($url); + curl_setopt ($c, CURLOPT_HEADER, false); + curl_setopt ($c, CURLOPT_RETURNTRANSFER, true); + curl_setopt ($c, CURLOPT_BINARYTRANSFER, true); + $imgRaw = curl_exec ($c); + + if (curl_getinfo ($c, CURLINFO_HTTP_CODE) == 200) { + $file = fopen ($dest, 'w'); + if ($file === false) { + return $url; + } + + fwrite ($file, $imgRaw); + fclose ($file); + } else { + return $url; + } + + curl_close ($c); + } + + return $favicon_url; +} -- cgit v1.2.3 From 1bee8ad9a7c02c0f53d1f334467cb6d1e5044511 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 28 Apr 2013 14:18:34 +0200 Subject: Flux déplacés de catégories lors de la suppression de la leur (issue #28) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 6 +++++- app/models/Feed.php | 24 ++++++++++++++++++++++++ app/views/configure/feed.phtml | 2 +- 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'app/models') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index f4d1a38e7..d6d210099 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -11,8 +11,11 @@ class configureController extends ActionController { } public function categorizeAction () { + $feedDAO = new FeedDAO (); $catDAO = new CategoryDAO (); $catDAO->checkDefault (); + $defaultCategory = $catDAO->getDefault (); + $defaultId = $defaultCategory->id (); if (Request::isPost ()) { $cats = Request::param ('categories', array ()); @@ -27,7 +30,8 @@ class configureController extends ActionController { 'color' => $cat->color () ); $catDAO->updateCategory ($ids[$key], $values); - } elseif ($ids[$key] != '000000') { + } elseif ($ids[$key] != $defaultId) { + $feedDAO->changeCategory ($ids[$key], $defaultId); $catDAO->deleteCategory ($ids[$key]); } } diff --git a/app/models/Feed.php b/app/models/Feed.php index 97cbe55d1..e519a91cb 100644 --- a/app/models/Feed.php +++ b/app/models/Feed.php @@ -296,6 +296,30 @@ class FeedDAO extends Model_pdo { } } + public function changeCategory ($idOldCat, $idNewCat) { + $catDAO = new CategoryDAO (); + $newCat = $catDAO->searchById ($idNewCat); + if (!$newCat) { + $newCat = $catDAO->getDefault (); + } + + $sql = 'UPDATE feed SET category=? WHERE category=?'; + $stm = $this->bd->prepare ($sql); + + $values = array ( + $newCat->id (), + $idOldCat + ); + + if ($stm && $stm->execute ($values)) { + return true; + } else { + $info = $stm->errorInfo(); + Log::record ('SQL error : ' . $info[2], Log::ERROR); + return false; + } + } + public function deleteFeed ($id) { $sql = 'DELETE FROM feed WHERE id=?'; $stm = $this->bd->prepare ($sql); diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 0d9c5cae6..33483f72d 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -2,7 +2,7 @@ flux) { ?>
    - +

    flux->name (); ?>

    flux->description (); ?> -- cgit v1.2.3 From 864318bf68b28ff6340701bce24e25768164e138 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 28 Apr 2013 16:01:14 +0200 Subject: Meilleure gestion des erreurs lors de l'ajout d'un flux RSS + les vidéos apparaissent maintenant dans les articles + si connexion paramétrée l'actualisation des flux n'est plus permis MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 332 ++++++++++++++++----------------- app/layout/nav_menu.phtml | 2 +- app/models/Exception/FeedException.php | 6 + app/models/Feed.php | 14 +- 4 files changed, 184 insertions(+), 170 deletions(-) (limited to 'app/models') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index c235e8b0f..b535e7bc4 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -2,96 +2,108 @@ class feedController extends ActionController { public function firstAction () { - $catDAO = new CategoryDAO (); - $catDAO->checkDefault (); - } - - public function addAction () { if (login_is_conf ($this->view->conf) && !is_logged ()) { Error::error ( 403, array ('error' => array (Translate::t ('access_denied'))) ); - } else { - if (Request::isPost ()) { - $url = Request::param ('url_rss'); - $cat = Request::param ('category'); - $user = Request::param ('username'); - $pass = Request::param ('password'); - $params = array (); - - try { - $feed = new Feed ($url); - $feed->_category ($cat); - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - $feed->_httpAuth ($httpAuth); - - $feed->load (); - - $feedDAO = new FeedDAO (); - $values = array ( - 'id' => $feed->id (), - 'url' => $feed->url (), - 'category' => $feed->category (), - 'name' => $feed->name (), - 'website' => $feed->website (), - 'description' => $feed->description (), - 'lastUpdate' => time (), - 'httpAuth' => $feed->httpAuth (), - ); + } - if ($feedDAO->searchByUrl ($values['url'])) { - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('already_subscribed', $feed->name ()) - ); - Session::_param ('notification', $notif); - } elseif ($feedDAO->addFeed ($values)) { - $entryDAO = new EntryDAO (); - $entries = $feed->entries (); - - foreach ($entries as $entry) { - $values = $entry->toArray (); - $entryDAO->addEntry ($values); - } - - // notif - $notif = array ( - 'type' => 'good', - 'content' => Translate::t ('feed_added', $feed->name ()) - ); - Session::_param ('notification', $notif); - $params['id'] = $feed->id (); - } else { - // notif - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('feed_not_added', $feed->name ()) - ); - Session::_param ('notification', $notif); - } - } catch (FeedException $e) { - Log::record ($e->getMessage (), Log::ERROR); + $catDAO = new CategoryDAO (); + $catDAO->checkDefault (); + } + + public function addAction () { + if (Request::isPost ()) { + $url = Request::param ('url_rss'); + $cat = Request::param ('category'); + $user = Request::param ('username'); + $pass = Request::param ('password'); + $params = array (); + + try { + $feed = new Feed ($url); + $feed->_category ($cat); + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } + $feed->_httpAuth ($httpAuth); + + $feed->load (); + + $feedDAO = new FeedDAO (); + $values = array ( + 'id' => $feed->id (), + 'url' => $feed->url (), + 'category' => $feed->category (), + 'name' => $feed->name (), + 'website' => $feed->website (), + 'description' => $feed->description (), + 'lastUpdate' => time (), + 'httpAuth' => $feed->httpAuth (), + ); + + if ($feedDAO->searchByUrl ($values['url'])) { + // on est déjà abonné à ce flux $notif = array ( 'type' => 'bad', - 'content' => Translate::t ('internal_problem_feed') + 'content' => Translate::t ('already_subscribed', $feed->name ()) ); Session::_param ('notification', $notif); - } catch (Exception $e) { - // notif + } elseif (!$feedDAO->addFeed ($values)) { + // problème au niveau de la base de données $notif = array ( 'type' => 'bad', - 'content' => Translate::t ('invalid_url', $url) + 'content' => Translate::t ('feed_not_added', $feed->name ()) ); Session::_param ('notification', $notif); - } + } else { + $entryDAO = new EntryDAO (); + $entries = $feed->entries (); - Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); + // on ajoute les articles en masse sans vérification + foreach ($entries as $entry) { + $values = $entry->toArray (); + $entryDAO->addEntry ($values); + } + + // ok, ajout terminé + $notif = array ( + 'type' => 'good', + 'content' => Translate::t ('feed_added', $feed->name ()) + ); + Session::_param ('notification', $notif); + + // permet de rediriger vers la page de conf du flux + $params['id'] = $feed->id (); + } + } catch (BadUrlException $e) { + Log::record ($e->getMessage (), Log::ERROR); + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('invalid_url', $url) + ); + Session::_param ('notification', $notif); + } catch (FeedException $e) { + Log::record ($e->getMessage (), Log::ERROR); + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('internal_problem_feed') + ); + Session::_param ('notification', $notif); + } catch (FileNotExistException $e) { + // Répertoire de cache n'existe pas + Log::record ($e->getMessage (), Log::ERROR); + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('internal_problem_feed') + ); + Session::_param ('notification', $notif); } + + Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); } } @@ -175,114 +187,100 @@ class feedController extends ActionController { } public function massiveImportAction () { - if (login_is_conf ($this->view->conf) && !is_logged ()) { - Error::error ( - 403, - array ('error' => array (Translate::t ('access_denied'))) - ); - } else { - $entryDAO = new EntryDAO (); - $feedDAO = new FeedDAO (); - - $categories = Request::param ('categories', array ()); - $feeds = Request::param ('feeds', array ()); - - $this->addCategories ($categories); - - $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 { - $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 - ); + $entryDAO = new EntryDAO (); + $feedDAO = new FeedDAO (); + + $categories = Request::param ('categories', array ()); + $feeds = Request::param ('feeds', array ()); + + $this->addCategories ($categories); + + $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 { + $feed->load (); - if (!$feedDAO->searchByUrl ($values['url'])) { - if (!$feedDAO->addFeed ($values)) { - $error = true; - } + // 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 + ); + + if (!$feedDAO->searchByUrl ($values['url'])) { + if (!$feedDAO->addFeed ($values)) { + $error = true; } - } catch (FeedException $e) { - $error = true; - Log::record ($e->getMessage (), Log::ERROR); } + } catch (FeedException $e) { + $error = true; + Log::record ($e->getMessage (), Log::ERROR); } + } - if ($error) { - $res = Translate::t ('feeds_imported_with_errors'); - } else { - $res = Translate::t ('feeds_imported'); - } - $notif = array ( - 'type' => 'good', - 'content' => $res - ); - Session::_param ('notification', $notif); - - Request::forward (array ( - 'c' => 'configure', - 'a' => 'importExport' - ), true); + if ($error) { + $res = Translate::t ('feeds_imported_with_errors'); + } else { + $res = Translate::t ('feeds_imported'); } + $notif = array ( + 'type' => 'good', + 'content' => $res + ); + Session::_param ('notification', $notif); + + Request::forward (array ( + 'c' => 'configure', + 'a' => 'importExport' + ), true); } public function deleteAction () { - if (login_is_conf ($this->view->conf) && !is_logged ()) { - Error::error ( - 403, - array ('error' => array (Translate::t ('access_denied'))) - ); - } else { - $type = Request::param ('type', 'feed'); - $id = Request::param ('id'); + $type = Request::param ('type', 'feed'); + $id = Request::param ('id'); - $feedDAO = new FeedDAO (); - if ($type == 'category') { - if ($feedDAO->deleteFeedByCategory ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Translate::t ('category_emptied') - ); - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('error_occured') - ); - } + $feedDAO = new FeedDAO (); + if ($type == 'category') { + if ($feedDAO->deleteFeedByCategory ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => Translate::t ('category_emptied') + ); } else { - if ($feedDAO->deleteFeed ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Translate::t ('feed_deleted') - ); - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('error_occured') - ); - } + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('error_occured') + ); } - - Session::_param ('notification', $notif); - - if ($type == 'category') { - Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } else { + if ($feedDAO->deleteFeed ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => Translate::t ('feed_deleted') + ); } else { - Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('error_occured') + ); } } + + Session::_param ('notification', $notif); + + if ($type == 'category') { + Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } else { + Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + } } private function addCategories ($categories) { diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 1ee935db9..ce124da11 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -1,6 +1,7 @@