From 59c17a3c6c26d6b487e2ec5e02caa3fb26f9ff9c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 27 Sep 2014 08:20:13 -0400 Subject: Fix read all shortcut Before, the read all shortcut raised a javascript exception when we use the confirmation option. The confirmation was not even displayed. The code was failling since there was a missing variable. Now, the shortcut ask for confirmation when the option is selected in the reading configuration page. The definition of the shortcut was buggy since the confirmation was handled properly in an other location. I simplified the code by removing the confirmation code in the shortcut. --- p/scripts/main.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index f6d5d2907..8a45ae896 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -538,14 +538,7 @@ function init_shortcuts() { }); shortcut.add("shift+" + shortcuts.mark_read, function () { // on marque tout comme lu - var btn = $(".nav_menu .read_all"); - if (btn.hasClass('confirm')) { - if (confirm(str_confirmation)) { - btn.click(); - } - } else { - btn.click(); - } + $(".nav_menu .read_all").click(); }, { 'disable_in_input': true }); -- cgit v1.2.3 From 3d288eb170091c2679cac34ee09e850b56e46861 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 29 Sep 2014 18:26:28 -0400 Subject: Add percent of total on top 10 feeds --- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/views/stats/index.phtml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/app/i18n/en.php b/app/i18n/en.php index beba02c4d..0d3654744 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -56,6 +56,7 @@ return array ( 'stats_entry_per_hour' => 'Per hour', 'stats_entry_per_day_of_week' => 'Per day of week', 'stats_entry_per_month' => 'Per month', + 'stats_percent_of_total' => '%% of total', 'last_week' => 'Last week', 'last_month' => 'Last month', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index b0fbf15ae..c72fc3e93 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -56,6 +56,7 @@ return array ( 'stats_entry_per_hour' => 'Par heure', 'stats_entry_per_day_of_week' => 'Par jour de la semaine', 'stats_entry_per_month' => 'Par mois', + 'stats_percent_of_total' => '%% du total', 'last_week' => 'Depuis la semaine dernière', 'last_month' => 'Depuis le mois dernier', diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 412e77e16..31185fbe3 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -48,6 +48,7 @@ + @@ -56,6 +57,7 @@ + repartition['all_feeds']['total'] * 100, 1);?> -- cgit v1.2.3 From cd88414abcffd94cfce933cf578ecc640b691381 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 29 Sep 2014 18:54:03 -0400 Subject: Add an average per day for the 30 day period --- app/Controllers/statsController.php | 1 + app/Models/StatsDAO.php | 27 ++++++++++++++++++++++++--- app/Models/StatsDAOSQLite.php | 23 +++++++++++++++++++++++ app/views/stats/index.phtml | 16 +++++++++++++--- 4 files changed, 61 insertions(+), 6 deletions(-) diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 256543f37..3069be34d 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -21,6 +21,7 @@ class FreshRSS_stats_Controller extends Minz_ActionController { Minz_View::appendScript(Minz_Url::display('/scripts/flotr2.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/flotr2.min.js'))); $this->view->repartition = $statsDAO->calculateEntryRepartition(); $this->view->count = $statsDAO->calculateEntryCount(); + $this->view->average = $statsDAO->calculateEntryAverage(); $this->view->feedByCategory = $statsDAO->calculateFeedByCategory(); $this->view->entryByCategory = $statsDAO->calculateEntryByCategory(); $this->view->topFeed = $statsDAO->calculateTopFeed(); diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index 40505ab3e..08dd4cd5c 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -79,6 +79,27 @@ SQL; return $this->convertToSerie($count); } + /** + * Calculates entry average per day on a 30 days period. + * + * @return integer + */ + public function calculateEntryAverage() { + $period = self::ENTRY_COUNT_PERIOD; + + // Get stats per day for the last 30 days + $sql = <<prefix}entry AS e +WHERE FROM_UNIXTIME(e.date, '%Y%m%d') BETWEEN DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -{$period} DAY), '%Y%m%d') AND DATE_FORMAT(DATE_ADD(NOW(), INTERVAL -1 DAY), '%Y%m%d') +SQL; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetch(PDO::FETCH_NAMED); + + return round($res['average'], 2); + } + /** * Initialize an array for the entry count. * @@ -160,7 +181,7 @@ SQL; public function calculateEntryAveragePerFeedPerHour($feed = null) { return $this->calculateEntryAveragePerFeedPerPeriod(1/24, $feed); } - + /** * Calculates the average number of article per day of week per feed * @@ -180,10 +201,10 @@ SQL; public function calculateEntryAveragePerFeedPerMonth($feed = null) { return $this->calculateEntryAveragePerFeedPerPeriod(30, $feed); } - + /** * Calculates the average number of article per feed - * + * * @param float $period number used to divide the number of day in the period * @param integer $feed id * @return integer diff --git a/app/Models/StatsDAOSQLite.php b/app/Models/StatsDAOSQLite.php index 3b1256de1..bb2336532 100644 --- a/app/Models/StatsDAOSQLite.php +++ b/app/Models/StatsDAOSQLite.php @@ -34,6 +34,29 @@ SQL; return $this->convertToSerie($count); } + /** + * Calculates entry average per day on a 30 days period. + * + * @return integer + */ + public function calculateEntryAverage() { + $period = self::ENTRY_COUNT_PERIOD; + + // Get stats per day for the last 30 days + $sql = <<prefix}entry AS e +WHERE strftime('%Y%m%d', e.date, 'unixepoch') + BETWEEN strftime('%Y%m%d', 'now', '-{$period} days') + AND strftime('%Y%m%d', 'now', '-1 day') +SQL; + $stm = $this->bd->prepare($sql); + $stm->execute(); + $res = $stm->fetch(PDO::FETCH_NAMED); + + return round($res['average'], 2); + } + protected function calculateEntryRepartitionPerFeedPerPeriod($period, $feed = null) { if ($feed) { $restrict = "WHERE e.id_feed = {$feed}"; diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 31185fbe3..9b19cb560 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -93,12 +93,22 @@ function initStats() { return; } // Entry per day + var avg = []; + for (var i = -31; i <= 0; i++) { + avg.push([i, average?>]); + } Flotr.draw(document.getElementById('statsEntryPerDay'), - [count ?>], + [{ + data: count ?>, + bars: {horizontal: false, show: true} + },{ + data: avg, + lines: {show: true}, + label: average?> + }], { grid: {verticalLines: false}, - bars: {horizontal: false, show: true}, - xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0}, + xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0, min: -30.75, max: -0.25}, yaxis: {min: 0}, mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} }); -- cgit v1.2.3 From fc6a3c2fd223d3c723c534768238182c917a2318 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Mon, 29 Sep 2014 18:57:40 -0400 Subject: Add string delimiters for averages. Before, if the average was equal to 0, it was displayed on the graph but the label was not displayed. Now, the label is displayed. --- app/views/stats/index.phtml | 2 +- app/views/stats/repartition.phtml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index 9b19cb560..fa57a77c0 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -104,7 +104,7 @@ function initStats() { },{ data: avg, lines: {show: true}, - label: average?> + label: "average?>" }], { grid: {verticalLines: false}, diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index b425c1458..750a3ffdc 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -67,7 +67,7 @@ function initStats() { }, { data: avg_h, lines: {show: true}, - label: averageHour?>, + label: "averageHour?>", yaxis: 2 }], { @@ -96,7 +96,7 @@ function initStats() { }, { data: avg_dow, lines: {show: true}, - label: averageDayOfWeek?>, + label: "averageDayOfWeek?>", yaxis: 2 }], { @@ -126,7 +126,7 @@ function initStats() { }, { data: avg_m, lines: {show: true}, - label: averageMonth?>, + label: "averageMonth?>", yaxis: 2 }], { -- cgit v1.2.3 From d087f753370541b2f35f59ded7db1aaff2370e9e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 10:10:06 +0200 Subject: We are working on 0.10-dev... but it could be the 1.0! --- CHANGELOG | 2 +- README.fr.md | 4 ++-- README.md | 4 ++-- constants.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d7de86d9b..44d3452ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,6 @@ # Journal des modifications -## 2014-09-xx FreshRSS 0.8.0 +## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) * UI * New interface for statistics diff --git a/README.fr.md b/README.fr.md index df43ef7e8..4e6c52d68 100644 --- a/README.fr.md +++ b/README.fr.md @@ -10,8 +10,8 @@ Il permet de gérer plusieurs utilisateurs, et dispose d’un mode de lecture an * Site officiel : http://freshrss.org * Démo : http://demo.freshrss.org/ * Développeur : Marien Fressinaud -* Version actuelle : 0.8-dev -* Date de publication 2014-0x-xx +* Version actuelle : 0.10-dev +* Date de publication 2014-xx-xx * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![Logo de FreshRSS](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) diff --git a/README.md b/README.md index 0a22df8f1..971d53ea6 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ It is a multi-user application with an anonymous reading mode. * Official website: http://freshrss.org * Demo: http://demo.freshrss.org/ * Developer: Marien Fressinaud -* Current version: 0.8-dev -* Publication date: 2014-0x-xx +* Current version: 0.10-dev +* Publication date: 2014-xx-xx * License [GNU AGPL 3](http://www.gnu.org/licenses/agpl-3.0.html) ![FreshRSS logo](http://marienfressinaud.fr/data/images/freshrss/freshrss_title.png) diff --git a/constants.php b/constants.php index 4c515d121..f66a012b0 100644 --- a/constants.php +++ b/constants.php @@ -1,5 +1,5 @@ Date: Tue, 30 Sep 2014 11:08:30 +0200 Subject: Add space after tag icon Fix https://github.com/marienfressinaud/FreshRSS/issues/643 --- app/views/helpers/view/normal_view.phtml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 1dbf14f4c..6d9789f8d 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -153,14 +153,15 @@ if (!empty($this->entries)) { if (!empty($tags)) { ?>
  • + + -- cgit v1.2.3 From 549500764e66529dae082f4f3cde4d639e8f189e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 12:14:28 +0200 Subject: Coding style (aside_feed.phtml) See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/layout/aside_feed.phtml | 51 +++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 5ffb1c791..c72710c2d 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -1,75 +1,76 @@ -- cgit v1.2.3 From 46ae0a3f5ada751c9442eca275e15450fad85509 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 14:33:28 +0200 Subject: BREAK CATEGORIZE SYSTEM! And begin big changes. See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/configure/categorize.phtml | 102 +++++++++++++++++++---------------- p/themes/base-theme/template.css | 20 +++++++ 2 files changed, 75 insertions(+), 47 deletions(-) diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 23d1c9fa1..7091ff1cf 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -1,55 +1,63 @@ -partial ('aside_feed'); ?> +partial('aside_feed'); ?> -
    - +
    + -
    - +
    +
    -

    defaultCategory->name ()); ?>

    - - categories as $cat) { $i++; ?> -
    - -
    -
    - - - nbFeed () > 0) { ?> - - - - - -
    - (nbFeed ()); ?>) - - id () === $this->defaultCategory->id ()) { ?> - - - - -
    +
    + + + +
    - - -
    - -
    - +
    + + categories as $cat) { + $feeds = $cat->feeds(); + ?> +
    +
    + +
    -
    -
    - - -
    -
    - +
      + + inError() ? ' error' : ''; + $empty = $feed->nbEntries() == 0 ? ' empty' : ''; + ?> +
    • + + ✇ name(); ?> +
    • + +
    • Empty
    • + +
    +
    +
    diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index dc011503d..792eac299 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -559,6 +559,8 @@ br + br + br { /*=== GLOBAL VIEW */ /*================*/ /*=== Category boxes */ + +/* TODO */ #stream.global .box-category { display: inline-block; width: 19em; @@ -581,6 +583,24 @@ br + br + br { width: 19em; max-width: 90%; } +/* TODO Date: Tue, 30 Sep 2014 15:02:56 +0200 Subject: Move creation of categories in a new Controller Category names are 255 chars max --- app/Controllers/categoryController.php | 64 +++++++++++++++++++++++++++++++++ app/Controllers/configureController.php | 12 ------- app/Models/Category.php | 2 +- app/views/configure/categorize.phtml | 2 +- 4 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 app/Controllers/categoryController.php diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php new file mode 100644 index 000000000..e2d98a509 --- /dev/null +++ b/app/Controllers/categoryController.php @@ -0,0 +1,64 @@ +view->loginOk) { + Minz_Error::error( + 403, + array('error' => array(_t('access_denied'))) + ); + } + + $catDAO = new FreshRSS_CategoryDAO(); + $catDAO->checkDefault(); + } + + /** + * This action creates a new category. + * + * URL parameter is: + * - new-category + */ + public function createAction() { + $catDAO = new FreshRSS_CategoryDAO(); + $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $cat_name = Minz_Request::param('new-category'); + if (!$cat_name) { + Minz_Request::bad(_t('category_no_name'), $url_redirect); + } + + $cat = new FreshRSS_Category($cat_name); + + if ($catDAO->searchByName($cat->name()) != null) { + Minz_Request::bad(_t('category_name_exists'), $url_redirect); + } + + $values = array( + 'id' => $cat->id(), + 'name' => $cat->name(), + ); + + if ($catDAO->addCategory($values)) { + Minz_Request::good(_t('category_created', $cat->name()), $url_redirect); + } else { + Minz_Request::bad(_t('category_not_created'), $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } +} diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 231865bd7..7ef144090 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -45,7 +45,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { if (Minz_Request::isPost()) { $cats = Minz_Request::param('categories', array()); $ids = Minz_Request::param('ids', array()); - $newCat = trim(Minz_Request::param('new_category', '')); foreach ($cats as $key => $name) { if (strlen($name) > 0) { @@ -64,17 +63,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { } } - if ($newCat != '') { - $cat = new FreshRSS_Category($newCat); - $values = array( - 'id' => $cat->id(), - 'name' => $cat->name(), - ); - - if ($catDAO->searchByName($newCat) == null) { - $catDAO->addCategory($values); - } - } invalidateHttpCache(); Minz_Request::good(_t('categories_updated'), diff --git a/app/Models/Category.php b/app/Models/Category.php index 0a0dbd3ca..e5f6c4334 100644 --- a/app/Models/Category.php +++ b/app/Models/Category.php @@ -61,7 +61,7 @@ class FreshRSS_Category extends Minz_Model { $this->id = $value; } public function _name ($value) { - $this->name = $value; + $this->name = substr(trim($value), 0, 255); } public function _feeds ($values) { if (!is_array ($values)) { diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 7091ff1cf..e7435e1c7 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -7,7 +7,7 @@
    -
    +
    -- cgit v1.2.3 From 9e0a62727f8ff3c6a68b4ef85089633677ff67ef Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 15:44:45 +0200 Subject: Move empty cat action in the new Controller feedController::delete is simpler than before. Improve coding style See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/categoryController.php | 43 ++++++++++++++++++++-- app/Controllers/feedController.php | 66 +++++++++++----------------------- app/views/configure/categorize.phtml | 8 +++-- 3 files changed, 66 insertions(+), 51 deletions(-) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index e2d98a509..6863c3bb8 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -26,7 +26,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { /** * This action creates a new category. * - * URL parameter is: + * Request parameter is: * - new-category */ public function createAction() { @@ -55,7 +55,46 @@ class FreshRSS_category_Controller extends Minz_ActionController { if ($catDAO->addCategory($values)) { Minz_Request::good(_t('category_created', $cat->name()), $url_redirect); } else { - Minz_Request::bad(_t('category_not_created'), $url_redirect); + Minz_Request::bad(_t('error_occured'), $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action deletes all the feeds relative to a given category + * + * Request parameter is: + * - id (of a category) + */ + public function emptyAction() { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $id = Minz_Request::param('id'); + if (!$id) { + Minz_Request::bad(_t('category_no_id'), $url_redirect); + } + + // List feeds to remove then related user queries. + $feeds = $feedDAO->listByCategory($id); + + if ($feedDAO->deleteFeedByCategory($id)) { + // TODO: Delete old favicons + + // Remove related queries + foreach ($feeds as $feed) { + $this->view->conf->remove_query_by_get('f_' . $feed->id()); + } + $this->view->conf->save(); + + Minz_Request::good(_t('category_emptied'), $url_redirect); + } else { + Minz_Request::bad(_t('error_occured'), $url_redirect); } } diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index c7cc25fbb..7ef427ac2 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -376,62 +376,36 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } - public function deleteAction () { - if (Minz_Request::isPost ()) { - $type = Minz_Request::param ('type', 'feed'); - $id = Minz_Request::param ('id'); - + public function deleteAction() { + if (Minz_Request::isPost()) { + $id = Minz_Request::param('id'); $feedDAO = FreshRSS_Factory::createFeedDao(); - if ($type == 'category') { - // List feeds to remove then related user queries. - $feeds = $feedDAO->listByCategory($id); - - if ($feedDAO->deleteFeedByCategory ($id)) { - // Remove related queries - foreach ($feeds as $feed) { - $this->view->conf->remove_query_by_get('f_' . $feed->id()); - } - $this->view->conf->save(); - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('category_emptied') - ); - //TODO: Delete old favicons - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occured') - ); - } - } else { - if ($feedDAO->deleteFeed ($id)) { - // Remove related queries - $this->view->conf->remove_query_by_get('f_' . $id); - $this->view->conf->save(); + if ($feedDAO->deleteFeed($id)) { + // TODO: Delete old favicon - $notif = array ( - 'type' => 'good', - 'content' => Minz_Translate::t ('feed_deleted') - ); - //TODO: Delete old favicon - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Minz_Translate::t ('error_occured') - ); - } + // Remove related queries + $this->view->conf->remove_query_by_get('f_' . $id); + $this->view->conf->save(); + + $notif = array( + 'type' => 'good', + 'content' => _t('feed_deleted') + ); + } else { + $notif = array( + 'type' => 'bad', + 'content' => _t('error_occured') + ); } - Minz_Session::_param ('notification', $notif); + Minz_Session::_param('notification', $notif); $redirect_url = Minz_Request::param('r', false, true); if ($redirect_url) { Minz_Request::forward($redirect_url); - } elseif ($type == 'category') { - Minz_Request::forward(array ('c' => 'configure', 'a' => 'categorize'), true); } else { - Minz_Request::forward(array ('c' => 'configure', 'a' => 'feed'), true); + Minz_Request::forward(array('c' => 'configure', 'a' => 'feed'), true); } } } diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index e7435e1c7..2d9dd65ca 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -1,7 +1,6 @@ partial('aside_feed'); ?>
    -
    @@ -14,6 +13,8 @@
    + + categories as $cat) { $feeds = $cat->feeds(); @@ -32,8 +33,9 @@ + form="controller-category" + formaction="id()); ?>"> +
  • -- cgit v1.2.3 From b9ddffdade8f6b8ba32684ca7eb640338074e61b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 16:09:08 +0200 Subject: Additional information about cat configuration See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/configure/categorize.phtml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 2d9dd65ca..5cd962ae4 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -1,6 +1,13 @@ partial('aside_feed'); ?> -
    +
    + + +

    + +

    + defaultCategory->name()); ?> +

    -- cgit v1.2.3 From 13fb1170c06bd67ba69534e823ea6f5861c745dd Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 16:31:38 +0200 Subject: Move deletion of categories into new Controller Fix i18n (occured -> occurred) See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/categoryController.php | 47 ++++++++++++++++++++++++++++++--- app/Controllers/configureController.php | 7 ----- app/views/configure/categorize.phtml | 9 ++++++- 3 files changed, 52 insertions(+), 11 deletions(-) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 6863c3bb8..be8524749 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -55,7 +55,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { if ($catDAO->addCategory($values)) { Minz_Request::good(_t('category_created', $cat->name()), $url_redirect); } else { - Minz_Request::bad(_t('error_occured'), $url_redirect); + Minz_Request::bad(_t('error_occurred'), $url_redirect); } } @@ -63,7 +63,48 @@ class FreshRSS_category_Controller extends Minz_ActionController { } /** - * This action deletes all the feeds relative to a given category + * This action deletes a category. + * Feeds in the given category are moved in the default category. + * Related user queries are deleted too. + * + * Request parameter is: + * - id (of a category) + */ + public function deleteAction() { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $catDAO = new FreshRSS_CategoryDAO(); + $default_category = $catDAO->getDefault(); + $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $id = Minz_Request::param('id'); + if (!$id) { + Minz_Request::bad(_t('category_no_id'), $url_redirect); + } + + if ($feedDAO->changeCategory($id, $default_category->id()) === false) { + Minz_Request::bad(_t('error_occurred'), $url_redirect); + } + + if ($catDAO->deleteCategory($id) === false) { + Minz_Request::bad(_t('error_occurred'), $url_redirect); + } + + // Remove related queries. + $this->view->conf->remove_query_by_get('c_' . $id); + $this->view->conf->save(); + + Minz_Request::good(_t('category_deleted'), $url_redirect); + } + + Minz_Request::forward($url_redirect, true); + } + + /** + * This action deletes all the feeds relative to a given category. + * Feed-related queries are deleted. * * Request parameter is: * - id (of a category) @@ -94,7 +135,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { Minz_Request::good(_t('category_emptied'), $url_redirect); } else { - Minz_Request::bad(_t('error_occured'), $url_redirect); + Minz_Request::bad(_t('error_occurred'), $url_redirect); } } diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 7ef144090..a7def6d9a 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -53,13 +53,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { 'name' => $cat->name(), ); $catDAO->updateCategory($ids[$key], $values); - } elseif ($ids[$key] != $defaultId) { - $feedDAO->changeCategory($ids[$key], $defaultId); - $catDAO->deleteCategory($ids[$key]); - - // Remove related queries. - $this->view->conf->remove_query_by_get('c_' . $ids[$key]); - $this->view->conf->save(); } } diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 5cd962ae4..781c4bb14 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -44,7 +44,14 @@ formaction="id()); ?>"> -
  • +
  • + +
  • -- cgit v1.2.3 From dc714d3949373b79344438335cfc0edde77de036 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 17:11:31 +0200 Subject: Cat updating system works Add a submit button Each box contains a specific form See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/categoryController.php | 39 ++++++++++++++++++++++++ app/views/configure/categorize.phtml | 54 +++++++++++++++++++--------------- 2 files changed, 69 insertions(+), 24 deletions(-) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index be8524749..65fe631cc 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -62,6 +62,45 @@ class FreshRSS_category_Controller extends Minz_ActionController { Minz_Request::forward($url_redirect, true); } + /** + * This action updates the given category. + * + * Request parameters are: + * - id + * - name + */ + public function updateAction() { + $catDAO = new FreshRSS_CategoryDAO(); + $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + + if (Minz_Request::isPost()) { + invalidateHttpCache(); + + $id = Minz_Request::param('id'); + $name = Minz_Request::param('name', ''); + if (strlen($name) <= 0) { + Minz_Request::bad(_t('category_no_name'), $url_redirect); + } + + if ($catDAO->searchById($id) == null) { + Minz_Request::bad(_t('category_not_exist'), $url_redirect); + } + + $cat = new FreshRSS_Category($name); + $values = array( + 'name' => $cat->name(), + ); + + if ($catDAO->updateCategory($id, $values)) { + Minz_Request::good(_t('category_updated'), $url_redirect); + } else { + Minz_Request::bad(_t('error_occurred'), $url_redirect); + } + } + + Minz_Request::forward($url_redirect, true); + } + /** * This action deletes a category. * Feeds in the given category are moved in the default category. diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 781c4bb14..b9d04ddb8 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -28,32 +28,38 @@ ?>
    - - + + +
    +
      -- cgit v1.2.3 From 0d5a1f3a659b6f407b47859c794a662075e3f48e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 30 Sep 2014 19:45:49 +0200 Subject: Improve design of .box See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/layout/aside_feed.phtml | 16 ----------- app/views/configure/categorize.phtml | 24 +++++++++-------- p/themes/Dark/dark.css | 29 ++++++++++++++++++++ p/themes/Flat/flat.css | 30 +++++++++++++++++++++ p/themes/Origine/origine.css | 30 +++++++++++++++++++++ p/themes/Pafat/pafat.css | 29 ++++++++++++++++++++ p/themes/Screwdriver/screwdriver.css | 34 ++++++++++++++++++++++++ p/themes/base-theme/base.css | 24 +++++++++++++++++ p/themes/base-theme/template.css | 51 ++++++++++++++++++++++++------------ 9 files changed, 223 insertions(+), 44 deletions(-) diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index c72710c2d..c028c4918 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -57,20 +57,4 @@
    • - -
    • - - feeds)) { ?> - feeds as $feed) { ?> - nbEntries(); ?> -
    • - - ✇ - name(); ?> - -
    • - - -
    • -
    diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index b9d04ddb8..8f77f9724 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -12,12 +12,12 @@
    -
    +
      - - +
    • +
    • -
    +
    @@ -27,10 +27,9 @@ $feeds = $cat->feeds(); ?>
    -
    +
    - diff --git a/p/themes/Dark/dark.css b/p/themes/Dark/dark.css index 10f6e655b..f3790614e 100644 --- a/p/themes/Dark/dark.css +++ b/p/themes/Dark/dark.css @@ -435,6 +435,35 @@ a.btn { font-size: 0; } +/*=== Boxes */ +.box { + border: 1px solid #000; + border-radius: 5px; +} +.box .box-title { + margin: 0; + padding: 5px 10px; + background: #26303F; + border-bottom: 1px solid #000; + border-radius: 5px 5px 0 0; +} +.box .box-content { + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/Flat/flat.css b/p/themes/Flat/flat.css index 484cee9f3..d0ac46fd5 100644 --- a/p/themes/Flat/flat.css +++ b/p/themes/Flat/flat.css @@ -438,6 +438,36 @@ a.btn { background: url("loader.gif") center center no-repeat #34495e; } +/*=== Boxes */ +.box { + border: 1px solid #ddd; + border-radius: 5px; +} +.box .box-title { + margin: 0; + padding: 5px 10px; + background: #ecf0f1; + color: #333; + border-bottom: 1px solid #ddd; + border-radius: 5px 5px 0 0; +} +.box .box-content { + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index 08fc08379..e3ae85075 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -467,6 +467,36 @@ a.btn { font-size: 0; } +/*=== Boxes */ +.box { + background: #fff; + border-radius: 5px; + box-shadow: 0 0 3px #bbb; +} +.box .box-title { + margin: 0; + padding: 5px 10px; + background: #f6f6f6; + border-bottom: 1px solid #ddd; + border-radius: 5px 5px 0 0; +} +.box .box-content { + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/Pafat/pafat.css b/p/themes/Pafat/pafat.css index a35ac861d..28b17e15f 100644 --- a/p/themes/Pafat/pafat.css +++ b/p/themes/Pafat/pafat.css @@ -491,6 +491,35 @@ a.btn { font-size: 0; } +/*=== Boxes */ +.box { + border: 1px solid #aaa; + border-radius: 5px; +} +.box .box-title { + margin: 0; + padding: 5px 10px; + background: #f6f6f6; + border-bottom: 1px solid #aaa; + border-radius: 5px 5px 0 0; +} +.box .box-content { + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/Screwdriver/screwdriver.css b/p/themes/Screwdriver/screwdriver.css index 37fa18e10..6206504d1 100644 --- a/p/themes/Screwdriver/screwdriver.css +++ b/p/themes/Screwdriver/screwdriver.css @@ -497,6 +497,40 @@ a.btn { font-size: 0; } +/*=== Boxes */ +.box { + background: #EDE7DE; + border-radius: 4px 4px 0 0; +} +.box .box-title { + margin: 0; + padding: 5px 10px; + background: linear-gradient(0deg, #EDE7DE 0%, #fff 100%) #171717; + background: -webkit-linear-gradient(bottom, #EDE7DE 0%, #fff 100%); + box-shadow: 0px -1px #fff inset,0 -2px #ccc inset; + color: #888; + text-shadow: 0 1px #ccc; + border-radius: 4px 4px 0 0; + font-size: 1.1rem; + font-weight: normal; +} +.box .box-content { + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/base-theme/base.css b/p/themes/base-theme/base.css index ccfab10df..3f6ae956d 100644 --- a/p/themes/base-theme/base.css +++ b/p/themes/base-theme/base.css @@ -329,6 +329,30 @@ a.btn { font-size: 0; } +/*=== Boxes */ +.box { +} +.box .box-title { + margin: 0; + padding: 5px 10px; +} +.box .box-content { + max-height: 260px; +} + +.box .box-content .item { + padding: 0 10px; + font-size: 0.9rem; + line-height: 2.5em; +} + +.box .box-content .item .configure { + visibility: hidden; +} +.box .box-content .item:hover .configure { + visibility: visible; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 792eac299..a5a29ab23 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -280,6 +280,40 @@ a.btn { width: 100px; } +/*=== Boxes */ +.box { + display: inline-block; + width: 20rem; + max-width: 95%; + margin: 20px 10px; + border: 1px solid #ccc; + vertical-align: top; +} +.box .box-title { + font-size: 1.2rem; + font-weight: bold; + text-align: center; +} +.box .box-title form { + margin: 0; +} +.box .box-content { + display: block; + overflow: auto; +} +.box .box-content .item { + display: block; +} + +.box .box-content-centered { + padding: 30px 5px; + text-align: center; +} +.box .box-content-centered .btn { + margin: 20px 0 0; +} + + /*=== STRUCTURE */ /*===============*/ /*=== Header */ @@ -585,23 +619,6 @@ br + br + br { } /* TODO Date: Tue, 30 Sep 2014 22:18:01 +0200 Subject: i18n minor spelling --- app/i18n/en.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/i18n/en.php b/app/i18n/en.php index beba02c4d..98f611c13 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -368,7 +368,7 @@ return array ( 'login_required' => 'Login required:', 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', - 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You may lost related favorites and user queries. It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You may lose related favorites and user queries. It cannot be cancelled!', 'notif_title_new_articles' => 'FreshRSS: new articles!', 'notif_body_new_articles' => 'There are \d new articles to read on FreshRSS.', -- cgit v1.2.3 From a5a0bd9a350836cb7e504fdb501c82cda37d2562 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 30 Sep 2014 22:28:47 +0200 Subject: SQL performance: Removed filter to hide old articles As discussed on https://github.com/marienfressinaud/FreshRSS/issues/493#issuecomment-56266415 For performance, but this is also a good simplification. Will help with PostgreSQL https://github.com/marienfressinaud/FreshRSS/issues/416 and SQLite too https://github.com/marienfressinaud/FreshRSS/issues/100 because the main query becomes simpler. Me may need to introduce another system to hide old articles, if this is a problem for some users. Also, the feature showing "empty feeds" in another colour may need to be adapted. --- app/Controllers/indexController.php | 12 +++--------- app/Models/EntryDAO.php | 29 ++++++++++------------------- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index e8e26b142..1b6563bb3 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -113,16 +113,10 @@ class FreshRSS_index_Controller extends Minz_ActionController { } } - $today = @strtotime('today'); - $this->view->today = $today; - - // on calcule la date des articles les plus anciens qu'on affiche - $nb_month_old = $this->view->conf->old_entries; - $date_min = $today - (3600 * 24 * 30 * $nb_month_old); //Do not use a fast changing value such as time() to allow SQL caching - $keepHistoryDefault = $this->view->conf->keep_history_default; + $this->view->today = @strtotime('today'); try { - $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb + 1, $first, $filter, $date_min, true, $keepHistoryDefault); + $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb + 1, $first, $filter); // Si on a récupéré aucun article "non lus" // on essaye de récupérer tous les articles @@ -135,7 +129,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Log::record('Failed to automatically correct nbNotRead! ' + $ex->getMessage(), Minz_Log::NOTICE); } $this->view->state = FreshRSS_Entry::STATE_ALL; - $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb, $first, $filter, $date_min, true, $keepHistoryDefault); + $entries = $entryDAO->listWhere($getType, $getId, $this->view->state, $order, $nb, $first, $filter); } Minz_Request::_param('state', $this->view->state); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index c1f87ee34..751ee6da7 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -299,7 +299,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return 'CONCAT(' . $s1 . ',' . $s2 . ')'; //MySQL } - private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { + private function sqlListWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { if (!$state) { $state = FreshRSS_Entry::STATE_ALL; } @@ -356,23 +356,14 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { default: throw new FreshRSS_EntriesGetter_Exception('Bad order in Entry->listByType: [' . $order . ']!'); } - if ($firstId === '' && parent::$sharedDbType === 'mysql') { - $firstId = $order === 'DESC' ? '9000000000'. '000000' : '0'; //MySQL optimization. Tested on MySQL 5.5 with 150k articles - } + /*if ($firstId === '' && parent::$sharedDbType === 'mysql') { + $firstId = $order === 'DESC' ? '9000000000'. '000000' : '0'; //MySQL optimization. TODO: check if this is needed again, after the filtering for old articles has been removed in 0.9-dev + }*/ if ($firstId !== '') { $where .= 'AND e1.id ' . ($order === 'DESC' ? '<=' : '>=') . $firstId . ' '; } - if (($date_min > 0) && ($type !== 's')) { - $where .= 'AND (e1.id >= ' . $date_min . '000000'; - if ($showOlderUnreadsorFavorites) { //Lax date constraint - $where .= ' OR e1.is_read=0 OR e1.is_favorite=1 OR (f.keep_history <> 0'; - if (intval($keepHistoryDefault) === 0) { - $where .= ' AND f.keep_history <> -2'; //default - } - $where .= ')'; - } - $where .= ') '; - $joinFeed = true; + if ($date_min > 0) { + $where .= 'AND e1.id >= ' . $date_min . '000000 '; } $search = ''; if ($filter !== '') { @@ -434,8 +425,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { . ($limit > 0 ? ' LIMIT ' . $limit : '')); //TODO: See http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ } - public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { - list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault); + public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); $sql = 'SELECT e.id, e.guid, e.title, e.author, ' . ($this->isCompressed() ? 'UNCOMPRESS(content_bin) AS content' : 'content') @@ -452,8 +443,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { return self::daoToEntry($stm->fetchAll(PDO::FETCH_ASSOC)); } - public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0, $showOlderUnreadsorFavorites = false, $keepHistoryDefault = 0) { //For API - list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min, $showOlderUnreadsorFavorites, $keepHistoryDefault); + public function listIdsWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { //For API + list($values, $sql) = $this->sqlListWhere($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); $stm = $this->bd->prepare($sql); $stm->execute($values); -- cgit v1.2.3 From 7481887db746fd2d6eefab021776b8abd4076429 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 10:06:04 +0200 Subject: Load feed configuration on the same page Need improvements See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/configureController.php | 4 ++++ app/views/configure/categorize.phtml | 5 ++++- app/views/configure/feed.phtml | 8 ++++++-- p/scripts/main.js | 30 ++++++++++++++++++++++++++++++ p/themes/base-theme/template.css | 5 +++++ 5 files changed, 49 insertions(+), 3 deletions(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index a7def6d9a..dd7a0a441 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -90,6 +90,10 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * Default values are empty strings unless specified. */ public function feedAction() { + if (Minz_Request::param('ajax')) { + $this->view->_useLayout(false); + } + $catDAO = new FreshRSS_CategoryDAO(); $this->view->categories = $catDAO->listCategories(false); diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 8f77f9724..008dc8c98 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -73,7 +73,7 @@ $empty = $feed->nbEntries() == 0 ? ' empty' : ''; ?>
  • - + ✇ name(); ?>
  • + +
    +
    diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index e96a28739..f58ac65af 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -1,8 +1,12 @@ -partial ('aside_feed'); ?> +partial('aside_feed'); + } +?> flux) { ?>
    - +

    flux->name (); ?>

    flux->description (); ?> diff --git a/p/scripts/main.js b/p/scripts/main.js index f6d5d2907..7fed7a819 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1240,6 +1240,35 @@ function faviconNbUnread(n) { } } +function init_slider_observers() { + var slider = $('#slider'); + if (slider.length < 1) { + return; + } + + $('.open-slider').on('click', function() { + if (ajax_loading) { + return false; + } + + ajax_loading = true; + + var url_slide = $(this).attr('href'); + + $.ajax({ + type: 'GET', + url: url_slide, + data : { ajax: true } + }).done(function (data) { + slider.html(data); + slider.show(); + ajax_loading = false; + }); + + return false; + }) +} + function init_all() { if (!(window.$ && window.url_freshrss)) { if (window.console) { @@ -1275,6 +1304,7 @@ function init_all() { init_feed_observers(); init_password_observers(); init_stats_observers(); + init_slider_observers(); } if (window.console) { diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index a5a29ab23..397f943a6 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -645,6 +645,11 @@ br + br + br { display: none; } +/*=== Slider */ +#slider { + min-height: 50px; +} + /*=== DIVERS */ /*===========*/ .nav-login, -- cgit v1.2.3 From fdb63fbbe695b6a6bc32f0e93f2ff702ca42329c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 10:19:38 +0200 Subject: Simplify configureController Remove useless code for category configuration. See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/configureController.php | 33 +-------------------------------- app/views/configure/categorize.phtml | 2 +- 2 files changed, 2 insertions(+), 33 deletions(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index dd7a0a441..3fd1d5149 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -28,43 +28,12 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * This action handles the category configuration page * * It displays the category configuration page. - * If this action is reached through a POST request, it loops through - * every category to check for modification then add a new category if - * needed then sends a notification to the user. - * If a category name is emptied, the category is deleted and all - * related feeds are moved to the default category. Related user queries - * are deleted too. - * If a category name is changed, it is updated. */ public function categorizeAction() { - $feedDAO = FreshRSS_Factory::createFeedDao(); $catDAO = new FreshRSS_CategoryDAO(); - $defaultCategory = $catDAO->getDefault(); - $defaultId = $defaultCategory->id(); - - if (Minz_Request::isPost()) { - $cats = Minz_Request::param('categories', array()); - $ids = Minz_Request::param('ids', array()); - - foreach ($cats as $key => $name) { - if (strlen($name) > 0) { - $cat = new FreshRSS_Category($name); - $values = array( - 'name' => $cat->name(), - ); - $catDAO->updateCategory($ids[$key], $values); - } - } - - invalidateHttpCache(); - - Minz_Request::good(_t('categories_updated'), - array('c' => 'configure', 'a' => 'categorize')); - } $this->view->categories = $catDAO->listCategories(false); - $this->view->defaultCategory = $catDAO->getDefault(); - $this->view->feeds = $feedDAO->listFeeds(); + $this->view->default_category = $catDAO->getDefault(); Minz_View::prependTitle(_t('categories_management') . ' · '); } diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml index 008dc8c98..f5030ef2c 100644 --- a/app/views/configure/categorize.phtml +++ b/app/views/configure/categorize.phtml @@ -6,7 +6,7 @@

    - defaultCategory->name()); ?> + default_category->name()); ?>

    -- cgit v1.2.3 From 1eef7893068655f8d145a3e06061a9e6296ac1f3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 11:27:41 +0200 Subject: Reorganize subscription management code There is still a lot of work to do. Some links are broken. See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/configureController.php | 116 ------------------ app/Controllers/subscriptionController.php | 130 ++++++++++++++++++++ app/Models/Themes.php | 1 + app/layout/aside_feed.phtml | 60 ---------- app/layout/aside_flux.phtml | 4 +- app/layout/aside_subscription.phtml | 17 +++ app/views/configure/categorize.phtml | 90 -------------- app/views/configure/feed.phtml | 186 ----------------------------- app/views/importExport/index.phtml | 2 +- app/views/subscription/feed.phtml | 186 +++++++++++++++++++++++++++++ app/views/subscription/index.phtml | 132 ++++++++++++++++++++ p/themes/icons/import.svg | 9 ++ 12 files changed, 478 insertions(+), 455 deletions(-) create mode 100644 app/Controllers/subscriptionController.php delete mode 100644 app/layout/aside_feed.phtml create mode 100644 app/layout/aside_subscription.phtml delete mode 100644 app/views/configure/categorize.phtml delete mode 100644 app/views/configure/feed.phtml create mode 100644 app/views/subscription/feed.phtml create mode 100644 app/views/subscription/index.phtml create mode 100644 p/themes/icons/import.svg diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 3fd1d5149..b7b88b3ba 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -8,9 +8,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { * This action is called before every other action in that class. It is * the common boiler plate for every action. It is triggered by the * underlying framework. - * - * @todo see if the category default configuration is needed here or if - * we can move it to the categorize action */ public function firstAction() { if (!$this->view->loginOk) { @@ -19,119 +16,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { array('error' => array(_t('access_denied'))) ); } - - $catDAO = new FreshRSS_CategoryDAO(); - $catDAO->checkDefault(); - } - - /** - * This action handles the category configuration page - * - * It displays the category configuration page. - */ - public function categorizeAction() { - $catDAO = new FreshRSS_CategoryDAO(); - - $this->view->categories = $catDAO->listCategories(false); - $this->view->default_category = $catDAO->getDefault(); - - Minz_View::prependTitle(_t('categories_management') . ' · '); - } - - /** - * This action handles the feed configuration page. - * - * It displays the feed configuration page. - * If this action is reached through a POST request, it stores all new - * configuraiton values then sends a notification to the user. - * - * The options available on the page are: - * - name - * - description - * - website URL - * - feed URL - * - category id (default: default category id) - * - CSS path to article on website - * - display in main stream (default: 0) - * - HTTP authentication - * - number of article to retain (default: -2) - * - refresh frequency (default: -2) - * Default values are empty strings unless specified. - */ - public function feedAction() { - if (Minz_Request::param('ajax')) { - $this->view->_useLayout(false); - } - - $catDAO = new FreshRSS_CategoryDAO(); - $this->view->categories = $catDAO->listCategories(false); - - $feedDAO = FreshRSS_Factory::createFeedDao(); - $this->view->feeds = $feedDAO->listFeeds(); - - $id = Minz_Request::param('id'); - if ($id == false && !empty($this->view->feeds)) { - $id = current($this->view->feeds)->id(); - } - - $this->view->flux = false; - if ($id != false) { - $this->view->flux = $this->view->feeds[$id]; - - if (!$this->view->flux) { - Minz_Error::error( - 404, - array('error' => array(_t('page_not_found'))) - ); - } else { - if (Minz_Request::isPost() && $this->view->flux) { - $user = Minz_Request::param('http_user', ''); - $pass = Minz_Request::param('http_pass', ''); - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - - $cat = intval(Minz_Request::param('category', 0)); - - $values = array( - 'name' => Minz_Request::param('name', ''), - 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), - 'website' => Minz_Request::param('website', ''), - 'url' => Minz_Request::param('url', ''), - 'category' => $cat, - 'pathEntries' => Minz_Request::param('path_entries', ''), - 'priority' => intval(Minz_Request::param('priority', 0)), - 'httpAuth' => $httpAuth, - 'keep_history' => intval(Minz_Request::param('keep_history', -2)), - 'ttl' => intval(Minz_Request::param('ttl', -2)), - ); - - if ($feedDAO->updateFeed($id, $values)) { - $this->view->flux->_category($cat); - $this->view->flux->faviconPrepare(); - $notif = array( - 'type' => 'good', - 'content' => _t('feed_updated') - ); - } else { - $notif = array( - 'type' => 'bad', - 'content' => _t('error_occurred_update') - ); - } - invalidateHttpCache(); - - Minz_Session::_param('notification', $notif); - Minz_Request::forward(array('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true); - } - - Minz_View::prependTitle(_t('rss_feed_management') . ' — ' . $this->view->flux->name() . ' · '); - } - } else { - Minz_View::prependTitle(_t('rss_feed_management') . ' · '); - } } /** diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php new file mode 100644 index 000000000..ab00f3e6a --- /dev/null +++ b/app/Controllers/subscriptionController.php @@ -0,0 +1,130 @@ +view->loginOk) { + Minz_Error::error( + 403, + array('error' => array(_t('access_denied'))) + ); + } + } + + /** + * This action handles the main subscription page + * + * It displays categories and associated feeds. + */ + public function indexAction() { + $catDAO = new FreshRSS_CategoryDAO(); + + $this->view->categories = $catDAO->listCategories(false); + $this->view->default_category = $catDAO->getDefault(); + + Minz_View::prependTitle(_t('subscription_management') . ' · '); + } + + /** + * This action handles the feed configuration page. + * + * It displays the feed configuration page. + * If this action is reached through a POST request, it stores all new + * configuraiton values then sends a notification to the user. + * + * The options available on the page are: + * - name + * - description + * - website URL + * - feed URL + * - category id (default: default category id) + * - CSS path to article on website + * - display in main stream (default: 0) + * - HTTP authentication + * - number of article to retain (default: -2) + * - refresh frequency (default: -2) + * Default values are empty strings unless specified. + */ + public function feedAction() { + if (Minz_Request::param('ajax')) { + $this->view->_useLayout(false); + } + + $catDAO = new FreshRSS_CategoryDAO(); + $this->view->categories = $catDAO->listCategories(false); + + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feeds = $feedDAO->listFeeds(); + + $id = Minz_Request::param('id'); + if ($id == false && !empty($this->view->feeds)) { + $id = current($this->view->feeds)->id(); + } + + $this->view->flux = false; + if ($id != false) { + $this->view->flux = $this->view->feeds[$id]; + + if (!$this->view->flux) { + Minz_Error::error( + 404, + array('error' => array(_t('page_not_found'))) + ); + } else { + if (Minz_Request::isPost() && $this->view->flux) { + $user = Minz_Request::param('http_user', ''); + $pass = Minz_Request::param('http_pass', ''); + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } + + $cat = intval(Minz_Request::param('category', 0)); + + $values = array( + 'name' => Minz_Request::param('name', ''), + 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), + 'website' => Minz_Request::param('website', ''), + 'url' => Minz_Request::param('url', ''), + 'category' => $cat, + 'pathEntries' => Minz_Request::param('path_entries', ''), + 'priority' => intval(Minz_Request::param('priority', 0)), + 'httpAuth' => $httpAuth, + 'keep_history' => intval(Minz_Request::param('keep_history', -2)), + 'ttl' => intval(Minz_Request::param('ttl', -2)), + ); + + if ($feedDAO->updateFeed($id, $values)) { + $this->view->flux->_category($cat); + $this->view->flux->faviconPrepare(); + $notif = array( + 'type' => 'good', + 'content' => _t('feed_updated') + ); + } else { + $notif = array( + 'type' => 'bad', + 'content' => _t('error_occurred_update') + ); + } + invalidateHttpCache(); + + Minz_Session::_param('notification', $notif); + Minz_Request::forward(array('c' => 'subscription'), true); + } + + Minz_View::prependTitle(_t('rss_feed_management') . ' · ' . $this->view->flux->name() . ' · '); + } + } else { + Minz_View::prependTitle(_t('rss_feed_management') . ' · '); + } + } +} diff --git a/app/Models/Themes.php b/app/Models/Themes.php index 68fc17a2b..e3b260261 100644 --- a/app/Models/Themes.php +++ b/app/Models/Themes.php @@ -82,6 +82,7 @@ class FreshRSS_Themes extends Minz_Model { 'favorite' => '★', 'help' => 'ⓘ', 'icon' => '⊚', + 'import' => '⤓', 'key' => '⚿', 'link' => '↗', 'login' => '🔒', diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml deleted file mode 100644 index c028c4918..000000000 --- a/app/layout/aside_feed.phtml +++ /dev/null @@ -1,60 +0,0 @@ - diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index aac3c0896..341697103 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -7,8 +7,8 @@
  • - - + +
  • diff --git a/app/layout/aside_subscription.phtml b/app/layout/aside_subscription.phtml new file mode 100644 index 000000000..9a95763c3 --- /dev/null +++ b/app/layout/aside_subscription.phtml @@ -0,0 +1,17 @@ + diff --git a/app/views/configure/categorize.phtml b/app/views/configure/categorize.phtml deleted file mode 100644 index f5030ef2c..000000000 --- a/app/views/configure/categorize.phtml +++ /dev/null @@ -1,90 +0,0 @@ -partial('aside_feed'); ?> - -
    - - -

    - -

    - default_category->name()); ?> -

    - -
    -
    - -
      -
      -
    • -
    • -
      -
    -
    - - - - categories as $cat) { - $feeds = $cat->feeds(); - ?> -
    -
    -
    - - - -
    -
    - -
      - - inError() ? ' error' : ''; - $empty = $feed->nbEntries() == 0 ? ' empty' : ''; - ?> -
    • - - ✇ name(); ?> -
    • - -
    • - -
    -
    - -
    - -
    -
    diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml deleted file mode 100644 index f58ac65af..000000000 --- a/app/views/configure/feed.phtml +++ /dev/null @@ -1,186 +0,0 @@ -partial('aside_feed'); - } -?> - -flux) { ?> -
    - - -

    flux->name (); ?>

    - flux->description (); ?> - - flux->nbEntries (); ?> - - flux->inError ()) { ?> -

    - -

    - - -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - - -
    -
    -
    -
    - - -
    -
    - - - -
    -
    -
    - - - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - -
    -
    - - - flux->httpAuth (false); ?> -
    - -
    - - -
    - - -
    - -
    -
    - -
    -
    - - -
    -
    - - -
    - -
    - - -
    -
    - -
    -
    - - -
    -
    -
    -
    - - -
    - diff --git a/app/views/importExport/index.phtml b/app/views/importExport/index.phtml index 35371faca..36c0eab4e 100644 --- a/app/views/importExport/index.phtml +++ b/app/views/importExport/index.phtml @@ -1,4 +1,4 @@ -partial('aside_feed'); ?> +partial('aside_subscription'); ?>
    diff --git a/app/views/subscription/feed.phtml b/app/views/subscription/feed.phtml new file mode 100644 index 000000000..e047741a1 --- /dev/null +++ b/app/views/subscription/feed.phtml @@ -0,0 +1,186 @@ +partial('aside_subscription'); + } +?> + +flux) { ?> +
    + + +

    flux->name (); ?>

    + flux->description (); ?> + + flux->nbEntries (); ?> + + flux->inError ()) { ?> +

    + +

    + + +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
    +
    +
    + +
    +
    + + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + +
    +
    + + + flux->httpAuth (false); ?> +
    + +
    + + +
    + + +
    + +
    +
    + +
    +
    + + +
    +
    + + +
    + +
    + + +
    +
    + +
    +
    + + +
    +
    +
    +
    + + +
    + diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml new file mode 100644 index 000000000..444dc9d9b --- /dev/null +++ b/app/views/subscription/index.phtml @@ -0,0 +1,132 @@ +partial('aside_subscription'); ?> + +
    + + +

    + +
    +
    + + + +
    +
    + +

    + default_category->name()); ?> +

    + +
    +
    + +
      +
      +
    • +
    • +
      +
    +
    + + + + categories as $cat) { + $feeds = $cat->feeds(); + ?> +
    +
    +
    + + + +
    +
    + +
      + + inError() ? ' error' : ''; + $empty = $feed->nbEntries() == 0 ? ' empty' : ''; + ?> +
    • + + ✇ name(); ?> +
    • + +
    • + +
    +
    + +
    + +
    +
    diff --git a/p/themes/icons/import.svg b/p/themes/icons/import.svg new file mode 100644 index 000000000..a7f20c909 --- /dev/null +++ b/p/themes/icons/import.svg @@ -0,0 +1,9 @@ + + + + + + + + + -- cgit v1.2.3 From 89c407d7d7f739e42d9e72e40304bbbef00c9b10 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 11:58:08 +0200 Subject: Add selected feed on main subscription page - When an id is given, corresponding feed is displayed - Refactor code - Improve coding style See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/subscriptionController.php | 116 ++++++++---------- app/views/helpers/feed/update.phtml | 175 ++++++++++++++++++++++++++ app/views/subscription/feed.phtml | 191 ++--------------------------- app/views/subscription/index.phtml | 5 + 4 files changed, 242 insertions(+), 245 deletions(-) create mode 100644 app/views/helpers/feed/update.phtml diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index ab00f3e6a..83f803edb 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -16,6 +16,11 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { array('error' => array(_t('access_denied'))) ); } + + $catDAO = new FreshRSS_CategoryDAO(); + + $this->view->categories = $catDAO->listCategories(false); + $this->view->default_category = $catDAO->getDefault(); } /** @@ -24,12 +29,13 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { * It displays categories and associated feeds. */ public function indexAction() { - $catDAO = new FreshRSS_CategoryDAO(); - - $this->view->categories = $catDAO->listCategories(false); - $this->view->default_category = $catDAO->getDefault(); - Minz_View::prependTitle(_t('subscription_management') . ' · '); + + $id = Minz_Request::param('id'); + if ($id !== false) { + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feed = $feedDAO->searchById($id); + } } /** @@ -57,74 +63,56 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $this->view->_useLayout(false); } - $catDAO = new FreshRSS_CategoryDAO(); - $this->view->categories = $catDAO->listCategories(false); - $feedDAO = FreshRSS_Factory::createFeedDao(); $this->view->feeds = $feedDAO->listFeeds(); $id = Minz_Request::param('id'); - if ($id == false && !empty($this->view->feeds)) { - $id = current($this->view->feeds)->id(); + if ($id === false || !isset($this->view->feeds[$id])) { + Minz_Error::error( + 404, + array('error' => array(_t('page_not_found'))) + ); + return; } - $this->view->flux = false; - if ($id != false) { - $this->view->flux = $this->view->feeds[$id]; + $this->view->feed = $this->view->feeds[$id]; + + Minz_View::prependTitle(_t('rss_feed_management') . ' · ' . $this->view->feed->name() . ' · '); + + if (Minz_Request::isPost()) { + $user = Minz_Request::param('http_user', ''); + $pass = Minz_Request::param('http_pass', ''); + + $httpAuth = ''; + if ($user != '' || $pass != '') { + $httpAuth = $user . ':' . $pass; + } + + $cat = intval(Minz_Request::param('category', 0)); + + $values = array( + 'name' => Minz_Request::param('name', ''), + 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), + 'website' => Minz_Request::param('website', ''), + 'url' => Minz_Request::param('url', ''), + 'category' => $cat, + 'pathEntries' => Minz_Request::param('path_entries', ''), + 'priority' => intval(Minz_Request::param('priority', 0)), + 'httpAuth' => $httpAuth, + 'keep_history' => intval(Minz_Request::param('keep_history', -2)), + 'ttl' => intval(Minz_Request::param('ttl', -2)), + ); + + invalidateHttpCache(); + + if ($feedDAO->updateFeed($id, $values)) { + $this->view->feed->_category($cat); + $this->view->feed->faviconPrepare(); - if (!$this->view->flux) { - Minz_Error::error( - 404, - array('error' => array(_t('page_not_found'))) - ); + Minz_Request::good(_t('feed_updated'), array('c' => 'subscription', 'params' => array('id' => $id))); } else { - if (Minz_Request::isPost() && $this->view->flux) { - $user = Minz_Request::param('http_user', ''); - $pass = Minz_Request::param('http_pass', ''); - - $httpAuth = ''; - if ($user != '' || $pass != '') { - $httpAuth = $user . ':' . $pass; - } - - $cat = intval(Minz_Request::param('category', 0)); - - $values = array( - 'name' => Minz_Request::param('name', ''), - 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), - 'website' => Minz_Request::param('website', ''), - 'url' => Minz_Request::param('url', ''), - 'category' => $cat, - 'pathEntries' => Minz_Request::param('path_entries', ''), - 'priority' => intval(Minz_Request::param('priority', 0)), - 'httpAuth' => $httpAuth, - 'keep_history' => intval(Minz_Request::param('keep_history', -2)), - 'ttl' => intval(Minz_Request::param('ttl', -2)), - ); - - if ($feedDAO->updateFeed($id, $values)) { - $this->view->flux->_category($cat); - $this->view->flux->faviconPrepare(); - $notif = array( - 'type' => 'good', - 'content' => _t('feed_updated') - ); - } else { - $notif = array( - 'type' => 'bad', - 'content' => _t('error_occurred_update') - ); - } - invalidateHttpCache(); - - Minz_Session::_param('notification', $notif); - Minz_Request::forward(array('c' => 'subscription'), true); - } - - Minz_View::prependTitle(_t('rss_feed_management') . ' · ' . $this->view->flux->name() . ' · '); + Minz_Request::bad(_t('error_occurred_update'), array('c' => 'subscription')); } - } else { - Minz_View::prependTitle(_t('rss_feed_management') . ' · '); } } } diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml new file mode 100644 index 000000000..4a6425c45 --- /dev/null +++ b/app/views/helpers/feed/update.phtml @@ -0,0 +1,175 @@ +
    + + +

    feed->name (); ?>

    + feed->description (); ?> + + feed->nbEntries (); ?> + + feed->inError ()) { ?> +

    + +

    + + +
    + +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + + +
    +
    +
    +
    + +
    +
    + + +
    + + +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    + +
    +
    +
    +
    + + +
    +
    + + + feed->httpAuth (false); ?> +
    + +
    + + +
    + + +
    + +
    +
    + +
    +
    + + +
    +
    + + +
    + +
    + + +
    +
    + +
    +
    + + +
    +
    +
    +
    diff --git a/app/views/subscription/feed.phtml b/app/views/subscription/feed.phtml index e047741a1..48a401c4a 100644 --- a/app/views/subscription/feed.phtml +++ b/app/views/subscription/feed.phtml @@ -1,186 +1,15 @@ partial('aside_subscription'); - } -?> - -flux) { ?> -
    - - -

    flux->name (); ?>

    - flux->description (); ?> - - flux->nbEntries (); ?> - - flux->inError ()) { ?> -

    - -

    - - -
    - -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    - -
    -
    - - -
    -
    -
    -
    - -
    -
    - - -
    - - -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - - -
    -
    -
    -
    - - -
    -
    - +if (!Minz_Request::param('ajax')) { + $this->partial('aside_subscription'); +} -
    -
    -
    - - - - -
    -
    -
    -
    - -
    - -
    -
    -
    - -
    - -
    -
    -
    -
    - - -
    -
    - - - flux->httpAuth (false); ?> -
    - -
    - - -
    - - -
    - -
    -
    - -
    -
    - - -
    -
    - - -
    - -
    - - -
    -
    - -
    -
    - - -
    -
    -
    +if ($this->feed) { + $this->renderHelper('feed/update'); +} else { +?> +
    + +
    - - -
    diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index 444dc9d9b..bce9eacf1 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -129,4 +129,9 @@
    +feed) && $this->feed) { + $this->renderHelper('feed/update'); + } +?>
    -- cgit v1.2.3 From a7bf7ced369a046b487ab1cd8b3819acc5ebdafe Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 12:18:32 +0200 Subject: Fix links for feed management See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/categoryController.php | 8 ++++---- app/Controllers/feedController.php | 16 +++++++++------- app/layout/aside_flux.phtml | 2 +- app/views/helpers/view/global_view.phtml | 2 +- app/views/helpers/view/normal_view.phtml | 2 +- app/views/helpers/view/reader_view.phtml | 2 +- app/views/stats/idle.phtml | 2 +- app/views/stats/repartition.phtml | 2 +- 8 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 65fe631cc..2c99751a4 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -31,7 +31,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { */ public function createAction() { $catDAO = new FreshRSS_CategoryDAO(); - $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { invalidateHttpCache(); @@ -71,7 +71,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { */ public function updateAction() { $catDAO = new FreshRSS_CategoryDAO(); - $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { invalidateHttpCache(); @@ -113,7 +113,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { $feedDAO = FreshRSS_Factory::createFeedDao(); $catDAO = new FreshRSS_CategoryDAO(); $default_category = $catDAO->getDefault(); - $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { invalidateHttpCache(); @@ -150,7 +150,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { */ public function emptyAction() { $feedDAO = FreshRSS_Factory::createFeedDao(); - $url_redirect = array('c' => 'configure', 'a' => 'categorize'); + $url_redirect = array('c' => 'subscription', 'a' => 'index'); if (Minz_Request::isPost()) { invalidateHttpCache(); diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 7ef427ac2..e4859b110 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -26,8 +26,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($url === false) { Minz_Request::forward(array( - 'c' => 'configure', - 'a' => 'feed' + 'c' => 'subscription', + 'a' => 'index' ), true); } @@ -166,7 +166,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feedDAO->rollBack (); } - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); + Minz_Request::forward (array ('c' => 'subscription', 'a' => 'index', 'params' => $params), true); } else { // GET request so we must ask confirmation to user @@ -193,8 +193,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Session::_param('notification', $notif); Minz_Request::forward(array( - 'c' => 'configure', - 'a' => 'feed', + 'c' => 'subscription', + 'a' => 'index', 'params' => array( 'id' => $feed->id() ) @@ -214,7 +214,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { ); Minz_Session::_param ('notification', $notif); invalidateHttpCache(); - Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true); + Minz_Request::forward (array ('c' => 'subscription', + 'a' => 'index', + 'params' => array('id' => $id)), true); } } @@ -405,7 +407,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($redirect_url) { Minz_Request::forward($redirect_url); } else { - Minz_Request::forward(array('c' => 'configure', 'a' => 'feed'), true); + Minz_Request::forward(array('c' => 'subscription', 'a' => 'index'), true); } } } diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 341697103..a8ae2f424 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -89,7 +89,7 @@
  • loginOk) { ?>
  • -
  • +
  • conf->reading_confirm ? 'confirm' : ''; ?> diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml index 72bcf4c73..5e4cad01a 100644 --- a/app/views/helpers/view/global_view.phtml +++ b/app/views/helpers/view/global_view.phtml @@ -48,6 +48,6 @@

    -

    +

    diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 6d9789f8d..e469edf58 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -186,6 +186,6 @@ if (!empty($this->entries)) {

    -

    +

    diff --git a/app/views/helpers/view/reader_view.phtml b/app/views/helpers/view/reader_view.phtml index c80dca519..413094239 100644 --- a/app/views/helpers/view/reader_view.phtml +++ b/app/views/helpers/view/reader_view.phtml @@ -39,6 +39,6 @@ if (!empty($this->entries)) {

    -

    +

    diff --git a/app/views/stats/idle.phtml b/app/views/stats/idle.phtml index 6f3d4a117..75cba1081 100644 --- a/app/views/stats/idle.phtml +++ b/app/views/stats/idle.phtml @@ -25,7 +25,7 @@
  • - +
  • diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index b425c1458..dac47e189 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -24,7 +24,7 @@ feed) {?> - + -- cgit v1.2.3 From f400621f44c2aac0b1bb4204e95e4c35a8a35f8f Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 13:37:10 +0200 Subject: Fix problem when deleting default category This is not allowed! See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/categoryController.php | 4 ++++ app/Controllers/subscriptionController.php | 1 + app/views/subscription/index.phtml | 12 +++++++++--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 2c99751a4..c79f37fa4 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -123,6 +123,10 @@ class FreshRSS_category_Controller extends Minz_ActionController { Minz_Request::bad(_t('category_no_id'), $url_redirect); } + if ($id === $default_category->id()) { + Minz_Request::bad(_t('category_not_delete_default'), $url_redirect); + } + if ($feedDAO->changeCategory($id, $default_category->id()) === false) { Minz_Request::bad(_t('error_occurred'), $url_redirect); } diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 83f803edb..aabae7b8f 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -19,6 +19,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $catDAO = new FreshRSS_CategoryDAO(); + $catDAO->checkDefault(); $this->view->categories = $catDAO->listCategories(false); $this->view->default_category = $catDAO->getDefault(); } diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index bce9eacf1..2d55890f7 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -82,9 +82,14 @@
  • -
  • + id() === $this->default_category->id()); - + if (!$no_feed || !$is_default) { + ?> +
  • +
  • - +
  • +
    -- cgit v1.2.3 From 405f23050b18e8388edb6f8be90aa59c17ada421 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 13:55:30 +0200 Subject: Design of the slider See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/subscription/index.phtml | 5 +++-- p/scripts/main.js | 14 ++++++++++---- p/themes/base-theme/template.css | 24 +++++++++++++++++++++++- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index 2d55890f7..10578bdd3 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -134,9 +134,10 @@
    -
    + +
    feed) ? ' class="active"' : ''; ?>> feed) && $this->feed) { + if (isset($this->feed)) { $this->renderHelper('feed/update'); } ?> diff --git a/p/scripts/main.js b/p/scripts/main.js index 7fed7a819..925a93650 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1241,7 +1241,8 @@ function faviconNbUnread(n) { } function init_slider_observers() { - var slider = $('#slider'); + var slider = $('#slider'), + closer = $('#close-slider'); if (slider.length < 1) { return; } @@ -1252,7 +1253,6 @@ function init_slider_observers() { } ajax_loading = true; - var url_slide = $(this).attr('href'); $.ajax({ @@ -1261,12 +1261,18 @@ function init_slider_observers() { data : { ajax: true } }).done(function (data) { slider.html(data); - slider.show(); + closer.addClass('active'); + slider.addClass('active'); ajax_loading = false; }); return false; - }) + }); + + closer.on('click', function() { + closer.removeClass('active'); + slider.removeClass('active'); + }); } function init_all() { diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 397f943a6..e6c832ee4 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -647,7 +647,29 @@ br + br + br { /*=== Slider */ #slider { - min-height: 50px; + position: fixed; + top: 0; bottom: 0; + left: 100%; right: 0; + overflow: auto; + background: #fff; + border-left: 1px solid #aaa; + transition: left 200ms linear; + -moz-transition: left 200ms linear; + -webkit-transition: left 200ms linear; + -o-transition: left 200ms linear; + -ms-transition: left 200ms linear; +} +#slider.active { + left: 40%; +} +#close-slider { + position: fixed; + top: 0; bottom: 0; + left: 100%; right: 0; + cursor: pointer; +} +#close-slider.active { + left: 0; } /*=== DIVERS */ -- cgit v1.2.3 From fe655e0d9d2fb1173099d77c478bbb2f7ac8b1e1 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 13:58:09 +0200 Subject: Fix close slider when a feed is selected See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/subscription/index.phtml | 5 +++-- p/scripts/main.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index 10578bdd3..577ddd972 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -134,8 +134,9 @@
    - -
    feed) ? ' class="active"' : ''; ?>> +feed) ? ' class="active"' : ''; ?> +> +
    > feed)) { $this->renderHelper('feed/update'); diff --git a/p/scripts/main.js b/p/scripts/main.js index 925a93650..005dc961b 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1272,6 +1272,7 @@ function init_slider_observers() { closer.on('click', function() { closer.removeClass('active'); slider.removeClass('active'); + return false; }); } -- cgit v1.2.3 From bbedca510bb0b88850476bf2e2aa6af8c02ac741 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 09:21:08 +0200 Subject: Better import icon See https://github.com/marienfressinaud/FreshRSS/issues/646 --- p/themes/icons/import.svg | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/p/themes/icons/import.svg b/p/themes/icons/import.svg index a7f20c909..18a54ab59 100644 --- a/p/themes/icons/import.svg +++ b/p/themes/icons/import.svg @@ -1,9 +1 @@ - - - - - - - - - + -- cgit v1.2.3 From 9b2ad32e98e4720d5ee422fccd3069f086ee8563 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 10:05:26 +0200 Subject: Fix a bug in main.js In global view, there is no ".category.all>a" element so we tried to apply str2int on an undefined value. In consequence, we were not able to mark several articles as read This patch need to apply on 0.8.1 and 0.9.1 See https://github.com/marienfressinaud/FreshRSS/issues/649 --- p/scripts/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 7cd53c745..c9e8dd299 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -33,7 +33,7 @@ function needsScroll($elem) { } function str2int(str) { - if (str == '') { + if (str == '' || str === undefined) { return 0; } return parseInt(str.replace(/\D/g, ''), 10) || 0; -- cgit v1.2.3 From db4da3babc0864099c5ab48e3583d0546a2759d8 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 11:39:51 +0200 Subject: First draft for drag and drop We can change feed category by drag and drop! Need improvements... See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/feedController.php | 15 ++++++++ app/Controllers/subscriptionController.php | 2 ++ app/views/subscription/index.phtml | 4 +-- p/scripts/category.js | 55 ++++++++++++++++++++++++++++++ p/scripts/main.js | 2 +- p/themes/Origine/origine.css | 9 +++++ 6 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 p/scripts/category.js diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index e4859b110..315665ef3 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -378,6 +378,21 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } } + public function moveAction() { + if (Minz_Request::isPost()) { + $feed_id = Minz_Request::param('f_id'); + $cat_id = Minz_Request::param('c_id'); + + $feedDAO = FreshRSS_Factory::createFeedDao(); + + $values = array( + 'category' => $cat_id, + ); + + $feedDAO->updateFeed($feed_id, $values); + } + } + public function deleteAction() { if (Minz_Request::isPost()) { $id = Minz_Request::param('id'); diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index aabae7b8f..7cc8179a0 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -30,6 +30,8 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { * It displays categories and associated feeds. */ public function indexAction() { + Minz_View::appendScript(Minz_Url::display('/scripts/category.js?' . + @filemtime(PUBLIC_PATH . '/scripts/category.js'))); Minz_View::prependTitle(_t('subscription_management') . ' · '); $id = Minz_Request::param('id'); diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index 577ddd972..3a79a34e6 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -113,14 +113,14 @@
    -
      +
        inError() ? ' error' : ''; $empty = $feed->nbEntries() == 0 ? ' empty' : ''; ?> -
      • +
      • ✇ name(); ?>
      • diff --git a/p/scripts/category.js b/p/scripts/category.js new file mode 100644 index 000000000..fe80c3b22 --- /dev/null +++ b/p/scripts/category.js @@ -0,0 +1,55 @@ +"use strict"; + + +function init_draggable() { + var feeds_draggable = '.box-content > .feed', + box_dropzone = '.box-content'; + + $('.box').on('dragstart', feeds_draggable, function(e) { + e.originalEvent.dataTransfer.effectAllowed = 'move'; + e.originalEvent.dataTransfer.setData('html', e.target.outerHTML); + e.originalEvent.dataTransfer.setData('feed-id', e.target.getAttribute('data-feed-id')); + }); + $('.box').on('dragend', feeds_draggable, function(e) { + var parent = e.target.parentNode; + parent.removeChild(e.target); + }); + + $('.box').on('dragenter', box_dropzone, function(e) { + $(e.target).addClass('drag-hover'); + }); + $('.box').on('dragleave', box_dropzone, function(e) { + $(e.target).removeClass('drag-hover'); + }); + $('.box').on('dragover', box_dropzone, function(e) { + e.originalEvent.dataTransfer.dropEffect = "move"; + + return false; + }); + $('.box').on('drop', box_dropzone, function(e) { + var feed_id = e.originalEvent.dataTransfer.getData('feed-id'), + cat_id = e.target.parentNode.getAttribute('data-cat-id'); + + $.ajax({ + type: 'POST', + url: './?c=feed&a=move', + data : { + f_id: feed_id, + c_id: cat_id + } + }); + + $(e.target).after(e.originalEvent.dataTransfer.getData('html')); + $(e.target).removeClass('drag-hover'); + return false; + }); +} + + +if (document.readyState && document.readyState !== 'loading') { + init_draggable(); +} else if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', function () { + init_draggable(); + }, false); +} diff --git a/p/scripts/main.js b/p/scripts/main.js index 005dc961b..e8055e00f 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1247,7 +1247,7 @@ function init_slider_observers() { return; } - $('.open-slider').on('click', function() { + $('.post').on('click', '.open-slider', function() { if (ajax_loading) { return false; } diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index e3ae85075..cf6c9a2ef 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -497,6 +497,15 @@ a.btn { visibility: visible; } +/*=== Draggable */ +.drag-hover { + background: #dfd; + transition: all linear 0.2s; +} +[draggable=true] { + cursor: grab; +} + /*=== STRUCTURE */ /*===============*/ /*=== Header */ -- cgit v1.2.3 From 50f07febaed5e839d4e7d56a664c8a208bc2aaf5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 12:13:16 +0200 Subject: Add dataTransfer property to event for JQuery See https://github.com/marienfressinaud/FreshRSS/issues/646 --- p/scripts/category.js | 15 +++++++++------ p/themes/Origine/origine.css | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/p/scripts/category.js b/p/scripts/category.js index fe80c3b22..4378aa9cd 100644 --- a/p/scripts/category.js +++ b/p/scripts/category.js @@ -2,17 +2,20 @@ function init_draggable() { + $.event.props.push('dataTransfer'); + var feeds_draggable = '.box-content > .feed', box_dropzone = '.box-content'; $('.box').on('dragstart', feeds_draggable, function(e) { - e.originalEvent.dataTransfer.effectAllowed = 'move'; - e.originalEvent.dataTransfer.setData('html', e.target.outerHTML); - e.originalEvent.dataTransfer.setData('feed-id', e.target.getAttribute('data-feed-id')); + e.dataTransfer.effectAllowed = 'move'; + e.dataTransfer.setData('html', e.target.outerHTML); + e.dataTransfer.setData('feed-id', e.target.getAttribute('data-feed-id')); }); $('.box').on('dragend', feeds_draggable, function(e) { var parent = e.target.parentNode; parent.removeChild(e.target); + }); $('.box').on('dragenter', box_dropzone, function(e) { @@ -22,12 +25,12 @@ function init_draggable() { $(e.target).removeClass('drag-hover'); }); $('.box').on('dragover', box_dropzone, function(e) { - e.originalEvent.dataTransfer.dropEffect = "move"; + e.dataTransfer.dropEffect = "move"; return false; }); $('.box').on('drop', box_dropzone, function(e) { - var feed_id = e.originalEvent.dataTransfer.getData('feed-id'), + var feed_id = e.dataTransfer.getData('feed-id'), cat_id = e.target.parentNode.getAttribute('data-cat-id'); $.ajax({ @@ -39,7 +42,7 @@ function init_draggable() { } }); - $(e.target).after(e.originalEvent.dataTransfer.getData('html')); + $(e.target).after(e.dataTransfer.getData('html')); $(e.target).removeClass('drag-hover'); return false; }); diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index cf6c9a2ef..c79f6cc4c 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -481,6 +481,7 @@ a.btn { border-radius: 5px 5px 0 0; } .box .box-content { + min-height: 2.5em; max-height: 260px; } -- cgit v1.2.3 From 6effa82cef4ea8fd98178e72b270de6ea4f9f80f Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 15:02:42 +0200 Subject: Improve drag and drop - Refactoring - Better design - Item doesn't disappear if action is not completed See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/subscription/index.phtml | 11 ++++--- p/scripts/category.js | 63 +++++++++++++++++++++++++++++--------- p/themes/Origine/origine.css | 9 ------ p/themes/base-theme/template.css | 12 ++++++++ 4 files changed, 67 insertions(+), 28 deletions(-) diff --git a/app/views/subscription/index.phtml b/app/views/subscription/index.phtml index 3a79a34e6..2c56f79ed 100644 --- a/app/views/subscription/index.phtml +++ b/app/views/subscription/index.phtml @@ -1,6 +1,6 @@ partial('aside_subscription'); ?> -
        +

        @@ -113,21 +113,24 @@
        -
          +
            inError() ? ' error' : ''; $empty = $feed->nbEntries() == 0 ? ' empty' : ''; ?> -
          • +
          • ✇ name(); ?>
          • -
          • +
        diff --git a/p/scripts/category.js b/p/scripts/category.js index 4378aa9cd..37ad36b17 100644 --- a/p/scripts/category.js +++ b/p/scripts/category.js @@ -1,38 +1,66 @@ "use strict"; +var loading = false, + dnd_successful = false; + +function dragend_process(t) { + if (loading) { + window.setTimeout(function() { + dragend_process(t); + }, 50); + } + + if (!dnd_successful) { + t.style.opacity = 1.0; + } else { + t.parentNode.removeChild(t); + } +} + function init_draggable() { + if (!(window.$ && window.url_freshrss)) { + if (window.console) { + console.log('FreshRSS waiting for JS…'); + } + window.setTimeout(init_draggable, 50); + return; + } + $.event.props.push('dataTransfer'); - var feeds_draggable = '.box-content > .feed', - box_dropzone = '.box-content'; + var draggable = '[draggable="true"]', + dropzone = '[dropzone="move"]'; - $('.box').on('dragstart', feeds_draggable, function(e) { + $('.drop-section').on('dragstart', draggable, function(e) { e.dataTransfer.effectAllowed = 'move'; - e.dataTransfer.setData('html', e.target.outerHTML); - e.dataTransfer.setData('feed-id', e.target.getAttribute('data-feed-id')); + e.dataTransfer.setData('text/html', e.target.outerHTML); + e.dataTransfer.setData('text', e.target.getAttribute('data-feed-id')); + e.target.style.opacity = 0.3; + + dnd_successful = false; }); - $('.box').on('dragend', feeds_draggable, function(e) { - var parent = e.target.parentNode; - parent.removeChild(e.target); - + $('.drop-section').on('dragend', draggable, function(e) { + dragend_process(e.target); }); - $('.box').on('dragenter', box_dropzone, function(e) { + $('.drop-section').on('dragenter', dropzone, function(e) { $(e.target).addClass('drag-hover'); }); - $('.box').on('dragleave', box_dropzone, function(e) { + $('.drop-section').on('dragleave', dropzone, function(e) { $(e.target).removeClass('drag-hover'); }); - $('.box').on('dragover', box_dropzone, function(e) { + $('.drop-section').on('dragover', dropzone, function(e) { e.dataTransfer.dropEffect = "move"; return false; }); - $('.box').on('drop', box_dropzone, function(e) { - var feed_id = e.dataTransfer.getData('feed-id'), + $('.drop-section').on('drop', dropzone, function(e) { + var feed_id = e.dataTransfer.getData('text'), cat_id = e.target.parentNode.getAttribute('data-cat-id'); + loading = true; + $.ajax({ type: 'POST', url: './?c=feed&a=move', @@ -40,10 +68,15 @@ function init_draggable() { f_id: feed_id, c_id: cat_id } + }).success(function() { + $(e.target).after(e.dataTransfer.getData('text/html')); + loading = false; + }).complete(function() { + dnd_successful = true; }); - $(e.target).after(e.dataTransfer.getData('html')); $(e.target).removeClass('drag-hover'); + return false; }); } diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index c79f6cc4c..b25deab0c 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -498,15 +498,6 @@ a.btn { visibility: visible; } -/*=== Draggable */ -.drag-hover { - background: #dfd; - transition: all linear 0.2s; -} -[draggable=true] { - cursor: grab; -} - /*=== STRUCTURE */ /*===============*/ /*=== Header */ diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index e6c832ee4..06874c9fe 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -304,6 +304,10 @@ a.btn { .box .box-content .item { display: block; } +.box .box-content .item.disabled { + text-align: center; + font-style: italic; +} .box .box-content-centered { padding: 30px 5px; @@ -313,6 +317,14 @@ a.btn { margin: 20px 0 0; } +/*=== Draggable */ +.drag-hover { + margin: 0 0 5px; + border-bottom: 2px solid #ccc; +} +[draggable=true] { + cursor: grab; +} /*=== STRUCTURE */ /*===============*/ -- cgit v1.2.3 From 408ac31dd8751eba037db216243958d396df1c8e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 19:02:43 +0200 Subject: Hack for dragleave (triggered on children!) See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/feedController.php | 7 ++++++- p/scripts/category.js | 33 ++++++++++++++++++++++++++------- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 315665ef3..b2b53185e 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -389,7 +389,12 @@ class FreshRSS_feed_Controller extends Minz_ActionController { 'category' => $cat_id, ); - $feedDAO->updateFeed($feed_id, $values); + if (!$feedDAO->updateFeed($feed_id, $values)) { + Minz_Error::error( + 404, + array('error' => array(_t('error_occurred'))) + ); + } } } diff --git a/p/scripts/category.js b/p/scripts/category.js index 37ad36b17..872d14490 100644 --- a/p/scripts/category.js +++ b/p/scripts/category.js @@ -4,6 +4,8 @@ var loading = false, dnd_successful = false; function dragend_process(t) { + t.style.display = 'none'; + if (loading) { window.setTimeout(function() { dragend_process(t); @@ -11,13 +13,13 @@ function dragend_process(t) { } if (!dnd_successful) { + t.style.display = 'block'; t.style.opacity = 1.0; } else { t.parentNode.removeChild(t); } } - function init_draggable() { if (!(window.$ && window.url_freshrss)) { if (window.console) { @@ -45,14 +47,31 @@ function init_draggable() { }); $('.drop-section').on('dragenter', dropzone, function(e) { - $(e.target).addClass('drag-hover'); + $(this).addClass('drag-hover'); + + e.preventDefault(); }); $('.drop-section').on('dragleave', dropzone, function(e) { - $(e.target).removeClass('drag-hover'); + var pos_this = $(this).position(), + scroll_top = $(document).scrollTop(), + top = pos_this.top, + left = pos_this.left, + right = left + $(this).width(), + bottom = top + $(this).height(), + mouse_x = e.originalEvent.screenX, + mouse_y = e.originalEvent.clientY + scroll_top; + + if (left <= mouse_x && mouse_x <= right && + top <= mouse_y && mouse_y <= bottom) { + // HACK because dragleave is triggered when hovering children! + return; + } + $(this).removeClass('drag-hover'); }); $('.drop-section').on('dragover', dropzone, function(e) { e.dataTransfer.dropEffect = "move"; + e.preventDefault(); return false; }); $('.drop-section').on('drop', dropzone, function(e) { @@ -70,14 +89,14 @@ function init_draggable() { } }).success(function() { $(e.target).after(e.dataTransfer.getData('text/html')); - loading = false; - }).complete(function() { dnd_successful = true; + }).complete(function() { + loading = false; }); - $(e.target).removeClass('drag-hover'); + $(this).removeClass('drag-hover'); - return false; + e.preventDefault(); }); } -- cgit v1.2.3 From ce43b1761b810c89e5e8660e8ae2638e97ca6339 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 19:47:02 +0200 Subject: Fix box when no feed in category See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/helpers/javascript_vars.phtml | 1 + p/scripts/category.js | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 1139eb446..71798369d 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -54,6 +54,7 @@ echo 'authType="', $authType, '",', echo 'str_confirmation_default="', Minz_Translate::t('confirm_action'), '"', ",\n"; echo 'str_notif_title_articles="', Minz_Translate::t('notif_title_new_articles'), '"', ",\n"; echo 'str_notif_body_articles="', Minz_Translate::t('notif_body_new_articles'), '"', ",\n"; +echo 'str_category_empty="', Minz_Translate::t('category_empty'), '"', ",\n"; echo 'html5_notif_timeout=', $this->conf->html5_notif_timeout,",\n"; diff --git a/p/scripts/category.js b/p/scripts/category.js index 872d14490..dc5df67e4 100644 --- a/p/scripts/category.js +++ b/p/scripts/category.js @@ -16,7 +16,12 @@ function dragend_process(t) { t.style.display = 'block'; t.style.opacity = 1.0; } else { - t.parentNode.removeChild(t); + var parent = $(t.parentNode); + $(t).remove(); + + if (parent.children().length <= 0) { + parent.append('
      • ' + str_category_empty + '
      • '); + } } } @@ -89,6 +94,9 @@ function init_draggable() { } }).success(function() { $(e.target).after(e.dataTransfer.getData('text/html')); + if ($(e.target).hasClass('disabled')) { + $(e.target).remove(); + } dnd_successful = true; }).complete(function() { loading = false; -- cgit v1.2.3 From 370b51815071a36574ef40f5661de4ba17f071c9 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 21:38:18 +0200 Subject: Filter link on feed updating page See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/views/helpers/feed/update.phtml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 4a6425c45..3f6b32076 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -1,9 +1,11 @@
        - -

        feed->name (); ?>

        feed->description (); ?> + + + + feed->nbEntries (); ?> feed->inError ()) { ?> @@ -67,13 +69,7 @@
    -
    -
    - - - -
    -
    +
    -- cgit v1.2.3 From 3b6b7d08d3c84dd9dc094fa3e0c0c58336552114 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 21:41:06 +0200 Subject: Fix position of links (updating feed) See last commit --- app/views/helpers/feed/update.phtml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 3f6b32076..678c5f132 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -1,10 +1,13 @@

    feed->name (); ?>

    - feed->description (); ?> - - - +
    + + + +
    + +

    feed->description (); ?>

    feed->nbEntries (); ?> -- cgit v1.2.3 From 94520ee326d1ad7323172a6d92ec0645e4606b73 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 2 Oct 2014 22:02:09 +0200 Subject: Fix category not appear on feed.add page (GET) Must apply to 0.8.1 and 0.9.1 See https://github.com/marienfressinaud/FreshRSS/issues/649 --- app/Controllers/feedController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index b2b53185e..eb26d9786 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -171,7 +171,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // GET request so we must ask confirmation to user Minz_View::prependTitle(Minz_Translate::t('add_rss_feed') . ' · '); - $this->view->categories = $this->catDAO->listCategories(); + $this->view->categories = $this->catDAO->listCategories(false); $this->view->feed = new FreshRSS_Feed($url); try { // We try to get some more information about the feed -- cgit v1.2.3 From 9f8d3d0527988b768f739fd4c0e61de68dfdd822 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 3 Oct 2014 12:18:43 +0200 Subject: Fix configure icon on Flat design See https://github.com/marienfressinaud/FreshRSS/issues/468 --- p/themes/Flat/flat.css | 5 +++++ p/themes/base-theme/template.css | 7 +++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/p/themes/Flat/flat.css b/p/themes/Flat/flat.css index d0ac46fd5..7b2695781 100644 --- a/p/themes/Flat/flat.css +++ b/p/themes/Flat/flat.css @@ -464,6 +464,11 @@ a.btn { .box .box-content .item .configure { visibility: hidden; } +.box .box-content .item .configure .icon { + vertical-align: middle; + background-color: #95a5a6; + border-radius: 3px; +} .box .box-content .item:hover .configure { visibility: visible; } diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 06874c9fe..1a96f1e2f 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -73,7 +73,9 @@ label { input { width: 180px; } -textarea { +textarea, +input[type="file"], +input.extend:focus { width: 300px; } input, select, textarea { @@ -85,9 +87,6 @@ input[type="checkbox"] { width: 15px !important; min-height: 15px !important; } -input.extend:focus { - width: 300px; -} button.as-link, button.as-link:hover, button.as-link:active { -- cgit v1.2.3 From dd945df0cb2bae216b4612364506e74aa3259c0b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 3 Oct 2014 12:54:10 +0200 Subject: Fix category not change (updating feed on MySQL) See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/feedController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index eb26d9786..d694c103e 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -384,12 +384,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $cat_id = Minz_Request::param('c_id'); $feedDAO = FreshRSS_Factory::createFeedDao(); - $values = array( 'category' => $cat_id, ); - if (!$feedDAO->updateFeed($feed_id, $values)) { + $feed = $feedDAO->searchById($feed_id); + + if (!$feed || ($feed->category() != $cat_id && + !$feedDAO->updateFeed($feed_id, $values))) { Minz_Error::error( 404, array('error' => array(_t('error_occurred'))) -- cgit v1.2.3 From 783171011dc6256f37cbd4365f5405b5e8a4b44e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 4 Oct 2014 10:30:40 +0200 Subject: Fix icon not appearing (Flat theme) See https://github.com/marienfressinaud/FreshRSS/issues/651 --- p/themes/Flat/flat.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/p/themes/Flat/flat.css b/p/themes/Flat/flat.css index 7b2695781..e2151b1f9 100644 --- a/p/themes/Flat/flat.css +++ b/p/themes/Flat/flat.css @@ -652,6 +652,12 @@ a.btn { padding: 5px 0; } +#dropdown-query ~ .dropdown-menu .dropdown-header .icon { + vertical-align: middle; + background-color: #95a5a6; + border-radius: 3px; +} + /*=== Feed articles */ .flux { border-left: 2px solid #ecf0f1; -- cgit v1.2.3 From 91cc88209c710e64cd8a10397e56d006d4566624 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 4 Oct 2014 08:45:57 -0400 Subject: Remove debugging code --- p/scripts/main.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 37281a907..02d16ca64 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -384,8 +384,6 @@ function collapse_entry() { } function user_filter(key) { - console.log('user filter'); - console.warn(key); var filter = $('#dropdown-query'); var filters = filter.siblings('.dropdown-menu').find('.item.query a'); if (typeof key === "undefined") { -- cgit v1.2.3 From 7a59568dfc20589c0495235679a96a375e36cfee Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 4 Oct 2014 08:46:11 -0400 Subject: Fix library with code provided in the comments of the library page. The fix was given by the owner of the project (I assume) but was never integrated in the code. There is no bug tracker so I couldn't open a ticket. It looks like the project is dead since there is modification to the library. --- p/scripts/shortcut.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/p/scripts/shortcut.js b/p/scripts/shortcut.js index debaffbaa..4137172c3 100644 --- a/p/scripts/shortcut.js +++ b/p/scripts/shortcut.js @@ -43,7 +43,9 @@ shortcut = { //Find Which key is pressed if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which; - var character = String.fromCharCode(code).toLowerCase(); + if( code == 32 || (code >= 48 && code <= 90) || (code >= 96 && code <= 111) || (code >= 186 && code <= 192) || (code >= 219 && code <= 222)) { + var character = String.fromCharCode(code).toLowerCase(); + } if(code == 188) character=","; //If the user presses , when the type is onkeydown if(code == 190) character="."; //If the user presses , when the type is onkeydown -- cgit v1.2.3 From 38a6f0c4b29e5a53c21f345dd839a4fa0b2a6f47 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sat, 4 Oct 2014 09:06:35 -0400 Subject: Add a shortcut to close drop-down lists --- app/Models/Configuration.php | 1 + app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/views/configure/shortcut.phtml | 7 +++++++ app/views/helpers/javascript_vars.phtml | 3 ++- p/scripts/main.js | 6 ++++++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index 95f819779..feba3d2f6 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -47,6 +47,7 @@ class FreshRSS_Configuration { 'focus_search' => 'a', 'user_filter' => 'u', 'help' => 'f1', + 'close_dropdown' => 'escape', ), 'topline_read' => true, 'topline_favorite' => true, diff --git a/app/i18n/en.php b/app/i18n/en.php index 28104196e..0456049a9 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -191,6 +191,7 @@ return array ( 'user_filter' => 'Access user filters', 'user_filter_help' => 'If there is only one user filter, it is used. Else filters are accessible by their number.', 'help' => 'Display documentation', + 'close_dropdown' => 'Close drop-down lists', 'file_to_import' => 'File to import
    (OPML, Json or Zip)', 'file_to_import_no_zip' => 'File to import
    (OPML or Json)', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index c72fc3e93..adc79d0e2 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -191,6 +191,7 @@ return array ( 'user_filter' => 'Accéder aux filtres utilisateur', 'user_filter_help' => 'S’il n’y a qu’un filtre utilisateur, celui ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.', 'help' => 'Afficher la documentation', + 'close_dropdown' => 'Fermer les listes déroulantes', 'file_to_import' => 'Fichier à importer
    (OPML, Json ou Zip)', 'file_to_import_no_zip' => 'Fichier à importer
    (OPML ou Json)', diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index a4029b676..44727e62b 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -111,6 +111,13 @@
    +
    + +
    + +
    +
    +
    diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 71798369d..4f7e3db0c 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -28,7 +28,8 @@ echo ',shortcuts={', 'auto_share:"', $s['auto_share'], '",', 'focus_search:"', $s['focus_search'], '",', 'user_filter:"', $s['user_filter'], '",', - 'help:"', $s['help'], '"', + 'help:"', $s['help'], '",', + 'close_dropdown:"', $s['close_dropdown'], '"', "},\n"; if (Minz_Request::param ('output') === 'global') { diff --git a/p/scripts/main.js b/p/scripts/main.js index 37281a907..0d90d3d39 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -663,6 +663,12 @@ function init_shortcuts() { 'disable_in_input': true }); + shortcut.add(shortcuts.close_dropdown, function () { + window.location.hash = null; + }, { + 'disable_in_input': true + }); + } function init_stream(divStream) { -- cgit v1.2.3 From 6e6d7b3c870975b2981f653b6f53a31f800f56ec Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 5 Oct 2014 01:43:29 +0200 Subject: Minor JavaScript --- p/scripts/main.js | 2 +- p/scripts/shortcut.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/p/scripts/main.js b/p/scripts/main.js index 79a34ec29..5793bb50b 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -33,7 +33,7 @@ function needsScroll($elem) { } function str2int(str) { - if (str == '' || str === undefined) { + if (!str) { return 0; } return parseInt(str.replace(/\D/g, ''), 10) || 0; diff --git a/p/scripts/shortcut.js b/p/scripts/shortcut.js index 4137172c3..e78cf6f5e 100644 --- a/p/scripts/shortcut.js +++ b/p/scripts/shortcut.js @@ -43,7 +43,7 @@ shortcut = { //Find Which key is pressed if (e.keyCode) code = e.keyCode; else if (e.which) code = e.which; - if( code == 32 || (code >= 48 && code <= 90) || (code >= 96 && code <= 111) || (code >= 186 && code <= 192) || (code >= 219 && code <= 222)) { + if (code == 32 || (code >= 48 && code <= 90) || (code >= 96 && code <= 111) || (code >= 186 && code <= 192) || (code >= 219 && code <= 222)) { //FreshRSS var character = String.fromCharCode(code).toLowerCase(); } -- cgit v1.2.3 From 9101bdb15edb7278ea26f6aee01c2b79e0f73dd5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 5 Oct 2014 09:58:21 +0200 Subject: Design shortcuts_navigation_help box --- app/views/configure/shortcut.phtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 44727e62b..5ae8069ad 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -18,6 +18,8 @@ +

    +
    @@ -46,8 +48,6 @@
    -
    -
    -- cgit v1.2.3 From 9c4f0a94d757763842ae183d7aea89044a675ba6 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 5 Oct 2014 10:00:49 +0200 Subject: Coding style shortcut.phtml --- app/views/configure/shortcut.phtml | 56 +++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index 5ae8069ad..fc8e90590 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -1,7 +1,7 @@ -partial ('aside_configure'); ?> +partial('aside_configure'); ?>
    - + list_keys as $key) { ?> @@ -11,115 +11,115 @@ conf->shortcuts; ?> -
    - + + - + - + -

    +

    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    - +
    @@ -127,8 +127,8 @@
    - - + +
    -- cgit v1.2.3 From 5474803aa7a05e4afa851c88bf21fd8383bf59d9 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 5 Oct 2014 10:57:50 +0200 Subject: Add a TODO in feedController --- app/Controllers/feedController.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index d694c103e..92ce40634 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -390,8 +390,10 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed = $feedDAO->searchById($feed_id); - if (!$feed || ($feed->category() != $cat_id && - !$feedDAO->updateFeed($feed_id, $values))) { + if ($feed && ($feed->category() == $cat_id || + $feedDAO->updateFeed($feed_id, $values))) { + // TODO: return something useful + } else { Minz_Error::error( 404, array('error' => array(_t('error_occurred'))) -- cgit v1.2.3 From febabccdd5e6db573ab80bd5c1758d136b91cd78 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 5 Oct 2014 12:14:22 +0200 Subject: Primitive extension system https://github.com/marienfressinaud/FreshRSS/issues/252 I have been using this extension system for a little while, in particular to include custom CSS and/or JavaScript (inclusion of PHP code is not done yet). There is very little code and it does not impact performances. I hurry to post it before https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/FreshRSS.php | 21 +++++++++++++++++++++ extensions/.gitignore | 1 + extensions/Read-me.txt | 15 +++++++++++++++ p/ext.php | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 extensions/.gitignore create mode 100644 extensions/Read-me.txt create mode 100644 p/ext.php diff --git a/app/FreshRSS.php b/app/FreshRSS.php index cdf8962cb..58aac4059 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -17,6 +17,7 @@ class FreshRSS extends Minz_FrontController { Minz_View::_param('loginOk', $loginOk); $this->loadStylesAndScripts($loginOk); //TODO: Do not load that when not needed, e.g. some Ajax requests $this->loadNotifications(); + $this->loadExtensions(); } private static function getCredentialsFromLongTermCookie() { @@ -179,4 +180,24 @@ class FreshRSS extends Minz_FrontController { Minz_Session::_param ('notification'); } } + + private function loadExtensions() { + $extensionPath = FRESHRSS_PATH . '/extensions/'; + //TODO: Add a preference to load only user-selected extensions + foreach (scandir($extensionPath) as $key => $extension) { + if (ctype_alpha($extension)) { + $mtime = @filemtime($extensionPath . $extension . '/style.css'); + if ($mtime !== false) { + Minz_View::appendStyle(Minz_Url::display('/ext.php?c&e=' . $extension . '&' . $mtime)); + } + $mtime = @filemtime($extensionPath . $extension . '/script.js'); + if ($mtime !== false) { + Minz_View::appendScript(Minz_Url::display('/ext.php?j&e=' . $extension . '&' . $mtime)); + } + if (file_exists($extensionPath . $extension . '/module.php')) { + //TODO: include + } + } + } + } } diff --git a/extensions/.gitignore b/extensions/.gitignore new file mode 100644 index 000000000..d93e5e396 --- /dev/null +++ b/extensions/.gitignore @@ -0,0 +1 @@ +/[xX] diff --git a/extensions/Read-me.txt b/extensions/Read-me.txt new file mode 100644 index 000000000..e7b66d5bc --- /dev/null +++ b/extensions/Read-me.txt @@ -0,0 +1,15 @@ +== FreshRSS extensions == + +You may place in this directory some custom extensions for FreshRSS. + +The structure must be: + +./FreshRSS/extensions/ + ./NameOfExtensionAlphanumeric/ + ./style.css + ./script.js + ./module.php + +Each file is optional. + +The name of non-official extensions should start by an 'x'. diff --git a/p/ext.php b/p/ext.php new file mode 100644 index 000000000..cff194343 --- /dev/null +++ b/p/ext.php @@ -0,0 +1,35 @@ + Date: Sun, 5 Oct 2014 12:38:13 +0200 Subject: Primitive extension system: minor change https://github.com/marienfressinaud/FreshRSS/issues/252 --- p/ext.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p/ext.php b/p/ext.php index cff194343..a1dde2f93 100644 --- a/p/ext.php +++ b/p/ext.php @@ -20,6 +20,9 @@ if (isset($_GET['j'])) { header('Content-Type: text/css; charset=UTF-8'); header('Content-Disposition: inline; filename="style.css"'); $filename .= 'style.css'; +} else { + header('HTTP/1.1 400 Bad Request'); + die(); } $mtime = @filemtime($filename); -- cgit v1.2.3 From 6c8b36f04ea1bc2c022c331bb0980b6c9dccb83c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 5 Oct 2014 15:55:20 +0200 Subject: Let's begin the big refactoring! Minz_Translate::t\s? replaces by _t See https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/Controllers/entryController.php | 8 ++-- app/Controllers/errorController.php | 4 +- app/Controllers/feedController.php | 30 ++++++------- app/Controllers/indexController.php | 22 +++++----- app/Controllers/statsController.php | 4 +- app/Controllers/usersController.php | 8 ++-- app/FreshRSS.php | 2 +- app/Models/CategoryDAO.php | 2 +- app/Models/StatsDAO.php | 2 +- app/Models/UserDAO.php | 4 +- app/layout/aside_stats.phtml | 14 +++--- app/views/configure/archiving.phtml | 36 ++++++++-------- app/views/configure/display.phtml | 44 +++++++++---------- app/views/configure/reading.phtml | 64 +++++++++++++-------------- app/views/configure/sharing.phtml | 24 +++++------ app/views/configure/users.phtml | 74 ++++++++++++++++---------------- app/views/error/index.phtml | 2 +- app/views/feed/add.phtml | 34 +++++++-------- app/views/helpers/feed/update.phtml | 60 +++++++++++++------------- app/views/helpers/javascript_vars.phtml | 8 ++-- app/views/helpers/logs_pagination.phtml | 8 ++-- app/views/helpers/view/normal_view.phtml | 14 +++--- app/views/helpers/view/reader_view.phtml | 2 +- app/views/helpers/view/rss_view.phtml | 2 +- app/views/index/about.phtml | 26 +++++------ app/views/index/logs.phtml | 8 ++-- lib/lib_rss.php | 8 ++-- 27 files changed, 256 insertions(+), 258 deletions(-) diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index ab66d9198..048ac1c69 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -5,7 +5,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { if (!$this->view->loginOk) { Minz_Error::error ( 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) + array ('error' => array (_t('access_denied'))) ); } @@ -75,7 +75,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('feeds_marked_read') + 'content' => _t('feeds_marked_read') ); Minz_Session::_param ('notification', $notif); } else { @@ -111,7 +111,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('optimization_complete') + 'content' => _t('optimization_complete') ); Minz_Session::_param ('notification', $notif); } @@ -155,7 +155,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $notif = array( 'type' => 'good', - 'content' => Minz_Translate::t('purge_completed', $nbTotal) + 'content' => _t('purge_completed', $nbTotal) ); Minz_Session::_param('notification', $notif); diff --git a/app/Controllers/errorController.php b/app/Controllers/errorController.php index 922650b3d..64a5c06fd 100644 --- a/app/Controllers/errorController.php +++ b/app/Controllers/errorController.php @@ -24,11 +24,11 @@ class FreshRSS_error_Controller extends Minz_ActionController { if ($this->view->errorMessage == '') { switch(Minz_Request::param('code')) { case 403: - $this->view->errorMessage = Minz_Translate::t('forbidden_access'); + $this->view->errorMessage = _t('forbidden_access'); break; case 404: default: - $this->view->errorMessage = Minz_Translate::t('page_not_found'); + $this->view->errorMessage = _t('page_not_found'); break; } } diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 92ce40634..029f9fa68 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -15,7 +15,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { ) { Minz_Error::error ( 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) + array ('error' => array (_t('access_denied'))) ); } } @@ -84,7 +84,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // on est déjà abonné à ce flux $notif = array ( 'type' => 'bad', - 'content' => Minz_Translate::t ('already_subscribed', $feed->name ()) + 'content' => _t('already_subscribed', $feed->name ()) ); Minz_Session::_param ('notification', $notif); } else { @@ -93,7 +93,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // problème au niveau de la base de données $notif = array ( 'type' => 'bad', - 'content' => Minz_Translate::t ('feed_not_added', $feed->name ()) + 'content' => _t('feed_not_added', $feed->name ()) ); Minz_Session::_param ('notification', $notif); } else { @@ -131,7 +131,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // ok, ajout terminé $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('feed_added', $feed->name ()) + 'content' => _t('feed_added', $feed->name ()) ); Minz_Session::_param ('notification', $notif); @@ -143,14 +143,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); $notif = array ( 'type' => 'bad', - 'content' => Minz_Translate::t ('invalid_url', $url) + 'content' => _t('invalid_url', $url) ); Minz_Session::_param ('notification', $notif); } catch (FreshRSS_Feed_Exception $e) { Minz_Log::record ($e->getMessage (), Minz_Log::WARNING); $notif = array ( 'type' => 'bad', - 'content' => Minz_Translate::t ('internal_problem_feed', Minz_Url::display(array('a' => 'logs'))) + 'content' => _t('internal_problem_feed', Minz_Url::display(array('a' => 'logs'))) ); Minz_Session::_param ('notification', $notif); } catch (Minz_FileNotExistException $e) { @@ -158,7 +158,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Log::record ($e->getMessage (), Minz_Log::ERROR); $notif = array ( 'type' => 'bad', - 'content' => Minz_Translate::t ('internal_problem_feed', Minz_Url::display(array('a' => 'logs'))) + 'content' => _t('internal_problem_feed', Minz_Url::display(array('a' => 'logs'))) ); Minz_Session::_param ('notification', $notif); } @@ -170,7 +170,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } else { // GET request so we must ask confirmation to user - Minz_View::prependTitle(Minz_Translate::t('add_rss_feed') . ' · '); + Minz_View::prependTitle(_t('add_rss_feed') . ' · '); $this->view->categories = $this->catDAO->listCategories(false); $this->view->feed = new FreshRSS_Feed($url); try { @@ -186,9 +186,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Already subscribe so we redirect to the feed configuration page $notif = array( 'type' => 'bad', - 'content' => Minz_Translate::t( - 'already_subscribed', $feed->name() - ) + 'content' => _t('already_subscribed', $feed->name()) ); Minz_Session::_param('notification', $notif); @@ -210,7 +208,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $n = $feedDAO->truncate($id); $notif = array( 'type' => $n === false ? 'bad' : 'good', - 'content' => Minz_Translate::t ('n_entries_deleted', $n) + 'content' => _t('n_entries_deleted', $n) ); Minz_Session::_param ('notification', $notif); invalidateHttpCache(); @@ -336,19 +334,19 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed = reset ($feeds); $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('feed_actualized', $feed->name ()) + 'content' => _t('feed_actualized', $feed->name ()) ); } elseif ($flux_update > 1) { // plusieurs flux on été mis à jour $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('n_feeds_actualized', $flux_update) + 'content' => _t('n_feeds_actualized', $flux_update) ); } else { // aucun flux n'a été mis à jour, oups $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('no_feed_to_refresh') + 'content' => _t('no_feed_to_refresh') ); } @@ -370,7 +368,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // ressenti utilisateur $notif = array ( 'type' => 'good', - 'content' => Minz_Translate::t ('feeds_actualized') + 'content' => _t('feeds_actualized') ); Minz_Session::_param ('notification', $notif); // et on désactive le layout car ne sert à rien diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 1b6563bb3..346739523 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -14,7 +14,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { if ($output === 'rss' && !$token_is_ok) { Minz_Error::error ( 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) + array ('error' => array (_t('access_denied'))) ); return; } elseif ($output !== 'rss') { @@ -62,7 +62,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Log::record ('Not found [' . $getType . '][' . $getId . ']', Minz_Log::DEBUG); Minz_Error::error ( 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) + array ('error' => array (_t('page_not_found'))) ); return; } @@ -145,7 +145,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Log::record ($e->getMessage (), Minz_Log::NOTICE); Minz_Error::error ( 404, - array ('error' => array (Minz_Translate::t ('page_not_found'))) + array ('error' => array (_t('page_not_found'))) ); } } @@ -158,12 +158,12 @@ class FreshRSS_index_Controller extends Minz_ActionController { private function checkAndProcessType ($getType, $getId) { switch ($getType) { case 'a': - $this->view->currentName = Minz_Translate::t ('your_rss_feeds'); + $this->view->currentName = _t('your_rss_feeds'); $this->nb_not_read_cat = $this->view->nb_not_read; $this->view->get_c = $getType; return true; case 's': - $this->view->currentName = Minz_Translate::t ('your_favorites'); + $this->view->currentName = _t('your_favorites'); $this->nb_not_read_cat = $this->view->nb_favorites['unread']; $this->view->get_c = $getType; return true; @@ -202,18 +202,18 @@ class FreshRSS_index_Controller extends Minz_ActionController { } public function aboutAction () { - Minz_View::prependTitle (Minz_Translate::t ('about') . ' · '); + Minz_View::prependTitle (_t('about') . ' · '); } public function logsAction () { if (!$this->view->loginOk) { Minz_Error::error ( 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) + array ('error' => array (_t('access_denied'))) ); } - Minz_View::prependTitle (Minz_Translate::t ('logs') . ' · '); + Minz_View::prependTitle (_t('logs') . ' · '); if (Minz_Request::isPost ()) { FreshRSS_LogDAO::truncate(); @@ -279,7 +279,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { } else { $res = array (); $res['status'] = 'failure'; - $res['reason'] = $reason == '' ? Minz_Translate::t ('invalid_login') : $reason; + $res['reason'] = $reason == '' ? _t('invalid_login') : $reason; Minz_Log::record ('Persona: ' . $res['reason'], Minz_Log::WARNING); } @@ -368,7 +368,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { if (!$ok) { $notif = array( 'type' => 'bad', - 'content' => Minz_Translate::t('invalid_login') + 'content' => _t('invalid_login') ); Minz_Session::_param('notification', $notif); } @@ -403,7 +403,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { } elseif (!Minz_Configuration::canLogIn()) { Minz_Error::error ( 403, - array ('error' => array (Minz_Translate::t ('access_denied'))) + array ('error' => array (_t('access_denied'))) ); } invalidateHttpCache(); diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 3069be34d..4adb5e75d 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -120,11 +120,11 @@ class FreshRSS_stats_Controller extends Minz_ActionController { public function firstAction() { if (!$this->view->loginOk) { Minz_Error::error( - 403, array('error' => array(Minz_Translate::t('access_denied'))) + 403, array('error' => array(_t('access_denied'))) ); } - Minz_View::prependTitle(Minz_Translate::t('stats') . ' · '); + Minz_View::prependTitle(_t('stats') . ' · '); } } diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php index a9e6c32bc..8eb82f5d5 100644 --- a/app/Controllers/usersController.php +++ b/app/Controllers/usersController.php @@ -8,7 +8,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { if (!$this->view->loginOk) { Minz_Error::error( 403, - array('error' => array(Minz_Translate::t('access_denied'))) + array('error' => array(_t('access_denied'))) ); } } @@ -90,7 +90,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { $notif = array( 'type' => $ok ? 'good' : 'bad', - 'content' => Minz_Translate::t($ok ? 'configuration_updated' : 'error_occurred') + 'content' => _t($ok ? 'configuration_updated' : 'error_occurred') ); Minz_Session::_param('notification', $notif); } @@ -162,7 +162,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { $notif = array( 'type' => $ok ? 'good' : 'bad', - 'content' => Minz_Translate::t($ok ? 'user_created' : 'error_occurred', $new_user_name) + 'content' => _t($ok ? 'user_created' : 'error_occurred', $new_user_name) ); Minz_Session::_param('notification', $notif); } @@ -194,7 +194,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { $notif = array( 'type' => $ok ? 'good' : 'bad', - 'content' => Minz_Translate::t($ok ? 'user_deleted' : 'error_occurred', $username) + 'content' => _t($ok ? 'user_deleted' : 'error_occurred', $username) ); Minz_Session::_param('notification', $notif); } diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 58aac4059..16f64fd8b 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -10,7 +10,7 @@ class FreshRSS extends Minz_FrontController { $loginOk = false; //Basic protection against XSRF attacks Minz_Error::error( 403, - array('error' => array(Minz_Translate::t('access_denied') . ' [HTTP_REFERER=' . + array('error' => array(_t('access_denied') . ' [HTTP_REFERER=' . htmlspecialchars(empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']) . ']')) ); } diff --git a/app/Models/CategoryDAO.php b/app/Models/CategoryDAO.php index f11f87f47..5def50a26 100644 --- a/app/Models/CategoryDAO.php +++ b/app/Models/CategoryDAO.php @@ -134,7 +134,7 @@ class FreshRSS_CategoryDAO extends Minz_ModelPdo { $def_cat = $this->searchById (1); if ($def_cat == null) { - $cat = new FreshRSS_Category (Minz_Translate::t ('default_category')); + $cat = new FreshRSS_Category (_t('default_category')); $cat->_id (1); $values = array ( diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index 08dd4cd5c..113944508 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -416,7 +416,7 @@ SQL; */ private function convertToTranslatedJson($data = array()) { $translated = array_map(function ($a) { - return Minz_Translate::t($a); + return _t($a); }, $data); return json_encode($translated); diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 9f64fb4a7..0c96d7175 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -9,7 +9,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { $ok = false; if (defined('SQL_CREATE_TABLES')) { //E.g. MySQL - $sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_', Minz_Translate::t('default_category')); + $sql = sprintf(SQL_CREATE_TABLES, $db['prefix'] . $username . '_', _t('default_category')); $stm = $userPDO->bd->prepare($sql); $ok = $stm && $stm->execute(); } else { //E.g. SQLite @@ -17,7 +17,7 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { if (is_array($SQL_CREATE_TABLES)) { $ok = true; foreach ($SQL_CREATE_TABLES as $instruction) { - $sql = sprintf($instruction, '', Minz_Translate::t('default_category')); + $sql = sprintf($instruction, '', _t('default_category')); $stm = $userPDO->bd->prepare($sql); $ok &= ($stm && $stm->execute()); } diff --git a/app/layout/aside_stats.phtml b/app/layout/aside_stats.phtml index fbfb9d84d..1cd31a99c 100644 --- a/app/layout/aside_stats.phtml +++ b/app/layout/aside_stats.phtml @@ -1,12 +1,12 @@ diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index c9cc7fe02..3180fe933 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -1,31 +1,31 @@ partial('aside_configure'); ?>
    - +
    - -

    + +

    - +
    - -   + +  
    - +
    () + ?> ()
    - +
    () + ?> ()
    - - + +
    - +
    -

    +

    -

    nb_total), ' ', Minz_Translate::t('articles'), ', ', formatBytes($this->size_user); ?>

    +

    nb_total), ' ', _t('articles'), ', ', formatBytes($this->size_user); ?>

    - - + +
    -

    +

    size_total); ?>

    diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 8eb3a156b..f1b80ab15 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -1,13 +1,13 @@ partial ('aside_configure'); ?>
    - + - +
    - +
    themes as $theme) { ?>conf->content_width; ?>
    - +
    - + - - - - - + + + + + - + @@ -80,7 +80,7 @@ - + @@ -93,16 +93,16 @@
    - +
    - +
    - - + +
    diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index 8b2da2a28..7e4efc264 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -1,13 +1,13 @@ partial ('aside_configure'); ?>
    - +
    - +
    - +
    @@ -15,22 +15,22 @@
    - +
    - +
    @@ -50,7 +50,7 @@
    @@ -59,8 +59,8 @@
    @@ -69,8 +69,8 @@
    @@ -79,8 +79,8 @@
    @@ -89,8 +89,8 @@
    @@ -99,8 +99,8 @@
    @@ -109,48 +109,48 @@
    - +
    - +
    - - + +
    diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index 02ce331da..ee276a94e 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -1,7 +1,7 @@ partial ('aside_configure'); ?>
    - + @@ -9,28 +9,28 @@ data-advanced='
    - - + +
    - +
    '> - + conf->sharing as $key => $sharing): ?> conf->shares[$sharing['type']]; ?>
    ' />
    - - + +
    - + @@ -42,7 +42,7 @@
    @@ -51,8 +51,8 @@
    - - + +
    diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 272896fb2..04e662fa3 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -1,36 +1,36 @@ partial('aside_configure'); ?>
    - +
    - +
    - +
    - +
    />
    - +
    - +
    /> @@ -41,36 +41,36 @@
    - + conf->mail_login; ?>
    placeholder="alice@example.net" /> - +
    - - + +
    - +
    - +
    @@ -80,7 +80,7 @@
    @@ -90,7 +90,7 @@
    @@ -100,7 +100,7 @@
    @@ -108,12 +108,12 @@
    - + conf->token; ?>
    - /> - +
    @@ -123,24 +123,24 @@
    - - + +
    - +
    - +
    conf->availableLanguages (); ?> @@ -173,25 +173,25 @@
    - +
    - +
    - +
    - + conf->mail_login; ?>
    @@ -200,8 +200,8 @@
    - - + +
    diff --git a/app/views/error/index.phtml b/app/views/error/index.phtml index ef4fbd39d..5e1949800 100644 --- a/app/views/error/index.phtml +++ b/app/views/error/index.phtml @@ -3,7 +3,7 @@

    code; ?>

    errorMessage; ?>
    - +

    diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml index 849dacac6..17e52a571 100644 --- a/app/views/feed/add.phtml +++ b/app/views/feed/add.phtml @@ -1,16 +1,16 @@ feed) { ?>
    -

    +

    load_ok) { ?> -

    +

    - + load_ok) { ?>
    - +
    @@ -18,7 +18,7 @@ feed->description(); if ($desc != '') { ?>
    - +
    @@ -26,7 +26,7 @@
    - +
    feed->website(); ?> @@ -35,17 +35,17 @@
    - +
    - +
    - +
    - +
    - + feed->httpAuth(false); ?>
    - +
    - +
    - +
    - - + +
    diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 678c5f132..8bd645d11 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -12,27 +12,27 @@ feed->nbEntries (); ?> feed->inError ()) { ?> -

    +

    -

    +

    - +
    - +
    - +
    - +
    @@ -41,18 +41,18 @@
    - +
    - +
    - +
    feed->priority () > 0 ? ' checked="checked"' : ''; ?> /> - +
    @@ -83,7 +83,7 @@
    - +
    @@ -96,21 +96,21 @@
    - +
    - +
    - +
    - +
    @@ -150,24 +150,24 @@
    - - + +
    - +
    - +
    - - + +
    - - + +
    diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 4f7e3db0c..ba02b9fad 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -52,10 +52,10 @@ echo 'authType="', $authType, '",', 'url_login="', _url ('index', 'login'), '",', 'url_logout="', _url ('index', 'logout'), '",'; -echo 'str_confirmation_default="', Minz_Translate::t('confirm_action'), '"', ",\n"; -echo 'str_notif_title_articles="', Minz_Translate::t('notif_title_new_articles'), '"', ",\n"; -echo 'str_notif_body_articles="', Minz_Translate::t('notif_body_new_articles'), '"', ",\n"; -echo 'str_category_empty="', Minz_Translate::t('category_empty'), '"', ",\n"; +echo 'str_confirmation_default="', _t('confirm_action'), '"', ",\n"; +echo 'str_notif_title_articles="', _t('notif_title_new_articles'), '"', ",\n"; +echo 'str_notif_body_articles="', _t('notif_body_new_articles'), '"', ",\n"; +echo 'str_category_empty="', _t('category_empty'), '"', ",\n"; echo 'html5_notif_timeout=', $this->conf->html5_notif_timeout,",\n"; diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml index e3d14810e..191cfa8de 100755 --- a/app/views/helpers/logs_pagination.phtml +++ b/app/views/helpers/logs_pagination.phtml @@ -9,14 +9,14 @@
  • currentPage > 1) { ?> - « + «
  • currentPage - 1; ?>
  • currentPage > 1) { ?> - +
  • @@ -34,13 +34,13 @@ currentPage + 1; ?>
  • currentPage < $this->nbPage) { ?> - +
  • nbPage; ?>
  • currentPage < $this->nbPage) { ?> - » + »
  • diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index e469edf58..ee745144f 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -30,12 +30,12 @@ if (!empty($this->entries)) {
    - +
    entries as $item) { if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) { ?>
    currentName; ?>
    entries)) { } if ($display_yesterday && $item->isDay (FreshRSS_Days::YESTERDAY, $this->today)) { ?>
    currentName; ?>
    entries)) { } if ($display_others && $item->isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) { ?>
    currentName; ?>
    entries)) {

    title (); ?>

    author(); - echo $author != '' ? '
    ' . Minz_Translate::t('by_author', $author) . '
    ' : '', + echo $author != '' ? '
    ' . _t('by_author', $author) . '
    ' : '', $lazyload && $hidePosts ? lazyimg($item->content()) : $item->content(); ?>
    @@ -133,7 +133,7 @@ if (!empty($this->entries)) { - +
    diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 31c9cdbc1..4f6beb9fd 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -77,11 +77,11 @@ function formatBytes($bytes, $precision = 2, $system = 'IEC') { } function timestamptodate ($t, $hour = true) { - $month = Minz_Translate::t (date('M', $t)); + $month = _t(date('M', $t)); if ($hour) { - $date = Minz_Translate::t ('format_date_hour', $month); + $date = _t('format_date_hour', $month); } else { - $date = Minz_Translate::t ('format_date', $month); + $date = _t('format_date', $month); } return @date ($date, $t); @@ -107,7 +107,7 @@ function html_only_entity_decode($text) { function customSimplePie() { $simplePie = new SimplePie(); - $simplePie->set_useragent(Minz_Translate::t('freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); + $simplePie->set_useragent(_t('freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); $simplePie->set_cache_location(CACHE_PATH); $simplePie->set_cache_duration(800); $simplePie->strip_htmltags(array( -- cgit v1.2.3 From c8fad68a4fd15857a2e3e21e7d5311dc7f87226c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 5 Oct 2014 16:10:25 +0200 Subject: Use _i() whenever it is possible Transform FreshRSS_Themes::icon\s? in _i See https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/layout/layout.phtml | 2 +- app/layout/nav_entries.phtml | 6 +++--- app/views/configure/archiving.phtml | 4 ++-- app/views/configure/display.phtml | 6 +++--- app/views/configure/sharing.phtml | 14 +++++++------- app/views/configure/users.phtml | 8 ++++---- app/views/entry/bookmark.phtml | 2 +- app/views/entry/read.phtml | 2 +- app/views/feed/add.phtml | 6 +++--- app/views/helpers/feed/update.phtml | 8 ++++---- app/views/helpers/javascript_vars.phtml | 2 +- app/views/helpers/view/global_view.phtml | 2 +- app/views/helpers/view/normal_view.phtml | 14 +++++++------- 13 files changed, 38 insertions(+), 38 deletions(-) diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index f95f45b5e..dbfac63a5 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -56,7 +56,7 @@ ?>
    - +
    diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml index 3141e92a0..ca6849193 100644 --- a/app/layout/nav_entries.phtml +++ b/app/layout/nav_entries.phtml @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 3180fe933..a883571aa 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -5,7 +5,7 @@
    -

    +

    @@ -63,7 +63,7 @@

    nb_total), ' ', _t('articles'), ', ', formatBytes($this->size_user); ?>

    - +
    diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index f1b80ab15..34239c7b2 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -62,12 +62,12 @@
    - - + + - + diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index ee276a94e..5f657ca74 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -4,15 +4,15 @@ + data-simple='
    ' data-advanced='
    -
    - +
    +
    '> conf->sharing as $key => $sharing): ?> @@ -27,12 +27,12 @@
    - +
    - + - + @@ -45,7 +45,7 @@ - + diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 04e662fa3..517e302e5 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -22,7 +22,7 @@
    /> - +
    @@ -34,7 +34,7 @@
    /> - +
    @@ -113,7 +113,7 @@
    /> - +
    @@ -184,7 +184,7 @@
    - +
    diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index c1fc32b7f..ab61fa206 100755 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -13,4 +13,4 @@ $url = Minz_Url::display (array ( 'params' => Minz_Request::params (), )); -echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => FreshRSS_Themes::icon(Minz_Request::param ('is_favorite') ? 'non-starred' : 'starred'))); +echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => _i(Minz_Request::param ('is_favorite') ? 'non-starred' : 'starred'))); diff --git a/app/views/entry/read.phtml b/app/views/entry/read.phtml index 9e79d4c07..0ef9df7eb 100755 --- a/app/views/entry/read.phtml +++ b/app/views/entry/read.phtml @@ -13,4 +13,4 @@ $url = Minz_Url::display (array ( 'params' => Minz_Request::params (), )); -echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => FreshRSS_Themes::icon(Minz_Request::param ('is_read') ? 'unread' : 'read'))); +echo json_encode (array ('url' => str_ireplace ('&', '&', $url), 'icon' => _i(Minz_Request::param ('is_read') ? 'unread' : 'read'))); diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml index 17e52a571..1db053b52 100644 --- a/app/views/feed/add.phtml +++ b/app/views/feed/add.phtml @@ -29,7 +29,7 @@
    feed->website(); ?> - +
    @@ -39,7 +39,7 @@
    - +
    @@ -76,7 +76,7 @@
    - +
    diff --git a/app/views/helpers/feed/update.phtml b/app/views/helpers/feed/update.phtml index 8bd645d11..9235752c3 100644 --- a/app/views/helpers/feed/update.phtml +++ b/app/views/helpers/feed/update.phtml @@ -36,7 +36,7 @@
    - +
    @@ -45,7 +45,7 @@
    - +
    @@ -139,7 +139,7 @@
    - +
    @@ -160,7 +160,7 @@
    - +
    diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index ba02b9fad..011b17b7a 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -33,7 +33,7 @@ echo ',shortcuts={', "},\n"; if (Minz_Request::param ('output') === 'global') { - echo "iconClose='", FreshRSS_Themes::icon('close'), "',\n"; + echo "iconClose='", _i('close'), "',\n"; } $authType = Minz_Configuration::authType(); diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml index 5e4cad01a..0e553c957 100644 --- a/app/views/helpers/view/global_view.phtml +++ b/app/views/helpers/view/global_view.phtml @@ -42,7 +42,7 @@
    conf->display_posts ? '' : ' class="hide_posts"'; ?>> - +
    diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index ee745144f..66b79cd7f 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -66,7 +66,7 @@ if (!empty($this->entries)) { $arUrl['params']['is_read'] = 0; } ?>isRead () ? 'read' : 'unread'); ?>isRead () ? 'read' : 'unread'); ?>entries)) { $arUrl['params']['is_favorite'] = 0; } ?>isFavorite () ? 'starred' : 'non-starred'); ?>isFavorite () ? 'starred' : 'non-starred'); ?>entries)) { ?>
  • ✇ name(); ?>
  • title (); ?>
  • date (); ?> 
  • - +
    @@ -111,7 +111,7 @@ if (!empty($this->entries)) { $arUrl['params']['is_read'] = 0; } ?>isRead () ? 'read' : 'unread'); ?>isRead () ? 'read' : 'unread'); ?>entries)) { $arUrl['params']['is_favorite'] = 0; } ?>isFavorite () ? 'starred' : 'non-starred'); ?>isFavorite () ? 'starred' : 'non-starred'); ?> @@ -132,7 +132,7 @@ if (!empty($this->entries)) { ?> -- cgit v1.2.3 From 70131f776a5fa30fdf26c64578039aeeb41333c7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 5 Oct 2014 16:53:43 +0200 Subject: SimplePie enclosure bug workaround https://github.com/marienfressinaud/FreshRSS/issues/504 --- app/Models/Feed.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 2a5ea45ac..03baf3ad2 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -288,6 +288,8 @@ class FreshRSS_Feed extends Minz_Model { $content .= '
     
    conf->topline_read ? ' checked="checked"' : ''; ?> /> conf->topline_favorite ? ' checked="checked"' : ''; ?> /> conf->topline_date ? ' checked="checked"' : ''; ?> /> conf->topline_link ? ' checked="checked"' : ''; ?> />
    conf->bottomline_read ? ' checked="checked"' : ''; ?> /> conf->bottomline_favorite ? ' checked="checked"' : ''; ?> /> conf->bottomline_sharing ? ' checked="checked"' : ''; ?> />
     
    - - + + - + - + - + - + @@ -41,14 +41,14 @@
    -

    +

     
    repartition['main_stream']['total']); ?> repartition['all_feeds']['total']); ?>
    repartition['main_stream']['read']); ?> repartition['all_feeds']['read']); ?>
    repartition['main_stream']['unread']); ?> repartition['all_feeds']['unread']); ?>
    repartition['main_stream']['favorite']); ?> repartition['all_feeds']['favorite']); ?>
    - - - - + + + + @@ -65,18 +65,18 @@
    -

    +

    -

    +

    -

    +

    diff --git a/app/views/users/index.phtml b/app/views/users/index.phtml index 517e302e5..95659f727 100644 --- a/app/views/users/index.phtml +++ b/app/views/users/index.phtml @@ -164,7 +164,7 @@
    -
    -
    - - -
    - -
    -
    - -
    - - - -- cgit v1.2.3 From 6009990935a2d06c252073f6b51ea5378536ef52 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 7 Oct 2014 10:16:38 +0200 Subject: Introduce FreshRSS_Auth::hasAccess('admin') Replace Minz_Configuration::isAdmin($user). FreshRSS_Auth::hasAccess() could be extended to others scopes later. See https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/Controllers/configureController.php | 2 +- app/Controllers/updateController.php | 2 +- app/Controllers/usersController.php | 8 ++++---- app/Models/Auth.php | 19 +++++++++++++++---- app/layout/aside_configure.phtml | 5 +---- app/layout/header.phtml | 5 +---- app/views/configure/archiving.phtml | 2 +- app/views/users/index.phtml | 6 +++--- lib/Minz/Configuration.php | 3 --- 9 files changed, 27 insertions(+), 25 deletions(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 7e77a757a..fb8c1466e 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -229,7 +229,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->nb_total = $entryDAO->count(); $this->view->size_user = $entryDAO->size(); - if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { + if (FreshRSS_Auth::hasAccess('admin')) { $this->view->size_total = $entryDAO->size(true); } } diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 9da1e8657..9d1e1ddf5 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -3,7 +3,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { public function firstAction() { $current_user = Minz_Session::param('currentUser', ''); - if (!FreshRSS_Auth::hasAccess() && Minz_Configuration::isAdmin($current_user)) { + if (!FreshRSS_Auth::hasAccess('admin')) { Minz_Error::error( 403, array('error' => array(_t('access_denied'))) diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php index c2b1d163f..11862ce27 100644 --- a/app/Controllers/usersController.php +++ b/app/Controllers/usersController.php @@ -51,7 +51,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { $this->view->conf->_apiPasswordHash($passwordHash); } - if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { + if (FreshRSS_Auth::hasAccess('admin')) { $this->view->conf->_mail_login(Minz_Request::param('mail_login', '', true)); } $email = $this->view->conf->mail_login; @@ -65,7 +65,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { $ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false); } - if (Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { + if (FreshRSS_Auth::hasAccess('admin')) { $current_token = $this->view->conf->token; $token = Minz_Request::param('token', $current_token); $this->view->conf->_token($token); @@ -105,7 +105,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { } public function createAction() { - if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { + if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { $db = Minz_Configuration::dataBase(); require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); @@ -177,7 +177,7 @@ class FreshRSS_users_Controller extends Minz_ActionController { } public function deleteAction() { - if (Minz_Request::isPost() && Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_'))) { + if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { $db = Minz_Configuration::dataBase(); require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); diff --git a/app/Models/Auth.php b/app/Models/Auth.php index c4a3abd98..992b444a5 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -99,12 +99,23 @@ class FreshRSS_Auth { } /** - * Returns if current user is connected. + * Returns if current user has access to the given scope. * - * @return boolean true if user is connected, false else. + * @param string $scope general (default) or admin + * @return boolean true if user has corresponding access, false else. */ - public static function hasAccess() { - return self::$login_ok; + public static function hasAccess($scope = 'general') { + $ok = self::$login_ok; + switch ($scope) { + case 'general': + break; + case 'admin': + $ok &= Minz_Session::param('currentUser') === Minz_Configuration::defaultUser(); + break; + default: + $ok = false; + } + return $ok; } /** diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index e17bcb254..59846a7c8 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -22,10 +22,7 @@
  • - +
  • diff --git a/app/layout/header.phtml b/app/layout/header.phtml index fadfd13d7..12c86d61d 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -64,10 +64,7 @@ if (Minz_Configuration::canLogIn()) {
  • - +
  • diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index a883571aa..adbfdb77e 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -67,7 +67,7 @@ - +

    diff --git a/app/views/users/index.phtml b/app/views/users/index.phtml index 95659f727..f1cdf01a3 100644 --- a/app/views/users/index.phtml +++ b/app/views/users/index.phtml @@ -11,7 +11,7 @@
    @@ -44,7 +44,7 @@ conf->mail_login; ?>
    - placeholder="alice@example.net" /> + placeholder="alice@example.net" />
    @@ -56,7 +56,7 @@
    - + diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 4e9da58b4..554bc8c96 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -100,9 +100,6 @@ class Minz_Configuration { public static function defaultUser () { return self::$default_user; } - public static function isAdmin($currentUser) { - return $currentUser === self::$default_user; - } public static function allowAnonymous() { return self::$allow_anonymous; } -- cgit v1.2.3 From 1252b3dd867e59917cf303f0c39c7da938b8ce32 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 7 Oct 2014 16:37:10 +0200 Subject: Authentication system moved + Persona comes back! AuthController is dedicated to auhentication. Persona is back, greater than ever! See https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/Controllers/authController.php | 182 ++++++++++++++++++++++++++++++++ app/Controllers/indexController.php | 90 +--------------- app/FreshRSS.php | 8 ++ app/Models/Auth.php | 21 +++- app/layout/header.phtml | 23 ++-- app/views/auth/formLogin.phtml | 28 +++++ app/views/auth/logout.phtml | 0 app/views/auth/personaLogin.phtml | 24 +++++ app/views/helpers/javascript_vars.phtml | 13 ++- app/views/index/formLogin.phtml | 46 -------- p/scripts/main.js | 65 ------------ p/scripts/persona.js | 76 +++++++++++++ 12 files changed, 356 insertions(+), 220 deletions(-) create mode 100644 app/Controllers/authController.php create mode 100644 app/views/auth/formLogin.phtml create mode 100644 app/views/auth/logout.phtml create mode 100644 app/views/auth/personaLogin.phtml delete mode 100644 app/views/index/formLogin.phtml create mode 100644 p/scripts/persona.js diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php new file mode 100644 index 000000000..2b67e34b8 --- /dev/null +++ b/app/Controllers/authController.php @@ -0,0 +1,182 @@ + 'index', 'a' => 'index'), true); + } + + $auth_type = Minz_Configuration::authType(); + switch ($auth_type) { + case 'form': + Minz_Request::forward(array('c' => 'auth', 'a' => 'formLogin')); + break; + case 'persona': + Minz_Request::forward(array('c' => 'auth', 'a' => 'personaLogin')); + break; + case 'http_auth': + case 'none': + // It should not happened! + Minz_Error::error(404); + default: + // TODO load plugin instead + Minz_Error::error(404); + } + } + + /** + * This action handles form login page. + * + * If this action is reached through a POST request, username and password + * are compared to login the current user. + * + * Parameters are: + * - nonce (default: false) + * - username (default: '') + * - challenge (default: '') + * - keep_logged_in (default: false) + */ + public function formLoginAction() { + invalidateHttpCache(); + + $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'); + Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . $file_mtime)); + + if (Minz_Request::isPost()) { + $nonce = Minz_Session::param('nonce'); + $username = Minz_Request::param('username', ''); + $challenge = Minz_Request::param('challenge', ''); + try { + $conf = new FreshRSS_Configuration($username); + } catch(Minz_Exception $e) { + // $username is not a valid user, nor the configuration file! + Minz_Log::warning('Login failure: ' . $e->getMessage()); + Minz_Request::bad(_t('invalid_login'), + array('c' => 'auth', 'a' => 'login')); + } + + $ok = FreshRSS_FormAuth::checkCredentials( + $username, $conf->passwordHash, $nonce, $challenge + ); + if ($ok) { + // Set session parameter to give access to the user. + Minz_Session::_param('currentUser', $username); + Minz_Session::_param('passwordHash', $conf->passwordHash); + FreshRSS_Auth::giveAccess(); + + // Set cookie parameter if nedded. + if (Minz_Request::param('keep_logged_in')) { + FreshRSS_FormAuth::makeCookie($username, $conf->passwordHash); + } else { + FreshRSS_FormAuth::deleteCookie(); + } + + // All is good, go back to the index. + Minz_Request::good(_t('login'), + array('c' => 'index', 'a' => 'index')); + } else { + Minz_Log::warning('Password mismatch for' . + ' user=' . $username . + ', nonce=' . $nonce . + ', c=' . $challenge); + Minz_Request::bad(_t('invalid_login'), + array('c' => 'auth', 'a' => 'login')); + } + } + } + + /** + * This action handles Persona login page. + * + * If this action is reached through a POST request, assertion from Persona + * is verificated and user connected if all is ok. + * + * Parameter is: + * - assertion (default: false) + * + * @todo: Persona system should be moved to a plugin + */ + public function personaLoginAction() { + $this->view->res = false; + + if (Minz_Request::isPost()) { + $this->view->_useLayout(false); + + $assert = Minz_Request::param('assertion'); + $url = 'https://verifier.login.persona.org/verify'; + $params = 'assertion=' . $assert . '&audience=' . + urlencode(Minz_Url::display(null, 'php', true)); + $ch = curl_init(); + $options = array( + CURLOPT_URL => $url, + CURLOPT_RETURNTRANSFER => TRUE, + CURLOPT_POST => 2, + CURLOPT_POSTFIELDS => $params + ); + curl_setopt_array($ch, $options); + $result = curl_exec($ch); + curl_close($ch); + + $res = json_decode($result, true); + + $login_ok = false; + $reason = ''; + if ($res['status'] === 'okay') { + $email = filter_var($res['email'], FILTER_VALIDATE_EMAIL); + if ($email != '') { + $persona_file = DATA_PATH . '/persona/' . $email . '.txt'; + if (($current_user = @file_get_contents($persona_file)) !== false) { + $current_user = trim($current_user); + try { + $conf = new FreshRSS_Configuration($current_user); + $login_ok = strcasecmp($email, $conf->mail_login) === 0; + } catch (Minz_Exception $e) { + //Permission denied or conf file does not exist + $reason = 'Invalid configuration for user ' . + '[' . $current_user . '] ' . $e->getMessage(); + } + } + } else { + $reason = 'Invalid email format [' . $res['email'] . ']'; + } + } else { + $reason = $res['reason']; + } + + if ($login_ok) { + Minz_Session::_param('currentUser', $current_user); + Minz_Session::_param('mail', $email); + FreshRSS_Auth::giveAccess(); + invalidateHttpCache(); + } else { + Minz_Log::error($reason); + + $res = array(); + $res['status'] = 'failure'; + $res['reason'] = _t('invalid_login'); + } + + header('Content-Type: application/json; charset=UTF-8'); + $this->view->res = $res; + } + } + + /** + * This action removes all accesses of the current user. + */ + public function logoutAction() { + invalidateHttpCache(); + FreshRSS_Auth::removeAccess(); + Minz_Request::good(_t('disconnected'), + array('c' => 'index', 'a' => 'index')); + } +} diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 3006480f9..5b490e672 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -20,7 +20,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { } elseif ($output !== 'rss') { // "hard" redirection is not required, just ask dispatcher to // forward to the login form without 302 redirection - Minz_Request::forward(array('c' => 'index', 'a' => 'login')); + Minz_Request::forward(array('c' => 'auth', 'a' => 'login')); return; } } @@ -228,92 +228,4 @@ class FreshRSS_index_Controller extends Minz_ActionController { $this->view->logsPaginator->_nbItemsPerPage(50); $this->view->logsPaginator->_currentPage($page); } - - /** - * This action handles the login page. - */ - public function loginAction() { - if (FreshRSS_Auth::hasAccess()) { - Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true); - } - - invalidateHttpCache(); - - $auth_type = Minz_Configuration::authType(); - switch ($auth_type) { - case 'form': - Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin')); - break; - case 'http_auth': - case 'none': - // It should not happened! - Minz_Error::error(404); - default: - // TODO load plugin instead - Minz_Error::error(404); - } - } - - /** - * - */ - public function formLoginAction() { - if (FreshRSS_Auth::hasAccess()) { - Minz_Request::forward(array('c' => 'index', 'a' => 'index'), true); - } - - invalidateHttpCache(); - - $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'); - Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . $file_mtime)); - - if (Minz_Request::isPost()) { - $nonce = Minz_Session::param('nonce'); - $username = Minz_Request::param('username', ''); - $challenge = Minz_Request::param('challenge', ''); - try { - $conf = new FreshRSS_Configuration($username); - } catch(Minz_Exception $e) { - // $username is not a valid user, nor the configuration file! - Minz_Log::warning('Login failure: ' . $e->getMessage()); - Minz_Request::bad(_t('invalid_login'), - array('c' => 'index', 'a' => 'login')); - } - - $ok = FreshRSS_FormAuth::checkCredentials( - $username, $conf->passwordHash, $nonce, $challenge - ); - if ($ok) { - // Set session parameter to give access to the user. - Minz_Session::_param('currentUser', $username); - Minz_Session::_param('passwordHash', $conf->passwordHash); - FreshRSS_Auth::giveAccess(); - - // Set cookie parameter if nedded. - if (Minz_Request::param('keep_logged_in', false)) { - FreshRSS_FormAuth::makeCookie($username, $conf->passwordHash); - } else { - FreshRSS_FormAuth::deleteCookie(); - } - - // All is good, go back to the index. - Minz_Request::good(_t('login'), - array('c' => 'index', 'a' => 'index')); - } else { - Minz_Log::warning('Password mismatch for' . - ' user=' . $username . - ', nonce=' . $nonce . - ', c=' . $challenge); - Minz_Request::bad(_t('invalid_login'), - array('c' => 'index', 'a' => 'login')); - } - } - } - - public function logoutAction() { - invalidateHttpCache(); - FreshRSS_Auth::removeAccess(); - Minz_Request::good(_t('disconnected'), - array('c' => 'index', 'a' => 'index')); - } } diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 35a37b887..6b7a813bf 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -64,6 +64,14 @@ class FreshRSS extends Minz_FrontController { Minz_View::appendScript(Minz_Url::display('/scripts/jquery.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/jquery.min.js'))); Minz_View::appendScript(Minz_Url::display('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); Minz_View::appendScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); + + if (Minz_Configuration::authType() === 'persona') { + // TODO move it in a plugin + // Needed for login AND logout with Persona. + Minz_View::appendScript('https://login.persona.org/include.js'); + $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/persona.js'); + Minz_View::appendScript(Minz_Url::display('/scripts/persona.js?' . $file_mtime)); + } } private function loadNotifications() { diff --git a/app/Models/Auth.php b/app/Models/Auth.php index 992b444a5..cc23d7974 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -20,7 +20,7 @@ class FreshRSS_Auth { Minz_Session::_param('currentUser', $current_user); } - $access_ok = self::accessControl($current_user); + $access_ok = self::accessControl(); if ($access_ok) { self::giveAccess(); @@ -36,10 +36,9 @@ class FreshRSS_Auth { * Required session parameters are also set in this method (such as * currentUser). * - * @param string $username username of the user to check access. * @return boolean true if user can be connected, false else. */ - public static function accessControl($username) { + public static function accessControl() { if (self::$login_ok) { return true; } @@ -61,6 +60,16 @@ class FreshRSS_Auth { Minz_Session::_param('currentUser', $current_user); } return $login_ok; + case 'persona': + $email = filter_var(Minz_Session::param('mail'), FILTER_VALIDATE_EMAIL); + $persona_file = DATA_PATH . '/persona/' . $email . '.txt'; + if (($current_user = @file_get_contents($persona_file)) !== false) { + $current_user = trim($current_user); + Minz_Session::_param('currentUser', $current_user); + Minz_Session::_param('mail', $email); + return true; + } + return false; case 'none': return true; default: @@ -87,6 +96,9 @@ class FreshRSS_Auth { case 'http_auth': self::$login_ok = strcasecmp($current_user, httpAuthUser()) === 0; break; + case 'persona': + self::$login_ok = strcasecmp(Minz_Session::param('mail'), $conf->mail_login) === 0; + break; case 'none': self::$login_ok = true; break; @@ -131,6 +143,9 @@ class FreshRSS_Auth { Minz_Session::_param('passwordHash'); FreshRSS_FormAuth::deleteCookie(); break; + case 'persona': + Minz_Session::_param('mail'); + break; case 'http_auth': case 'none': // Nothing to do... diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 12c86d61d..deb21edc9 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -2,9 +2,9 @@ if (Minz_Configuration::canLogIn()) { ?>
  • -
  • -
    + +
    + +
    + diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml new file mode 100644 index 000000000..0194a11a5 --- /dev/null +++ b/app/views/auth/formLogin.phtml @@ -0,0 +1,28 @@ +
    +

    + +
    +
    + + +
    +
    + + +
    + +
    +
    + +
    +
    +
    + +
    + + +

    +
    diff --git a/app/views/auth/logout.phtml b/app/views/auth/logout.phtml new file mode 100644 index 000000000..e69de29bb diff --git a/app/views/auth/personaLogin.phtml b/app/views/auth/personaLogin.phtml new file mode 100644 index 000000000..d62fe5818 --- /dev/null +++ b/app/views/auth/personaLogin.phtml @@ -0,0 +1,24 @@ +res === false) { ?> +
    +

    + +

    + + +

    + + + + + +

    + +

    +
    +res); +} +?> diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 8f615ed87..3bbcc3848 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -8,6 +8,15 @@ $hide_posts = ($this->conf->display_posts || Minz_Request::param('output') === 'reader'); $s = $this->conf->shortcuts; +$url_login = Minz_Url::display(array( + 'c' => 'auth', + 'a' => 'login' +), 'php'); +$url_logout = Minz_Url::display(array( + 'c' => 'auth', + 'a' => 'logout' +), 'php'); + echo 'var context={', 'hide_posts:', $hide_posts ? 'false' : 'true', ',', 'display_order:"', Minz_Request::param('order', $this->conf->sort_order), '",', @@ -43,8 +52,8 @@ echo 'shortcuts={', echo 'url={', 'index:"', _url('index', 'index'), '",', - 'login:"', _url('index', 'login'), '",', - 'logout:"', _url('index', 'logout'), '",', + 'login:"', $url_login, '",', + 'logout:"', $url_logout, '",', 'help:"', FRESHRSS_WIKI, '"', "},\n"; diff --git a/app/views/index/formLogin.phtml b/app/views/index/formLogin.phtml deleted file mode 100644 index b05cdced4..000000000 --- a/app/views/index/formLogin.phtml +++ /dev/null @@ -1,46 +0,0 @@ -
    -

    -
    - - -
    -
    - - -
    - -
    -
    - -
    -
    -
    - -
    -

    -

    - - - - - -

    - -

    -
    diff --git a/p/scripts/main.js b/p/scripts/main.js index b01a3a34d..77e1e3f77 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1034,67 +1034,7 @@ function init_crypto_form() { } // -// -function init_persona() { - if (!(navigator.id)) { - if (window.console) { - console.log('FreshRSS waiting for Persona…'); - } - window.setTimeout(init_persona, 100); - return; - } - $('a.signin').click(function() { - navigator.id.request(); - return false; - }); - - $('a.signout').click(function() { - navigator.id.logout(); - return false; - }); - navigator.id.watch({ - loggedInUser: context['current_user_mail'], - - onlogin: function(assertion) { - // A user has logged in! Here you need to: - // 1. Send the assertion to your backend for verification and to create a session. - // 2. Update your UI. - $.ajax ({ - type: 'POST', - url: url['login'], - data: {assertion: assertion}, - success: function(res, status, xhr) { - /*if (res.status === 'failure') { - alert (res_obj.reason); - } else*/ if (res.status === 'okay') { - location.href = url['index']; - } - }, - error: function(res, status, xhr) { - alert("Login failure: " + res); - } - }); - }, - onlogout: function() { - // A user has logged out! Here you need to: - // Tear down the user's session by redirecting the user or making a call to your backend. - // Also, make sure loggedInUser will get set to null on the next page load. - // (That's a literal JavaScript null. Not false, 0, or undefined. null.) - $.ajax ({ - type: 'POST', - url: url['logout'], - success: function(res, status, xhr) { - location.href = url['index']; - }, - error: function(res, status, xhr) { - //alert("logout failure" + res); - } - }); - } - }); -} -// function init_confirm_action() { $('body').on('click', '.confirm', function () { @@ -1274,11 +1214,6 @@ function init_all() { return; } init_notifications(); - switch (context['auth_type']) { - case 'persona': - init_persona(); - break; - } init_confirm_action(); $stream = $('#stream'); if ($stream.length > 0) { diff --git a/p/scripts/persona.js b/p/scripts/persona.js new file mode 100644 index 000000000..36aeeaf56 --- /dev/null +++ b/p/scripts/persona.js @@ -0,0 +1,76 @@ +"use strict"; + +function init_persona() { + if (!(navigator.id && window.$)) { + if (window.console) { + console.log('FreshRSS (Persona) waiting for JS…'); + } + window.setTimeout(init_persona, 100); + return; + } + + $('a.signin').click(function() { + navigator.id.request(); + return false; + }); + + $('a.signout').click(function() { + navigator.id.logout(); + return false; + }); + + navigator.id.watch({ + loggedInUser: context['current_user_mail'], + + onlogin: function(assertion) { + // A user has logged in! Here you need to: + // 1. Send the assertion to your backend for verification and to create a session. + // 2. Update your UI. + $.ajax ({ + type: 'POST', + url: url['login'], + data: {assertion: assertion}, + success: function(res, status, xhr) { + if (res.status === 'failure') { + openNotification(res.reason, 'bad'); + } else if (res.status === 'okay') { + location.href = url['index']; + } + }, + error: function(res, status, xhr) { + // alert(res); + } + }); + }, + onlogout: function() { + // A user has logged out! Here you need to: + // Tear down the user's session by redirecting the user or making a call to your backend. + // Also, make sure loggedInUser will get set to null on the next page load. + // (That's a literal JavaScript null. Not false, 0, or undefined. null.) + $.ajax ({ + type: 'POST', + url: url['logout'], + success: function(res, status, xhr) { + location.href = url['index']; + }, + error: function(res, status, xhr) { + // alert(res); + } + }); + } + }); +} + +if (document.readyState && document.readyState !== 'loading') { + if (window.console) { + console.log('FreshRSS (Persona) immediate init…'); + } + init_persona(); +} else if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', function () { + if (window.console) { + console.log('FreshRSS (Persona) waiting for DOMContentLoaded…'); + } + init_persona(); + }, false); +} -- cgit v1.2.3 From dbf57266b297c3f831602ec4f451c27a5ad71e6b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Tue, 7 Oct 2014 16:58:11 +0200 Subject: Reset auth system comes back! It has moved to authController. --- app/Controllers/authController.php | 68 ++++++++++++++++++++++++++++++++++++++ app/views/auth/personaLogin.phtml | 2 +- app/views/auth/reset.phtml | 33 ++++++++++++++++++ 3 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 app/views/auth/reset.phtml diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 2b67e34b8..e30fa4b72 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -179,4 +179,72 @@ class FreshRSS_auth_Controller extends Minz_ActionController { Minz_Request::good(_t('disconnected'), array('c' => 'index', 'a' => 'index')); } + + /** + * This action resets the authentication system. + * + * After reseting, form auth is set by default. + */ + public function resetAction() { + Minz_View::prependTitle(_t('auth_reset') . ' · '); + + Minz_View::appendScript(Minz_Url::display( + '/scripts/bcrypt.min.js?' . @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js') + )); + + $this->view->no_form = false; + // Enable changement of auth only if Persona! + if (Minz_Configuration::authType() != 'persona') { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('damn'), + 'body' => _t('auth_not_persona') + ); + $this->view->no_form = true; + return; + } + + $conf = new FreshRSS_Configuration(Minz_Configuration::defaultUser()); + // Admin user must have set its master password. + if (!$conf->passwordHash) { + $this->view->message = array( + 'status' => 'bad', + 'title' => _t('damn'), + 'body' => _t('auth_no_password_set') + ); + $this->view->no_form = true; + return; + } + + invalidateHttpCache(); + + if (Minz_Request::isPost()) { + $nonce = Minz_Session::param('nonce'); + $username = Minz_Request::param('username', ''); + $challenge = Minz_Request::param('challenge', ''); + + $ok = FreshRSS_FormAuth::checkCredentials( + $username, $conf->passwordHash, $nonce, $challenge + ); + + if ($ok) { + Minz_Configuration::_authType('form'); + $ok = Minz_Configuration::writeFile(); + + if ($ok) { + Minz_Request::good(_t('auth_form_set')); + } else { + Minz_Request::bad(_t('auth_form_not_set'), + array('c' => 'auth', 'a' => 'reset')); + } + } else { + Minz_Log::warning('Password mismatch for' . + ' user=' . $username . + ', nonce=' . $nonce . + ', c=' . $challenge); + Minz_Request::bad(_t('invalid_login'), + array('c' => 'auth', 'a' => 'reset')); + } + } + } } diff --git a/app/views/auth/personaLogin.phtml b/app/views/auth/personaLogin.phtml index d62fe5818..dd3e22b52 100644 --- a/app/views/auth/personaLogin.phtml +++ b/app/views/auth/personaLogin.phtml @@ -11,7 +11,7 @@ - +

    diff --git a/app/views/auth/reset.phtml b/app/views/auth/reset.phtml new file mode 100644 index 000000000..e501555c4 --- /dev/null +++ b/app/views/auth/reset.phtml @@ -0,0 +1,33 @@ +
    +

    + + message)) { ?> +

    + message['title']; ?>
    + message['body']; ?> +

    + + + no_form) { ?> +
    +

    +
    + +

    + +
    + + +
    +
    + + +
    + +
    +
    + +
    + + +
    -- cgit v1.2.3 From eb40dbccdb1e0830fcad96d333b242870cc0d0a7 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Thu, 9 Oct 2014 21:44:44 -0400 Subject: Change statistic average I was using the stats and it feels that the stat average was useless in that form since the line is always at the same position no matter what is the value. So I deleted that line and added the average in the title. It is way more useful this way. I updated some translations both on i18n files and on http://i18n.freshrss.org --- app/Models/StatsDAO.php | 2 +- app/i18n/en.php | 6 +++--- app/i18n/fr.php | 6 +++--- app/views/stats/repartition.phtml | 36 +++--------------------------------- 4 files changed, 10 insertions(+), 40 deletions(-) diff --git a/app/Models/StatsDAO.php b/app/Models/StatsDAO.php index 99d4e2148..283d5dcb1 100644 --- a/app/Models/StatsDAO.php +++ b/app/Models/StatsDAO.php @@ -237,7 +237,7 @@ SQL; $interval_in_days = $period; } - return round($res['count'] / ($interval_in_days / $period), 2); + return $res['count'] / ($interval_in_days / $period); } /** diff --git a/app/i18n/en.php b/app/i18n/en.php index 9e968998a..ebc25ba0c 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -398,9 +398,9 @@ 'stats_entry_count' => 'Entry count', 'stats_entry_per_category' => 'Entries per category', 'stats_entry_per_day' => 'Entries per day (last 30 days)', - 'stats_entry_per_day_of_week' => 'Per day of week', - 'stats_entry_per_hour' => 'Per hour', - 'stats_entry_per_month' => 'Per month', + 'stats_entry_per_day_of_week' => 'Per day of week (average: %.2f messages)', + 'stats_entry_per_hour' => 'Per hour (average: %.2f messages)', + 'stats_entry_per_month' => 'Per month (average: %.2f messages)', 'stats_entry_repartition' => 'Entries repartition', 'stats_feed_per_category' => 'Feeds per category', 'stats_idle' => 'Idle feeds', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 072094026..220f8b12d 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -398,9 +398,9 @@ 'stats_entry_count' => 'Nombre d’articles', 'stats_entry_per_category' => 'Articles par catégorie', 'stats_entry_per_day' => 'Nombre d’articles par jour (30 derniers jours)', - 'stats_entry_per_day_of_week' => 'Par jour de la semaine', - 'stats_entry_per_hour' => 'Par heure', - 'stats_entry_per_month' => 'Par mois', + 'stats_entry_per_day_of_week' => 'Par jour de la semaine (moyenne : %.2f messages)', + 'stats_entry_per_hour' => 'Par heure (moyenne : %.2f messages)', + 'stats_entry_per_month' => 'Par mois (moyenne : %.2f messages)', 'stats_entry_repartition' => 'Répartition des articles', 'stats_feed_per_category' => 'Flux par catégorie', 'stats_idle' => 'Flux inactifs', diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index a181ae251..670714707 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -30,17 +30,17 @@
    -

    +

    averageHour); ?>

    -

    +

    averageDayOfWeek); ?>

    -

    +

    averageMonth); ?>

    @@ -56,19 +56,10 @@ function initStats() { return; } // Entry per hour - var avg_h = []; - for (var i = -1; i <= 24; i++) { - avg_h.push([i, averageHour?>]); - } Flotr.draw(document.getElementById('statsEntryPerHour'), [{ data: repartitionHour ?>, bars: {horizontal: false, show: true} - }, { - data: avg_h, - lines: {show: true}, - label: "averageHour?>", - yaxis: 2 }], { grid: {verticalLines: false}, @@ -81,23 +72,13 @@ function initStats() { max: 23.9, tickDecimals: 0}, yaxis: {min: 0}, - y2axis: {showLabels: false}, mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} }); // Entry per day of week - var avg_dow = []; - for (var i = -1; i <= 7; i++) { - avg_dow.push([i, averageDayOfWeek?>]); - } Flotr.draw(document.getElementById('statsEntryPerDayOfWeek'), [{ data: repartitionDayOfWeek ?>, bars: {horizontal: false, show: true} - }, { - data: avg_dow, - lines: {show: true}, - label: "averageDayOfWeek?>", - yaxis: 2 }], { grid: {verticalLines: false}, @@ -111,23 +92,13 @@ function initStats() { max: 6.9, tickDecimals: 0}, yaxis: {min: 0}, - y2axis: {showLabels: false}, mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} }); // Entry per month - var avg_m = []; - for (var i = 0; i <= 13; i++) { - avg_m.push([i, averageMonth?>]); - } Flotr.draw(document.getElementById('statsEntryPerMonth'), [{ data: repartitionMonth ?>, bars: {horizontal: false, show: true} - }, { - data: avg_m, - lines: {show: true}, - label: "averageMonth?>", - yaxis: 2 }], { grid: {verticalLines: false}, @@ -141,7 +112,6 @@ function initStats() { max: 12.9, tickDecimals: 0}, yaxis: {min: 0}, - y2axis: {showLabels: false}, mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}} }); -- cgit v1.2.3 From 1283e73d08a0441dbf84d7e45ff8c1c42bf188b1 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 14 Oct 2014 20:00:06 +0200 Subject: SimplePie: bug date CEST https://github.com/marienfressinaud/FreshRSS/issues/659 https://github.com/simplepie/simplepie/pull/380 --- lib/SimplePie/SimplePie/Parse/Date.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/SimplePie/SimplePie/Parse/Date.php b/lib/SimplePie/SimplePie/Parse/Date.php index ef800f125..ba7c0703e 100644 --- a/lib/SimplePie/SimplePie/Parse/Date.php +++ b/lib/SimplePie/SimplePie/Parse/Date.php @@ -331,6 +331,7 @@ class SimplePie_Parse_Date 'CCT' => 23400, 'CDT' => -18000, 'CEDT' => 7200, + 'CEST' => 7200, //FreshRSS 'CET' => 3600, 'CGST' => -7200, 'CGT' => -10800, -- cgit v1.2.3 From c5fe3bd6593d0a07c087d1e60ae2e4b8ab5f9fa9 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 16 Oct 2014 15:25:46 +0200 Subject: Reorganize user pages Three pages: - User profil - User management - Authentication --- app/Controllers/authController.php | 60 ++++++++++ app/Controllers/userController.php | 198 +++++++++++++++++++++++++++++++++ app/Controllers/usersController.php | 210 ----------------------------------- app/layout/aside_configure.phtml | 12 +- app/layout/header.phtml | 4 +- app/views/auth/index.phtml | 84 ++++++++++++++ app/views/user/manage.phtml | 76 +++++++++++++ app/views/user/profil.phtml | 59 ++++++++++ app/views/users/index.phtml | 211 ------------------------------------ 9 files changed, 490 insertions(+), 424 deletions(-) create mode 100644 app/Controllers/userController.php delete mode 100644 app/Controllers/usersController.php create mode 100644 app/views/auth/index.phtml create mode 100644 app/views/user/manage.phtml create mode 100644 app/views/user/profil.phtml delete mode 100644 app/views/users/index.phtml diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index e30fa4b72..751ce1f3f 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -4,6 +4,66 @@ * This controller handles action about authentication. */ class FreshRSS_auth_Controller extends Minz_ActionController { + /** + * This action handles authentication management page. + * + * Parameters are: + * - token (default: current token) + * - anon_access (default: false) + * - anon_refresh (default: false) + * - auth_type (default: none) + * - unsafe_autologin (default: false) + * - api_enabled (default: false) + * + * @todo move unsafe_autologin in an extension. + */ + public function indexAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403, + array('error' => array(_t('access_denied')))); + } + + if (Minz_Request::isPost()) { + $ok = true; + + $current_token = $this->view->conf->token; + $token = Minz_Request::param('token', $current_token); + $this->view->conf->_token($token); + $ok &= $this->view->conf->save(); + + $anon = Minz_Request::param('anon_access', false); + $anon = ((bool)$anon) && ($anon !== 'no'); + $anon_refresh = Minz_Request::param('anon_refresh', false); + $anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no'); + $auth_type = Minz_Request::param('auth_type', 'none'); + $unsafe_autologin = Minz_Request::param('unsafe_autologin', false); + $api_enabled = Minz_Request::param('api_enabled', false); + if ($anon != Minz_Configuration::allowAnonymous() || + $auth_type != Minz_Configuration::authType() || + $anon_refresh != Minz_Configuration::allowAnonymousRefresh() || + $unsafe_autologin != Minz_Configuration::unsafeAutologinEnabled() || + $api_enabled != Minz_Configuration::apiEnabled()) { + + Minz_Configuration::_authType($auth_type); + Minz_Configuration::_allowAnonymous($anon); + Minz_Configuration::_allowAnonymousRefresh($anon_refresh); + Minz_Configuration::_enableAutologin($unsafe_autologin); + Minz_Configuration::_enableApi($api_enabled); + $ok &= Minz_Configuration::writeFile(); + } + + invalidateHttpCache(); + + if ($ok) { + Minz_Request::good('configuration_updated', + array('c' => 'auth', 'a' => 'index')); + } else { + Minz_Request::bad('error_occurred', + array('c' => 'auth', 'a' => 'index')); + } + } + } + /** * This action handles the login page. * diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php new file mode 100644 index 000000000..c516246c9 --- /dev/null +++ b/app/Controllers/userController.php @@ -0,0 +1,198 @@ + array(_t('access_denied'))) + ); + } + } + + /** + * This action displays the user profil page. + */ + public function profilAction() { + Minz_View::prependTitle(_t('users.profil') . ' · '); + + if (Minz_Request::isPost()) { + $ok = true; + + $passwordPlain = Minz_Request::param('passwordPlain', '', true); + if ($passwordPlain != '') { + Minz_Request::_param('passwordPlain'); //Discard plain-text password ASAP + $_POST['passwordPlain'] = ''; + if (!function_exists('password_hash')) { + include_once(LIB_PATH . '/password_compat.php'); + } + $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); + $passwordPlain = ''; + $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js + $ok &= ($passwordHash != ''); + $this->view->conf->_passwordHash($passwordHash); + } + Minz_Session::_param('passwordHash', $this->view->conf->passwordHash); + + $passwordPlain = Minz_Request::param('apiPasswordPlain', '', true); + if ($passwordPlain != '') { + if (!function_exists('password_hash')) { + include_once(LIB_PATH . '/password_compat.php'); + } + $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); + $passwordPlain = ''; + $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js + $ok &= ($passwordHash != ''); + $this->view->conf->_apiPasswordHash($passwordHash); + } + + // TODO: why do we need of hasAccess here? + if (FreshRSS_Auth::hasAccess('admin')) { + $this->view->conf->_mail_login(Minz_Request::param('mail_login', '', true)); + } + $email = $this->view->conf->mail_login; + Minz_Session::_param('mail', $email); + + $ok &= $this->view->conf->save(); + + if ($email != '') { + $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; + @unlink($personaFile); + $ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false); + } + + if ($ok) { + Minz_Request::good('users.profil.updated', + array('c' => 'user', 'a' => 'profil')); + } else { + Minz_Request::bad('error_occurred', + array('c' => 'user', 'a' => 'profil')); + } + } + } + + /** + * This action displays the user management page. + */ + public function manageAction() { + Minz_View::prependTitle(_t('users.manage') . ' · '); + } + + public function createAction() { + if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { + $db = Minz_Configuration::dataBase(); + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + $new_user_language = Minz_Request::param('new_user_language', $this->view->conf->language); + if (!in_array($new_user_language, $this->view->conf->availableLanguages())) { + $new_user_language = $this->view->conf->language; + } + + $new_user_name = Minz_Request::param('new_user_name'); + $ok = ($new_user_name != '') && ctype_alnum($new_user_name); + + if ($ok) { + $ok &= (strcasecmp($new_user_name, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to alter the default user + + $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive + + $configPath = DATA_PATH . '/' . $new_user_name . '_user.php'; + $ok &= !file_exists($configPath); + } + if ($ok) { + + $passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true); + $passwordHash = ''; + if ($passwordPlain != '') { + Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP + $_POST['new_user_passwordPlain'] = ''; + if (!function_exists('password_hash')) { + include_once(LIB_PATH . '/password_compat.php'); + } + $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); + $passwordPlain = ''; + $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js + $ok &= ($passwordHash != ''); + } + if (empty($passwordHash)) { + $passwordHash = ''; + } + + $new_user_email = filter_var($_POST['new_user_email'], FILTER_VALIDATE_EMAIL); + if (empty($new_user_email)) { + $new_user_email = ''; + } else { + $personaFile = DATA_PATH . '/persona/' . $new_user_email . '.txt'; + @unlink($personaFile); + $ok &= (file_put_contents($personaFile, $new_user_name) !== false); + } + } + if ($ok) { + $config_array = array( + 'language' => $new_user_language, + 'passwordHash' => $passwordHash, + 'mail_login' => $new_user_email, + ); + $ok &= (file_put_contents($configPath, "createUser($new_user_name); + } + invalidateHttpCache(); + + $notif = array( + 'type' => $ok ? 'good' : 'bad', + 'content' => _t($ok ? 'user_created' : 'error_occurred', $new_user_name) + ); + Minz_Session::_param('notification', $notif); + } + + Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + } + + public function deleteAction() { + if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { + $db = Minz_Configuration::dataBase(); + require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); + + $username = Minz_Request::param('username'); + $ok = ctype_alnum($username); + + if ($ok) { + $ok &= (strcasecmp($username, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to delete the default user + } + if ($ok) { + $configPath = DATA_PATH . '/' . $username . '_user.php'; + $ok &= file_exists($configPath); + } + if ($ok) { + $userDAO = new FreshRSS_UserDAO(); + $ok &= $userDAO->deleteUser($username); + $ok &= unlink($configPath); + //TODO: delete Persona file + } + invalidateHttpCache(); + + $notif = array( + 'type' => $ok ? 'good' : 'bad', + 'content' => _t($ok ? 'user_deleted' : 'error_occurred', $username) + ); + Minz_Session::_param('notification', $notif); + } + + Minz_Request::forward(array('c' => 'user', 'a' => 'manage'), true); + } +} diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php deleted file mode 100644 index 11862ce27..000000000 --- a/app/Controllers/usersController.php +++ /dev/null @@ -1,210 +0,0 @@ - array(_t('access_denied'))) - ); - } - } - - /** - * This action display the user configuration page - */ - public function indexAction() { - Minz_View::prependTitle(_t('users') . ' · '); - } - - public function authAction() { - if (Minz_Request::isPost()) { - $ok = true; - - $passwordPlain = Minz_Request::param('passwordPlain', '', true); - if ($passwordPlain != '') { - Minz_Request::_param('passwordPlain'); //Discard plain-text password ASAP - $_POST['passwordPlain'] = ''; - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); - } - $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); - $passwordPlain = ''; - $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js - $ok &= ($passwordHash != ''); - $this->view->conf->_passwordHash($passwordHash); - } - Minz_Session::_param('passwordHash', $this->view->conf->passwordHash); - - $passwordPlain = Minz_Request::param('apiPasswordPlain', '', true); - if ($passwordPlain != '') { - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); - } - $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); - $passwordPlain = ''; - $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js - $ok &= ($passwordHash != ''); - $this->view->conf->_apiPasswordHash($passwordHash); - } - - if (FreshRSS_Auth::hasAccess('admin')) { - $this->view->conf->_mail_login(Minz_Request::param('mail_login', '', true)); - } - $email = $this->view->conf->mail_login; - Minz_Session::_param('mail', $email); - - $ok &= $this->view->conf->save(); - - if ($email != '') { - $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; - @unlink($personaFile); - $ok &= (file_put_contents($personaFile, Minz_Session::param('currentUser', '_')) !== false); - } - - if (FreshRSS_Auth::hasAccess('admin')) { - $current_token = $this->view->conf->token; - $token = Minz_Request::param('token', $current_token); - $this->view->conf->_token($token); - $ok &= $this->view->conf->save(); - - $anon = Minz_Request::param('anon_access', false); - $anon = ((bool)$anon) && ($anon !== 'no'); - $anon_refresh = Minz_Request::param('anon_refresh', false); - $anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no'); - $auth_type = Minz_Request::param('auth_type', 'none'); - $unsafe_autologin = Minz_Request::param('unsafe_autologin', false); - $api_enabled = Minz_Request::param('api_enabled', false); - if ($anon != Minz_Configuration::allowAnonymous() || - $auth_type != Minz_Configuration::authType() || - $anon_refresh != Minz_Configuration::allowAnonymousRefresh() || - $unsafe_autologin != Minz_Configuration::unsafeAutologinEnabled() || - $api_enabled != Minz_Configuration::apiEnabled()) { - - Minz_Configuration::_authType($auth_type); - Minz_Configuration::_allowAnonymous($anon); - Minz_Configuration::_allowAnonymousRefresh($anon_refresh); - Minz_Configuration::_enableAutologin($unsafe_autologin); - Minz_Configuration::_enableApi($api_enabled); - $ok &= Minz_Configuration::writeFile(); - } - } - - invalidateHttpCache(); - - $notif = array( - 'type' => $ok ? 'good' : 'bad', - 'content' => _t($ok ? 'configuration_updated' : 'error_occurred') - ); - Minz_Session::_param('notification', $notif); - } - Minz_Request::forward(array('c' => 'users', 'a' => 'index'), true); - } - - public function createAction() { - if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { - $db = Minz_Configuration::dataBase(); - require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); - - $new_user_language = Minz_Request::param('new_user_language', $this->view->conf->language); - if (!in_array($new_user_language, $this->view->conf->availableLanguages())) { - $new_user_language = $this->view->conf->language; - } - - $new_user_name = Minz_Request::param('new_user_name'); - $ok = ($new_user_name != '') && ctype_alnum($new_user_name); - - if ($ok) { - $ok &= (strcasecmp($new_user_name, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to alter the default user - - $ok &= !in_array(strtoupper($new_user_name), array_map('strtoupper', listUsers())); //Not an existing user, case-insensitive - - $configPath = DATA_PATH . '/' . $new_user_name . '_user.php'; - $ok &= !file_exists($configPath); - } - if ($ok) { - - $passwordPlain = Minz_Request::param('new_user_passwordPlain', '', true); - $passwordHash = ''; - if ($passwordPlain != '') { - Minz_Request::_param('new_user_passwordPlain'); //Discard plain-text password ASAP - $_POST['new_user_passwordPlain'] = ''; - if (!function_exists('password_hash')) { - include_once(LIB_PATH . '/password_compat.php'); - } - $passwordHash = password_hash($passwordPlain, PASSWORD_BCRYPT, array('cost' => self::BCRYPT_COST)); - $passwordPlain = ''; - $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js - $ok &= ($passwordHash != ''); - } - if (empty($passwordHash)) { - $passwordHash = ''; - } - - $new_user_email = filter_var($_POST['new_user_email'], FILTER_VALIDATE_EMAIL); - if (empty($new_user_email)) { - $new_user_email = ''; - } else { - $personaFile = DATA_PATH . '/persona/' . $new_user_email . '.txt'; - @unlink($personaFile); - $ok &= (file_put_contents($personaFile, $new_user_name) !== false); - } - } - if ($ok) { - $config_array = array( - 'language' => $new_user_language, - 'passwordHash' => $passwordHash, - 'mail_login' => $new_user_email, - ); - $ok &= (file_put_contents($configPath, "createUser($new_user_name); - } - invalidateHttpCache(); - - $notif = array( - 'type' => $ok ? 'good' : 'bad', - 'content' => _t($ok ? 'user_created' : 'error_occurred', $new_user_name) - ); - Minz_Session::_param('notification', $notif); - } - Minz_Request::forward(array('c' => 'users', 'a' => 'index'), true); - } - - public function deleteAction() { - if (Minz_Request::isPost() && FreshRSS_Auth::hasAccess('admin')) { - $db = Minz_Configuration::dataBase(); - require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); - - $username = Minz_Request::param('username'); - $ok = ctype_alnum($username); - - if ($ok) { - $ok &= (strcasecmp($username, Minz_Configuration::defaultUser()) !== 0); //It is forbidden to delete the default user - } - if ($ok) { - $configPath = DATA_PATH . '/' . $username . '_user.php'; - $ok &= file_exists($configPath); - } - if ($ok) { - $userDAO = new FreshRSS_UserDAO(); - $ok &= $userDAO->deleteUser($username); - $ok &= unlink($configPath); - //TODO: delete Persona file - } - invalidateHttpCache(); - - $notif = array( - 'type' => $ok ? 'good' : 'bad', - 'content' => _t($ok ? 'user_deleted' : 'error_occurred', $username) - ); - Minz_Session::_param('notification', $notif); - } - Minz_Request::forward(array('c' => 'users', 'a' => 'index'), true); - } -} diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 59846a7c8..7a9d0d839 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -19,10 +19,18 @@
  • -
  • - +
  • +
  • +
  • + +
  • +
  • + +
  • diff --git a/app/layout/header.phtml b/app/layout/header.phtml index deb21edc9..7e7c1b477 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -63,8 +63,10 @@ if (Minz_Configuration::canLogIn()) {
  • -
  • +
  • +
  • +
  • diff --git a/app/views/auth/index.phtml b/app/views/auth/index.phtml new file mode 100644 index 000000000..c37a7aef6 --- /dev/null +++ b/app/views/auth/index.phtml @@ -0,0 +1,84 @@ +partial('aside_configure'); ?> + +
    + + +
    + + +
    + +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    + + +
    + + conf->token; ?> +
    + /> + +
    +
    + + +
    +
    + +
    +
    + +
    +
    + + +
    +
    + +
    diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml new file mode 100644 index 000000000..03746cabb --- /dev/null +++ b/app/views/user/manage.phtml @@ -0,0 +1,76 @@ +partial('aside_configure'); ?> + +
    + + +
    + + +
    + +
    + +
    +
    + +
    +
    + +
    +
    + + +
    + + +
    + +
    + +
    +
    + +
    + +
    + +
    +
    + +
    + +
    +
    + + +
    + +
    +
    + +
    + + conf->mail_login; ?> +
    + +
    +
    + +
    +
    + + +
    +
    + + +
    diff --git a/app/views/user/profil.phtml b/app/views/user/profil.phtml new file mode 100644 index 000000000..a74c7b6f8 --- /dev/null +++ b/app/views/user/profil.phtml @@ -0,0 +1,59 @@ +partial('aside_configure'); ?> + +
    + + +
    + + +
    + +
    + + +
    +
    + +
    + +
    +
    + /> + +
    + +
    +
    + + +
    + +
    +
    + /> + +
    +
    +
    + + +
    + + conf->mail_login; ?> +
    + placeholder="alice@example.net" /> + +
    +
    + +
    +
    + + +
    +
    + +
    diff --git a/app/views/users/index.phtml b/app/views/users/index.phtml deleted file mode 100644 index f1cdf01a3..000000000 --- a/app/views/users/index.phtml +++ /dev/null @@ -1,211 +0,0 @@ -partial('aside_configure'); ?> - -
    - - -
    - - -
    - -
    - - -
    -
    - -
    - -
    -
    - /> - -
    - -
    -
    - - -
    - -
    -
    - /> - -
    -
    -
    - - -
    - - conf->mail_login; ?> -
    - placeholder="alice@example.net" /> - -
    -
    - -
    -
    - - -
    -
    - - - - - -
    - -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - - -
    - - conf->token; ?> -
    - /> - -
    -
    - - -
    -
    - -
    -
    - -
    -
    - - -
    -
    - - -
    - - -
    - -
    - -
    -
    - -
    -
    - -
    -
    - - -
    - - -
    - -
    - -
    -
    - -
    - -
    - -
    -
    - -
    - -
    -
    - - -
    - -
    -
    - -
    - - conf->mail_login; ?> -
    - -
    -
    - -
    -
    - - -
    -
    - - - - -
    -- cgit v1.2.3 From 2796cc9ae559842a90fa15cba65c94a11b29195e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 16 Oct 2014 16:43:37 +0200 Subject: User list load a new page Beginning of more options for administrator! --- app/Controllers/userController.php | 4 ++++ app/views/stats/repartition.phtml | 2 +- app/views/user/manage.phtml | 41 +++++++++++++++++++------------------- p/scripts/main.js | 2 +- 4 files changed, 26 insertions(+), 23 deletions(-) diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index c516246c9..00b51cc3d 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -88,6 +88,10 @@ class FreshRSS_user_Controller extends Minz_ActionController { */ public function manageAction() { Minz_View::prependTitle(_t('users.manage') . ' · '); + + $this->view->current_user = Minz_Request::param( + 'u', Minz_Session::param('currentUser', '_') + ); } public function createAction() { diff --git a/app/views/stats/repartition.phtml b/app/views/stats/repartition.phtml index 670714707..32268a546 100644 --- a/app/views/stats/repartition.phtml +++ b/app/views/stats/repartition.phtml @@ -5,7 +5,7 @@

    - categories as $category) { $feeds = $category->feeds(); diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 03746cabb..fb569872b 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -3,27 +3,6 @@
    -
    - - -
    - -
    - -
    -
    - -
    -
    - -
    -
    - -
    @@ -71,6 +50,26 @@
    + + +
    + +
    + +
    + +
    +
    + +
    +
    + +
    +
    diff --git a/p/scripts/main.js b/p/scripts/main.js index 77e1e3f77..1e13ff16a 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1086,7 +1086,7 @@ function init_share_observers() { } function init_stats_observers() { - $('#feed_select').on('change', function(e) { + $('.select-change').on('change', function(e) { redirect($(this).find(':selected').data('url')); }); } -- cgit v1.2.3 From d4ad951b9b686f387056bda8f3fa6ede8d9ca3f1 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 16 Oct 2014 17:08:48 +0200 Subject: Show more information about user when selected --- app/Controllers/userController.php | 19 ++++++++++++++++--- app/Models/Factory.php | 18 +++++++++--------- app/Models/UserDAO.php | 4 ++++ app/views/configure/archiving.phtml | 2 +- app/views/user/manage.phtml | 2 ++ 5 files changed, 32 insertions(+), 13 deletions(-) diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 00b51cc3d..4a04737f2 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -87,11 +87,24 @@ class FreshRSS_user_Controller extends Minz_ActionController { * This action displays the user management page. */ public function manageAction() { + if (!FreshRSS_Auth::hasAccess('admin')) { + Minz_Error::error(403, + array('error' => array(_t('access_denied')))); + } + Minz_View::prependTitle(_t('users.manage') . ' · '); - $this->view->current_user = Minz_Request::param( - 'u', Minz_Session::param('currentUser', '_') - ); + $userDAO = new FreshRSS_UserDAO(); + + $username = Minz_Request::param('u', Minz_Session::param('currentUser')); + if (!$userDAO->exist($username)) { + $username = Minz_Session::param('currentUser'); + } + $this->view->current_user = $username; + + $entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user); + $this->view->nb_articles = $entryDAO->count(); + $this->view->size_user = $entryDAO->size(); } public function createAction() { diff --git a/app/Models/Factory.php b/app/Models/Factory.php index 08569b2e2..93f4552f7 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -2,30 +2,30 @@ class FreshRSS_Factory { - public static function createFeedDao() { + public static function createFeedDao($username = null) { $db = Minz_Configuration::dataBase(); if ($db['type'] === 'sqlite') { - return new FreshRSS_FeedDAOSQLite(); + return new FreshRSS_FeedDAOSQLite($username); } else { - return new FreshRSS_FeedDAO(); + return new FreshRSS_FeedDAO($username); } } - public static function createEntryDao() { + public static function createEntryDao($username = null) { $db = Minz_Configuration::dataBase(); if ($db['type'] === 'sqlite') { - return new FreshRSS_EntryDAOSQLite(); + return new FreshRSS_EntryDAOSQLite($username); } else { - return new FreshRSS_EntryDAO(); + return new FreshRSS_EntryDAO($username); } } - public static function createStatsDAO() { + public static function createStatsDAO($username = null) { $db = Minz_Configuration::dataBase(); if ($db['type'] === 'sqlite') { - return new FreshRSS_StatsDAOSQLite(); + return new FreshRSS_StatsDAOSQLite($username); } else { - return new FreshRSS_StatsDAO(); + return new FreshRSS_StatsDAO($username); } } diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 15215258c..85b45c4a7 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -53,4 +53,8 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } } } + + public function exist($username) { + return file_exists(DATA_PATH . '/' . $username . '_user.php'); + } } diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index adbfdb77e..8f424c126 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -60,7 +60,7 @@

    -

    nb_total), ' ', _t('articles'), ', ', formatBytes($this->size_user); ?>

    +

    nb_total)), ' — ', formatBytes($this->size_user); ?>

    diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index fb569872b..65e60add5 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -63,6 +63,8 @@ + +

    nb_articles)), ', ', formatBytes($this->size_user); ?>

    -- cgit v1.2.3 From 5797344aff9ceebbdeb6e49305f3984a5c89f82c Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 16 Oct 2014 17:15:51 +0200 Subject: Fix a bug to get size of user (SQLite) --- app/Controllers/userController.php | 3 ++- app/Models/EntryDAOSQLite.php | 2 +- lib/Minz/ModelPdo.php | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 4a04737f2..d5c90a382 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -94,14 +94,15 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('users.manage') . ' · '); + // Get the correct current user. $userDAO = new FreshRSS_UserDAO(); - $username = Minz_Request::param('u', Minz_Session::param('currentUser')); if (!$userDAO->exist($username)) { $username = Minz_Session::param('currentUser'); } $this->view->current_user = $username; + // Get information about the current user. $entryDAO = FreshRSS_Factory::createEntryDao($this->view->current_user); $this->view->nb_articles = $entryDAO->count(); $this->view->size_user = $entryDAO->size(); diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php index 66078aca9..4a3fe24a2 100644 --- a/app/Models/EntryDAOSQLite.php +++ b/app/Models/EntryDAOSQLite.php @@ -124,6 +124,6 @@ class FreshRSS_EntryDAOSQLite extends FreshRSS_EntryDAO { } public function size($all = false) { - return @filesize(DATA_PATH . '/' . Minz_Session::param('currentUser', '_') . '.sqlite'); + return @filesize(DATA_PATH . '/' . $this->current_user . '.sqlite'); } } diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 66127ea22..827c89c69 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -24,6 +24,7 @@ class Minz_ModelPdo { */ protected $bd; + protected $current_user; protected $prefix; public function dbType() { @@ -46,6 +47,7 @@ class Minz_ModelPdo { if ($currentUser === null) { $currentUser = Minz_Session::param('currentUser', '_'); } + $this->current_user = $currentUser; try { $type = $db['type']; -- cgit v1.2.3 From 74be86d7e817bcccdc0052c54fefdc8379d9fe7f Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 17 Oct 2014 09:33:35 +0200 Subject: Reorganise menus (aside and header) --- app/layout/aside_configure.phtml | 2 +- app/layout/header.phtml | 3 ++- lib/lib_opml.php | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 7a9d0d839..2e2b87203 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -18,12 +18,12 @@
  • -
  • +
  • diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 7e7c1b477..c680cbcdc 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -62,9 +62,10 @@ if (Minz_Configuration::canLogIn()) {
  • -
  • +
  • +
  • diff --git a/lib/lib_opml.php b/lib/lib_opml.php index 16a9921ea..f320335bb 100644 --- a/lib/lib_opml.php +++ b/lib/lib_opml.php @@ -101,6 +101,7 @@ function libopml_parse_string($xml) { // First, we get all "head" elements. Head is required but its sub-elements // are optional. + // TODO: test head exists! foreach ($opml->head->children() as $key => $value) { if (in_array($key, unserialize(HEAD_ELEMENTS), true)) { $array['head'][$key] = (string)$value; @@ -114,6 +115,7 @@ function libopml_parse_string($xml) { // Then, we get body oulines. Body must contain at least one outline // element. $at_least_one_outline = false; + // TODO: test body exists! foreach ($opml->body->children() as $key => $value) { if ($key === 'outline') { $at_least_one_outline = true; -- cgit v1.2.3 From ce0984e102f5ce7d07277425595dad74193d4528 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 17 Oct 2014 16:23:07 +0200 Subject: Fix i18n --- app/i18n/en.php | 28 +++++++++++++++++----------- app/i18n/fr.php | 32 +++++++++++++++++++------------- app/layout/aside_configure.phtml | 8 ++++---- app/layout/header.phtml | 10 +++++----- app/views/configure/archiving.phtml | 19 ++++++++++++------- app/views/user/manage.phtml | 4 +++- 6 files changed, 60 insertions(+), 41 deletions(-) diff --git a/app/i18n/en.php b/app/i18n/en.php index ebc25ba0c..f65576ea3 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -9,6 +9,7 @@ 'add_category' => 'Add a category', 'add_query' => 'Add a query', 'add_rss_feed' => 'Add a RSS feed', + 'admin.users.articles_and_size' => '%d articles (%s)', 'administration' => 'Manage', 'advanced' => 'Advanced', 'after_onread' => 'After “mark all as read”,', @@ -18,8 +19,8 @@ 'all_feeds' => 'All feeds', 'already_subscribed' => 'You have already subscribed to %s', 'api_enabled' => 'Allow API access (required for mobile apps)', - 'apr' => 'apr', 'Apr' => '\\A\\p\\r\\i\\l', + 'apr' => 'apr', 'april' => 'Apr', 'archiving_configuration' => 'Archiving', 'archiving_configuration_help' => 'More options are available in the individual stream settings', @@ -34,8 +35,8 @@ 'article_viewed' => 'when article is viewed', 'ask_empty' => 'Clear?', 'attention' => 'Attention!', - 'aug' => 'aug', 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'aug' => 'aug', 'august' => 'Aug', 'author' => 'Author', 'auth_form' => 'Web form (traditional, requires JavaScript)', @@ -98,10 +99,11 @@ 'choose_language' => 'Choose a language for FreshRSS', 'clear_logs' => 'Clear the logs', 'collapse_article' => 'Collapse', + 'conf.users.articles_and_size' => '%d articles (%s)', 'configuration' => 'Configuration', 'configuration_updated' => 'Configuration has been updated', 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', - 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You may lost related favorites and user queries. It cannot be cancelled!', + 'confirm_action_feed_cat' => 'Are you sure you want to perform this action? You will lose related favorites and user queries. It cannot be cancelled!', 'congratulations' => 'Congratulations!', 'content_width' => 'Content width', 'create' => 'Create', @@ -116,8 +118,8 @@ 'current_user' => 'Current user', 'damn' => 'Damn!', 'data_is_ok' => 'Permissions on data directory are good', - 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', 'dec' => 'dec', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', 'december' => 'Dec', 'default_category' => 'Uncategorized', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', @@ -182,6 +184,10 @@ 'freshrss_installation' => 'Installation · FreshRSS', 'fri' => 'Fri', 'g+' => 'Google+', + 'gen.menu.admin' => 'Administration', + 'gen.menu.authentication' => 'Authentication', + 'gen.menu.manage_users' => 'Manage users', + 'gen.menu.profil' => 'Profil', 'general_configuration' => 'General configuration', 'general_conf_is_ok' => 'General configuration has been saved.', 'github_or_email' => 'on Github or by mail', @@ -207,18 +213,18 @@ 'invalid_login' => 'Login is invalid', 'invalid_url' => 'URL %s is invalid', 'is_admin' => 'is administrator', - 'jan' => 'jan', 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'jan' => 'jan', 'january' => 'Jan', 'javascript_for_shortcuts' => 'JavaScript must be enabled in order to use shortcuts', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', 'javascript_should_be_activated' => 'JavaScript must be enabled', - 'Jul' => '\\J\\u\\l\\y', 'jul' => 'jul', + 'Jul' => '\\J\\u\\l\\y', 'july' => 'Jul', 'jump_next' => 'jump to next unread sibling (feed or category)', - 'Jun' => '\\J\\u\\n\\e', 'jun' => 'jun', + 'Jun' => '\\J\\u\\n\\e', 'june' => 'Jun', 'keep_history' => 'Minimum number of articles to keep', 'keep_logged_in' => 'Keep me logged in (1 month)', @@ -244,16 +250,16 @@ 'logs_empty' => 'Log file is empty', 'log_is_ok' => 'Permissions on logs directory are good', 'main_stream' => 'Main stream', - 'Mar' => '\\M\\a\\r\\c\\h', 'mar' => 'mar', + 'Mar' => '\\M\\a\\r\\c\\h', 'march' => 'Mar', 'mark_all_read' => 'Mark all as read', 'mark_cat_read' => 'Mark category as read', 'mark_favorite' => 'Mark as favourite', 'mark_feed_read' => 'Mark feed as read', 'mark_read' => 'Mark as read', - 'May' => '\\M\\a\\y', 'may' => 'May', + 'May' => '\\M\\a\\y', 'minz_is_nok' => 'You lack the Minz framework. You should execute build.sh script or download it on Github and install in %s directory the content of its /lib directory.', 'minz_is_ok' => 'You have the Minz framework', 'mon' => 'Mon', @@ -274,8 +280,8 @@ 'not_read' => '%d unread', 'not_reads' => '%d unread', 'not_yet_implemented' => 'Not yet implemented', - 'nov' => 'nov', 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'nov' => 'nov', 'november' => 'Nov', 'no_feed_actualized' => 'No RSS feed has been updated', 'no_feed_to_display' => 'There is no article to show.', @@ -291,8 +297,8 @@ 'number_feeds' => '%d feeds', 'n_entries_deleted' => '%d articles have been deleted', 'n_feeds_actualized' => '%d feeds have been updated', - 'oct' => 'oct', 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'oct' => 'oct', 'october' => 'Oct', 'ok' => 'Ok!', 'older_first' => 'Oldest first', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 220f8b12d..ab34eed3e 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -9,6 +9,7 @@ 'add_category' => 'Ajouter une catégorie', 'add_query' => 'Créer un filtre', 'add_rss_feed' => 'Ajouter un flux RSS', + 'admin.users.articles_and_size' => '%d articles (%s)', 'administration' => 'Gérer', 'advanced' => 'Avancé', 'after_onread' => 'Après “marquer tout comme lu”,', @@ -18,8 +19,8 @@ 'all_feeds' => 'Tous les flux', 'already_subscribed' => 'Vous êtes déjà abonné à %s', 'api_enabled' => 'Autoriser l’accès par API (nécessaire pour les applis mobiles)', - 'apr' => 'avr.', 'Apr' => '\\a\\v\\r\\i\\l', + 'apr' => 'avr.', 'april' => 'avril', 'archiving_configuration' => 'Archivage', 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux.', @@ -34,8 +35,8 @@ 'article_viewed' => 'lorsque l’article est affiché', 'ask_empty' => 'Vider ?', 'attention' => 'Attention !', - 'aug' => 'août', 'Aug' => '\\a\\o\\û\\t', + 'aug' => 'août', 'august' => 'août', 'author' => 'Auteur', 'auth_form' => 'Formulaire (traditionnel, requiert JavaScript)', @@ -88,8 +89,8 @@ 'category_empty' => 'Catégorie vide', 'category_name_exists' => 'Une catégorie possède déjà ce nom.', 'category_not_delete_default' => 'Vous ne pouvez pas supprimer la catégorie par défaut !', - 'category_not_exist' => 'Cette catégorie n\'existe pas !', - 'category_no_id' => 'Vous devez préciser l\'id de la catégorie.', + 'category_not_exist' => 'Cette catégorie n’existe pas !', + 'category_no_id' => 'Vous devez préciser l’id de la catégorie.', 'category_no_name' => 'Vous devez préciser un nom pour la catégorie.', 'category_number' => 'Catégorie n°%d', 'category_updated' => 'La catégorie a été mise à jour.', @@ -98,10 +99,11 @@ 'choose_language' => 'Choisissez la langue pour FreshRSS', 'clear_logs' => 'Effacer les logs', 'collapse_article' => 'Refermer', + 'conf.users.articles_and_size' => '%d articles (%s)', 'configuration' => 'Configuration', 'configuration_updated' => 'La configuration a été mise à jour.', 'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !', - 'confirm_action_feed_cat' => 'Êtes-vous sûr(e) de vouloir continuer ? Vous pourriez perdre les favoris et les filtres associés. Cette action ne peut être annulée !', + 'confirm_action_feed_cat' => 'Êtes-vous sûr(e) de vouloir continuer ? Vous perdrez les favoris et les filtres associés. Cette action ne peut être annulée !', 'congratulations' => 'Félicitations !', 'content_width' => 'Largeur du contenu', 'create' => 'Créer', @@ -116,8 +118,8 @@ 'current_user' => 'Utilisateur actuel', 'damn' => 'Arf !', 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', - 'Dec' => '\\d\\é\\c\\e\\m\\b\\r\\e', 'dec' => 'déc.', + 'Dec' => '\\d\\é\\c\\e\\m\\b\\r\\e', 'december' => 'décembre', 'default_category' => 'Sans catégorie', 'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)', @@ -182,6 +184,10 @@ 'freshrss_installation' => 'Installation · FreshRSS', 'fri' => 'ven.', 'g+' => 'Google+', + 'gen.menu.admin' => 'Administration', + 'gen.menu.authentication' => 'Authentification', + 'gen.menu.manage_users' => 'Gestion des utilisateurs', + 'gen.menu.profil' => 'Profil', 'general_configuration' => 'Configuration générale', 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', 'github_or_email' => 'sur Github ou par courriel', @@ -207,18 +213,18 @@ 'invalid_login' => 'L’identifiant est invalide !', 'invalid_url' => 'L’url %s est invalide.', 'is_admin' => 'est administrateur', - 'jan' => 'jan.', 'Jan' => '\\j\\a\\n\\v\\i\\e\\r', + 'jan' => 'jan.', 'january' => 'janvier', 'javascript_for_shortcuts' => 'Le JavaScript doit être activé pour pouvoir profiter des raccourcis.', 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', 'javascript_should_be_activated' => 'Le JavaScript doit être activé.', - 'Jul' => '\\j\\u\\i\\l\\l\\e\\t', 'jul' => 'jui.', + 'Jul' => '\\j\\u\\i\\l\\l\\e\\t', 'july' => 'juillet', 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', - 'Jun' => '\\j\\u\\i\\n', 'jun' => 'juin', + 'Jun' => '\\j\\u\\i\\n', 'june' => 'juin', 'keep_history' => 'Nombre minimum d’articles à conserver', 'keep_logged_in' => 'Rester connecté (1 mois)', @@ -244,16 +250,16 @@ 'logs_empty' => 'Les logs sont vides.', 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', 'main_stream' => 'Flux principal', - 'Mar' => '\\m\\a\\r\\s', 'mar' => 'mar.', + 'Mar' => '\\m\\a\\r\\s', 'march' => 'mars', 'mark_all_read' => 'Tout marquer comme lu', 'mark_cat_read' => 'Marquer la catégorie comme lue', 'mark_favorite' => 'Mettre en favori', 'mark_feed_read' => 'Marquer le flux comme lu', 'mark_read' => 'Marquer comme lu', - 'May' => '\\m\\a\\i', 'may' => 'mai.', + 'May' => '\\m\\a\\i', '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.', 'minz_is_ok' => 'Vous disposez du framework Minz', 'mon' => 'lun.', @@ -274,8 +280,8 @@ 'not_read' => '%d non lu', 'not_reads' => '%d non lus', 'not_yet_implemented' => 'Pas encore implémenté', - 'nov' => 'nov.', 'Nov' => '\\n\\o\\v\\e\\m\\b\\r\\e', + 'nov' => 'nov.', 'november' => 'novembre', 'no_feed_actualized' => 'Aucun flux n’a pu être mis à jour.', 'no_feed_to_display' => 'Il n’y a aucun article à afficher.', @@ -291,8 +297,8 @@ 'number_feeds' => '%d flux', 'n_entries_deleted' => '%d articles ont été supprimés.', 'n_feeds_actualized' => '%d flux ont été mis à jour.', - 'oct' => 'oct.', 'Oct' => '\\o\\c\\t\\o\\b\\r\\e', + 'oct' => 'oct.', 'october' => 'octobre', 'ok' => 'Ok !', 'older_first' => 'Plus anciens en premier', diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 2e2b87203..20446c877 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -20,16 +20,16 @@
  • - +
  • - +
  • - +
  • - +
  • diff --git a/app/layout/header.phtml b/app/layout/header.phtml index c680cbcdc..e848ac4eb 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -62,12 +62,12 @@ if (Minz_Configuration::canLogIn()) {
  • -
  • -
  • +
  • - -
  • -
  • +
  • + +
  • +
  • diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 8f424c126..f469d343c 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -58,20 +58,25 @@
    -

    +
    -

    nb_total)), ' — ', formatBytes($this->size_user); ?>

    - - - + nb_total), formatBytes($this->size_user)); ?>
    -

    +
    -

    size_total); ?>

    + size_total); ?> +
    +
    + +
    +
    + + +
    diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 65e60add5..89c91e06c 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -64,7 +64,9 @@ -

    nb_articles)), ', ', formatBytes($this->size_user); ?>

    +

    nb_articles), + formatBytes($this->size_user)); ?>

    -- cgit v1.2.3 From 3bad4d138e5c4a86aa3f88dea3787c3335861ce4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 17 Oct 2014 16:29:55 +0200 Subject: Fix i18n --- app/i18n/en.php | 4 ++-- app/i18n/fr.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/i18n/en.php b/app/i18n/en.php index f65576ea3..283d28dc6 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -9,7 +9,7 @@ 'add_category' => 'Add a category', 'add_query' => 'Add a query', 'add_rss_feed' => 'Add a RSS feed', - 'admin.users.articles_and_size' => '%d articles (%s)', + 'admin.users.articles_and_size' => '%s articles (%s)', 'administration' => 'Manage', 'advanced' => 'Advanced', 'after_onread' => 'After “mark all as read”,', @@ -99,7 +99,7 @@ 'choose_language' => 'Choose a language for FreshRSS', 'clear_logs' => 'Clear the logs', 'collapse_article' => 'Collapse', - 'conf.users.articles_and_size' => '%d articles (%s)', + 'conf.users.articles_and_size' => '%s articles (%s)', 'configuration' => 'Configuration', 'configuration_updated' => 'Configuration has been updated', 'confirm_action' => 'Are you sure you want to perform this action? It cannot be cancelled!', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index ab34eed3e..0517544d5 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -9,7 +9,7 @@ 'add_category' => 'Ajouter une catégorie', 'add_query' => 'Créer un filtre', 'add_rss_feed' => 'Ajouter un flux RSS', - 'admin.users.articles_and_size' => '%d articles (%s)', + 'admin.users.articles_and_size' => '%s articles (%s)', 'administration' => 'Gérer', 'advanced' => 'Avancé', 'after_onread' => 'Après “marquer tout comme lu”,', @@ -99,7 +99,7 @@ 'choose_language' => 'Choisissez la langue pour FreshRSS', 'clear_logs' => 'Effacer les logs', 'collapse_article' => 'Refermer', - 'conf.users.articles_and_size' => '%d articles (%s)', + 'conf.users.articles_and_size' => '%s articles (%s)', 'configuration' => 'Configuration', 'configuration_updated' => 'La configuration a été mise à jour.', 'confirm_action' => 'Êtes-vous sûr(e) de vouloir continuer ? Cette action ne peut être annulée !', -- cgit v1.2.3 From 7080a32650ab8b19e917d8add944a75cc98381bc Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 11:54:31 +0200 Subject: Add checking installation feature --- app/Controllers/updateController.php | 14 +++++- app/Models/DatabaseDAO.php | 83 ++++++++++++++++++++++++++++++++++++ app/Models/DatabaseDAOSQLite.php | 48 +++++++++++++++++++++ app/Models/Factory.php | 9 ++++ app/SQL/install.sql.mysql.php | 2 - app/SQL/install.sql.sqlite.php | 2 - app/layout/aside_configure.phtml | 7 ++- app/layout/header.phtml | 1 + app/views/update/checkInstall.phtml | 30 +++++++++++++ lib/lib_rss.php | 62 +++++++++++++++++++++++++++ 10 files changed, 252 insertions(+), 6 deletions(-) create mode 100644 app/Models/DatabaseDAO.php create mode 100644 app/Models/DatabaseDAOSQLite.php create mode 100644 app/views/update/checkInstall.phtml diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 9d1e1ddf5..4ebb11f51 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -12,7 +12,6 @@ class FreshRSS_update_Controller extends Minz_ActionController { invalidateHttpCache(); - Minz_View::prependTitle(_t('update_system') . ' · '); $this->view->update_to_apply = false; $this->view->last_update_time = 'unknown'; $this->view->check_last_hour = false; @@ -24,6 +23,8 @@ class FreshRSS_update_Controller extends Minz_ActionController { } public function indexAction() { + Minz_View::prependTitle(_t('update_system') . ' · '); + if (file_exists(UPDATE_FILENAME) && !is_writable(FRESHRSS_PATH)) { $this->view->message = array( 'status' => 'bad', @@ -126,4 +127,15 @@ class FreshRSS_update_Controller extends Minz_ActionController { } } } + + /** + * This action displays information about installation. + */ + public function checkInstallAction() { + Minz_View::prependTitle(_t('gen.title.check_install') . ' · '); + + $this->view->status_php = check_install_php(); + $this->view->status_files = check_install_files(); + $this->view->status_database = check_install_database(); + } } diff --git a/app/Models/DatabaseDAO.php b/app/Models/DatabaseDAO.php new file mode 100644 index 000000000..0d85718e3 --- /dev/null +++ b/app/Models/DatabaseDAO.php @@ -0,0 +1,83 @@ +bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + + $tables = array( + $this->prefix . 'category' => false, + $this->prefix . 'feed' => false, + $this->prefix . 'entry' => false, + ); + foreach ($res as $value) { + $tables[array_pop($value)] = true; + } + + return count(array_keys($tables, true, true)) == count($tables); + } + + public function getSchema($table) { + $sql = 'DESC ' . $this->prefix . $table; + $stm = $this->bd->prepare($sql); + $stm->execute(); + + return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function checkTable($table, $schema) { + $columns = $this->getSchema($table); + + $ok = (count($columns) == count($schema)); + foreach ($columns as $c) { + $ok &= in_array($c['name'], $schema); + } + + return $ok; + } + + public function categoryIsCorrect() { + return $this->checkTable('category', array( + 'id', 'name' + )); + } + + public function feedIsCorrect() { + return $this->checkTable('feed', array( + 'id', 'url', 'category', 'name', 'website', 'description', 'lastUpdate', + 'priority', 'pathEntries', 'httpAuth', 'error', 'keep_history', 'ttl', + 'cache_nbEntries', 'cache_nbUnreads' + )); + } + + public function entryIsCorrect() { + return $this->checkTable('entry', array( + 'id', 'guid', 'title', 'author', 'content_bin', 'link', 'date', 'is_read', + 'is_favorite', 'id_feed', 'tags' + )); + } + + public function daoToSchema($dao) { + return array( + 'name' => $dao['Field'], + 'type' => strtolower($dao['Type']), + 'notnull' => (bool)$dao['Null'], + 'default' => $dao['Default'], + ); + } + + public function listDaoToSchema($listDAO) { + $list = array(); + + foreach ($listDAO as $dao) { + $list[] = $this->daoToSchema($dao); + } + + return $list; + } +} diff --git a/app/Models/DatabaseDAOSQLite.php b/app/Models/DatabaseDAOSQLite.php new file mode 100644 index 000000000..7f53f967d --- /dev/null +++ b/app/Models/DatabaseDAOSQLite.php @@ -0,0 +1,48 @@ +bd->prepare($sql); + $stm->execute(); + $res = $stm->fetchAll(PDO::FETCH_ASSOC); + + $tables = array( + 'category' => false, + 'feed' => false, + 'entry' => false, + ); + foreach ($res as $value) { + $tables[$value['name']] = true; + } + + return count(array_keys($tables, true, true)) == count($tables); + } + + public function getSchema($table) { + $sql = 'PRAGMA table_info(' . $table . ')'; + $stm = $this->bd->prepare($sql); + $stm->execute(); + + return $this->listDaoToSchema($stm->fetchAll(PDO::FETCH_ASSOC)); + } + + public function entryIsCorrect() { + return $this->checkTable('entry', array( + 'id', 'guid', 'title', 'author', 'content', 'link', 'date', 'is_read', + 'is_favorite', 'id_feed', 'tags' + )); + } + + public function daoToSchema($dao) { + return array( + 'name' => $dao['name'], + 'type' => strtolower($dao['type']), + 'notnull' => $dao['notnull'] === '1' ? true : false, + 'default' => $dao['dflt_value'], + ); + } +} diff --git a/app/Models/Factory.php b/app/Models/Factory.php index 93f4552f7..91cb84998 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -29,4 +29,13 @@ class FreshRSS_Factory { } } + public static function createDatabaseDAO($username = null) { + $db = Minz_Configuration::dataBase(); + if ($db['type'] === 'sqlite') { + return new FreshRSS_DatabaseDAOSQLite($username); + } else { + return new FreshRSS_DatabaseDAO($username); + } + } + } diff --git a/app/SQL/install.sql.mysql.php b/app/SQL/install.sql.mysql.php index 16cb3a3b8..cf0159199 100644 --- a/app/SQL/install.sql.mysql.php +++ b/app/SQL/install.sql.mysql.php @@ -57,5 +57,3 @@ INSERT IGNORE INTO `%1$scategory` (id, name) VALUES(1, "%2$s"); '); define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); - -define('SQL_SHOW_TABLES', 'SHOW tables;'); diff --git a/app/SQL/install.sql.sqlite.php b/app/SQL/install.sql.sqlite.php index 7988ada04..30bca2810 100644 --- a/app/SQL/install.sql.sqlite.php +++ b/app/SQL/install.sql.sqlite.php @@ -55,5 +55,3 @@ $SQL_CREATE_TABLES = array( ); define('SQL_DROP_TABLES', 'DROP TABLES %1$sentry, %1$sfeed, %1$scategory'); - -define('SQL_SHOW_TABLES', 'SELECT name FROM sqlite_master WHERE type="table"'); diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 20446c877..32dc19a4e 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -31,7 +31,12 @@
  • -
  • +
  • + +
  • +
  • diff --git a/app/layout/header.phtml b/app/layout/header.phtml index e848ac4eb..506cec175 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -68,6 +68,7 @@ if (Minz_Configuration::canLogIn()) {
  • +
  • diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml new file mode 100644 index 000000000..32058714e --- /dev/null +++ b/app/views/update/checkInstall.phtml @@ -0,0 +1,30 @@ +partial('aside_configure'); ?> + +
    + + +

    + + status_php as $key => $status) { ?> +

    + +

    + + +

    + + status_files as $key => $status) { ?> +

    + +

    + + +

    + + status_database as $key => $status) { ?> +

    + +

    + + +
    diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 2f9a2ea45..dbed207d0 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -245,3 +245,65 @@ function is_referer_from_same_domain() { } return (isset($host['port']) ? $host['port'] : 0) === (isset($referer['port']) ? $referer['port'] : 0); } + + +/** + * + */ +function check_install_php() { + return array( + 'php' => version_compare(PHP_VERSION, '5.2.1') >= 0, + 'minz' => file_exists(LIB_PATH . '/Minz'), + 'curl' => extension_loaded('curl'), + 'pdo_mysql' => extension_loaded('pdo_mysql'), + 'pdo_sqlite' => extension_loaded('pdo_sqlite'), + 'pdo' => extension_loaded('pdo_mysql') || extension_loaded('pdo_sqlite'), + 'pcre' => extension_loaded('pcre'), + 'ctype' => extension_loaded('ctype'), + 'dom' => class_exists('DOMDocument'), + 'json' => extension_loaded('json'), + 'zip' => extension_loaded('zip'), + ); +} + + +/** + * + */ +function check_install_files() { + return array( + 'data' => DATA_PATH && is_writable(DATA_PATH), + 'cache' => CACHE_PATH && is_writable(CACHE_PATH), + 'logs' => LOG_PATH && is_writable(LOG_PATH), + 'favicons' => is_writable(DATA_PATH . '/favicons'), + 'persona' => is_writable(DATA_PATH . '/persona'), + 'tokens' => is_writable(DATA_PATH . '/tokens'), + ); +} + + +/** + * + */ +function check_install_database() { + $status = array( + 'connection' => true, + 'tables' => false, + 'categories' => false, + 'feeds' => false, + 'entries' => false, + ); + + try { + $dbDAO = FreshRSS_Factory::createDatabaseDAO(); + + $status['tables'] = $dbDAO->tablesAreCorrect(); + $status['categories'] = $dbDAO->categoryIsCorrect(); + $status['feeds'] = $dbDAO->feedIsCorrect(); + $status['entries'] = $dbDAO->entryIsCorrect(); + } catch(Minz_PDOConnectionException $e) { + $status['connection'] = false; + } + + return $status; +} -- cgit v1.2.3 From 61a2f9387f2d7f681040c1641c7601fa3002c8f8 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 12:42:46 +0200 Subject: Fix i18n (french and english) --- app/i18n/en.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- app/i18n/fr.php | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- lib/lib_rss.php | 6 ++++++ 3 files changed, 112 insertions(+), 8 deletions(-) diff --git a/app/i18n/en.php b/app/i18n/en.php index 283d28dc6..b24af38c1 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -9,6 +9,53 @@ 'add_category' => 'Add a category', 'add_query' => 'Add a query', 'add_rss_feed' => 'Add a RSS feed', + 'admin.check_install.cache.nok' => 'Check permissions on ./data/cache directory. HTTP server must have rights to write into', + 'admin.check_install.cache.ok' => 'Permissions on cache directory are good.', + 'admin.check_install.categories.nok' => 'Category table is bad configured.', + 'admin.check_install.categories.ok' => 'Category table is ok.', + 'admin.check_install.connection.nok' => 'Connection to the database cannot being established.', + 'admin.check_install.connection.ok' => 'Connection to the database is ok.', + 'admin.check_install.ctype.nok' => 'You lack a required library for character type checking (php-ctype).', + 'admin.check_install.ctype.ok' => 'You have the required library for character type checking (ctype).', + 'admin.check_install.curl.nok' => 'You lack cURL (php5-curl package).', + 'admin.check_install.curl.ok' => 'You have version %s of cURL.', + 'admin.check_install.data.nok' => 'Check permissions on ./data directory. HTTP server must have rights to write into', + 'admin.check_install.data.ok' => 'Permissions on data directory are good.', + 'admin.check_install.database' => 'Database installation', + 'admin.check_install.dom.nok' => 'You lack a required library to browse the DOM (php-xml package).', + 'admin.check_install.dom.ok' => 'You have the required library to browse the DOM.', + 'admin.check_install.entries.nok' => 'Entry table is bad configured.', + 'admin.check_install.entries.ok' => 'Entry table is ok.', + 'admin.check_install.favicons.nok' => 'Check permissions on ./data/favicons directory. HTTP server must have rights to write into', + 'admin.check_install.favicons.ok' => 'Permissions on favicons directory are good.', + 'admin.check_install.feeds.nok' => 'Feed table is bad configured.', + 'admin.check_install.feeds.ok' => 'Feed table is ok.', + 'admin.check_install.files' => 'File installation', + 'admin.check_install.json.nok' => 'You lack JSON (php5-json package).', + 'admin.check_install.json.ok' => 'You have version %s of JSON.', + 'admin.check_install.logs.nok' => 'Check permissions on ./data/logs directory. HTTP server must have rights to write into', + 'admin.check_install.logs.ok' => 'Permissions on logs directory are good.', + 'admin.check_install.minz.nok' => 'You lack the Minz framework.', + 'admin.check_install.minz.ok' => 'You have the Minz framework.', + 'admin.check_install.pcre.nok' => 'You lack a required library for regular expressions (php-pcre).', + 'admin.check_install.pcre.ok' => 'You have the required library for regular expressions (PCRE).', + 'admin.check_install.pdo.nok' => 'You lack PDO or one of the supported drivers (pdo_mysql, pdo_sqlite).', + 'admin.check_install.pdo.ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite).', + 'admin.check_install.pdo_mysql.nok' => 'You lack PDO for MySQL (it\'s ok if PDO is good).', + 'admin.check_install.pdo_mysql.ok' => 'You have PDO for MySQL.', + 'admin.check_install.pdo_sqlite.nok' => 'You lack PDO for SQLite (it\'s ok if PDO is good).', + 'admin.check_install.pdo_sqlite.ok' => 'You have PDO for SQLite.', + 'admin.check_install.persona.nok' => 'Check permissions on ./data/persona directory. HTTP server must have rights to write into', + 'admin.check_install.persona.ok' => 'Permissions on Mozilla Persona directory are good.', + 'admin.check_install.php' => 'PHP installation', + 'admin.check_install.php.nok' => 'Your PHP version is %s but FreshRSS requires at least version %s.', + 'admin.check_install.php.ok' => 'Your PHP version is %s, which is compatible with FreshRSS.', + 'admin.check_install.tables.nok' => 'There is one or more lacking tables in the database.', + 'admin.check_install.tables.ok' => 'Tables are existing in the database.', + 'admin.check_install.tokens.nok' => 'Check permissions on ./data/tokens directory. HTTP server must have rights to write into', + 'admin.check_install.tokens.ok' => 'Permissions on tokens directory are good.', + 'admin.check_install.zip.nok' => 'You lack ZIP extension (php5-zip package).', + 'admin.check_install.zip.ok' => 'You have version %s of ZIP extension.', 'admin.users.articles_and_size' => '%s articles (%s)', 'administration' => 'Manage', 'advanced' => 'Advanced', @@ -118,8 +165,8 @@ 'current_user' => 'Current user', 'damn' => 'Damn!', 'data_is_ok' => 'Permissions on data directory are good', - 'dec' => 'dec', 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'dec' => 'dec', 'december' => 'Dec', 'default_category' => 'Uncategorized', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', @@ -186,8 +233,10 @@ 'g+' => 'Google+', 'gen.menu.admin' => 'Administration', 'gen.menu.authentication' => 'Authentication', + 'gen.menu.check_install' => 'Installation checking', 'gen.menu.manage_users' => 'Manage users', 'gen.menu.profil' => 'Profil', + 'gen.title.check_install' => 'Installation checking', 'general_configuration' => 'General configuration', 'general_conf_is_ok' => 'General configuration has been saved.', 'github_or_email' => 'on Github or by mail', @@ -219,8 +268,8 @@ 'javascript_for_shortcuts' => 'JavaScript must be enabled in order to use shortcuts', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', 'javascript_should_be_activated' => 'JavaScript must be enabled', - 'jul' => 'jul', 'Jul' => '\\J\\u\\l\\y', + 'jul' => 'jul', 'july' => 'Jul', 'jump_next' => 'jump to next unread sibling (feed or category)', 'jun' => 'jun', @@ -297,8 +346,8 @@ 'number_feeds' => '%d feeds', 'n_entries_deleted' => '%d articles have been deleted', 'n_feeds_actualized' => '%d feeds have been updated', - 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', 'oct' => 'oct', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', 'october' => 'Oct', 'ok' => 'Ok!', 'older_first' => 'Oldest first', @@ -375,8 +424,8 @@ 'seconds_(0_means_no_timeout)' => 'seconds (0 means no timeout)', 'see_on_website' => 'See on original website', 'see_website' => 'See website', - 'sep' => 'sep', 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', + 'sep' => 'sep', 'september' => 'Sep', 'shaarli' => 'Shaarli', 'share' => 'Share', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 0517544d5..22494274c 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -9,6 +9,53 @@ 'add_category' => 'Ajouter une catégorie', 'add_query' => 'Créer un filtre', 'add_rss_feed' => 'Ajouter un flux RSS', + 'admin.check_install.cache.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/cache. Le serveur HTTP doit être capable d’écrire dedans', + 'admin.check_install.cache.ok' => 'Les droits sur le répertoire de cache sont bons.', + 'admin.check_install.categories.nok' => 'La table category est mal configurée.', + 'admin.check_install.categories.ok' => 'La table category est bien configurée.', + 'admin.check_install.connection.nok' => 'La connexion à la base de données est impossible.', + 'admin.check_install.connection.ok' => 'La connexion à la base de données est bonne.', + 'admin.check_install.ctype.nok' => 'Il manque une librairie pour la vérification des types de caractères (php-ctype).', + 'admin.check_install.ctype.ok' => 'Vous disposez du nécessaire pour la vérification des types de caractères (ctype).', + 'admin.check_install.curl.nok' => 'Vous ne disposez pas de cURL (paquet php5-curl).', + 'admin.check_install.curl.ok' => 'Vous disposez de cURL dans sa version %s.', + 'admin.check_install.data.nok' => 'Veuillez vérifier les droits sur le répertoire ./data. Le serveur HTTP doit être capable d’écrire dedans', + 'admin.check_install.data.ok' => 'Les droits sur le répertoire de data sont bons.', + 'admin.check_install.database' => 'Installation de la base de données', + 'admin.check_install.dom.nok' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml).', + 'admin.check_install.dom.ok' => 'Vous disposez du nécessaire pour parcourir le DOM.', + 'admin.check_install.entries.nok' => 'La table entry est mal configurée.', + 'admin.check_install.entries.ok' => 'La table entry est bien configurée.', + 'admin.check_install.favicons.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/favicons. Le serveur HTTP doit être capable d’écrire dedans', + 'admin.check_install.favicons.ok' => 'Les droits sur le répertoire des favicons sont bons.', + 'admin.check_install.feeds.nok' => 'La table feed est mal configurée.', + 'admin.check_install.feeds.ok' => 'La table feed est bien configurée.', + 'admin.check_install.files' => 'Installation des fichiers', + 'admin.check_install.json.nok' => 'Vous ne disposez pas de JSON (paquet php5-json).', + 'admin.check_install.json.ok' => 'Vous disposez de JSON dans sa version %s.', + 'admin.check_install.logs.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/logs. Le serveur HTTP doit être capable d’écrire dedans', + 'admin.check_install.logs.ok' => 'Les droits sur le répertoire des logs sont bons.', + 'admin.check_install.minz.nok' => 'Vous ne disposez pas de la librairie Minz.', + 'admin.check_install.minz.ok' => 'Vous disposez du framework Minz', + 'admin.check_install.pcre.nok' => 'Il manque une librairie pour les expressions régulières (php-pcre).', + 'admin.check_install.pcre.ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE).', + 'admin.check_install.pdo.nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite).', + 'admin.check_install.pdo.ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite).', + 'admin.check_install.pdo_mysql.nok' => 'Vous ne possédez pas PDO pour MySQL (ok si PDO est bon).', + 'admin.check_install.pdo_mysql.ok' => 'Vous possédez PDO pour MySQL.', + 'admin.check_install.pdo_sqlite.nok' => 'Vous ne possédez pas PDO pour SQLite (ok si PDO est bon).', + 'admin.check_install.pdo_sqlite.ok' => 'Vous possédez PDO pour SQLite.', + 'admin.check_install.persona.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/persona. Le serveur HTTP doit être capable d’écrire dedans', + 'admin.check_install.persona.ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons.', + 'admin.check_install.php' => 'Installation de PHP', + 'admin.check_install.php.nok' => 'Votre version de PHP est la %s mais FreshRSS requiert au moins la version %s.', + 'admin.check_install.php.ok' => 'Votre version de PHP est la %s, qui est compatible avec FreshRSS.', + 'admin.check_install.tables.nok' => 'Il manque une ou plusieurs tables en base de données.', + 'admin.check_install.tables.ok' => 'Les tables sont bien présentes en base de données.', + 'admin.check_install.tokens.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/tokens. Le serveur HTTP doit être capable d’écrire dedans', + 'admin.check_install.tokens.ok' => 'Les droits sur le répertoire des tokens sont bons.', + 'admin.check_install.zip.nok' => 'Vous ne disposez pas de l\'extension ZIP (paquet php5-zip).', + 'admin.check_install.zip.ok' => 'Vous disposez de l\'extension ZIP dans sa version %s.', 'admin.users.articles_and_size' => '%s articles (%s)', 'administration' => 'Gérer', 'advanced' => 'Avancé', @@ -118,8 +165,8 @@ 'current_user' => 'Utilisateur actuel', 'damn' => 'Arf !', 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', - 'dec' => 'déc.', 'Dec' => '\\d\\é\\c\\e\\m\\b\\r\\e', + 'dec' => 'déc.', 'december' => 'décembre', 'default_category' => 'Sans catégorie', 'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)', @@ -186,8 +233,10 @@ 'g+' => 'Google+', 'gen.menu.admin' => 'Administration', 'gen.menu.authentication' => 'Authentification', + 'gen.menu.check_install' => 'Vérification de l\'installation', 'gen.menu.manage_users' => 'Gestion des utilisateurs', 'gen.menu.profil' => 'Profil', + 'gen.title.check_install' => 'Vérification de l\'installation', 'general_configuration' => 'Configuration générale', 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', 'github_or_email' => 'sur Github ou par courriel', @@ -219,8 +268,8 @@ 'javascript_for_shortcuts' => 'Le JavaScript doit être activé pour pouvoir profiter des raccourcis.', 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', 'javascript_should_be_activated' => 'Le JavaScript doit être activé.', - 'jul' => 'jui.', 'Jul' => '\\j\\u\\i\\l\\l\\e\\t', + 'jul' => 'jui.', 'july' => 'juillet', 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', 'jun' => 'juin', @@ -297,8 +346,8 @@ 'number_feeds' => '%d flux', 'n_entries_deleted' => '%d articles ont été supprimés.', 'n_feeds_actualized' => '%d flux ont été mis à jour.', - 'Oct' => '\\o\\c\\t\\o\\b\\r\\e', 'oct' => 'oct.', + 'Oct' => '\\o\\c\\t\\o\\b\\r\\e', 'october' => 'octobre', 'ok' => 'Ok !', 'older_first' => 'Plus anciens en premier', @@ -375,8 +424,8 @@ 'seconds_(0_means_no_timeout)' => 'secondes (0 signifie aucun timeout ) ', 'see_on_website' => 'Voir sur le site d’origine', 'see_website' => 'Voir le site', - 'sep' => 'sep.', 'Sep' => '\\s\\e\\p\\t\\e\\m\\b\\r\\e', + 'sep' => 'sep.', 'september' => 'septembre', 'shaarli' => 'Shaarli', 'share' => 'Partager', diff --git a/lib/lib_rss.php b/lib/lib_rss.php index dbed207d0..9abdf18ce 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -248,7 +248,9 @@ function is_referer_from_same_domain() { /** + * Check PHP and its extensions are well-installed. * + * @return array of tested values. */ function check_install_php() { return array( @@ -268,7 +270,9 @@ function check_install_php() { /** + * Check different data files and directories exist. * + * @return array of tested values. */ function check_install_files() { return array( @@ -283,7 +287,9 @@ function check_install_files() { /** + * Check database is well-installed. * + * @return array of tested values. */ function check_install_database() { $status = array( -- cgit v1.2.3 From ae84e877c5fdda2b1a29ab0bb6c2469258fcc9a5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 12:52:18 +0200 Subject: Fix some i18n keys --- app/i18n/en.php | 6 +++--- app/i18n/fr.php | 6 +++--- app/views/update/checkInstall.phtml | 8 +++++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/i18n/en.php b/app/i18n/en.php index b24af38c1..2792ad7a2 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -18,7 +18,7 @@ 'admin.check_install.ctype.nok' => 'You lack a required library for character type checking (php-ctype).', 'admin.check_install.ctype.ok' => 'You have the required library for character type checking (ctype).', 'admin.check_install.curl.nok' => 'You lack cURL (php5-curl package).', - 'admin.check_install.curl.ok' => 'You have version %s of cURL.', + 'admin.check_install.curl.ok' => 'You have cURL extension.', 'admin.check_install.data.nok' => 'Check permissions on ./data directory. HTTP server must have rights to write into', 'admin.check_install.data.ok' => 'Permissions on data directory are good.', 'admin.check_install.database' => 'Database installation', @@ -32,7 +32,7 @@ 'admin.check_install.feeds.ok' => 'Feed table is ok.', 'admin.check_install.files' => 'File installation', 'admin.check_install.json.nok' => 'You lack JSON (php5-json package).', - 'admin.check_install.json.ok' => 'You have version %s of JSON.', + 'admin.check_install.json.ok' => 'You have JSON extension.', 'admin.check_install.logs.nok' => 'Check permissions on ./data/logs directory. HTTP server must have rights to write into', 'admin.check_install.logs.ok' => 'Permissions on logs directory are good.', 'admin.check_install.minz.nok' => 'You lack the Minz framework.', @@ -55,7 +55,7 @@ 'admin.check_install.tokens.nok' => 'Check permissions on ./data/tokens directory. HTTP server must have rights to write into', 'admin.check_install.tokens.ok' => 'Permissions on tokens directory are good.', 'admin.check_install.zip.nok' => 'You lack ZIP extension (php5-zip package).', - 'admin.check_install.zip.ok' => 'You have version %s of ZIP extension.', + 'admin.check_install.zip.ok' => 'You have ZIP extension.', 'admin.users.articles_and_size' => '%s articles (%s)', 'administration' => 'Manage', 'advanced' => 'Advanced', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 22494274c..85b32a737 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -18,7 +18,7 @@ 'admin.check_install.ctype.nok' => 'Il manque une librairie pour la vérification des types de caractères (php-ctype).', 'admin.check_install.ctype.ok' => 'Vous disposez du nécessaire pour la vérification des types de caractères (ctype).', 'admin.check_install.curl.nok' => 'Vous ne disposez pas de cURL (paquet php5-curl).', - 'admin.check_install.curl.ok' => 'Vous disposez de cURL dans sa version %s.', + 'admin.check_install.curl.ok' => 'Vous disposez de cURL.', 'admin.check_install.data.nok' => 'Veuillez vérifier les droits sur le répertoire ./data. Le serveur HTTP doit être capable d’écrire dedans', 'admin.check_install.data.ok' => 'Les droits sur le répertoire de data sont bons.', 'admin.check_install.database' => 'Installation de la base de données', @@ -32,7 +32,7 @@ 'admin.check_install.feeds.ok' => 'La table feed est bien configurée.', 'admin.check_install.files' => 'Installation des fichiers', 'admin.check_install.json.nok' => 'Vous ne disposez pas de JSON (paquet php5-json).', - 'admin.check_install.json.ok' => 'Vous disposez de JSON dans sa version %s.', + 'admin.check_install.json.ok' => 'Vous disposez de l\'extension JSON.', 'admin.check_install.logs.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/logs. Le serveur HTTP doit être capable d’écrire dedans', 'admin.check_install.logs.ok' => 'Les droits sur le répertoire des logs sont bons.', 'admin.check_install.minz.nok' => 'Vous ne disposez pas de la librairie Minz.', @@ -55,7 +55,7 @@ 'admin.check_install.tokens.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/tokens. Le serveur HTTP doit être capable d’écrire dedans', 'admin.check_install.tokens.ok' => 'Les droits sur le répertoire des tokens sont bons.', 'admin.check_install.zip.nok' => 'Vous ne disposez pas de l\'extension ZIP (paquet php5-zip).', - 'admin.check_install.zip.ok' => 'Vous disposez de l\'extension ZIP dans sa version %s.', + 'admin.check_install.zip.ok' => 'Vous disposez de l\'extension ZIP.', 'admin.users.articles_and_size' => '%s articles (%s)', 'administration' => 'Gérer', 'advanced' => 'Avancé', diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml index 32058714e..5f913bccd 100644 --- a/app/views/update/checkInstall.phtml +++ b/app/views/update/checkInstall.phtml @@ -7,7 +7,13 @@ status_php as $key => $status) { ?>

    - +

    -- cgit v1.2.3 From df4ddf0e552d9113c9f55d5361212f8279a5c617 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 13:31:49 +0200 Subject: Unsafe autologin comes back Should be moved in an extension later! See https://github.com/marienfressinaud/FreshRSS/issues/655 --- app/Controllers/authController.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 751ce1f3f..d4b65d849 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -104,6 +104,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { * - username (default: '') * - challenge (default: '') * - keep_logged_in (default: false) + * + * @todo move unsafe autologin in an extension. */ public function formLoginAction() { invalidateHttpCache(); @@ -151,6 +153,42 @@ class FreshRSS_auth_Controller extends Minz_ActionController { Minz_Request::bad(_t('invalid_login'), array('c' => 'auth', 'a' => 'login')); } + } elseif (Minz_Configuration::unsafeAutologinEnabled()) { + $username = Minz_Request::param('u', ''); + $password = Minz_Request::param('p', ''); + Minz_Request::_param('p'); + + if (!$username) { + return; + } + + try { + $conf = new FreshRSS_Configuration($username); + } catch(Minz_Exception $e) { + // $username is not a valid user, nor the configuration file! + Minz_Log::warning('Login failure: ' . $e->getMessage()); + return; + } + + if (!function_exists('password_verify')) { + include_once(LIB_PATH . '/password_compat.php'); + } + + $s = $conf->passwordHash; + $ok = password_verify($password, $s); + unset($password); + if ($ok) { + Minz_Session::_param('currentUser', $username); + Minz_Session::_param('passwordHash', $s); + FreshRSS_Auth::giveAccess(); + + Minz_Request::good(_t('login'), + array('c' => 'index', 'a' => 'index')); + } else { + Minz_Log::warning('Unsafe password mismatch for user ' . $username); + Minz_Request::bad(_t('invalid_login'), + array('c' => 'auth', 'a' => 'login')); + } } } -- cgit v1.2.3 From ad92dd7dae35e7205da3172d4ba35ea01da2bc8b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 18:21:10 +0200 Subject: First draft for Context object. See https://github.com/marienfressinaud/FreshRSS/issues/634 --- app/FreshRSS.php | 40 ++++++++++++++++++++-------------------- app/Models/Context.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 20 deletions(-) create mode 100644 app/Models/Context.php diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 6b7a813bf..e1399ad78 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -1,50 +1,50 @@ loadConfiguration(); - $this->loadParamsView(); + if (Minz_Request::isPost() && !is_referer_from_same_domain()) { - //Basic protection against XSRF attacks + // Basic protection against XSRF attacks FreshRSS_Auth::removeAccess(); + $http_referer = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; Minz_Error::error( 403, - array('error' => array(_t('access_denied') . ' [HTTP_REFERER=' . - htmlspecialchars(empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']) . ']')) + array('error' => array( + _t('access_denied'), + ' [HTTP_REFERER=' . htmlspecialchars($http_referer) . ']' + )) ); } + + // Load context and configuration. + // TODO: remove $this->view->conf variable which is contained in context + FreshRSS_Context::init(); + Minz_View::_param('conf', FreshRSS_Context::$conf); + + $this->loadParamsView(); $this->loadStylesAndScripts(); $this->loadNotifications(); $this->loadExtensions(); } - private function loadConfiguration() { - $current_user = Minz_Session::param('currentUser'); - try { - $this->conf = new FreshRSS_Configuration($current_user); - Minz_View::_param('conf', $this->conf); - } catch(Minz_Exception $e) { - Minz_Log::error('Cannot load configuration file of user `' . $current_user . '`'); - die($e->getMessage()); - } - } - private function loadParamsView() { - Minz_Session::_param('language', $this->conf->language); - Minz_Translate::init(); + // TODO: outputs should be different actions. $output = Minz_Request::param('output', ''); if (($output === '') || ($output !== 'normal' && $output !== 'rss' && $output !== 'reader' && $output !== 'global')) { - $output = $this->conf->view_mode; + $output = FreshRSS_Context::$conf->view_mode; Minz_Request::_param('output', $output); } } private function loadStylesAndScripts() { - $theme = FreshRSS_Themes::load($this->conf->theme); + $theme = FreshRSS_Themes::load(FreshRSS_Context::$conf->theme); if ($theme) { foreach($theme['files'] as $file) { if ($file[0] === '_') { diff --git a/app/Models/Context.php b/app/Models/Context.php new file mode 100644 index 000000000..d984fece7 --- /dev/null +++ b/app/Models/Context.php @@ -0,0 +1,32 @@ +getMessage()); + } + + // Init i18n. + Minz_Session::_param('language', self::$conf->language); + Minz_Translate::init(); + + // Get the current state. + self::$state = self::$conf->default_view; + } + + public static function stateEnabled($state) { + return self::$state & $state; + } +} -- cgit v1.2.3 From 1a22a87fb1b1fcb61d201de399c33c2185dc1f6e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Mon, 20 Oct 2014 18:45:22 +0200 Subject: Use FreshRSS_Context::$conf only - Replace $this->view->conf in controllers - Replace $this->conf in views --- app/Controllers/authController.php | 6 +- app/Controllers/categoryController.php | 8 +-- app/Controllers/configureController.php | 92 +++++++++++++++--------------- app/Controllers/entryController.php | 6 +- app/Controllers/feedController.php | 18 +++--- app/Controllers/importExportController.php | 4 +- app/Controllers/indexController.php | 8 +-- app/Controllers/javascriptController.php | 2 +- app/Controllers/userController.php | 18 +++--- app/FreshRSS.php | 2 - app/layout/aside_flux.phtml | 8 +-- app/layout/layout.phtml | 2 +- app/layout/nav_menu.phtml | 14 ++--- app/views/auth/index.phtml | 4 +- app/views/configure/archiving.phtml | 10 ++-- app/views/configure/display.phtml | 30 +++++----- app/views/configure/queries.phtml | 4 +- app/views/configure/reading.phtml | 42 +++++++------- app/views/configure/sharing.phtml | 6 +- app/views/configure/shortcut.phtml | 2 +- app/views/helpers/javascript_vars.phtml | 16 +++--- app/views/helpers/pagination.phtml | 2 +- app/views/helpers/view/global_view.phtml | 6 +- app/views/helpers/view/normal_view.phtml | 30 +++++----- app/views/helpers/view/reader_view.phtml | 4 +- app/views/user/manage.phtml | 6 +- app/views/user/profil.phtml | 2 +- 27 files changed, 175 insertions(+), 177 deletions(-) diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index d4b65d849..4af39cb71 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -26,10 +26,10 @@ class FreshRSS_auth_Controller extends Minz_ActionController { if (Minz_Request::isPost()) { $ok = true; - $current_token = $this->view->conf->token; + $current_token = FreshRSS_Context::$conf->token; $token = Minz_Request::param('token', $current_token); - $this->view->conf->_token($token); - $ok &= $this->view->conf->save(); + FreshRSS_Context::$conf->_token($token); + $ok &= FreshRSS_Context::$conf->save(); $anon = Minz_Request::param('anon_access', false); $anon = ((bool)$anon) && ($anon !== 'no'); diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 537a2b210..977ce51be 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -136,8 +136,8 @@ class FreshRSS_category_Controller extends Minz_ActionController { } // Remove related queries. - $this->view->conf->remove_query_by_get('c_' . $id); - $this->view->conf->save(); + FreshRSS_Context::$conf->remove_query_by_get('c_' . $id); + FreshRSS_Context::$conf->save(); Minz_Request::good(_t('category_deleted'), $url_redirect); } @@ -172,9 +172,9 @@ class FreshRSS_category_Controller extends Minz_ActionController { // Remove related queries foreach ($feeds as $feed) { - $this->view->conf->remove_query_by_get('f_' . $feed->id()); + FreshRSS_Context::$conf->remove_query_by_get('f_' . $feed->id()); } - $this->view->conf->save(); + FreshRSS_Context::$conf->save(); Minz_Request::good(_t('category_emptied'), $url_redirect); } else { diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index fb8c1466e..8a9dcdc62 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -44,23 +44,23 @@ class FreshRSS_configure_Controller extends Minz_ActionController { */ public function displayAction() { if (Minz_Request::isPost()) { - $this->view->conf->_language(Minz_Request::param('language', 'en')); - $this->view->conf->_theme(Minz_Request::param('theme', FreshRSS_Themes::$defaultTheme)); - $this->view->conf->_content_width(Minz_Request::param('content_width', 'thin')); - $this->view->conf->_topline_read(Minz_Request::param('topline_read', false)); - $this->view->conf->_topline_favorite(Minz_Request::param('topline_favorite', false)); - $this->view->conf->_topline_date(Minz_Request::param('topline_date', false)); - $this->view->conf->_topline_link(Minz_Request::param('topline_link', false)); - $this->view->conf->_bottomline_read(Minz_Request::param('bottomline_read', false)); - $this->view->conf->_bottomline_favorite(Minz_Request::param('bottomline_favorite', false)); - $this->view->conf->_bottomline_sharing(Minz_Request::param('bottomline_sharing', false)); - $this->view->conf->_bottomline_tags(Minz_Request::param('bottomline_tags', false)); - $this->view->conf->_bottomline_date(Minz_Request::param('bottomline_date', false)); - $this->view->conf->_bottomline_link(Minz_Request::param('bottomline_link', false)); - $this->view->conf->_html5_notif_timeout(Minz_Request::param('html5_notif_timeout', 0)); - $this->view->conf->save(); - - Minz_Session::_param('language', $this->view->conf->language); + FreshRSS_Context::$conf->_language(Minz_Request::param('language', 'en')); + FreshRSS_Context::$conf->_theme(Minz_Request::param('theme', FreshRSS_Themes::$defaultTheme)); + FreshRSS_Context::$conf->_content_width(Minz_Request::param('content_width', 'thin')); + FreshRSS_Context::$conf->_topline_read(Minz_Request::param('topline_read', false)); + FreshRSS_Context::$conf->_topline_favorite(Minz_Request::param('topline_favorite', false)); + FreshRSS_Context::$conf->_topline_date(Minz_Request::param('topline_date', false)); + FreshRSS_Context::$conf->_topline_link(Minz_Request::param('topline_link', false)); + FreshRSS_Context::$conf->_bottomline_read(Minz_Request::param('bottomline_read', false)); + FreshRSS_Context::$conf->_bottomline_favorite(Minz_Request::param('bottomline_favorite', false)); + FreshRSS_Context::$conf->_bottomline_sharing(Minz_Request::param('bottomline_sharing', false)); + FreshRSS_Context::$conf->_bottomline_tags(Minz_Request::param('bottomline_tags', false)); + FreshRSS_Context::$conf->_bottomline_date(Minz_Request::param('bottomline_date', false)); + FreshRSS_Context::$conf->_bottomline_link(Minz_Request::param('bottomline_link', false)); + FreshRSS_Context::$conf->_html5_notif_timeout(Minz_Request::param('html5_notif_timeout', 0)); + FreshRSS_Context::$conf->save(); + + Minz_Session::_param('language', FreshRSS_Context::$conf->language); Minz_Translate::reset(); invalidateHttpCache(); @@ -102,27 +102,27 @@ class FreshRSS_configure_Controller extends Minz_ActionController { */ public function readingAction() { if (Minz_Request::isPost()) { - $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); - $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal')); - $this->view->conf->_default_view((int)Minz_Request::param('default_view', FreshRSS_Entry::STATE_ALL)); - $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); - $this->view->conf->_display_posts(Minz_Request::param('display_posts', false)); - $this->view->conf->_display_categories(Minz_Request::param('display_categories', false)); - $this->view->conf->_hide_read_feeds(Minz_Request::param('hide_read_feeds', false)); - $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); - $this->view->conf->_lazyload(Minz_Request::param('lazyload', false)); - $this->view->conf->_sticky_post(Minz_Request::param('sticky_post', false)); - $this->view->conf->_reading_confirm(Minz_Request::param('reading_confirm', false)); - $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); - $this->view->conf->_mark_when(array( + FreshRSS_Context::$conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); + FreshRSS_Context::$conf->_view_mode(Minz_Request::param('view_mode', 'normal')); + FreshRSS_Context::$conf->_default_view((int)Minz_Request::param('default_view', FreshRSS_Entry::STATE_ALL)); + FreshRSS_Context::$conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); + FreshRSS_Context::$conf->_display_posts(Minz_Request::param('display_posts', false)); + FreshRSS_Context::$conf->_display_categories(Minz_Request::param('display_categories', false)); + FreshRSS_Context::$conf->_hide_read_feeds(Minz_Request::param('hide_read_feeds', false)); + FreshRSS_Context::$conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); + FreshRSS_Context::$conf->_lazyload(Minz_Request::param('lazyload', false)); + FreshRSS_Context::$conf->_sticky_post(Minz_Request::param('sticky_post', false)); + FreshRSS_Context::$conf->_reading_confirm(Minz_Request::param('reading_confirm', false)); + FreshRSS_Context::$conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); + FreshRSS_Context::$conf->_mark_when(array( 'article' => Minz_Request::param('mark_open_article', false), 'site' => Minz_Request::param('mark_open_site', false), 'scroll' => Minz_Request::param('mark_scroll', false), 'reception' => Minz_Request::param('mark_upon_reception', false), )); - $this->view->conf->save(); + FreshRSS_Context::$conf->save(); - Minz_Session::_param('language', $this->view->conf->language); + Minz_Session::_param('language', FreshRSS_Context::$conf->language); Minz_Translate::reset(); invalidateHttpCache(); @@ -143,8 +143,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController { public function sharingAction() { if (Minz_Request::isPost()) { $params = Minz_Request::params(); - $this->view->conf->_sharing($params['share']); - $this->view->conf->save(); + FreshRSS_Context::$conf->_sharing($params['share']); + FreshRSS_Context::$conf->save(); invalidateHttpCache(); Minz_Request::good(_t('configuration_updated'), @@ -185,8 +185,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController { } } - $this->view->conf->_shortcuts($shortcuts_ok); - $this->view->conf->save(); + FreshRSS_Context::$conf->_shortcuts($shortcuts_ok); + FreshRSS_Context::$conf->save(); invalidateHttpCache(); Minz_Request::good(_t('shortcuts_updated'), @@ -213,10 +213,10 @@ class FreshRSS_configure_Controller extends Minz_ActionController { */ public function archivingAction() { if (Minz_Request::isPost()) { - $this->view->conf->_old_entries(Minz_Request::param('old_entries', 3)); - $this->view->conf->_keep_history_default(Minz_Request::param('keep_history_default', 0)); - $this->view->conf->_ttl_default(Minz_Request::param('ttl_default', -2)); - $this->view->conf->save(); + FreshRSS_Context::$conf->_old_entries(Minz_Request::param('old_entries', 3)); + FreshRSS_Context::$conf->_keep_history_default(Minz_Request::param('keep_history_default', 0)); + FreshRSS_Context::$conf->_ttl_default(Minz_Request::param('ttl_default', -2)); + FreshRSS_Context::$conf->save(); invalidateHttpCache(); Minz_Request::good(_t('configuration_updated'), @@ -253,8 +253,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $query['name'] = _t('query_number', $key + 1); } } - $this->view->conf->_queries($queries); - $this->view->conf->save(); + FreshRSS_Context::$conf->_queries($queries); + FreshRSS_Context::$conf->save(); Minz_Request::good(_t('configuration_updated'), array('c' => 'configure', 'a' => 'queries')); @@ -262,7 +262,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->query_get = array(); $cat_dao = new FreshRSS_CategoryDAO(); $feed_dao = FreshRSS_Factory::createFeedDao(); - foreach ($this->view->conf->queries as $key => $query) { + foreach (FreshRSS_Context::$conf->queries as $key => $query) { if (!isset($query['get'])) { continue; } @@ -330,7 +330,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { */ public function addQueryAction() { $whitelist = array('get', 'order', 'name', 'search', 'state'); - $queries = $this->view->conf->queries; + $queries = FreshRSS_Context::$conf->queries; $query = Minz_Request::params(); $query['name'] = _t('query_number', count($queries) + 1); foreach ($query as $key => $value) { @@ -342,8 +342,8 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $query['state'] -= FreshRSS_Entry::STATE_STRICT; } $queries[] = $query; - $this->view->conf->_queries($queries); - $this->view->conf->save(); + FreshRSS_Context::$conf->_queries($queries); + FreshRSS_Context::$conf->save(); Minz_Request::good(_t('query_created', $query['name']), array('c' => 'configure', 'a' => 'queries')); diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index a1dfacb4d..449029648 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -21,7 +21,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { // the end. $this->params = array(); $output = Minz_Request::param('output', ''); - if ($output != '' && $this->view->conf->view_mode !== $output) { + if ($output != '' && FreshRSS_Context::$conf->view_mode !== $output) { $this->params['output'] = $output; } @@ -167,7 +167,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { public function purgeAction() { @set_time_limit(300); - $nb_month_old = max($this->view->conf->old_entries, 1); + $nb_month_old = max(FreshRSS_Context::$conf->old_entries, 1); $date_min = time() - (3600 * 24 * 30 * $nb_month_old); $feedDAO = FreshRSS_Factory::createFeedDao(); @@ -181,7 +181,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { if ($feed_history == -2) { // TODO: -2 must be a constant! // -2 means we take the default value from configuration - $feed_history = $this->view->conf->keep_history_default; + $feed_history = FreshRSS_Context::$conf->keep_history_default; } if ($feed_history >= 0) { diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 2a7238eaf..c2859edf4 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -14,7 +14,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // Token is useful in the case that anonymous refresh is forbidden // and CRON task cannot be used with php command so the user can // set a CRON task to refresh his feeds by using token inside url - $token = $this->view->conf->token; + $token = FreshRSS_Context::$conf->token; $token_param = Minz_Request::param('token', ''); $token_is_ok = ($token != '' && $token == $token_param); $action = Minz_Request::actionName(); @@ -154,14 +154,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed->_id($id); $feed->faviconPrepare(); - $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; + $is_read = FreshRSS_Context::$conf->mark_when['reception'] ? 1 : 0; $entryDAO = FreshRSS_Factory::createEntryDao(); // We want chronological order and SimplePie uses reverse order. $entries = array_reverse($feed->entries()); // Calculate date of oldest entries we accept in DB. - $nb_month_old = $this->view->conf->old_entries; + $nb_month_old = FreshRSS_Context::$conf->old_entries; $date_min = time() - (3600 * 24 * 30 * $nb_month_old); // Use a shared statement and a transaction to improve a LOT the @@ -265,15 +265,15 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feeds[] = $feed; } } else { - $feeds = $feedDAO->listFeedsOrderUpdate($this->view->conf->ttl_default); + $feeds = $feedDAO->listFeedsOrderUpdate(FreshRSS_Context::$conf->ttl_default); } // Calculate date of oldest entries we accept in DB. - $nb_month_old = max($this->view->conf->old_entries, 1); + $nb_month_old = max(FreshRSS_Context::$conf->old_entries, 1); $date_min = time() - (3600 * 24 * 30 * $nb_month_old); $updated_feeds = 0; - $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; + $is_read = FreshRSS_Context::$conf->mark_when['reception'] ? 1 : 0; foreach ($feeds as $feed) { if (!$feed->lock()) { Minz_Log::notice('Feed already being actualized: ' . $feed->url()); @@ -294,7 +294,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { if ($feed_history == -2) { // TODO: -2 must be a constant! // -2 means we take the default value from configuration - $feed_history = $this->view->conf->keep_history_default; + $feed_history = FreshRSS_Context::$conf->keep_history_default; } // We want chronological order and SimplePie uses reverse order. @@ -470,8 +470,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { // TODO: Delete old favicon // Remove related queries - $this->view->conf->remove_query_by_get('f_' . $id); - $this->view->conf->save(); + FreshRSS_Context::$conf->remove_query_by_get('f_' . $id); + FreshRSS_Context::$conf->save(); Minz_Request::good(_t('feed_deleted'), $redirect_url); } else { diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index aaac1b68b..ab277e688 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -289,7 +289,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { return true; } - $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; + $is_read = FreshRSS_Context::$conf->mark_when['reception'] ? 1 : 0; $google_compliant = strpos($article_object['id'], 'com.google') !== false; @@ -484,7 +484,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $this->view->type = 'feed/' . $feed->id(); $this->view->entries = $this->entryDAO->listWhere( 'f', $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', - $this->view->conf->posts_per_page + FreshRSS_Context::$conf->posts_per_page ); $this->view->feed = $feed; } diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 5b490e672..f994e257c 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -5,7 +5,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { public function indexAction() { $output = Minz_Request::param('output'); - $token = $this->view->conf->token; + $token = FreshRSS_Context::$conf->token; // check if user is logged in if (!FreshRSS_Auth::hasAccess() && !Minz_Configuration::allowAnonymous()) { @@ -76,11 +76,11 @@ class FreshRSS_index_Controller extends Minz_ActionController { ); // On récupère les différents éléments de filtrage - $this->view->state = Minz_Request::param('state', $this->view->conf->default_view); + $this->view->state = Minz_Request::param('state', FreshRSS_Context::$conf->default_view); $state_param = Minz_Request::param('state', null); $filter = Minz_Request::param('search', ''); - $this->view->order = $order = Minz_Request::param('order', $this->view->conf->sort_order); - $nb = Minz_Request::param('nb', $this->view->conf->posts_per_page); + $this->view->order = $order = Minz_Request::param('order', FreshRSS_Context::$conf->sort_order); + $nb = Minz_Request::param('nb', FreshRSS_Context::$conf->posts_per_page); $first = Minz_Request::param('next', ''); $ajax_request = Minz_Request::param('ajax', false); diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php index 14e6f36de..62f413989 100755 --- a/app/Controllers/javascriptController.php +++ b/app/Controllers/javascriptController.php @@ -8,7 +8,7 @@ class FreshRSS_javascript_Controller extends Minz_ActionController { public function actualizeAction() { header('Content-Type: text/javascript; charset=UTF-8'); $feedDAO = FreshRSS_Factory::createFeedDao(); - $this->view->feeds = $feedDAO->listFeedsOrderUpdate($this->view->conf->ttl_default); + $this->view->feeds = $feedDAO->listFeedsOrderUpdate(FreshRSS_Context::$conf->ttl_default); } public function nbUnreadsPerFeedAction() { diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index d5c90a382..61d33437d 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -42,9 +42,9 @@ class FreshRSS_user_Controller extends Minz_ActionController { $passwordPlain = ''; $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js $ok &= ($passwordHash != ''); - $this->view->conf->_passwordHash($passwordHash); + FreshRSS_Context::$conf->_passwordHash($passwordHash); } - Minz_Session::_param('passwordHash', $this->view->conf->passwordHash); + Minz_Session::_param('passwordHash', FreshRSS_Context::$conf->passwordHash); $passwordPlain = Minz_Request::param('apiPasswordPlain', '', true); if ($passwordPlain != '') { @@ -55,17 +55,17 @@ class FreshRSS_user_Controller extends Minz_ActionController { $passwordPlain = ''; $passwordHash = preg_replace('/^\$2[xy]\$/', '\$2a\$', $passwordHash); //Compatibility with bcrypt.js $ok &= ($passwordHash != ''); - $this->view->conf->_apiPasswordHash($passwordHash); + FreshRSS_Context::$conf->_apiPasswordHash($passwordHash); } // TODO: why do we need of hasAccess here? if (FreshRSS_Auth::hasAccess('admin')) { - $this->view->conf->_mail_login(Minz_Request::param('mail_login', '', true)); + FreshRSS_Context::$conf->_mail_login(Minz_Request::param('mail_login', '', true)); } - $email = $this->view->conf->mail_login; + $email = FreshRSS_Context::$conf->mail_login; Minz_Session::_param('mail', $email); - $ok &= $this->view->conf->save(); + $ok &= FreshRSS_Context::$conf->save(); if ($email != '') { $personaFile = DATA_PATH . '/persona/' . $email . '.txt'; @@ -113,9 +113,9 @@ class FreshRSS_user_Controller extends Minz_ActionController { $db = Minz_Configuration::dataBase(); require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php'); - $new_user_language = Minz_Request::param('new_user_language', $this->view->conf->language); - if (!in_array($new_user_language, $this->view->conf->availableLanguages())) { - $new_user_language = $this->view->conf->language; + $new_user_language = Minz_Request::param('new_user_language', FreshRSS_Context::$conf->language); + if (!in_array($new_user_language, FreshRSS_Context::$conf->availableLanguages())) { + $new_user_language = FreshRSS_Context::$conf->language; } $new_user_name = Minz_Request::param('new_user_name'); diff --git a/app/FreshRSS.php b/app/FreshRSS.php index e1399ad78..752b14e31 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -24,9 +24,7 @@ class FreshRSS extends Minz_FrontController { } // Load context and configuration. - // TODO: remove $this->view->conf variable which is contained in context FreshRSS_Context::init(); - Minz_View::_param('conf', FreshRSS_Context::$conf); $this->loadParamsView(); $this->loadStylesAndScripts(); diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index a66be2ed9..114ccbf56 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -1,4 +1,4 @@ -
    +
      @@ -17,7 +17,7 @@ 'index', 'a' => 'index', 'params' => array()); - if ($this->conf->view_mode !== Minz_Request::param('output', 'normal')) { + if (FreshRSS_Context::$conf->view_mode !== Minz_Request::param('output', 'normal')) { $arUrl['params']['output'] = 'normal'; } ?> @@ -47,7 +47,7 @@ $c_show = false; if ($this->get_c == $cat->id()) { $c_active = true; - if (!$this->conf->display_categories || $this->get_f) { + if (!FreshRSS_Context::$conf->display_categories || $this->get_f) { $c_show = true; } } @@ -92,7 +92,7 @@
    • - conf->reading_confirm ? 'confirm' : ''; ?> + reading_confirm ? 'confirm' : ''; ?>
    • - conf->queries as $query) { ?> + queries as $query) { ?>
    • - conf->queries) > 0) { ?> + queries) > 0) { ?>
    • @@ -132,7 +132,7 @@ $string_mark = _t('mark_cat_read'); } $nextGet = $get; - if ($this->conf->onread_jump_next && strlen($get) > 2) { + if (FreshRSS_Context::$conf->onread_jump_next && strlen($get) > 2) { $anotherUnreadId = ''; $foundCurrent = false; switch ($get[0]) { @@ -180,7 +180,7 @@ $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax)); $output = Minz_Request::param('output', ''); - if ($output != '' && $this->conf->view_mode !== $output) { + if ($output != '' && FreshRSS_Context::$conf->view_mode !== $output) { $arUrl['params']['output'] = $output; } $markReadUrl = Minz_Url::display($arUrl); @@ -190,7 +190,7 @@
    - - + + - - + + - - - - - - + + + + + +
    conf->topline_read ? ' checked="checked"' : ''; ?> />conf->topline_favorite ? ' checked="checked"' : ''; ?> />topline_read ? ' checked="checked"' : ''; ?> />topline_favorite ? ' checked="checked"' : ''; ?> /> conf->topline_date ? ' checked="checked"' : ''; ?> />conf->topline_link ? ' checked="checked"' : ''; ?> />topline_date ? ' checked="checked"' : ''; ?> />topline_link ? ' checked="checked"' : ''; ?> />
    conf->bottomline_read ? ' checked="checked"' : ''; ?> />conf->bottomline_favorite ? ' checked="checked"' : ''; ?> />conf->bottomline_sharing ? ' checked="checked"' : ''; ?> />conf->bottomline_tags ? ' checked="checked"' : ''; ?> />conf->bottomline_date ? ' checked="checked"' : ''; ?> />conf->bottomline_link ? ' checked="checked"' : ''; ?> />bottomline_read ? ' checked="checked"' : ''; ?> />bottomline_favorite ? ' checked="checked"' : ''; ?> />bottomline_sharing ? ' checked="checked"' : ''; ?> />bottomline_tags ? ' checked="checked"' : ''; ?> />bottomline_date ? ' checked="checked"' : ''; ?> />bottomline_link ? ' checked="checked"' : ''; ?> />

    @@ -95,7 +95,7 @@
    - +
    diff --git a/app/views/configure/queries.phtml b/app/views/configure/queries.phtml index e778ce078..994dfc11b 100644 --- a/app/views/configure/queries.phtml +++ b/app/views/configure/queries.phtml @@ -6,7 +6,7 @@
    - conf->queries as $key => $query) { ?> + queries as $key => $query) { ?>
    - conf->queries) > 0) { ?> + queries) > 0) { ?>
    diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml index c8685acf3..ef775b4b1 100644 --- a/app/views/configure/reading.phtml +++ b/app/views/configure/reading.phtml @@ -9,7 +9,7 @@
    - +
    @@ -18,8 +18,8 @@
    @@ -28,9 +28,9 @@
    @@ -39,9 +39,9 @@
    @@ -49,7 +49,7 @@
    @@ -58,7 +58,7 @@
    @@ -68,7 +68,7 @@
    @@ -78,7 +78,7 @@
    @@ -88,7 +88,7 @@
    @@ -98,7 +98,7 @@
    @@ -108,7 +108,7 @@
    @@ -119,19 +119,19 @@
    @@ -141,7 +141,7 @@
    diff --git a/app/views/configure/sharing.phtml b/app/views/configure/sharing.phtml index 09c1e6f40..ef5e85a0c 100644 --- a/app/views/configure/sharing.phtml +++ b/app/views/configure/sharing.phtml @@ -15,8 +15,8 @@
    '> - conf->sharing as $key => $sharing): ?> - conf->shares[$sharing['type']]; ?> + sharing as $key => $sharing): ?> + shares[$sharing['type']]; ?>
    diff --git a/app/views/user/profile.phtml b/app/views/user/profile.phtml new file mode 100644 index 000000000..60257012c --- /dev/null +++ b/app/views/user/profile.phtml @@ -0,0 +1,59 @@ +partial('aside_configure'); ?> + +
    + + +
    + + +
    + +
    + + +
    +
    + +
    + +
    +
    + /> + +
    + +
    +
    + + +
    + +
    +
    + /> + +
    +
    +
    + + +
    + + mail_login; ?> +
    + placeholder="alice@example.net" /> + +
    +
    + +
    +
    + + +
    +
    +
    +
    -- cgit v1.2.3 From 4dec7bf127fdb71c78d09bb4f64995028a60c439 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 26 Oct 2014 12:37:38 +0100 Subject: Fix i18n string Order has been changed due to a little bug in sort order function. --- app/Controllers/authController.php | 6 +- app/i18n/en.php | 109 +++++++++++++++++++------------------ app/i18n/fr.php | 109 +++++++++++++++++++------------------ 3 files changed, 114 insertions(+), 110 deletions(-) diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index a08f906e3..491be8d8a 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -23,6 +23,8 @@ class FreshRSS_auth_Controller extends Minz_ActionController { array('error' => array(_t('access_denied')))); } + Minz_View::prependTitle(_t('gen.title.authentication') . ' · '); + if (Minz_Request::isPost()) { $ok = true; @@ -55,10 +57,10 @@ class FreshRSS_auth_Controller extends Minz_ActionController { invalidateHttpCache(); if ($ok) { - Minz_Request::good('configuration_updated', + Minz_Request::good(_t('configuration_updated'), array('c' => 'auth', 'a' => 'index')); } else { - Minz_Request::bad('error_occurred', + Minz_Request::bad(_t('error_occurred'), array('c' => 'auth', 'a' => 'index')); } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 275471e19..1e6621c12 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -1,5 +1,17 @@ '\\A\\p\\r\\i\\l', + 'Aug' => '\\A\\u\\g\\u\\s\\t', + 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', + 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', + 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', + 'Jul' => '\\J\\u\\l\\y', + 'Jun' => '\\J\\u\\n\\e', + 'Mar' => '\\M\\a\\r\\c\\h', + 'May' => '\\M\\a\\y', + 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', + 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', + 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', 'about' => 'About', 'about_freshrss' => 'About FreshRSS', 'access_denied' => 'You don’t have permission to access this page', @@ -61,42 +73,40 @@ 'advanced' => 'Advanced', 'after_onread' => 'After “mark all as read”,', 'agpl3' => 'AGPL 3', + 'all_feeds' => 'All feeds', 'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)', 'allow_anonymous_refresh' => 'Allow anonymous refresh of the articles', - 'all_feeds' => 'All feeds', 'already_subscribed' => 'You have already subscribed to %s', 'api_enabled' => 'Allow API access (required for mobile apps)', - 'Apr' => '\\A\\p\\r\\i\\l', 'apr' => 'apr', 'april' => 'Apr', 'archiving_configuration' => 'Archiving', 'archiving_configuration_help' => 'More options are available in the individual stream settings', 'article' => 'Article', - 'articles' => 'articles', - 'articles_per_page' => 'Number of articles per page', - 'articles_to_display' => 'Articles to display', 'article_icons' => 'Article icons', 'article_open_on_website' => 'when article is opened on its original website', 'article_published_on' => 'This article originally appeared on %s', 'article_published_on_author' => 'This article originally appeared on %s by %s', 'article_viewed' => 'when article is viewed', + 'articles' => 'articles', + 'articles_per_page' => 'Number of articles per page', + 'articles_to_display' => 'Articles to display', 'ask_empty' => 'Clear?', 'attention' => 'Attention!', - 'Aug' => '\\A\\u\\g\\u\\s\\t', 'aug' => 'aug', 'august' => 'Aug', - 'author' => 'Author', 'auth_form' => 'Web form (traditional, requires JavaScript)', 'auth_form_not_set' => 'A problem occured during authentication system configuration. Please retry later.', 'auth_form_set' => 'Form is now your default authentication system.', + 'auth_no_password_set' => 'Administrator password hasn’t been set. This feature isn’t available.', 'auth_none' => 'None (dangerous)', 'auth_not_persona' => 'Only Persona system can be reset.', - 'auth_no_password_set' => 'Administrator password hasn’t been set. This feature isn’t available.', 'auth_persona' => 'Mozilla Persona (modern, requires JavaScript)', 'auth_reset' => 'Authentication reset', 'auth_token' => 'Authentication token', 'auth_type' => 'Authentication method', 'auth_will_reset' => 'Authentication system will be reset: a form will be used instead of Persona.', + 'author' => 'Author', 'auto_load_more' => 'Load next articles at the page bottom', 'auto_read_when' => 'Mark article as read…', 'auto_share' => 'Share', @@ -105,9 +115,9 @@ 'bad_opml_file' => 'Your OPML file is invalid', 'base_url' => 'Base URL', 'bdd' => 'Database', - 'bdd_configuration' => 'Database configuration', 'bdd_conf_is_ko' => 'Verify your database information.', 'bdd_conf_is_ok' => 'Database configuration has been saved.', + 'bdd_configuration' => 'Database configuration', 'bdd_type' => 'Type of database', 'before_one_day' => 'Before one day', 'before_one_week' => 'Before one week', @@ -123,8 +133,8 @@ 'by_email' => 'By email', 'by_feed' => 'by feed', 'cache_is_ok' => 'Permissions on cache directory are good', - 'cancel' => 'Cancel', 'can_not_be_deleted' => 'Cannot be deleted', + 'cancel' => 'Cancel', 'categories' => 'Categories', 'categories_management' => 'Categories management', 'categories_updated' => 'Categories have been updated', @@ -135,10 +145,10 @@ 'category_emptied' => 'Category has been emptied', 'category_empty' => 'Empty category', 'category_name_exists' => 'Category name already exists.', - 'category_not_delete_default' => 'You cannot delete the default category!', - 'category_not_exist' => 'The category does not exist!', 'category_no_id' => 'You must precise the id of the category.', 'category_no_name' => 'Category name cannot be empty.', + 'category_not_delete_default' => 'You cannot delete the default category!', + 'category_not_exist' => 'The category does not exist!', 'category_number' => 'Category n°%d', 'category_updated' => 'Category has been updated.', 'change_value' => 'You should change this value by any other', @@ -165,7 +175,6 @@ 'current_user' => 'Current user', 'damn' => 'Damn!', 'data_is_ok' => 'Permissions on data directory are good', - 'Dec' => '\\D\\e\\c\\e\\m\\b\\e\\r', 'dec' => 'dec', 'december' => 'Dec', 'default_category' => 'Uncategorized', @@ -178,9 +187,9 @@ 'display_articles_unfolded' => 'Show articles unfolded by default', 'display_categories_unfolded' => 'Show categories folded by default', 'display_configuration' => 'Display', + 'do_not_change_if_doubt' => 'Don’t change if you doubt about it', 'dom_is_nok' => 'You lack a required library to browse the DOM (php-xml package)', 'dom_is_ok' => 'You have the required library to browse the DOM', - 'do_not_change_if_doubt' => 'Don’t change if you doubt about it', 'email' => 'Email', 'error_occurred' => 'An error occurred', 'error_occurred_update' => 'Nothing was changed', @@ -193,19 +202,8 @@ 'favicons_is_ok' => 'Permissions on favicons directory are good', 'favorite_feeds' => 'Favourites (%s)', 'feb' => 'feb', - 'Feb' => '\\F\\e\\b\\r\\u\\a\\r\\y', 'february' => 'Feb', 'feed' => 'Feed', - 'feedback.login.error' => 'Login is invalid', - 'feedback.login.success' => 'You are connected', - 'feedback.logout.success' => 'You are disconnected', - 'feedback.user_profile.updated' => 'Your profile has been modified', - 'feeds' => 'Feeds', - 'feeds_actualized' => 'RSS feeds have been updated', - 'feeds_imported' => 'Your feeds have been imported and will now be updated', - 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', - 'feeds_marked_read' => 'Feeds have been marked as read', - 'feeds_moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under %s.', 'feed_actualized' => '%s has been updated', 'feed_added' => 'RSS feed %s has been added', 'feed_deleted' => 'Feed has been deleted', @@ -217,6 +215,16 @@ 'feed_updated' => 'Feed has been updated', 'feed_url' => 'Feed URL', 'feed_validator' => 'Check the validity of the feed', + 'feedback.login.error' => 'Login is invalid', + 'feedback.login.success' => 'You are connected', + 'feedback.logout.success' => 'You are disconnected', + 'feedback.user_profile.updated' => 'Your profile has been modified', + 'feeds' => 'Feeds', + 'feeds_actualized' => 'RSS feeds have been updated', + 'feeds_imported' => 'Your feeds have been imported and will now be updated', + 'feeds_imported_with_errors' => 'Your feeds have been imported but some errors occurred', + 'feeds_marked_read' => 'Feeds have been marked as read', + 'feeds_moved_category_deleted' => 'When you delete a category, their feeds are automatically classified under %s.', 'file_cannot_be_uploaded' => 'File cannot be uploaded!', 'file_is_nok' => 'Check permissions on %s directory. HTTP server must have rights to write into', 'file_to_import' => 'File to import
    (OPML, Json or Zip)', @@ -239,12 +247,13 @@ 'gen.menu.check_install' => 'Installation checking', 'gen.menu.user_management' => 'Manage users', 'gen.menu.user_profile' => 'Profile', + 'gen.title.authentication' => 'Authentication', 'gen.title.check_install' => 'Installation checking', 'gen.title.global_view' => 'Global view', 'gen.title.user_management' => 'Manage users', 'gen.title.user_profile' => 'Profile', - 'general_configuration' => 'General configuration', 'general_conf_is_ok' => 'General configuration has been saved.', + 'general_configuration' => 'General configuration', 'github_or_email' => 'on Github or by mail', 'global_view' => 'Global view', 'help' => 'Display documentation', @@ -261,24 +270,21 @@ 'import' => 'Import', 'import_export' => 'Import / export', 'informations' => 'Information', + 'install_not_deleted' => 'Something went wrong; you must delete the file %s manually.', 'installation_is_ok' => 'The installation process was successful.
    The final step will now attempt to delete any file and database backup created during the update process.
    You may choose to skip this step by deleting ./data/do-install.txt manually.', 'installation_step' => 'Installation — step %d · FreshRSS', - 'install_not_deleted' => 'Something went wrong; you must delete the file %s manually.', 'internal_problem_feed' => 'The RSS feed could not be added. Check FressRSS logs for details.', 'invalid_login' => 'Login is invalid', 'invalid_url' => 'URL %s is invalid', 'is_admin' => 'is administrator', - 'Jan' => '\\J\\a\\n\\u\\a\\r\\y', 'jan' => 'jan', 'january' => 'Jan', 'javascript_for_shortcuts' => 'JavaScript must be enabled in order to use shortcuts', 'javascript_is_better' => 'FreshRSS is more pleasant with JavaScript enabled', 'javascript_should_be_activated' => 'JavaScript must be enabled', 'jul' => 'jul', - 'Jul' => '\\J\\u\\l\\y', 'july' => 'Jul', 'jump_next' => 'jump to next unread sibling (feed or category)', - 'Jun' => '\\J\\u\\n\\e', 'jun' => 'jun', 'june' => 'Jun', 'keep_history' => 'Minimum number of articles to keep', @@ -295,6 +301,7 @@ 'lead_developer' => 'Lead developer', 'license' => 'License', 'load_more' => 'Load more articles', + 'log_is_ok' => 'Permissions on logs directory are good', 'login' => 'Login', 'login_configuration' => 'Login', 'login_persona_problem' => 'Connection problem with Persona?', @@ -303,41 +310,30 @@ 'logout' => 'Logout', 'logs' => 'Logs', 'logs_empty' => 'Log file is empty', - 'log_is_ok' => 'Permissions on logs directory are good', 'main_stream' => 'Main stream', 'mar' => 'mar', - 'Mar' => '\\M\\a\\r\\c\\h', 'march' => 'Mar', 'mark_all_read' => 'Mark all as read', 'mark_cat_read' => 'Mark category as read', 'mark_favorite' => 'Mark as favourite', 'mark_feed_read' => 'Mark feed as read', 'mark_read' => 'Mark as read', - 'May' => '\\M\\a\\y', 'may' => 'May', 'minz_is_nok' => 'You lack the Minz framework. You should execute build.sh script or download it on Github and install in %s directory the content of its /lib directory.', 'minz_is_ok' => 'You have the Minz framework', 'mon' => 'Mon', 'month' => 'months', 'more_information' => 'More information', - 'newer_first' => 'Newer first', + 'n_entries_deleted' => '%d articles have been deleted', + 'n_feeds_actualized' => '%d feeds have been updated', 'new_article' => 'There are new available articles, click to refresh the page.', 'new_category' => 'New category', + 'newer_first' => 'Newer first', 'next' => 'Next', 'next_article' => 'Skip to the next article', 'next_page' => 'Skip to the next page', 'next_step' => 'Go to the next step', 'no' => 'No', - 'normal_view' => 'Normal view', - 'nothing_to_load' => 'There are no more articles', - 'notif_body_new_articles' => 'There are \\d new articles to read on FreshRSS.', - 'notif_title_new_articles' => 'FreshRSS: new articles!', - 'not_read' => '%d unread', - 'not_reads' => '%d unread', - 'not_yet_implemented' => 'Not yet implemented', - 'Nov' => '\\N\\o\\v\\e\\m\\b\\e\\r', - 'nov' => 'nov', - 'november' => 'Nov', 'no_feed_actualized' => 'No RSS feed has been updated', 'no_feed_to_display' => 'There is no article to show.', 'no_feed_to_refresh' => 'There is no feed to refresh…', @@ -347,12 +343,18 @@ 'no_selected_feed' => 'No feed selected.', 'no_update' => 'No update to apply', 'no_zip_extension' => 'Zip extension is not present on your server.', + 'normal_view' => 'Normal view', + 'not_read' => '%d unread', + 'not_reads' => '%d unread', + 'not_yet_implemented' => 'Not yet implemented', + 'nothing_to_load' => 'There are no more articles', + 'notif_body_new_articles' => 'There are \\d new articles to read on FreshRSS.', + 'notif_title_new_articles' => 'FreshRSS: new articles!', + 'nov' => 'nov', + 'november' => 'Nov', 'number_articles' => '%d articles', 'number_divided_when_reader' => 'Divided by 2 in the reading view.', 'number_feeds' => '%d feeds', - 'n_entries_deleted' => '%d articles have been deleted', - 'n_feeds_actualized' => '%d feeds have been updated', - 'Oct' => '\\O\\c\\t\\o\\b\\e\\r', 'oct' => 'oct', 'october' => 'Oct', 'ok' => 'Ok!', @@ -419,8 +421,8 @@ 'refresh' => 'Refresh', 'related_tags' => 'Related tags', 'retrieve_truncated_feeds' => 'Retrieves truncated RSS feeds (attention, requires more time!)', - 'rss_feeds_of' => 'RSS feed of %s', 'rss_feed_management' => 'RSS feeds management', + 'rss_feeds_of' => 'RSS feed of %s', 'rss_view' => 'RSS feed', 'sat' => 'Sat', 'save' => 'Save', @@ -431,7 +433,6 @@ 'see_on_website' => 'See on original website', 'see_website' => 'See website', 'sep' => 'sep', - 'Sep' => '\\S\\e\\p\\t\\e\\m\\b\\e\\r', 'september' => 'Sep', 'shaarli' => 'Shaarli', 'share' => 'Share', @@ -492,7 +493,6 @@ 'twitter' => 'Twitter', 'unsafe_autologin' => 'Allow unsafe automatic login using the format: ', 'update' => 'Update', - 'updated' => 'Modifications have been updated', 'update_apply' => 'Apply', 'update_can_apply' => 'An update is available.', 'update_check' => 'Check for new updates', @@ -504,15 +504,16 @@ 'update_server_not_found' => 'Update server cannot be found. [%s]', 'update_start' => 'Start update process', 'update_system' => 'Update system', + 'updated' => 'Modifications have been updated', 'upon_reception' => 'upon reception of the article', - 'username' => 'Username', - 'username_admin' => 'Administrator username', - 'users' => 'Users', - 'users_list' => 'List of users', 'user_created' => 'User %s has been created', 'user_deleted' => 'User %s has been deleted', 'user_filter' => 'Access user filters', 'user_filter_help' => 'If there is only one user filter, it is used. Else filters are accessible by their number.', + 'username' => 'Username', + 'username_admin' => 'Administrator username', + 'users' => 'Users', + 'users_list' => 'List of users', 'version' => 'Version', 'version_update' => 'Update', 'wallabag' => 'wallabag', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index e3a49d54c..61a84cc04 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -1,5 +1,17 @@ '\\a\\v\\r\\i\\l', + 'Aug' => '\\a\\o\\û\\t', + 'Dec' => '\\d\\é\\c\\e\\m\\b\\r\\e', + 'Feb' => '\\f\\é\\v\\r\\i\\e\\r', + 'Jan' => '\\j\\a\\n\\v\\i\\e\\r', + 'Jul' => '\\j\\u\\i\\l\\l\\e\\t', + 'Jun' => '\\j\\u\\i\\n', + 'Mar' => '\\m\\a\\r\\s', + 'May' => '\\m\\a\\i', + 'Nov' => '\\n\\o\\v\\e\\m\\b\\r\\e', + 'Oct' => '\\o\\c\\t\\o\\b\\r\\e', + 'Sep' => '\\s\\e\\p\\t\\e\\m\\b\\r\\e', 'about' => 'À propos', 'about_freshrss' => 'À propos de FreshRSS', 'access_denied' => 'Vous n’avez pas le droit d’accéder à cette page !', @@ -61,42 +73,40 @@ 'advanced' => 'Avancé', 'after_onread' => 'Après “marquer tout comme lu”,', 'agpl3' => 'AGPL 3', + 'all_feeds' => 'Tous les flux', 'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)', 'allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux', - 'all_feeds' => 'Tous les flux', 'already_subscribed' => 'Vous êtes déjà abonné à %s', 'api_enabled' => 'Autoriser l’accès par API (nécessaire pour les applis mobiles)', - 'Apr' => '\\a\\v\\r\\i\\l', 'apr' => 'avr.', 'april' => 'avril', 'archiving_configuration' => 'Archivage', 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux.', 'article' => 'Article', - 'articles' => 'articles', - 'articles_per_page' => 'Nombre d’articles par page', - 'articles_to_display' => 'Articles à afficher', 'article_icons' => 'Icônes d’article', 'article_open_on_website' => 'lorsque l’article est ouvert sur le site d’origine', 'article_published_on' => 'Article publié initialement sur %s', 'article_published_on_author' => 'Article publié initialement sur %s par %s', 'article_viewed' => 'lorsque l’article est affiché', + 'articles' => 'articles', + 'articles_per_page' => 'Nombre d’articles par page', + 'articles_to_display' => 'Articles à afficher', 'ask_empty' => 'Vider ?', 'attention' => 'Attention !', - 'Aug' => '\\a\\o\\û\\t', 'aug' => 'août', 'august' => 'août', - 'author' => 'Auteur', 'auth_form' => 'Formulaire (traditionnel, requiert JavaScript)', 'auth_form_not_set' => 'Un problème est survenu lors de la configuration de votre système d’authentification. Veuillez réessayer plus tard.', 'auth_form_set' => 'Le formulaire est désormais votre système d’authentification.', + 'auth_no_password_set' => 'Aucun mot de passe administrateur n’a été précisé. Cette fonctionnalité n’est pas disponible.', 'auth_none' => 'Aucune (dangereux)', 'auth_not_persona' => 'Seul le système d’authentification Persona peut être réinitialisé.', - 'auth_no_password_set' => 'Aucun mot de passe administrateur n’a été précisé. Cette fonctionnalité n’est pas disponible.', 'auth_persona' => 'Mozilla Persona (moderne, requiert JavaScript)', 'auth_reset' => 'Réinitialisation de l’authentification', 'auth_token' => 'Jeton d’identification', 'auth_type' => 'Méthode d’authentification', 'auth_will_reset' => 'Le système d’authentification va être réinitialisé : un formulaire sera utilisé à la place de Persona.', + 'author' => 'Auteur', 'auto_load_more' => 'Charger les articles suivants en bas de page', 'auto_read_when' => 'Marquer un article comme lu…', 'auto_share' => 'Partager', @@ -105,9 +115,9 @@ 'bad_opml_file' => 'Votre fichier OPML n’est pas valide.', 'base_url' => 'Base de l’URL', 'bdd' => 'Base de données', - 'bdd_configuration' => 'Base de données', 'bdd_conf_is_ko' => 'Vérifiez les informations d’accès à la base de données.', 'bdd_conf_is_ok' => 'La configuration de la base de données a été enregistrée.', + 'bdd_configuration' => 'Base de données', 'bdd_type' => 'Type de base de données', 'before_one_day' => 'Antérieurs à 1 jour', 'before_one_week' => 'Antérieurs à 1 semaine', @@ -123,8 +133,8 @@ 'by_email' => 'Par courriel', 'by_feed' => 'par flux', 'cache_is_ok' => 'Les droits sur le répertoire de cache sont bons', - 'cancel' => 'Annuler', 'can_not_be_deleted' => 'Ne peut pas être supprimée.', + 'cancel' => 'Annuler', 'categories' => 'Catégories', 'categories_management' => 'Gestion des catégories', 'categories_updated' => 'Les catégories ont été mises à jour.', @@ -135,10 +145,10 @@ 'category_emptied' => 'La catégorie a été vidée.', 'category_empty' => 'Catégorie vide', 'category_name_exists' => 'Une catégorie possède déjà ce nom.', - 'category_not_delete_default' => 'Vous ne pouvez pas supprimer la catégorie par défaut !', - 'category_not_exist' => 'Cette catégorie n’existe pas !', 'category_no_id' => 'Vous devez préciser l’id de la catégorie.', 'category_no_name' => 'Vous devez préciser un nom pour la catégorie.', + 'category_not_delete_default' => 'Vous ne pouvez pas supprimer la catégorie par défaut !', + 'category_not_exist' => 'Cette catégorie n’existe pas !', 'category_number' => 'Catégorie n°%d', 'category_updated' => 'La catégorie a été mise à jour.', 'change_value' => 'Vous devriez changer cette valeur par n’importe quelle autre', @@ -165,7 +175,6 @@ 'current_user' => 'Utilisateur actuel', 'damn' => 'Arf !', 'data_is_ok' => 'Les droits sur le répertoire de data sont bons', - 'Dec' => '\\d\\é\\c\\e\\m\\b\\r\\e', 'dec' => 'déc.', 'december' => 'décembre', 'default_category' => 'Sans catégorie', @@ -178,9 +187,9 @@ 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', 'display_categories_unfolded' => 'Afficher les catégories pliées par défaut', 'display_configuration' => 'Affichage', + 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', 'dom_is_nok' => 'Il manque une librairie pour parcourir le DOM (paquet php-xml)', 'dom_is_ok' => 'Vous disposez du nécessaire pour parcourir le DOM', - 'do_not_change_if_doubt' => 'Laissez tel quel dans le doute', 'email' => 'Courriel', 'error_occurred' => 'Une erreur est survenue !', 'error_occurred_update' => 'Rien n’a été modifié !', @@ -193,19 +202,8 @@ 'favicons_is_ok' => 'Les droits sur le répertoire des favicons sont bons', 'favorite_feeds' => 'Favoris (%s)', 'feb' => 'fév.', - 'Feb' => '\\f\\é\\v\\r\\i\\e\\r', 'february' => 'février', 'feed' => 'Flux', - 'feedback.login.error' => 'L’identifiant est invalide !', - 'feedback.login.success' => 'Vous êtes désormais connecté', - 'feedback.logout.success' => 'Vous avez été déconnecté', - 'feedback.user_profile.updated' => 'Votre profil a été mis à jour', - 'feeds' => 'Flux', - 'feeds_actualized' => 'Les flux ont été mis à jour.', - 'feeds_imported' => 'Vos flux ont été importés et vont maintenant être actualisés.', - 'feeds_imported_with_errors' => 'Vos flux ont été importés mais des erreurs sont survenues.', - 'feeds_marked_read' => 'Les flux ont été marqués comme lus.', - 'feeds_moved_category_deleted' => 'Lors de la suppression d’une catégorie, ses flux seront automatiquement classés dans %s.', 'feed_actualized' => '%s a été mis à jour.', 'feed_added' => 'Le flux %s a bien été ajouté.', 'feed_deleted' => 'Le flux a été supprimé.', @@ -217,6 +215,16 @@ 'feed_updated' => 'Le flux a été mis à jour.', 'feed_url' => 'URL du flux', 'feed_validator' => 'Vérifier la valididé du flux', + 'feedback.login.error' => 'L’identifiant est invalide !', + 'feedback.login.success' => 'Vous êtes désormais connecté', + 'feedback.logout.success' => 'Vous avez été déconnecté', + 'feedback.user_profile.updated' => 'Votre profil a été mis à jour', + 'feeds' => 'Flux', + 'feeds_actualized' => 'Les flux ont été mis à jour.', + 'feeds_imported' => 'Vos flux ont été importés et vont maintenant être actualisés.', + 'feeds_imported_with_errors' => 'Vos flux ont été importés mais des erreurs sont survenues.', + 'feeds_marked_read' => 'Les flux ont été marqués comme lus.', + 'feeds_moved_category_deleted' => 'Lors de la suppression d’une catégorie, ses flux seront automatiquement classés dans %s.', 'file_cannot_be_uploaded' => 'Le fichier ne peut pas être téléchargé !', 'file_is_nok' => 'Veuillez vérifier les droits sur le répertoire %s. Le serveur HTTP doit être capable d’écrire dedans', 'file_to_import' => 'Fichier à importer
    (OPML, Json ou Zip)', @@ -239,12 +247,13 @@ 'gen.menu.check_install' => 'Vérification de l\'installation', 'gen.menu.user_management' => 'Gestion des utilisateurs', 'gen.menu.user_profile' => 'Profil', + 'gen.title.authentication' => 'Authentification', 'gen.title.check_install' => 'Vérification de l\'installation', 'gen.title.global_view' => 'Vue globale', 'gen.title.user_management' => 'Gestion des utilisateurs', 'gen.title.user_profile' => 'Profil', - 'general_configuration' => 'Configuration générale', 'general_conf_is_ok' => 'La configuration générale a été enregistrée.', + 'general_configuration' => 'Configuration générale', 'github_or_email' => 'sur Github ou par courriel', 'global_view' => 'Vue globale', 'help' => 'Afficher la documentation', @@ -261,24 +270,21 @@ 'import' => 'Importer', 'import_export' => 'Importer / exporter', 'informations' => 'Informations', + 'install_not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier %s à la main.', 'installation_is_ok' => 'L’installation s’est bien passée.
    La dernière étape va maintenant tenter de supprimer les fichiers ainsi que d’éventuelles copies de base de données créés durant le processus de mise à jour.
    Vous pouvez choisir de sauter cette étape en supprimant ./data/do-install.txt manuellement.', 'installation_step' => 'Installation — étape %d · FreshRSS', - 'install_not_deleted' => 'Quelque chose s’est mal passé, vous devez supprimer le fichier %s à la main.', 'internal_problem_feed' => 'Le flux ne peut pas être ajouté. Consulter les logs de FreshRSS pour plus de détails.', 'invalid_login' => 'L’identifiant est invalide !', 'invalid_url' => 'L’url %s est invalide.', 'is_admin' => 'est administrateur', - 'Jan' => '\\j\\a\\n\\v\\i\\e\\r', 'jan' => 'jan.', 'january' => 'janvier', 'javascript_for_shortcuts' => 'Le JavaScript doit être activé pour pouvoir profiter des raccourcis.', 'javascript_is_better' => 'FreshRSS est plus agréable à utiliser avec JavaScript activé', 'javascript_should_be_activated' => 'Le JavaScript doit être activé.', 'jul' => 'jui.', - 'Jul' => '\\j\\u\\i\\l\\l\\e\\t', 'july' => 'juillet', 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', - 'Jun' => '\\j\\u\\i\\n', 'jun' => 'juin', 'june' => 'juin', 'keep_history' => 'Nombre minimum d’articles à conserver', @@ -295,6 +301,7 @@ 'lead_developer' => 'Développeur principal', 'license' => 'Licence', 'load_more' => 'Charger plus d’articles', + 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', 'login' => 'Connexion', 'login_configuration' => 'Identification', 'login_persona_problem' => 'Problème de connexion à Persona ?', @@ -303,41 +310,30 @@ 'logout' => 'Déconnexion', 'logs' => 'Logs', 'logs_empty' => 'Les logs sont vides.', - 'log_is_ok' => 'Les droits sur le répertoire des logs sont bons', 'main_stream' => 'Flux principal', 'mar' => 'mar.', - 'Mar' => '\\m\\a\\r\\s', 'march' => 'mars', 'mark_all_read' => 'Tout marquer comme lu', 'mark_cat_read' => 'Marquer la catégorie comme lue', 'mark_favorite' => 'Mettre en favori', 'mark_feed_read' => 'Marquer le flux comme lu', 'mark_read' => 'Marquer comme lu', - 'May' => '\\m\\a\\i', 'may' => 'mai.', '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.', 'minz_is_ok' => 'Vous disposez du framework Minz', 'mon' => 'lun.', 'month' => 'mois', 'more_information' => 'Plus d’informations', - 'newer_first' => 'Plus récents en premier', + 'n_entries_deleted' => '%d articles ont été supprimés.', + 'n_feeds_actualized' => '%d flux ont été mis à jour.', 'new_article' => 'Il y a de nouveaux articles disponibles, cliquez pour rafraîchir la page.', 'new_category' => 'Nouvelle catégorie', + 'newer_first' => 'Plus récents en premier', 'next' => 'Suivant', 'next_article' => 'Passer à l’article suivant', 'next_page' => 'Passer à la page suivante', 'next_step' => 'Passer à l’étape suivante', 'no' => 'Non', - 'normal_view' => 'Vue normale', - 'nothing_to_load' => 'Fin des articles', - 'notif_body_new_articles' => 'Il y a \\d nouveaux articles à lire sur FreshRSS.', - 'notif_title_new_articles' => 'FreshRSS : nouveaux articles !', - 'not_read' => '%d non lu', - 'not_reads' => '%d non lus', - 'not_yet_implemented' => 'Pas encore implémenté', - 'Nov' => '\\n\\o\\v\\e\\m\\b\\r\\e', - 'nov' => 'nov.', - 'november' => 'novembre', 'no_feed_actualized' => 'Aucun flux n’a pu être mis à jour.', 'no_feed_to_display' => 'Il n’y a aucun article à afficher.', 'no_feed_to_refresh' => 'Il n’y a aucun flux à actualiser…', @@ -347,12 +343,18 @@ 'no_selected_feed' => 'Aucun flux sélectionné.', 'no_update' => 'Aucune mise à jour à appliquer', 'no_zip_extension' => 'L’extension Zip n’est pas présente sur votre serveur.', + 'normal_view' => 'Vue normale', + 'not_read' => '%d non lu', + 'not_reads' => '%d non lus', + 'not_yet_implemented' => 'Pas encore implémenté', + 'nothing_to_load' => 'Fin des articles', + 'notif_body_new_articles' => 'Il y a \\d nouveaux articles à lire sur FreshRSS.', + 'notif_title_new_articles' => 'FreshRSS : nouveaux articles !', + 'nov' => 'nov.', + 'november' => 'novembre', 'number_articles' => '%d articles', 'number_divided_when_reader' => 'Divisé par 2 dans la vue de lecture.', 'number_feeds' => '%d flux', - 'n_entries_deleted' => '%d articles ont été supprimés.', - 'n_feeds_actualized' => '%d flux ont été mis à jour.', - 'Oct' => '\\o\\c\\t\\o\\b\\r\\e', 'oct' => 'oct.', 'october' => 'octobre', 'ok' => 'Ok !', @@ -419,8 +421,8 @@ 'refresh' => 'Actualisation', 'related_tags' => 'Tags associés', 'retrieve_truncated_feeds' => 'Permet de récupérer les flux tronqués (attention, demande plus de temps !)', - 'rss_feeds_of' => 'Flux RSS de %s', 'rss_feed_management' => 'Gestion des flux RSS', + 'rss_feeds_of' => 'Flux RSS de %s', 'rss_view' => 'Flux RSS', 'sat' => 'sam.', 'save' => 'Enregistrer', @@ -431,7 +433,6 @@ 'see_on_website' => 'Voir sur le site d’origine', 'see_website' => 'Voir le site', 'sep' => 'sep.', - 'Sep' => '\\s\\e\\p\\t\\e\\m\\b\\r\\e', 'september' => 'septembre', 'shaarli' => 'Shaarli', 'share' => 'Partager', @@ -492,7 +493,6 @@ 'twitter' => 'Twitter', 'unsafe_autologin' => 'Autoriser les connexions automatiques non-sûres au format : ', 'update' => 'Mise à jour', - 'updated' => 'Modifications enregistrées.', 'update_apply' => 'Appliquer la mise à jour', 'update_can_apply' => 'Une mise à jour est disponible.', 'update_check' => 'Vérifier les mises à jour', @@ -504,15 +504,16 @@ 'update_server_not_found' => 'Le serveur de mise à jour n’a pas été trouvé. [%s]', 'update_start' => 'Lancer la mise à jour', 'update_system' => 'Système de mise à jour', + 'updated' => 'Modifications enregistrées.', 'upon_reception' => 'dès la réception du nouvel article', - 'username' => 'Nom d’utilisateur', - 'username_admin' => 'Nom d’utilisateur administrateur', - 'users' => 'Utilisateurs', - 'users_list' => 'Liste des utilisateurs', 'user_created' => 'L’utilisateur %s a été créé.', 'user_deleted' => 'L’utilisateur %s a été supprimé.', 'user_filter' => 'Accéder aux filtres utilisateur', 'user_filter_help' => 'S’il n’y a qu’un filtre utilisateur, celui-ci est utilisé automatiquement. Sinon ils sont accessibles par leur numéro.', + 'username' => 'Nom d’utilisateur', + 'username_admin' => 'Nom d’utilisateur administrateur', + 'users' => 'Utilisateurs', + 'users_list' => 'Liste des utilisateurs', 'version' => 'Version', 'version_update' => 'Mise à jour', 'wallabag' => 'wallabag', -- cgit v1.2.3 From e86a3d001745656c6ec94837ff3275d4bc93aa5a Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 26 Oct 2014 12:40:42 +0100 Subject: Fix pdo checking Show only one message for both mysql and sqlite pdo conf. If one of them is ok, PDO is ok. See https://github.com/marienfressinaud/FreshRSS/issues/678 --- lib/lib_rss.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 80eb206d2..8ae357f02 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -257,13 +257,13 @@ function is_referer_from_same_domain() { * @return array of tested values. */ function check_install_php() { + $pdo_mysql = extension_loaded('pdo_mysql'); + $pdo_sqlite = extension_loaded('pdo_sqlite'); return array( 'php' => version_compare(PHP_VERSION, '5.2.1') >= 0, 'minz' => file_exists(LIB_PATH . '/Minz'), 'curl' => extension_loaded('curl'), - 'pdo_mysql' => extension_loaded('pdo_mysql'), - 'pdo_sqlite' => extension_loaded('pdo_sqlite'), - 'pdo' => extension_loaded('pdo_mysql') || extension_loaded('pdo_sqlite'), + 'pdo' => $pdo_mysql || $pdo_sqlite, 'pcre' => extension_loaded('pcre'), 'ctype' => extension_loaded('ctype'), 'dom' => class_exists('DOMDocument'), -- cgit v1.2.3 From 659515862566744fc90511bc4182fc32ccf2e6b3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 26 Oct 2014 14:13:05 +0100 Subject: Fix themes (aside_feed) --- p/themes/Dark/dark.css | 3 +-- p/themes/Flat/flat.css | 3 +-- p/themes/Origine/origine.css | 4 +--- p/themes/Pafat/pafat.css | 1 - p/themes/Screwdriver/screwdriver.css | 1 - p/themes/base-theme/base.css | 1 - p/themes/base-theme/template.css | 14 ++++++++++++-- 7 files changed, 15 insertions(+), 12 deletions(-) diff --git a/p/themes/Dark/dark.css b/p/themes/Dark/dark.css index e551aa9c0..03bf3c985 100644 --- a/p/themes/Dark/dark.css +++ b/p/themes/Dark/dark.css @@ -474,7 +474,6 @@ a.btn { line-height: 2.5rem; font-size: 1rem; background: #1c1c1c; - font-weight: bold; } .tree-folder-title .title { background: inherit; @@ -485,6 +484,7 @@ a.btn { } .tree-folder.active .tree-folder-title { background: #2c2c2c; + font-weight: bold; } .tree-folder-items { border-top: 1px solid #222; @@ -594,7 +594,6 @@ a.btn { .aside_feed .tree-folder-items .item:hover .dropdown-toggle > .icon, .aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { border-radius: 3px; - vertical-align: middle; background-color: #111; } diff --git a/p/themes/Flat/flat.css b/p/themes/Flat/flat.css index eb7737c5d..313bee0ee 100644 --- a/p/themes/Flat/flat.css +++ b/p/themes/Flat/flat.css @@ -483,7 +483,6 @@ a.btn { background: #34495e; line-height: 2.5rem; font-size: 1rem; - font-weight: bold; } .tree-folder-title .title { background: inherit; @@ -494,6 +493,7 @@ a.btn { } .tree-folder.active .tree-folder-title { background: #2980b9; + font-weight: bold; } .tree-folder-items { background: #2c3e50; @@ -597,7 +597,6 @@ a.btn { .aside_feed .tree-folder-items .item:hover .dropdown-toggle > .icon, .aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { border-radius: 3px; - vertical-align: middle; } /*=== Configuration pages */ diff --git a/p/themes/Origine/origine.css b/p/themes/Origine/origine.css index 464422a0b..afd6ec04f 100644 --- a/p/themes/Origine/origine.css +++ b/p/themes/Origine/origine.css @@ -508,7 +508,6 @@ a.btn { background: #fff; line-height: 2.5rem; font-size: 1rem; - font-weight: bold; } .tree-folder-title .title { background: inherit; @@ -519,6 +518,7 @@ a.btn { } .tree-folder.active .tree-folder-title { background: #f0f0f0; + font-weight: bold; } .tree-folder.active .tree-folder-title .title { color: #0062BE; @@ -629,11 +629,9 @@ a.btn { left: 2px; } .aside_feed .tree-folder-items .item .dropdown-target:target ~ .dropdown-toggle > .icon, -.aside_feed .tree-folder-items .item:hover .dropdown-toggle > .icon, .aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { background-color: #fff; border-radius: 3px; - vertical-align: middle; } /*=== Configuration pages */ diff --git a/p/themes/Pafat/pafat.css b/p/themes/Pafat/pafat.css index 49cb3bc17..8b1e7866c 100644 --- a/p/themes/Pafat/pafat.css +++ b/p/themes/Pafat/pafat.css @@ -642,7 +642,6 @@ a.btn { .aside_feed .tree-folder-items .item:hover .dropdown-toggle > .icon, .aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { border-radius: 3px; - vertical-align: middle; background-color: #fff; } diff --git a/p/themes/Screwdriver/screwdriver.css b/p/themes/Screwdriver/screwdriver.css index 4f55d752e..b6c2e670e 100644 --- a/p/themes/Screwdriver/screwdriver.css +++ b/p/themes/Screwdriver/screwdriver.css @@ -664,7 +664,6 @@ a.btn { .aside_feed .tree-folder-items .item:hover .dropdown-toggle > .icon, .aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { border-radius: 3px; - vertical-align: middle; } /*=== Configuration pages */ diff --git a/p/themes/base-theme/base.css b/p/themes/base-theme/base.css index 871a632d8..ac30dbfea 100644 --- a/p/themes/base-theme/base.css +++ b/p/themes/base-theme/base.css @@ -465,7 +465,6 @@ a.btn { .aside_feed .tree-folder-items .item:hover .dropdown-toggle > .icon, .aside_feed .tree-folder-items .item.active .dropdown-toggle > .icon { border-radius: 3px; - vertical-align: middle; } /*=== Configuration pages */ diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index a79d539d8..ffb104af2 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -401,14 +401,23 @@ a.btn { .aside { display: table-cell; height: 100%; - width: 250px; + width: 300px; vertical-align: top; } -/*=== Aside main page (feeds) */ +/*=== Aside main page */ +.aside_feed .tree-folder-title .icon { + padding: 5px; +} +.aside_feed .tree-folder-items .item.feed { + padding: 0px 15px; +} .aside_feed .tree-folder-items:not(.active) { display: none; } +.aside_feed .tree-folder-items .dropdown { + vertical-align: top; +} .aside_feed .tree-folder-items .dropdown-menu { left: 0; } @@ -472,6 +481,7 @@ a.btn { .flux .item.date { width: 145px; text-align: right; + overflow: hidden; } .flux .item > a { display: block; -- cgit v1.2.3 From 956896bf87275317ba822188c14e07eb21fae3de Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Sun, 26 Oct 2014 17:01:31 +0100 Subject: Fixes #683 --- app/actualize_script.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/actualize_script.php b/app/actualize_script.php index e5925514e..74840215b 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -7,6 +7,11 @@ ob_implicit_flush(false); ob_start(); echo 'Results: ', "\n"; //Buffered +if (defined('STDOUT')) { + $begin_date = date_create('now'); + fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered +} + Minz_Configuration::init(); $users = listUsers(); @@ -52,6 +57,10 @@ foreach ($users as $myUser) { syslog(LOG_INFO, 'FreshRSS actualize done.'); if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); + $end_date = date_create('now'); + $duration = date_diff($end_date, $begin_date); + fwrite(STDOUT, 'Ending feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered + fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%H hours %M minutes and %S') . ' secondes for ' . count($users) . " users\n"); //Unbuffered } echo 'End.', "\n"; ob_end_flush(); -- cgit v1.2.3 From 01ef0ef2b8b5f8eda53b2dff19f460dd9d1b8276 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 26 Oct 2014 18:58:43 +0100 Subject: Fix nav_entries menu width See https://github.com/marienfressinaud/FreshRSS/issues/678 --- p/themes/base-theme/template.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index ffb104af2..6640284f9 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -569,7 +569,7 @@ br + br + br { position: fixed; bottom: 0; left: 0; display: table; - width: 250px; + width: 300px; background: #fff; table-layout: fixed; } -- cgit v1.2.3 From e861e5789d52fab6c4055e39fb92d64194eaab5e Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Sun, 26 Oct 2014 19:00:00 +0100 Subject: Fix errors + improvements on bug #683 fix. --- app/actualize_script.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/actualize_script.php b/app/actualize_script.php index 74840215b..9fe499cc9 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -9,7 +9,7 @@ echo 'Results: ', "\n"; //Buffered if (defined('STDOUT')) { $begin_date = date_create('now'); - fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered + fwrite(STDOUT, 'Starting feed actualization at ' . $begin_date->format('c') . "\n"); //Unbuffered } Minz_Configuration::init(); @@ -59,8 +59,8 @@ if (defined('STDOUT')) { fwrite(STDOUT, 'Done.' . "\n"); $end_date = date_create('now'); $duration = date_diff($end_date, $begin_date); - fwrite(STDOUT, 'Ending feed actualization at ' . $begin_date->format('H:i:s (O)') . "\n"); //Unbuffered - fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%H hours %M minutes and %S') . ' secondes for ' . count($users) . " users\n"); //Unbuffered + fwrite(STDOUT, 'Ending feed actualization at ' . $end_date->format('c') . "\n"); //Unbuffered + fwrite(STDOUT, 'Feed actualizations took ' . $duration->format('%a day(s), %h hour(s), %i minute(s) and %s seconds') . ' for ' . count($users) . " users\n"); //Unbuffered } echo 'End.', "\n"; ob_end_flush(); -- cgit v1.2.3 From 482f995d61f4b172f7b79becc25d0d7157098daf Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 26 Oct 2014 21:21:07 +0100 Subject: All the category area is clickable See https://github.com/marienfressinaud/FreshRSS/issues/646 --- p/themes/base-theme/template.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 6640284f9..79fe506f2 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -348,6 +348,8 @@ a.btn { text-overflow: ellipsis; } .tree-folder-title .title { + display: inline-block; + width: 100%; vertical-align: middle; } .tree-folder-items > .item { @@ -406,6 +408,10 @@ a.btn { } /*=== Aside main page */ +.aside_feed .category .title { + width: calc(100% - 35px); +} + .aside_feed .tree-folder-title .icon { padding: 5px; } -- cgit v1.2.3 From 299495d0820dd6a8c26842264a3b15b95884b9fb Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 26 Oct 2014 22:33:00 +0100 Subject: Crypto update bcrypt.js + bug https://github.com/marienfressinaud/FreshRSS/issues/676 --- p/scripts/bcrypt.min.js | 78 ++++++++++++++++++++++++++----------------------- p/scripts/main.js | 2 +- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/p/scripts/bcrypt.min.js b/p/scripts/bcrypt.min.js index 6892caddc..614f0c259 100644 --- a/p/scripts/bcrypt.min.js +++ b/p/scripts/bcrypt.min.js @@ -1,41 +1,45 @@ -/* +(function(){/* bcrypt.js (c) 2013 Daniel Wirtz Released under the Apache License, Version 2.0 see: https://github.com/dcodeIO/bcrypt.js for details */ -function p(n){throw n;}var q=null; -(function(n){function u(c,a,b,f){for(var d,e=c[a],l=c[a+1],e=e^b[0],h=0;14>=h;)d=f[e>>24&255],d+=f[256|e>>16&255],d^=f[512|e>>8&255],d+=f[768|e&255],l^=d^b[++h],d=f[l>>24&255],d+=f[256|l>>16&255],d^=f[512|l>>8&255],d+=f[768|l&255],e^=d^b[++h];c[a]=l^b[17];c[a+1]=e;return c}function s(c,a){var b,f=0;for(b=0;4>b;b++)f=f<<8|c[a]&255,a=(a+1)%c.length;return{key:f,a:a}}function y(c,a,b){for(var f=0,d=[0,0],e=a.length,l=b.length,h=0;hk;k++)for(m=0;m>1;m++)u(e,m<<1,h,g);n=[];for(k=0;k>24&255)>>>0),n.push((e[k]>>16&255)>>>0),n.push((e[k]>>8&255)>>>0),n.push((e[k]&255)>>>0);return f?(f(q,n),q):n}f&&z(d);return q}var e=B.slice(),l=e.length;(4>b||31>=8;while(a);f=f.concat(b.reverse())}return f}function w(c,a,b){function f(a){var b=[];b.push("$2");"a"<=d&&b.push(d);b.push("$");10>l&&b.push("0");b.push(l.toString());b.push("$");b.push(v.b(h,h.length));b.push(v.b(a,4*B.length-1));return b.join("")}var d,e;("$"!=a.charAt(0)||"2"!=a.charAt(1))&&p(Error("Invalid salt version: "+ -a.substring(0,2)));"$"==a.charAt(2)?(d=String.fromCharCode(0),e=3):(d=a.charAt(2),("a"!=d||"$"!=a.charAt(3))&&p(Error("Invalid salt revision: "+a.substring(2,4))),e=4);"$"=a||a>c.length)&&p(Error("Invalid 'len': "+a));b>2&63]);d=(d&3)<<4;if(b>=a){f.push(t[d&63]);break}e=c[b++]&255;d|=e>>4&15;f.push(t[d&63]);d=(e&15)<< -2;if(b>=a){f.push(t[d&63]);break}e=c[b++]&255;d|=e>>6&3;f.push(t[d&63]);f.push(t[e&63])}return f.join("")},c:function(c,a){var b=0,f=c.length,d=0,e=[],l,h,g;for(0>=a&&p(Error("Illegal 'len': "+a));b>>0;g|=(h&48)>>4;e.push(String.fromCharCode(g));if(++d>=a||b>=f)break;g=c.charCodeAt(b++);l=g>>0;g|=(l&60)>>2;e.push(String.fromCharCode(g)); -if(++d>=a||b>=f)break;g=c.charCodeAt(b++);h=g>>0;g|=h;e.push(String.fromCharCode(g));++d}f=[];for(b=0;bc||31c&&b.push("0");b.push(c.toString());b.push("$");try{b.push(v.b(G(),16)),a=b.join("")}catch(f){p(f)}return a};m.genSalt=function(c,a,b){"function"==typeof a&&(b=a,a=-1);var f;"function"==typeof c?(b=c,f=10):f=parseInt(c,10);"function"!=typeof b&&p(Error("Illegal or missing 'callback': "+b));z(function(){try{var a=m.genSaltSync(f);b(q,a)}catch(c){b(c,q)}})};m.hashSync=function(c,a){a||(a=10);"number"==typeof a&&(a=m.genSaltSync(a));return w(c,a)};m.hash=function(c,a,b){"function"!= -typeof b&&p(Error("Illegal 'callback': "+b));"number"==typeof a?m.genSalt(a,function(a,d){w(c,d,b)}):w(c,a,b)};m.compareSync=function(c,a){("string"!=typeof c||"string"!=typeof a)&&p(Error("Illegal argument types: "+typeof c+", "+typeof a));60!=a.length&&p(Error("Illegal hash length: "+a.length+" != 60"));for(var b=m.hashSync(c,a.substr(0,a.length-31)),f=b.length==a.length,d=b.length=e&&(a.length>=e&&b[e]!=a[e])&&(f=!1);return f};m.compare=function(c, -a,b){"function"!=typeof b&&p(Error("Illegal 'callback': "+b));m.hash(c,a.substr(0,29),function(c,d){b(c,a===d)})};m.getRounds=function(c){"string"!=typeof c&&p(Error("Illegal type of 'hash': "+typeof c));return parseInt(c.split("$")[2],10)};m.getSalt=function(c){"string"!=typeof c&&p(Error("Illegal type of 'hash': "+typeof c));60!=c.length&&p(Error("Illegal hash length: "+c.length+" != 60"));return c.substring(0,29)};"undefined"!=typeof module&&module.exports?module.exports=m:"undefined"!=typeof define&& -define.amd?define("bcrypt",function(){return m}):(n.dcodeIO||(n.dcodeIO={}),n.dcodeIO.bcrypt=m)})(this); +function l(t){throw t;}var p=null; +(function(t){function B(c){if("undefined"!==typeof module&&module&&module.exports)try{return require("crypto").randomBytes(c)}catch(a){}try{var b;(t.crypto||t.msCrypto).getRandomValues(b=new Uint32Array(c));return Array.prototype.slice.call(b)}catch(d){}x||l(Error("Neither WebCryptoAPI nor a crypto module is available. Use bcrypt.setRandomFallback to set an alternative"));return x(c)}function F(c){var a=[],b=0;G.f(function(){return b>=c.length?p:c.charCodeAt(b++)},function(b){a.push(b)});return a} +function y(c,a){var b=0,d=[],f,e;for((0>=a||a>c.length)&&l(Error("Illegal len: "+a));b>2&63]);f=(f&3)<<4;if(b>=a){d.push(u[f&63]);break}e=c[b++]&255;f|=e>>4&15;d.push(u[f&63]);f=(e&15)<<2;if(b>=a){d.push(u[f&63]);break}e=c[b++]&255;f|=e>>6&3;d.push(u[f&63]);d.push(u[e&63])}return d.join("")}function H(c){for(var a=0,b=c.length,d=0,f=[],e,k,h;ad;){h=c.charCodeAt(a++);e=h>>0; +h|=(k&48)>>4;f.push(z(h));if(16<=++d||a>=b)break;h=c.charCodeAt(a++);e=h>>0;h|=(e&60)>>2;f.push(z(h));if(16<=++d||a>=b)break;h=c.charCodeAt(a++);k=h>>0;h|=k;f.push(z(h));++d}c=[];for(a=0;a=h;)f=d[e>>24&255],f+=d[256|e>>16&255],f^=d[512|e>>8&255],f+=d[768|e&255],k^=f^b[++h],f=d[k>>24&255],f+=d[256|k>>16&255],f^=d[512|k>>8& +255],f+=d[768|k&255],e^=f^b[++h];c[a]=k^b[17];c[a+1]=e;return c}function v(c,a){for(var b=0,d=0;4>b;++b)d=d<<8|c[a]&255,a=(a+1)%c.length;return{key:d,a:a}}function C(c,a,b){for(var d=0,f=[0,0],e=a.length,k=b.length,h,g=0;gq;q++)for(r=0;r>1;r++)w(k,r<<1,m,n);g=[];for(q=0;q>24&255)>>>0),g.push((k[q]>>16&255)>>>0),g.push((k[q]>>8&255)>>>0),g.push((k[q]&255)>>>0);if(d){d(p,g);return}return g}d&& +s(e)}var k=E.slice(),h=k.length,g;if(4>b||31g&&b.push("0");b.push(g.toString());b.push("$"); +b.push(y(m,m.length));b.push(y(a,4*E.length-1));return b.join("")}var e;if("string"!==typeof c||"string"!==typeof a){e=Error("Invalid string / salt: Not a string");if(b){s(b.bind(this,e));return}l(e)}var k,h;if("$"!==a.charAt(0)||"2"!==a.charAt(1)){e=Error("Invalid salt version: "+a.substring(0,2));if(b){s(b.bind(this,e));return}l(e)}if("$"===a.charAt(2))k=String.fromCharCode(0),h=3;else{k=a.charAt(2);if("a"!==k&&"y"!==k||"$"!==a.charAt(3)){e=Error("Invalid salt revision: "+a.substring(2,4));if(b){s(b.bind(this, +e));return}l(e)}h=4}if("$"c||31c&&b.push("0");b.push(c.toString());b.push("$");b.push(y(B(16),16));return b.join("")};n.genSalt=function(c,a,b){"function"===typeof a&&(b=a,a=void 0);"function"===typeof c&&(b=c,c=10);"function"!==typeof b&&l(Error("Illegal callback: "+typeof b));"number"!==typeof c?s(b.bind(this,Error("Illegal arguments: "+typeof c))):s(function(){try{b(p,n.genSaltSync(c))}catch(a){b(a)}})};n.hashSync=function(c, +a){"undefined"===typeof a&&(a=10);"number"===typeof a&&(a=n.genSaltSync(a));("string"!==typeof c||"string"!==typeof a)&&l(Error("Illegal arguments: "+typeof c+", "+typeof a));return A(c,a)};n.hash=function(c,a,b,d){"function"!==typeof b&&l(Error("Illegal callback: "+typeof b));"string"===typeof c&&"number"===typeof a?n.genSalt(a,function(a,e){A(c,e,b,d)}):"string"===typeof c&&"string"===typeof a?A(c,a,b,d):s(b.bind(this,Error("Illegal arguments: "+typeof c+", "+typeof a)))};n.compareSync=function(c, +a){("string"!==typeof c||"string"!==typeof a)&&l(Error("Illegal arguments: "+typeof c+", "+typeof a));if(60!==a.length)return!1;for(var b=n.hashSync(c,a.substr(0,a.length-31)),d=b.length===a.length,f=b.length=e&&(a.length>=e&&b[e]!=a[e])&&(d=!1);return d};n.compare=function(c,a,b,d){"function"!==typeof b&&l(Error("Illegal callback: "+typeof b));"string"!==typeof c||"string"!==typeof a?s(b.bind(this,Error("Illegal arguments: "+typeof c+", "+typeof a))): +n.hash(c,a.substr(0,29),function(d,c){b(d,a===c)},d)};n.getRounds=function(c){"string"!==typeof c&&l(Error("Illegal arguments: "+typeof c));return parseInt(c.split("$")[2],10)};n.getSalt=function(c){"string"!==typeof c&&l(Error("Illegal arguments: "+typeof c));60!==c.length&&l(Error("Illegal hash length: "+c.length+" != 60"));return c.substring(0,29)};var s="undefined"!==typeof process&&process&&"function"===typeof process.nextTick?"function"===typeof setImmediate?setImmediate:process.nextTick:setTimeout, +u="./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),r=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,54,55,56,57,58,59,60,61,62,63,-1,-1,-1,-1,-1,-1,-1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,-1,-1,-1,-1,-1,-1,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,-1,-1,-1,-1,-1],z=String.fromCharCode,G=function(){var c={h:1114111, +g:function(a,b){var d=p;"number"===typeof a&&(d=a,a=function(){return p});for(;d!==p||(d=a())!==p;)128>d?b(d&127):(2048>d?b(d>>6&31|192):(65536>d?b(d>>12&15|224):(b(d>>18&7|240),b(d>>12&63|128)),b(d>>6&63|128)),b(d&63|128)),d=p},e:function(a,b){function d(a){a=a.slice(0,a.indexOf(p));var b=Error(a.toString());b.name="TruncatedError";b.bytes=a;l(b)}for(var c,e,k,h;(c=a())!==p;)0===(c&128)?b(c):192===(c&224)?((e=a())===p&&d([c,e]),b((c&31)<<6|e&63)):224===(c&240)?(((e=a())===p||(k=a())===p)&&d([c,e, +k]),b((c&15)<<12|(e&63)<<6|k&63)):240===(c&248)?(((e=a())===p||(k=a())===p||(h=a())===p)&&d([c,e,k,h]),b((c&7)<<18|(e&63)<<12|(k&63)<<6|h&63)):l(RangeError("Illegal starting byte: "+c))},b:function(a,b){for(var c,f=p;(c=f!==p?f:a())!==p;)55296<=c&&57343>=c&&(f=a())!==p&&56320<=f&&57343>=f?(b(1024*(c-55296)+f-56320+65536),f=p):b(c);f!==p&&b(f)},d:function(a,b){var c=p;"number"===typeof a&&(c=a,a=function(){return p});for(;c!==p||(c=a())!==p;)65535>=c?b(c):(c-=65536,b((c>>10)+55296),b(c%1024+56320)), +c=p},f:function(a,b){c.b(a,function(a){c.g(a,b)})},k:function(a,b){c.e(a,function(a){c.d(a,b)})},c:function(a){return 128>a?1:2048>a?2:65536>a?3:4},j:function(a){for(var b,d=0;(b=a())!==p;)d+=c.c(b);return d},i:function(a){var b=0,d=0;c.b(a,function(a){++b;d+=c.c(a)});return[b,d]}};return c}();Date.now=Date.now||function(){return+new Date};var J=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069, +3041331479,2450970073,2306472731],K=[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828, +289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486, +1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557, +442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592, +3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370, +48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946,1266315497,3048417604,3681880366,3289982499,290971E4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509, +1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880, +613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303, +2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385, +1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030, +4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055,3913112168, +2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499, +499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905, +3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651, +309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610, +1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037, +2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504,976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200, +2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241, +3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891, +3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409E3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588, +3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493, +1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462],E=[1332899944,1700884034,1701343084,1684370003,1668446532, +1869963892];"undefined"!==typeof module&&module.exports?module.exports=n:"undefined"!==typeof define&&define.amd?define(function(){return n}):(t.dcodeIO=t.dcodeIO||{}).bcrypt=n})(this);})(); diff --git a/p/scripts/main.js b/p/scripts/main.js index b6370866f..dc5428048 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -1014,7 +1014,7 @@ function init_crypto_form() { try { var strong = window.Uint32Array && window.crypto && (typeof window.crypto.getRandomValues === 'function'), s = dcodeIO.bcrypt.hashSync($('#passwordPlain').val(), data.salt1), - c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? 4 : poormanSalt()); + c = dcodeIO.bcrypt.hashSync(data.nonce + s, strong ? dcodeIO.bcrypt.genSaltSync(4) : poormanSalt()); $('#challenge').val(c); if (s == '' || c == '') { openNotification('Crypto error!', 'bad'); -- cgit v1.2.3 From c6f35ef51c2c536efb4f8e73603ae46b8512cc24 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 27 Oct 2014 21:45:30 +0100 Subject: Global limits for number of feeds and categories New 'limits' sub-array in config.php with 'max_feeds' and 'max_categories'. If the values are < 0, then it is the default value (16384). https://github.com/marienfressinaud/FreshRSS/issues/680 --- app/Controllers/categoryController.php | 7 +++++++ app/Controllers/feedController.php | 7 +++++++ lib/Minz/Configuration.php | 26 ++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 977ce51be..ef8af7ed6 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -33,6 +33,13 @@ class FreshRSS_category_Controller extends Minz_ActionController { $catDAO = new FreshRSS_CategoryDAO(); $url_redirect = array('c' => 'subscription', 'a' => 'index'); + $limits = Minz_Configuration::limits(); + $this->view->categories = $catDAO->listCategories(false); + if (count($this->view->categories) >= $limits['max_categories']) { + Minz_Request::bad(_t('over_max_categories', $limits['max_categories']), $url_redirect); + return; + } + if (Minz_Request::isPost()) { invalidateHttpCache(); diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index c2859edf4..39e4b5761 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -68,6 +68,13 @@ class FreshRSS_feed_Controller extends Minz_ActionController { 'params' => array(), ); + $limits = Minz_Configuration::limits(); + $this->view->feeds = $feedDAO->listFeeds(); + if (count($this->view->feeds) >= $limits['max_feeds']) { + Minz_Request::bad(_t('over_max_feeds', $limits['max_feeds']), $url_redirect); + return; + } + if (Minz_Request::isPost()) { @set_time_limit(300); diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 554bc8c96..fe9ea6b2e 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -60,6 +60,12 @@ class Minz_Configuration { 'prefix' => '', ); + const MAX_SMALL_INT = 16384; + private static $limits = array( + 'max_feeds' => Minz_Configuration::MAX_SMALL_INT, + 'max_categories' => Minz_Configuration::MAX_SMALL_INT, + ); + /* * Getteurs */ @@ -97,6 +103,9 @@ class Minz_Configuration { public static function dataBase () { return self::$db; } + public static function limits() { + return self::$limits; + } public static function defaultUser () { return self::$default_user; } @@ -178,6 +187,7 @@ class Minz_Configuration { 'api_enabled' => self::$api_enabled, 'unsafe_autologin_enabled' => self::$unsafe_autologin_enabled, ), + 'limits' => self::$limits, 'db' => self::$db, ); @rename(DATA_PATH . self::CONF_PATH_NAME, DATA_PATH . self::CONF_PATH_NAME . '.bak.php'); @@ -291,6 +301,22 @@ class Minz_Configuration { ); } + if (isset($ini_array['limits'])) { + $limits = $ini_array['limits']; + if (isset($limits['max_feeds'])) { + self::$limits['max_feeds'] = intval($limits['max_feeds']); + if (self::$limits['max_feeds'] < 0 || self::$limits['max_feeds'] > Minz_Configuration::MAX_SMALL_INT) { + self::$limits['max_feeds'] = Minz_Configuration::MAX_SMALL_INT; + } + } + if (isset($limits['max_categories'])) { + self::$limits['max_categories'] = intval($limits['max_categories']); + if (self::$limits['max_categories'] < 0 || self::$limits['max_categories'] > Minz_Configuration::MAX_SMALL_INT) { + self::$limits['max_categories'] = Minz_Configuration::MAX_SMALL_INT; + } + } + } + // Base de données if (isset ($ini_array['db'])) { $db = $ini_array['db']; -- cgit v1.2.3 From 2e5d4d97c989f55c3506ceb918126eaf9c68f1d6 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 28 Oct 2014 22:29:55 +0100 Subject: More limit options in config.php See e.g. https://github.com/marienfressinaud/FreshRSS/issues/681 https://github.com/marienfressinaud/FreshRSS/issues/680 https://github.com/marienfressinaud/FreshRSS/issues/656 --- CHANGELOG | 6 ++++++ lib/Minz/Configuration.php | 26 ++++++++++++++++++++------ lib/lib_rss.php | 5 +++-- 3 files changed, 29 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 44d3452ae..688a286e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,11 @@ # Journal des modifications +## + +* Configuration + * New options in config.php for cache duration, timeout, max number of feeds and categories per user. + + ## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) * UI diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index fe9ea6b2e..9511cb357 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -62,6 +62,8 @@ class Minz_Configuration { const MAX_SMALL_INT = 16384; private static $limits = array( + 'cache_duration' => 800, //SimplePie cache duration in seconds + 'timeout' => 10, //SimplePie timeout in seconds 'max_feeds' => Minz_Configuration::MAX_SMALL_INT, 'max_categories' => Minz_Configuration::MAX_SMALL_INT, ); @@ -303,16 +305,28 @@ class Minz_Configuration { if (isset($ini_array['limits'])) { $limits = $ini_array['limits']; + if (isset($limits['cache_duration'])) { + $v = intval($limits['cache_duration']); + if ($v > 0) { + self::$limits['cache_duration'] = $v; + } + } + if (isset($limits['timeout'])) { + $v = intval($limits['timeout']); + if ($v > 0) { + self::$limits['timeout'] = $v; + } + } if (isset($limits['max_feeds'])) { - self::$limits['max_feeds'] = intval($limits['max_feeds']); - if (self::$limits['max_feeds'] < 0 || self::$limits['max_feeds'] > Minz_Configuration::MAX_SMALL_INT) { - self::$limits['max_feeds'] = Minz_Configuration::MAX_SMALL_INT; + $v = intval($limits['max_feeds']); + if ($v > 0 && $v < Minz_Configuration::MAX_SMALL_INT) { + self::$limits['max_feeds'] = $v; } } if (isset($limits['max_categories'])) { - self::$limits['max_categories'] = intval($limits['max_categories']); - if (self::$limits['max_categories'] < 0 || self::$limits['max_categories'] > Minz_Configuration::MAX_SMALL_INT) { - self::$limits['max_categories'] = Minz_Configuration::MAX_SMALL_INT; + $v = intval($limits['max_categories']); + if ($v > 0 && $v < Minz_Configuration::MAX_SMALL_INT) { + self::$limits['max_categories'] = $v; } } } diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 8ae357f02..3648a4582 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -110,11 +110,12 @@ function html_only_entity_decode($text) { } function customSimplePie() { + $limits = Minz_Configuration::limits(); $simplePie = new SimplePie(); $simplePie->set_useragent(_t('freshrss') . '/' . FRESHRSS_VERSION . ' (' . PHP_OS . '; ' . FRESHRSS_WEBSITE . ') ' . SIMPLEPIE_NAME . '/' . SIMPLEPIE_VERSION); $simplePie->set_cache_location(CACHE_PATH); - $simplePie->set_cache_duration(800); - $simplePie->set_timeout(10); //TODO: Make a user setting + $simplePie->set_cache_duration($limits['cache_duration']); + $simplePie->set_timeout($limits['timeout']); $simplePie->strip_htmltags(array( 'base', 'blink', 'body', 'doctype', 'embed', 'font', 'form', 'frame', 'frameset', 'html', -- cgit v1.2.3 From 4cbd7e0583709912d790ed04a72b75d79da31b73 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 28 Oct 2014 23:32:55 +0100 Subject: Bug: unlock was not done for feeds with error --- app/Controllers/feedController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 39e4b5761..7ac083d56 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -293,6 +293,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } catch (FreshRSS_Feed_Exception $e) { Minz_Log::notice($e->getMessage()); $feedDAO->updateLastUpdate($feed->id(), 1); + $feed->unlock(); continue; } -- cgit v1.2.3 From 00127f07c5fc784130d658e3f26519b0279fc6b8 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 28 Oct 2014 23:52:46 +0100 Subject: SimplePie: cache feeds with errors Before the cache system was not used for feeds with errors, which was problematic especially if several users have this feed. Furthermore, there was no protection against repetitive refresh. Bonus: slightly better performance by avoiding some superfluous file_exists(). Warning: needs a bit of testing https://github.com/marienfressinaud/FreshRSS/issues/681 --- app/Models/Feed.php | 3 ++- lib/SimplePie/SimplePie.php | 24 +++++++++++++++--------- lib/SimplePie/SimplePie/Cache/File.php | 12 ++++++------ 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 03baf3ad2..bd1babeea 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -217,7 +217,8 @@ class FreshRSS_Feed extends Minz_Model { $mtime = $feed->init(); if ((!$mtime) || $feed->error()) { - throw new FreshRSS_Feed_Exception($feed->error() . ' [' . $url . ']'); + $errorMessage = $feed->error(); + throw new FreshRSS_Feed_Exception(($errorMessage == '' ? 'Feed error' : $errorMessage) . ' [' . $url . ']'); } if ($loadDetails) { diff --git a/lib/SimplePie/SimplePie.php b/lib/SimplePie/SimplePie.php index 06c100f59..84001dd9a 100644 --- a/lib/SimplePie/SimplePie.php +++ b/lib/SimplePie/SimplePie.php @@ -1455,7 +1455,11 @@ class SimplePie { // Load the Cache $this->data = $cache->load(); - if (!empty($this->data)) + if ($cache->mtime() + $this->cache_duration > time()) { //FreshRSS + $this->raw_data = false; + return true; // If the cache is still valid, just return true + } + elseif (!empty($this->data)) { // If the cache is for an outdated build of SimplePie if (!isset($this->data['build']) || $this->data['build'] !== SIMPLEPIE_BUILD) @@ -1487,7 +1491,7 @@ class SimplePie } } // Check if the cache has been updated - elseif ($cache->mtime() + $this->cache_duration < time()) + else //if ($cache->mtime() + $this->cache_duration < time()) //FreshRSS removed { // If we have last-modified and/or etag set //if (isset($this->data['headers']['last-modified']) || isset($this->data['headers']['etag'])) //FreshRSS removed @@ -1516,6 +1520,7 @@ class SimplePie } else { + $cache->touch(); //FreshRSS $this->error = $file->error; //FreshRSS return !empty($this->data); //FreshRSS //unset($file); //FreshRSS removed @@ -1533,17 +1538,18 @@ class SimplePie } } } - // If the cache is still valid, just return true - else - { - $this->raw_data = false; - return true; - } + //// If the cache is still valid, just return true + //else //FreshRSS removed + //{ + // $this->raw_data = false; + // return true; + //} } // If the cache is empty, delete it else { - $cache->unlink(); + //$cache->unlink(); //FreshRSS removed + $cache->touch(); //FreshRSS $this->data = array(); } } diff --git a/lib/SimplePie/SimplePie/Cache/File.php b/lib/SimplePie/SimplePie/Cache/File.php index 3b163545b..cb4b528c4 100644 --- a/lib/SimplePie/SimplePie/Cache/File.php +++ b/lib/SimplePie/SimplePie/Cache/File.php @@ -136,11 +136,11 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base */ public function mtime() { - if (file_exists($this->name)) + //if (file_exists($this->name)) //FreshRSS removed { - return filemtime($this->name); + return @filemtime($this->name); //FreshRSS } - return false; + //return false; //FreshRSS removed } /** @@ -150,11 +150,11 @@ class SimplePie_Cache_File implements SimplePie_Cache_Base */ public function touch() { - if (file_exists($this->name)) + //if (file_exists($this->name)) //FreshRSS removed { - return touch($this->name); + return @touch($this->name); //FreshRSS } - return false; + //return false; //FreshRSS removed } /** -- cgit v1.2.3 From 9f97f7df8822ed2f32a9bc9d46ece92dee93089c Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Wed, 29 Oct 2014 00:45:42 +0100 Subject: Ne pas rafraîchir les flux des utilisateurs non logués depuis x jours MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/marienfressinaud/FreshRSS/issues/681 Warning: needs some testing --- CHANGELOG | 2 +- app/Controllers/userController.php | 3 +-- app/Models/Auth.php | 13 +++++-------- app/Models/UserDAO.php | 10 +++++++++- app/actualize_script.php | 10 ++++++++++ lib/Minz/Configuration.php | 7 +++++++ 6 files changed, 33 insertions(+), 12 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 688a286e3..a556fcc13 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,7 +3,7 @@ ## * Configuration - * New options in config.php for cache duration, timeout, max number of feeds and categories per user. + * New options in config.php for cache duration, timeout, max inactivity, max number of feeds and categories per user. ## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 2343520ca..39db1d879 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -95,9 +95,8 @@ class FreshRSS_user_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('gen.title.user_management') . ' · '); // Get the correct current user. - $userDAO = new FreshRSS_UserDAO(); $username = Minz_Request::param('u', Minz_Session::param('currentUser')); - if (!$userDAO->exist($username)) { + if (!FreshRSS_UserDAO::exist($username)) { $username = Minz_Session::param('currentUser'); } $this->view->current_user = $username; diff --git a/app/Models/Auth.php b/app/Models/Auth.php index cc23d7974..2971d65c8 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -20,10 +20,11 @@ class FreshRSS_Auth { Minz_Session::_param('currentUser', $current_user); } - $access_ok = self::accessControl(); - - if ($access_ok) { + if (self::$login_ok) { self::giveAccess(); + } elseif (self::accessControl()) { + self::giveAccess(); + FreshRSS_UserDAO::touch($current_user); } else { // Be sure all accesses are removed! self::removeAccess(); @@ -38,11 +39,7 @@ class FreshRSS_Auth { * * @return boolean true if user can be connected, false else. */ - public static function accessControl() { - if (self::$login_ok) { - return true; - } - + private static function accessControl() { switch (Minz_Configuration::authType()) { case 'form': $credentials = FreshRSS_FormAuth::getCredentialsFromCookie(); diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 85b45c4a7..60fca71b1 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -54,7 +54,15 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { } } - public function exist($username) { + public static function exist($username) { return file_exists(DATA_PATH . '/' . $username . '_user.php'); } + + public static function touch($username) { + return touch(DATA_PATH . '/' . $username . '_user.php'); + } + + public static function mtime($username) { + return @filemtime(DATA_PATH . '/' . $username . '_user.php'); + } } diff --git a/app/actualize_script.php b/app/actualize_script.php index 9fe499cc9..6ce4178cd 100755 --- a/app/actualize_script.php +++ b/app/actualize_script.php @@ -22,7 +22,17 @@ if (Minz_Configuration::defaultUser() !== ''){ $users = array_unique($users); } +$limits = Minz_Configuration::limits(); +$minLastActivity = time() - $limits['max_inactivity']; + foreach ($users as $myUser) { + if (($myUser !== Minz_Configuration::defaultUser()) && (FreshRSS_UserDAO::mtime($myUser) < $minLastActivity)) { + syslog(LOG_INFO, 'FreshRSS skip inactive user ' . $myUser); + if (defined('STDOUT')) { + fwrite(STDOUT, 'FreshRSS skip inactive user ' . $myUser . "\n"); //Unbuffered + } + continue; + } syslog(LOG_INFO, 'FreshRSS actualize ' . $myUser); if (defined('STDOUT')) { fwrite(STDOUT, 'Actualize ' . $myUser . "...\n"); //Unbuffered diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 9511cb357..6cbc9fc0b 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -64,6 +64,7 @@ class Minz_Configuration { private static $limits = array( 'cache_duration' => 800, //SimplePie cache duration in seconds 'timeout' => 10, //SimplePie timeout in seconds + 'max_inactivity' => PHP_INT_MAX, //Time in seconds after which a user who has not used the account is considered inactive (no auto-refresh of feeds). 'max_feeds' => Minz_Configuration::MAX_SMALL_INT, 'max_categories' => Minz_Configuration::MAX_SMALL_INT, ); @@ -317,6 +318,12 @@ class Minz_Configuration { self::$limits['timeout'] = $v; } } + if (isset($limits['max_inactivity'])) { + $v = intval($limits['max_inactivity']); + if ($v > 0) { + self::$limits['max_inactivity'] = $v; + } + } if (isset($limits['max_feeds'])) { $v = intval($limits['max_feeds']); if ($v > 0 && $v < Minz_Configuration::MAX_SMALL_INT) { -- cgit v1.2.3 From 1ea996c4eaa0f07f4fd906e7cade68a9bee3b11d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 29 Oct 2014 10:15:22 +0100 Subject: Update i18n for limit of category. --- app/Controllers/categoryController.php | 5 +++-- app/i18n/en.php | 5 +---- app/i18n/fr.php | 5 +---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index ef8af7ed6..609284559 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -35,9 +35,10 @@ class FreshRSS_category_Controller extends Minz_ActionController { $limits = Minz_Configuration::limits(); $this->view->categories = $catDAO->listCategories(false); + if (count($this->view->categories) >= $limits['max_categories']) { - Minz_Request::bad(_t('over_max_categories', $limits['max_categories']), $url_redirect); - return; + Minz_Request::bad(_t('sub.categories.over_max', $limits['max_categories']), + $url_redirect); } if (Minz_Request::isPost()) { diff --git a/app/i18n/en.php b/app/i18n/en.php index 1e6621c12..2c61d822d 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -53,10 +53,6 @@ 'admin.check_install.pcre.ok' => 'You have the required library for regular expressions (PCRE).', 'admin.check_install.pdo.nok' => 'You lack PDO or one of the supported drivers (pdo_mysql, pdo_sqlite).', 'admin.check_install.pdo.ok' => 'You have PDO and at least one of the supported drivers (pdo_mysql, pdo_sqlite).', - 'admin.check_install.pdo_mysql.nok' => 'You lack PDO for MySQL (it\'s ok if PDO is good).', - 'admin.check_install.pdo_mysql.ok' => 'You have PDO for MySQL.', - 'admin.check_install.pdo_sqlite.nok' => 'You lack PDO for SQLite (it\'s ok if PDO is good).', - 'admin.check_install.pdo_sqlite.ok' => 'You have PDO for SQLite.', 'admin.check_install.persona.nok' => 'Check permissions on ./data/persona directory. HTTP server must have rights to write into', 'admin.check_install.persona.ok' => 'Permissions on Mozilla Persona directory are good.', 'admin.check_install.php' => 'PHP installation', @@ -477,6 +473,7 @@ 'status_unread' => 'Unread', 'steps' => 'Steps', 'sticky_post' => 'Stick the article to the top when opened', + 'sub.categories.over_max' => 'You have reached your limit of categories (%d)', 'submit' => 'Submit', 'subscription_management' => 'Subscriptions management', 'sun' => 'Sun', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 61a84cc04..2420b20c3 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -53,10 +53,6 @@ 'admin.check_install.pcre.ok' => 'Vous disposez du nécessaire pour les expressions régulières (PCRE).', 'admin.check_install.pdo.nok' => 'Vous ne disposez pas de PDO ou d’un des drivers supportés (pdo_mysql, pdo_sqlite).', 'admin.check_install.pdo.ok' => 'Vous disposez de PDO et d’au moins un des drivers supportés (pdo_mysql, pdo_sqlite).', - 'admin.check_install.pdo_mysql.nok' => 'Vous ne possédez pas PDO pour MySQL (ok si PDO est bon).', - 'admin.check_install.pdo_mysql.ok' => 'Vous possédez PDO pour MySQL.', - 'admin.check_install.pdo_sqlite.nok' => 'Vous ne possédez pas PDO pour SQLite (ok si PDO est bon).', - 'admin.check_install.pdo_sqlite.ok' => 'Vous possédez PDO pour SQLite.', 'admin.check_install.persona.nok' => 'Veuillez vérifier les droits sur le répertoire ./data/persona. Le serveur HTTP doit être capable d’écrire dedans', 'admin.check_install.persona.ok' => 'Les droits sur le répertoire de Mozilla Persona sont bons.', 'admin.check_install.php' => 'Installation de PHP', @@ -477,6 +473,7 @@ 'status_unread' => 'non lus', 'steps' => 'Étapes', 'sticky_post' => 'Aligner l’article en haut quand il est ouvert', + 'sub.categories.over_max' => 'Vous avez atteint votre limite de catégories (%d)', 'submit' => 'Valider', 'subscription_management' => 'Gestion des abonnements', 'sun' => 'dim.', -- cgit v1.2.3 From cf7350af4768809c8b5117ba586f5165a4e2b1a8 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 29 Oct 2014 10:21:34 +0100 Subject: Update i18n for limit of feeds See https://github.com/marienfressinaud/FreshRSS/issues/680 --- app/Controllers/feedController.php | 4 ++-- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 7ac083d56..8563b1c0f 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -71,8 +71,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $limits = Minz_Configuration::limits(); $this->view->feeds = $feedDAO->listFeeds(); if (count($this->view->feeds) >= $limits['max_feeds']) { - Minz_Request::bad(_t('over_max_feeds', $limits['max_feeds']), $url_redirect); - return; + Minz_Request::bad(_t('sub.feeds.over_max', $limits['max_feeds']), + $url_redirect); } if (Minz_Request::isPost()) { diff --git a/app/i18n/en.php b/app/i18n/en.php index 2c61d822d..a35a6ccf1 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -474,6 +474,7 @@ 'steps' => 'Steps', 'sticky_post' => 'Stick the article to the top when opened', 'sub.categories.over_max' => 'You have reached your limit of categories (%d)', + 'sub.feeds.over_max' => 'You have reached your limit of feeds (%d)', 'submit' => 'Submit', 'subscription_management' => 'Subscriptions management', 'sun' => 'Sun', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 2420b20c3..c29b6c9ac 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -474,6 +474,7 @@ 'steps' => 'Étapes', 'sticky_post' => 'Aligner l’article en haut quand il est ouvert', 'sub.categories.over_max' => 'Vous avez atteint votre limite de catégories (%d)', + 'sub.feeds.over_max' => 'Vous avez atteint votre limite de flux (%d)', 'submit' => 'Valider', 'subscription_management' => 'Gestion des abonnements', 'sun' => 'dim.', -- cgit v1.2.3 From fb3cda8ac9f7c8895ed33d7db432a92b063a7198 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 29 Oct 2014 11:08:31 +0100 Subject: Fix limits in import OPML files See https://github.com/marienfressinaud/FreshRSS/issues/680 --- app/Controllers/importExportController.php | 55 +++++++++++++++++++++++------- 1 file changed, 43 insertions(+), 12 deletions(-) diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index ab277e688..514077bbd 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -176,19 +176,43 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { */ private function addOpmlElements($opml_elements, $parent_cat = null) { $error = false; + + $nb_feeds = count($this->feedDAO->listFeeds()); + $nb_cats = count($this->catDAO->listCategories(false)); + $limits = Minz_Configuration::limits(); + foreach ($opml_elements as $elt) { - $res = false; + $is_error = false; if (isset($elt['xmlUrl'])) { // If xmlUrl exists, it means it is a feed - $res = $this->addFeedOpml($elt, $parent_cat); + if ($nb_feeds >= $limits['max_feeds']) { + Minz_Log::warning(_t('sub.feeds.over_max', + $limits['max_feeds'])); + $is_error = true; + continue; + } + + $is_error = $this->addFeedOpml($elt, $parent_cat); + if (!$is_error) { + $nb_feeds += 1; + } } else { // No xmlUrl? It should be a category! - $res = $this->addCategoryOpml($elt, $parent_cat); + $limit_reached = ($nb_cats >= $limits['max_categories']); + if ($limit_reached) { + Minz_Log::warning(_t('sub.categories.over_max', + $limits['max_categories'])); + } + + $is_error = $this->addCategoryOpml($elt, $parent_cat, $limit_reached); + if (!$is_error) { + $nb_cats += 1; + } } - if (!$error && $res) { + if (!$error && $is_error) { // oops: there is at least one error! - $error = $res; + $error = $is_error; } } @@ -203,16 +227,18 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * @return boolean true if an error occured, false else. */ private function addFeedOpml($feed_elt, $parent_cat) { + $default_cat = $this->catDAO->getDefault(); if (is_null($parent_cat)) { // This feed has no parent category so we get the default one - $parent_cat = $this->catDAO->getDefault()->name(); + $parent_cat = $default_cat->name(); } $cat = $this->catDAO->searchByName($parent_cat); - if (!$cat) { + if (is_null($cat)) { // If there is not $cat, it means parent category does not exist in - // database. It should not happened! - return true; + // database. + // If it happens, take the default category. + $cat = $default_cat; } // We get different useful information @@ -253,14 +279,19 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { * * @param array $cat_elt an OPML element (must be a category element). * @param string $parent_cat the name of the parent category. + * @param boolean $cat_limit_reached indicates if category limit has been reached. + * if yes, category is not added (but we try for feeds!) * @return boolean true if an error occured, false else. */ - private function addCategoryOpml($cat_elt, $parent_cat) { + private function addCategoryOpml($cat_elt, $parent_cat, $cat_limit_reached) { // Create a new Category object $cat = new FreshRSS_Category(Minz_Helper::htmlspecialchars_utf8($cat_elt['text'])); - $id = $this->catDAO->addCategoryObject($cat); - $error = ($id === false); + $error = true; + if (!$cat_limit_reached) { + $id = $this->catDAO->addCategoryObject($cat); + $error = ($id === false); + } if (isset($cat_elt['@outlines'])) { // Our cat_elt contains more categories or more feeds, so we -- cgit v1.2.3 From d20b5a127fe95f91b55f3ae9391365c67f96c4cc Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 29 Oct 2014 11:47:51 +0100 Subject: Fix limit in import Json files See https://github.com/marienfressinaud/FreshRSS/issues/680 --- app/Controllers/importExportController.php | 28 +++++++++++++++++++++++++--- app/Models/FeedDAO.php | 2 +- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 514077bbd..8028af8ed 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -327,12 +327,34 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $error = false; $article_to_feed = array(); + $nb_feeds = count($this->feedDAO->listFeeds()); + $limits = Minz_Configuration::limits(); + // First, we check feeds of articles are in DB (and add them if needed). foreach ($article_object['items'] as $item) { - $feed = $this->addFeedJson($item['origin'], $google_compliant); + $key = $google_compliant ? 'htmlUrl' : 'feedUrl'; + $feed = new FreshRSS_Feed($item['origin'][$key]); + $feed = $this->feedDAO->searchByUrl($feed->url()); + if (is_null($feed)) { - $error = true; - } else { + // Feed does not exist in DB,we should to try to add it. + if ($nb_feeds >= $limits['max_feeds']) { + // Oops, no more place! + Minz_Log::warning(_t('sub.feeds.over_max', $limits['max_feeds'])); + } else { + $feed = $this->addFeedJson($item['origin'], $google_compliant); + } + + if (is_null($feed)) { + // Still null? It means something went wrong. + $error = true; + } else { + // Nice! Increase the counter. + $nb_feeds += 1; + } + } + + if (!is_null($feed)) { $article_to_feed[$item['id']] = $feed->id(); } } diff --git a/app/Models/FeedDAO.php b/app/Models/FeedDAO.php index 852de6e36..74597c730 100644 --- a/app/Models/FeedDAO.php +++ b/app/Models/FeedDAO.php @@ -191,7 +191,7 @@ class FreshRSS_FeedDAO extends Minz_ModelPdo { $res = $stm->fetchAll(PDO::FETCH_ASSOC); $feed = current(self::daoToFeed($res)); - if (isset($feed)) { + if (isset($feed) && $feed !== false) { return $feed; } else { return null; -- cgit v1.2.3 From 9478d2f0116be69e08071dd02c0f945c5f78d7e0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 30 Oct 2014 12:43:52 +0100 Subject: Add do_post_update support --- app/Controllers/updateController.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 4ebb11f51..4ef5357ea 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -109,6 +109,19 @@ class FreshRSS_update_Controller extends Minz_ActionController { require(UPDATE_FILENAME); + if (Minz_Request::param('post_conf', false)) { + $res = do_post_update(); + + if ($res === true) { + @unlink(UPDATE_FILENAME); + @file_put_contents(DATA_PATH . '/last_update.txt', time()); + Minz_Request::good(_t('update_finished')); + } else { + Minz_Request::bad(_t('update_problem', $res), + array('c' => 'update', 'a' => 'index')); + } + } + if (Minz_Request::isPost()) { save_info_update(); } @@ -117,10 +130,11 @@ class FreshRSS_update_Controller extends Minz_ActionController { $res = apply_update(); if ($res === true) { - @unlink(UPDATE_FILENAME); - @file_put_contents(DATA_PATH . '/last_update.txt', time()); - - Minz_Request::good(_t('update_finished')); + Minz_Request::forward(array( + 'c' => 'update', + 'a' => 'apply', + 'params' => array('post_conf' => true) + ), true); } else { Minz_Request::bad(_t('update_problem', $res), array('c' => 'update', 'a' => 'index')); -- cgit v1.2.3 From ee5bbe48269a2fd5bc9c175fdb1e5a92a2c04502 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 30 Oct 2014 19:19:09 +0100 Subject: Fix bug size with SQLite --- app/Controllers/configureController.php | 2 +- lib/Minz/ModelPdo.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index cafd0e8a8..deb8cc849 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -225,7 +225,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_View::prependTitle(_t('archiving_configuration') . ' · '); - $entryDAO = FreshRSS_Factory::createEntryDao(); + $entryDAO = FreshRSS_Factory::createEntryDao('freshrss'); $this->view->nb_total = $entryDAO->count(); $this->view->size_user = $entryDAO->size(); diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php index 827c89c69..6198cd85c 100644 --- a/lib/Minz/ModelPdo.php +++ b/lib/Minz/ModelPdo.php @@ -17,6 +17,7 @@ class Minz_ModelPdo { private static $sharedBd = null; private static $sharedPrefix; private static $has_transaction = false; + private static $sharedCurrentUser; protected static $sharedDbType; /** @@ -39,6 +40,7 @@ class Minz_ModelPdo { if (self::$useSharedBd && self::$sharedBd != null && $currentUser === null) { $this->bd = self::$sharedBd; $this->prefix = self::$sharedPrefix; + $this->current_user = self::$sharedCurrentUser; return; } @@ -48,6 +50,7 @@ class Minz_ModelPdo { $currentUser = Minz_Session::param('currentUser', '_'); } $this->current_user = $currentUser; + self::$sharedCurrentUser = $currentUser; try { $type = $db['type']; -- cgit v1.2.3 From 036240ab01999c8eff1b9b3a98a7313cf43f5836 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 30 Oct 2014 19:31:32 +0100 Subject: Fix coding style formatNumber and formatBytes --- app/views/configure/archiving.phtml | 4 ++-- app/views/stats/index.phtml | 20 ++++++++++---------- app/views/user/manage.phtml | 4 ++-- lib/lib_rss.php | 14 ++++++-------- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/app/views/configure/archiving.phtml b/app/views/configure/archiving.phtml index 410434599..7c2d79343 100644 --- a/app/views/configure/archiving.phtml +++ b/app/views/configure/archiving.phtml @@ -60,7 +60,7 @@
    - nb_total), formatBytes($this->size_user)); ?> + nb_total), format_bytes($this->size_user)); ?>
    @@ -68,7 +68,7 @@
    - size_total); ?> + size_total); ?>
    diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index ba4258b71..c75810850 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -18,23 +18,23 @@ - repartition['main_stream']['total']); ?> - repartition['all_feeds']['total']); ?> + repartition['main_stream']['total']); ?> + repartition['all_feeds']['total']); ?> - repartition['main_stream']['read']); ?> - repartition['all_feeds']['read']); ?> + repartition['main_stream']['read']); ?> + repartition['all_feeds']['read']); ?> - repartition['main_stream']['unread']); ?> - repartition['all_feeds']['unread']); ?> + repartition['main_stream']['unread']); ?> + repartition['all_feeds']['unread']); ?> - repartition['main_stream']['favorite']); ?> - repartition['all_feeds']['favorite']); ?> + repartition['main_stream']['favorite']); ?> + repartition['all_feeds']['favorite']); ?> @@ -56,8 +56,8 @@ - - repartition['all_feeds']['total'] * 100, 1);?> + + repartition['all_feeds']['total'] * 100, 1);?> diff --git a/app/views/user/manage.phtml b/app/views/user/manage.phtml index 2bfd633a2..e46e02572 100644 --- a/app/views/user/manage.phtml +++ b/app/views/user/manage.phtml @@ -65,8 +65,8 @@

    nb_articles), - formatBytes($this->size_user)); ?>

    + format_number($this->nb_articles), + format_bytes($this->size_user)); ?>

    diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 3648a4582..317c6852f 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -56,16 +56,14 @@ function checkUrl($url) { } } -function formatNumber($n, $precision = 0) { - return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable - number_format($n, $precision, '.', ' ')); //number_format does not seem to be Unicode-compatible -} function format_number($n, $precision = 0) { - // TODO: coding style, prefer THIS function. Remove formatNumber. - return formatNumber($n, $precision); + // number_format does not seem to be Unicode-compatible + return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable + number_format($n, $precision, '.', ' ') + ); } -function formatBytes($bytes, $precision = 2, $system = 'IEC') { +function format_bytes($bytes, $precision = 2, $system = 'IEC') { if ($system === 'IEC') { $base = 1024; $units = array('B', 'KiB', 'MiB', 'GiB', 'TiB'); @@ -77,7 +75,7 @@ function formatBytes($bytes, $precision = 2, $system = 'IEC') { $pow = $bytes === 0 ? 0 : floor(log($bytes) / log($base)); $pow = min($pow, count($units) - 1); $bytes /= pow($base, $pow); - return formatNumber($bytes, $precision) . ' ' . $units[$pow]; + return format_number($bytes, $precision) . ' ' . $units[$pow]; } function timestamptodate ($t, $hour = true) { -- cgit v1.2.3 From ba832bef4de4a02df46023b389f752b01d43c98b Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 30 Oct 2014 19:34:36 +0100 Subject: Fix TODO in format_number() --- lib/lib_rss.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lib_rss.php b/lib/lib_rss.php index 317c6852f..e7ca95aba 100644 --- a/lib/lib_rss.php +++ b/lib/lib_rss.php @@ -58,7 +58,7 @@ function checkUrl($url) { function format_number($n, $precision = 0) { // number_format does not seem to be Unicode-compatible - return str_replace(' ', ' ', //Espace insécable //TODO: remplacer par une espace _fine_ insécable + return str_replace(' ', ' ', //Espace fine insécable number_format($n, $precision, '.', ' ') ); } -- cgit v1.2.3 From 58deab37cdd97e93ac25aba574a32befe1db2243 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 30 Oct 2014 19:57:08 +0100 Subject: Fix Minz_Error::error() -> use default values --- app/Controllers/authController.php | 3 +-- app/Controllers/categoryController.php | 5 +---- app/Controllers/configureController.php | 5 +---- app/Controllers/entryController.php | 5 +---- app/Controllers/feedController.php | 10 ++-------- app/Controllers/importExportController.php | 5 +---- app/Controllers/statsController.php | 29 +++++++++++++---------------- app/Controllers/subscriptionController.php | 10 ++-------- app/Controllers/updateController.php | 5 +---- app/Controllers/userController.php | 8 ++------ 10 files changed, 25 insertions(+), 60 deletions(-) diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 491be8d8a..44496cd3e 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -19,8 +19,7 @@ class FreshRSS_auth_Controller extends Minz_ActionController { */ public function indexAction() { if (!FreshRSS_Auth::hasAccess('admin')) { - Minz_Error::error(403, - array('error' => array(_t('access_denied')))); + Minz_Error::error(403); } Minz_View::prependTitle(_t('gen.title.authentication') . ' · '); diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 609284559..50b1d841a 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -13,10 +13,7 @@ class FreshRSS_category_Controller extends Minz_ActionController { */ public function firstAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } $catDAO = new FreshRSS_CategoryDAO(); diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index deb8cc849..1c8ac9111 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -11,10 +11,7 @@ class FreshRSS_configure_Controller extends Minz_ActionController { */ public function firstAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } } diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index d11f3a520..b4beed619 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -11,10 +11,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { */ public function firstAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } // If ajax request, we do not print layout diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 8563b1c0f..9990a852c 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -20,10 +20,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $action = Minz_Request::actionName(); if ($action !== 'actualize' || !(Minz_Configuration::allowAnonymousRefresh() || $token_is_ok)) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } } } @@ -442,10 +439,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } else { Minz_Log::warning('Cannot move feed `' . $feed_id . '` ' . 'in the category `' . $cat_id . '`'); - Minz_Error::error( - 404, - array('error' => array(_t('error_occurred'))) - ); + Minz_Error::error(404); } } diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 8028af8ed..4e2dbd157 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -11,10 +11,7 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { */ public function firstAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } require_once(LIB_PATH . '/lib_opml.php'); diff --git a/app/Controllers/statsController.php b/app/Controllers/statsController.php index 0e3430fcc..18fbca6df 100644 --- a/app/Controllers/statsController.php +++ b/app/Controllers/statsController.php @@ -5,6 +5,19 @@ */ class FreshRSS_stats_Controller extends Minz_ActionController { + /** + * This action is called before every other action in that class. It is + * the common boiler plate for every action. It is triggered by the + * underlying framework. + */ + public function firstAction() { + if (!FreshRSS_Auth::hasAccess()) { + Minz_Error::error(403); + } + + Minz_View::prependTitle(_t('stats') . ' · '); + } + /** * This action handles the statistic main page. * @@ -111,20 +124,4 @@ class FreshRSS_stats_Controller extends Minz_ActionController { $this->view->repartitionMonth = $statsDAO->calculateEntryRepartitionPerFeedPerMonth($id); $this->view->averageMonth = $statsDAO->calculateEntryAveragePerFeedPerMonth($id); } - - /** - * This action is called before every other action in that class. It is - * the common boiler plate for every action. It is triggered by the - * underlying framework. - */ - public function firstAction() { - if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, array('error' => array(_t('access_denied'))) - ); - } - - Minz_View::prependTitle(_t('stats') . ' · '); - } - } diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index a89168eb3..67b95eba6 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -11,10 +11,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { */ public function firstAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } $catDAO = new FreshRSS_CategoryDAO(); @@ -71,10 +68,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $id = Minz_Request::param('id'); if ($id === false || !isset($this->view->feeds[$id])) { - Minz_Error::error( - 404, - array('error' => array(_t('page_not_found'))) - ); + Minz_Error::error(404); return; } diff --git a/app/Controllers/updateController.php b/app/Controllers/updateController.php index 4ef5357ea..0896b13ac 100644 --- a/app/Controllers/updateController.php +++ b/app/Controllers/updateController.php @@ -4,10 +4,7 @@ class FreshRSS_update_Controller extends Minz_ActionController { public function firstAction() { $current_user = Minz_Session::param('currentUser', ''); if (!FreshRSS_Auth::hasAccess('admin')) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } invalidateHttpCache(); diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 39db1d879..5050571a9 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -15,10 +15,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { */ public function firstAction() { if (!FreshRSS_Auth::hasAccess()) { - Minz_Error::error( - 403, - array('error' => array(_t('access_denied'))) - ); + Minz_Error::error(403); } } @@ -88,8 +85,7 @@ class FreshRSS_user_Controller extends Minz_ActionController { */ public function manageAction() { if (!FreshRSS_Auth::hasAccess('admin')) { - Minz_Error::error(403, - array('error' => array(_t('access_denied')))); + Minz_Error::error(403); } Minz_View::prependTitle(_t('gen.title.user_management') . ' · '); -- cgit v1.2.3 From 39d2a26cf0cbdf9238ba7a43c812225565f094b1 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 30 Oct 2014 20:00:25 +0100 Subject: Fix bug in stats/index.phtml --- app/views/stats/index.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/stats/index.phtml b/app/views/stats/index.phtml index c75810850..1300cb2c7 100644 --- a/app/views/stats/index.phtml +++ b/app/views/stats/index.phtml @@ -23,7 +23,7 @@ - repartition['main_stream']['read']); ?> + repartition['main_stream']['read']); ?> repartition['all_feeds']['read']); ?> -- cgit v1.2.3 From 3d3dc81e0fd382112a98e895559980836970bf80 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 31 Oct 2014 14:23:11 +0100 Subject: Update CHANGELOG --- CHANGELOG | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a556fcc13..1543847df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,42 @@ # Journal des modifications -## +## 2014-10-31 FreshRSS 0.9.2 (beta) +* UI + * New subscription page (introduce .box items) + * Change feed category by drag and drop + * New feed aside on the main page + * New configuration / administration organization * Configuration * New options in config.php for cache duration, timeout, max inactivity, max number of feeds and categories per user. +* Refactoring + * Refactor authentication system (introduce FreshRSS_Auth model) + * Refactor indexController (introduce FreshRSS_Context model) + * Use ```_t()```, ```_i()```, ```_url()```, ```Minz_Request::good()``` and ```Minz_Request::bad()``` as much as possible + * Refactor javascript_vars.phtml + * Better coding style +* I18n + * Introduce a new system for i18n keys (not finished yet) +* Misc. + * Fix global view (didn't work anymore) + * Add do_post_update for update system + * Introduce ```checkInstallAction``` to test if FreshRSS installation is ok + + + +## 2014-10-09 FreshRSS 0.8.1 / 0.9.1 (beta) + +* UI + * Add a space after tag icon +* Statistics + * Add an average per day on the 30 day period graph + * Add percent of total on top 10 feed +* Bug fixes + * Fix "mark as read" in global view + * Fix "read all" shortcut + * Fix categories not appearing when adding a new feed (GET action) + * Fix enclosure problem + * Fix getExtension() on PHP < 5.3.7 ## 2014-09-26 FreshRSS 0.8.0 / 0.9.0 (beta) -- cgit v1.2.3 From d9c56fb6f76a0a79ec193188e7416d624944c8f3 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 31 Oct 2014 15:58:19 +0100 Subject: Remove check database for next beta See https://github.com/FreshRSS/FreshRSS/issues/678 --- app/views/update/checkInstall.phtml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/views/update/checkInstall.phtml b/app/views/update/checkInstall.phtml index 5f913bccd..b36551340 100644 --- a/app/views/update/checkInstall.phtml +++ b/app/views/update/checkInstall.phtml @@ -25,6 +25,7 @@

    + status_database as $key => $status) { ?> @@ -32,5 +33,6 @@

    + */ ?>
    -- cgit v1.2.3 From 724e13f0a6419b046b33da71e66058e279551edd Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 31 Oct 2014 16:43:05 +0100 Subject: Fix global view mark as read --- app/views/index/global.phtml | 5 +++-- p/scripts/global_view.js | 12 ++++++------ p/themes/base-theme/template.css | 6 +++--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml index 0975a5a00..ae7f5ffbc 100644 --- a/app/views/index/global.phtml +++ b/app/views/index/global.phtml @@ -47,7 +47,8 @@ ?>
    -
    -
    display_posts ? '' : ' class="hide_posts"'; ?>> +
    +
    display_posts ? '' : ' class="hide_posts"'; ?>> +
    diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 14909f44e..7d7ba22b5 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -24,12 +24,13 @@ function load_panel(link) { // en en ouvrant une autre ensuite, on se retrouve au même point de scroll $("#panel").scrollTop(0); - $('#panel').on('click', '#nav_menu_read_all > a, #nav_menu_read_all .item > a, #bigMarkAsRead', function () { + $('#panel').on('click', '#nav_menu_read_all button, #bigMarkAsRead', function () { + console.log($(this).attr("formaction")); $.ajax({ - url: $(this).attr("href"), + type: "POST", + url: $(this).attr("formaction"), async: false }); - //$("#panel .close").first().click(); window.location.reload(false); return false; }); @@ -39,9 +40,8 @@ function load_panel(link) { } function init_close_panel() { - $("#panel .close").click(function () { - $("#panel").html('' + icons['close'] + ''); - init_close_panel(); + $("#overlay .close").click(function () { + $("#panel").html(''); $("#panel").slideToggle(); $("#overlay").fadeOut(); diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.css index 79fe506f2..5ba621415 100644 --- a/p/themes/base-theme/template.css +++ b/p/themes/base-theme/template.css @@ -645,13 +645,13 @@ br + br + br { overflow: auto; background: #fff; } -#panel .close { +#overlay .close { position: fixed; top: 0; bottom: 0; left: 0; right: 0; display: block; } -#panel .close img { +#overlay .close img { display: none; } @@ -762,7 +762,7 @@ br + br + br { } #panel { - top: 0; bottom: 0; + top: 25px; bottom: 30px; left: 0; right: 0; } #panel .close { -- cgit v1.2.3