From 19407e1ab6df2c239017fb20e47d6201bdaab223 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 27 Apr 2013 13:40:48 +0200 Subject: Structure pour l'internationalisation terminée (voir bug #38) : il reste à faire la traduction en anglais notamment, rajouter une option pour changer la langue, détecter la langue préférée de l'utilisateur et voir si on peut migrer facilement l'installateur aussi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/configure/categorize.phtml | 20 ++++++------- app/views/configure/display.phtml | 54 +++++++++++++++++----------------- app/views/configure/feed.phtml | 42 +++++++++++++------------- app/views/configure/importExport.phtml | 12 ++++---- app/views/configure/shortcut.phtml | 30 +++++++++---------- 5 files changed, 79 insertions(+), 79 deletions(-) (limited to 'app/views/configure') diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 660ddef20..b6ba5c3c7 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -1,23 +1,23 @@ partial ('aside_configure'); ?>
- ← Retour à vos flux RSS +
- Gestion des catégories - gestion des flux + - -

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

+

defaultCategory->name ()); ?>

categories as $cat) { $i++; ?>
- Vider ? (nbFeed (); ?> flux) + (nbFeed ()); ?>) id () == $this->defaultCategory->id ()) { ?> - ne peut pas être supprimée +
@@ -25,16 +25,16 @@
- +
- +
- - + +
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 79fa4b43c..fcae83d9a 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -1,104 +1,104 @@ partial ('aside_configure'); ?>
- ← Retour à vos flux RSS +
- Configuration générale +
- +
- mois +
- + conf->mailLogin (); ?>
- - + +
- Configuration de lecture +
- +
- +
- +
- +
- +
- Partage +
- +
- +
- - + +
diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index adea27e52..73b70ec4c 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -2,35 +2,35 @@ flux) { ?>
- ← Retour à vos flux RSS +

flux->name (); ?>

flux->description (); ?>
- Informations +
- +
- +
- +
flux->nbEntries (); ?>
- Catégorie - gestion + -
- +
categories as $cat) { ?>
- Avancé +
- +
- +
- - Permet de récupérer les flux tronqués (attention, demande plus de temps !) + +
- - + +
-
Aucun flux sélectionné. Pensez à en ajouter !
+
diff --git a/app/views/configure/importExport.phtml b/app/views/configure/importExport.phtml index 34bee4a07..4cc575356 100644 --- a/app/views/configure/importExport.phtml +++ b/app/views/configure/importExport.phtml @@ -14,12 +14,12 @@ partial ('aside_feed'); ?>
- ← Retour à vos flux RSS +
- Import / export au format OPML +
- +
@@ -27,9 +27,9 @@
- - ou - Exporter + + +
diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 86682465a..4c7884234 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -1,7 +1,7 @@ partial ('aside_configure'); ?>
- ← Retour à vos flux RSS + list_keys as $key) { ?> @@ -12,57 +12,57 @@ conf->shortcuts (); ?>
- Gestion des raccourcis + - +
- +
- + shift pour marquer tous les articles comme non lus +
- +
- +
- +
- + shift pour passer au dernier article de la page +
- +
- + shift pour passer au premier article de la page +
- +
- +
@@ -70,8 +70,8 @@
- - + +
-- 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/views/configure') 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 0e95494e29353a9ae31fb1196c6c9aaf556ae981 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud 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/views/configure') 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 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/views/configure') 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