From aeda49a7d271c2196fcba0d3b2b15d31ad0b33b5 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 5 Nov 2016 20:48:46 +0100 Subject: Add CLI for user information + Fix last user activity https://github.com/FreshRSS/FreshRSS/issues/1345 --- app/Models/Auth.php | 2 +- app/Models/EntryDAO.php | 5 +++++ app/Models/UserDAO.php | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'app/Models') diff --git a/app/Models/Auth.php b/app/Models/Auth.php index b93942e19..3313fdf3f 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -25,7 +25,7 @@ class FreshRSS_Auth { self::giveAccess(); } elseif (self::accessControl()) { self::giveAccess(); - FreshRSS_UserDAO::touch($current_user); + FreshRSS_UserDAO::touch(); } else { // Be sure all accesses are removed! self::removeAccess(); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index 58f2c1a79..d8a4a486d 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -241,6 +241,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { if (count($ids) < 1) { return 0; } + FreshRSS_UserDAO::touch(); $sql = 'UPDATE `' . $this->prefix . 'entry` ' . 'SET is_favorite=? ' . 'WHERE id IN (' . str_repeat('?,', count($ids) - 1). '?)'; @@ -315,6 +316,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { * @return integer affected rows */ public function markRead($ids, $is_read = true) { + FreshRSS_UserDAO::touch(); if (is_array($ids)) { //Many IDs at once (used by API) if (count($ids) < 6) { //Speed heuristics $affected = 0; @@ -379,6 +381,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { * @return integer affected rows */ public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadEntries(0) is deprecated!'); @@ -421,6 +424,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { * @return integer affected rows */ public function markReadCat($id, $idMax = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadCat(0) is deprecated!'); @@ -458,6 +462,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { * @return integer affected rows */ public function markReadFeed($id_feed, $idMax = 0, $filter = null, $state = 0) { + FreshRSS_UserDAO::touch(); if ($idMax == 0) { $idMax = time() . '000000'; Minz_Log::debug('Calling markReadFeed(0) is deprecated!'); diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index a95ee6bc4..190954b1a 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -84,7 +84,11 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { return is_dir(join_path(DATA_PATH , 'users', $username)); } - public static function touch($username) { + public static function touch($username = '') { + if (($username == '') || (!ctype_alnum($username))) { + $username = Minz_Session::param('currentUser', '_'); + } + Minz_Log::debug('touch ' . $username); return touch(join_path(DATA_PATH , 'users', $username, 'config.php')); } -- cgit v1.2.3 From 5aeaed897119ff1af4555ec93662d68c2252ba71 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 6 Nov 2016 11:24:51 +0100 Subject: PostgreSQL fix updateCachedValues https://github.com/FreshRSS/FreshRSS/issues/1360 --- app/Models/Factory.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'app/Models') diff --git a/app/Models/Factory.php b/app/Models/Factory.php index 764987c46..b12f0cef9 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -7,6 +7,8 @@ class FreshRSS_Factory { switch ($conf->db['type']) { case 'sqlite': return new FreshRSS_FeedDAOSQLite($username); + case 'pgsql': + return new FreshRSS_FeedDAOSQLite($username); default: return new FreshRSS_FeedDAO($username); } -- cgit v1.2.3 From 34868cd2911523163c6732d58efa00d3fe322d4f Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 6 Nov 2016 11:33:45 +0100 Subject: Switch simplify syntax --- app/Models/Factory.php | 1 - 1 file changed, 1 deletion(-) (limited to 'app/Models') diff --git a/app/Models/Factory.php b/app/Models/Factory.php index b12f0cef9..6502c38b7 100644 --- a/app/Models/Factory.php +++ b/app/Models/Factory.php @@ -6,7 +6,6 @@ class FreshRSS_Factory { $conf = Minz_Configuration::get('system'); switch ($conf->db['type']) { case 'sqlite': - return new FreshRSS_FeedDAOSQLite($username); case 'pgsql': return new FreshRSS_FeedDAOSQLite($username); default: -- cgit v1.2.3 From 829d9997d31929b45384808f7cca343edb00b0d2 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 6 Nov 2016 14:04:06 +0100 Subject: Fix small bugs in install Small fixes in install (e.g. better check that DB password works) --- CHANGELOG.md | 1 + app/Models/UserDAO.php | 1 - app/install.php | 4 ++-- cli/README.md | 4 ++-- cli/create-user.php | 3 +++ cli/do-install.php | 12 ++++++------ data/config.default.php | 2 +- lib/lib_install.php | 6 +++++- 8 files changed, 20 insertions(+), 13 deletions(-) (limited to 'app/Models') diff --git a/CHANGELOG.md b/CHANGELOG.md index 52d95d7bd..9410ac339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ * Bug fixing * Fix bug in estimating last user activity [#1358](https://github.com/FreshRSS/FreshRSS/issues/1358) * PostgreSQL: fix bug when updating cached values [#1360](https://github.com/FreshRSS/FreshRSS/issues/1360) + * Fix small bugs in installer [#1363](https://github.com/FreshRSS/FreshRSS/pull/1363) ## 2016-11-02 FreshRSS 1.6.1 diff --git a/app/Models/UserDAO.php b/app/Models/UserDAO.php index 190954b1a..32bc6de2f 100644 --- a/app/Models/UserDAO.php +++ b/app/Models/UserDAO.php @@ -88,7 +88,6 @@ class FreshRSS_UserDAO extends Minz_ModelPdo { if (($username == '') || (!ctype_alnum($username))) { $username = Minz_Session::param('currentUser', '_'); } - Minz_Log::debug('touch ' . $username); return touch(join_path(DATA_PATH , 'users', $username, 'config.php')); } diff --git a/app/install.php b/app/install.php index fcc901713..5c8a6e0e8 100644 --- a/app/install.php +++ b/app/install.php @@ -230,7 +230,7 @@ function saveStep3() { $_SESSION['bd_error'] = ''; header('Location: index.php?step=4'); } else { - $_SESSION['bd_error'] = empty($config_array['db']['bd_error']) ? 'Unknown error!' : $config_array['db']['bd_error']; + $_SESSION['bd_error'] = empty($config_array['db']['error']) ? 'Unknown error!' : $config_array['db']['error']; } } invalidateHttpCache(); @@ -375,7 +375,7 @@ function checkDbUser(&$dbOptions) { } } catch (PDOException $e) { $ok = false; - $dbOptions['bd_error'] = $e->getMessage(); + $dbOptions['error'] = $e->getMessage(); } return $ok; } diff --git a/cli/README.md b/cli/README.md index 35c0033a4..25b12234c 100644 --- a/cli/README.md +++ b/cli/README.md @@ -32,8 +32,8 @@ Options in parenthesis are optional. ```sh cd /usr/share/FreshRSS -./cli/do-install.php --default_user admin --auth_type form ( --environment production --base_url https://rss.example.net/ --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss ) -# --auth_type can be: 'form' (recommended), 'http_auth' (using the Web server access control), 'none' (dangerous) +./cli/do-install.php --default_user admin ( --auth_type form --environment production --base_url https://rss.example.net/ --title FreshRSS --allow_anonymous --api_enabled --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123 --db-base freshrss --db-prefix freshrss ) +# --auth_type can be: 'form' (default), 'http_auth' (using the Web server access control), 'none' (dangerous) # --db-type can be: 'sqlite' (default), 'mysql' (MySQL or MariaDB), 'pgsql' (PostgreSQL) # --environment can be: 'production' (default), 'development' (for additional log messages) # --db-prefix is an optional prefix in front of the names of the tables diff --git a/cli/create-user.php b/cli/create-user.php index 008b82ce3..444264cc7 100755 --- a/cli/create-user.php +++ b/cli/create-user.php @@ -43,6 +43,9 @@ if (!$ok) { invalidateHttpCache(FreshRSS_Context::$system_conf->default_user); +echo '• Remember to refresh the feeds of the user: ', $username , "\n", + "\t", './cli/actualize-user.php --user ', $username, "\n"; + accessRights(); done($ok); diff --git a/cli/do-install.php b/cli/do-install.php index 667191680..b687b86cb 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -26,9 +26,9 @@ $dBparams = array( $options = getopt('', array_merge($params, $dBparams)); -if (empty($options['default_user']) || empty($options['auth_type'])) { - fail('Usage: ' . basename(__FILE__) . " --default_user admin --auth_type form" . - " ( --environment production --base_url https://rss.example.net/" . +if (empty($options['default_user'])) { + fail('Usage: ' . basename(__FILE__) . " --default_user admin ( --auth_type form" . + " --environment production --base_url https://rss.example.net/" . " --title FreshRSS --allow_anonymous --api_enabled" . " --db-type mysql --db-host localhost:3306 --db-user freshrss --db-password dbPassword123" . " --db-base freshrss --db-prefix freshrss )"); @@ -51,7 +51,7 @@ if (!ctype_alnum($options['default_user'])) { fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . $options['default_user']); } -if (!in_array($options['auth_type'], array('form', 'http_auth', 'none'))) { +if (isset($options['auth_type']) && !in_array($options['auth_type'], array('form', 'http_auth', 'none'))) { fail('FreshRSS invalid authentication method (auth_type must be one of { form, http_auth, none }: ' . $options['auth_type']); } @@ -86,11 +86,11 @@ if (file_put_contents(join_path(DATA_PATH, 'config.php'), " 'none', + 'auth_type' => 'form', # Allow or not the use of the API, used for mobile apps. # End-point is http://example.net/FreshRSS/p/api/greader.php diff --git a/lib/lib_install.php b/lib/lib_install.php index 0e7b7f036..dd8090bcd 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -54,8 +54,8 @@ function generateSalt() { function checkDb(&$dbOptions) { $dsn = ''; + $driver_options = null; try { - $driver_options = null; switch ($dbOptions['type']) { case 'mysql': include_once(APP_PATH . '/SQL/install.sql.mysql.php'); @@ -99,8 +99,12 @@ function checkDb(&$dbOptions) { default: return false; } + + $c = new PDO($dsn, $dbOptions['user'], $dbOptions['password'], $driver_options); + $res = $c->query('SELECT 1'); } catch (PDOException $e) { $dsn = ''; + syslog(LOG_DEBUG, 'FreshRSS SQL warning: ' . $e->getMessage()); $dbOptions['error'] = $e->getMessage(); } $dbOptions['dsn'] = $dsn; -- cgit v1.2.3 From f59de4e2b679efb1ba4bbfd576a5ea07422cc169 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 15 Nov 2016 20:43:06 +0100 Subject: Stream JSON export Avoid large in-memory copies https://github.com/FreshRSS/FreshRSS/issues/1372 --- app/Controllers/importExportController.php | 4 +- app/Models/EntryDAO.php | 42 ++++++++------ app/views/helpers/export/articles.phtml | 92 +++++++++++++++++------------- 3 files changed, 78 insertions(+), 60 deletions(-) (limited to 'app/Models') diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 3ba91a243..d86587ea9 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -641,13 +641,13 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $this->view->list_title = _t('sub.import_export.starred_list'); $this->view->type = 'starred'; $unread_fav = $this->entryDAO->countUnreadReadFavorites(); - $this->view->entries = $this->entryDAO->listWhere( + $this->view->entriesRaw = $this->entryDAO->listWhereRaw( 's', '', FreshRSS_Entry::STATE_ALL, 'ASC', $unread_fav['all'] ); } elseif ($type === 'feed' && $feed != null) { $this->view->list_title = _t('sub.import_export.feed_list', $feed->name()); $this->view->type = 'feed/' . $feed->id(); - $this->view->entries = $this->entryDAO->listWhere( + $this->view->entriesRaw = $this->entryDAO->listWhereRaw( 'f', $feed->id(), FreshRSS_Entry::STATE_ALL, 'ASC', $maxFeedEntries ); diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index d8a4a486d..397471baa 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -518,7 +518,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $stm->execute($values); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - $entries = self::daoToEntry($res); + $entries = self::daoToEntries($res); return isset($entries[0]) ? $entries[0] : null; } @@ -533,7 +533,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $stm->execute($values); $res = $stm->fetchAll(PDO::FETCH_ASSOC); - $entries = self::daoToEntry($res); + $entries = self::daoToEntries($res); return isset($entries[0]) ? $entries[0] : null; } @@ -666,7 +666,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { . ($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) { + public function listWhereRaw($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 e0.id, e0.guid, e0.title, e0.author, ' @@ -680,8 +680,12 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $stm = $this->bd->prepare($sql); $stm->execute($values); + return $stm; + } - return self::daoToEntry($stm->fetchAll(PDO::FETCH_ASSOC)); + public function listWhere($type = 'a', $id = '', $state = FreshRSS_Entry::STATE_ALL, $order = 'DESC', $limit = 1, $firstId = '', $filter = '', $date_min = 0) { + $stm = $this->listWhereRaw($type, $id, $state, $order, $limit, $firstId, $filter, $date_min); + return self::daoToEntries($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) { //For API @@ -810,15 +814,8 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { return $res[0]; } - public static function daoToEntry($listDAO) { - $list = array(); - - if (!is_array($listDAO)) { - $listDAO = array($listDAO); - } - - foreach ($listDAO as $key => $dao) { - $entry = new FreshRSS_Entry( + public static function daoToEntry($dao) { + $entry = new FreshRSS_Entry( $dao['id_feed'], $dao['guid'], $dao['title'], @@ -830,10 +827,21 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable { $dao['is_favorite'], $dao['tags'] ); - if (isset($dao['id'])) { - $entry->_id($dao['id']); - } - $list[] = $entry; + if (isset($dao['id'])) { + $entry->_id($dao['id']); + } + return $entry; + } + + private static function daoToEntries($listDAO) { + $list = array(); + + if (!is_array($listDAO)) { + $listDAO = array($listDAO); + } + + foreach ($listDAO as $key => $dao) { + $list[] = self::daoToEntry($dao); } unset($listDAO); diff --git a/app/views/helpers/export/articles.phtml b/app/views/helpers/export/articles.phtml index ffdca1daa..2ad4a3abf 100644 --- a/app/views/helpers/export/articles.phtml +++ b/app/views/helpers/export/articles.phtml @@ -1,47 +1,57 @@ 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, - 'title' => $this->list_title, - 'author' => $username, - 'items' => array() - ); + $options = 0; + if (version_compare(PHP_VERSION, '5.4.0') >= 0) { + $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; + } - foreach ($this->entries as $entry) { - if (!isset($this->feed)) { - $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed ()); - } else { - $feed = $this->feed; - } + $articles = array( + 'id' => 'user/' . str_replace('/', '', $username) . '/state/org.freshrss/' . $this->type, + 'title' => $this->list_title, + 'author' => $username, + 'items' => array(), + ); - $articles['items'][] = array( - 'id' => $entry->guid(), - 'categories' => array_values($entry->tags()), - 'title' => $entry->title(), - 'author' => $entry->author(), - 'published' => $entry->date(true), - 'updated' => $entry->date(true), - 'alternate' => array(array( - 'href' => $entry->link(), - 'type' => 'text/html' - )), - 'content' => array( - 'content' => $entry->content() - ), - 'origin' => array( - 'streamId' => $feed->id(), - 'title' => $feed->name(), - 'htmlUrl' => $feed->website(), - 'feedUrl' => $feed->url() - ) - ); - } + echo rtrim(json_encode($articles, $options), " ]}\n\r\t"); + $first = true; - $options = 0; - if (version_compare(PHP_VERSION, '5.4.0') >= 0) { - $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE; - } + foreach ($this->entriesRaw as $entryRaw) { + $entry = FreshRSS_EntryDAO::daoToEntry($entryRaw); + if (!isset($this->feed)) { + $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $entry->feed ()); + } else { + $feed = $this->feed; + } - echo json_encode($articles, $options); -?> + $article = array( + 'id' => $entry->guid(), + 'categories' => array_values($entry->tags()), + 'title' => $entry->title(), + 'author' => $entry->author(), + 'published' => $entry->date(true), + 'updated' => $entry->date(true), + 'alternate' => array(array( + 'href' => $entry->link(), + 'type' => 'text/html', + )), + 'content' => array( + 'content' => $entry->content(), + ), + 'origin' => array( + 'streamId' => $feed->id(), + 'title' => $feed->name(), + 'htmlUrl' => $feed->website(), + 'feedUrl' => $feed->url(), + ) + ); + + if ($first) { + $first = false; + } else { + echo ",\n"; + } + echo json_encode($article, $options); + } + + echo "\n]}\n"; -- cgit v1.2.3 From 332a4dec8690b658bcb878a20056aea33c673f69 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 24 Dec 2016 16:33:28 +0100 Subject: Option for cookie duration https://github.com/FreshRSS/FreshRSS/issues/1384 --- app/Controllers/authController.php | 4 ++++ app/Models/Auth.php | 11 ++++++++--- app/i18n/cz/gen.php | 2 +- app/i18n/de/gen.php | 2 +- app/i18n/en/gen.php | 2 +- app/i18n/fr/gen.php | 2 +- app/i18n/it/gen.php | 2 +- app/i18n/nl/gen.php | 2 +- app/i18n/ru/gen.php | 2 +- app/i18n/tr/gen.php | 2 +- app/views/auth/formLogin.phtml | 2 +- data/config.default.php | 3 +++ 12 files changed, 24 insertions(+), 12 deletions(-) (limited to 'app/Models') diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 9decba431..1398e4e49 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -113,6 +113,10 @@ class FreshRSS_auth_Controller extends Minz_ActionController { $file_mtime = @filemtime(PUBLIC_PATH . '/scripts/bcrypt.min.js'); Minz_View::appendScript(Minz_Url::display('/scripts/bcrypt.min.js?' . $file_mtime)); + $conf = Minz_Configuration::get('system'); + $limits = $conf->limits; + $this->view->cookie_days = round($limits['cookie_duration'] / 86400, 1); + if (Minz_Request::isPost()) { $nonce = Minz_Session::param('nonce'); $username = Minz_Request::param('username', ''); diff --git a/app/Models/Auth.php b/app/Models/Auth.php index 3313fdf3f..042210eaf 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -219,8 +219,8 @@ class FreshRSS_FormAuth { } public static function makeCookie($username, $password_hash) { + $conf = Minz_Configuration::get('system'); do { - $conf = Minz_Configuration::get('system'); $token = sha1($conf->salt . $username . uniqid(mt_rand(), true)); $token_file = DATA_PATH . '/tokens/' . $token . '.txt'; } while (file_exists($token_file)); @@ -229,7 +229,9 @@ class FreshRSS_FormAuth { return false; } - $expire = time() + 2629744; //1 month //TODO: Use a configuration instead + $limits = $conf->limits; + $cookie_duration = empty($limits['cookie_duration']) ? 2629744 : $limits['cookie_duration']; + $expire = time() + $cookie_duration; Minz_Session::setLongTermCookie('FreshRSS_login', $token, $expire); return $token; } @@ -247,7 +249,10 @@ class FreshRSS_FormAuth { } public static function purgeTokens() { - $oldest = time() - 2629744; // 1 month // TODO: Use a configuration instead + $conf = Minz_Configuration::get('system'); + $limits = $conf->limits; + $cookie_duration = empty($limits['cookie_duration']) ? 2629744 : $limits['cookie_duration']; + $oldest = time() - $cookie_duration; foreach (new DirectoryIterator(DATA_PATH . '/tokens/') as $file_info) { // $extension = $file_info->getExtension(); doesn't work in PHP < 5.3.7 $extension = pathinfo($file_info->getFilename(), PATHINFO_EXTENSION); diff --git a/app/i18n/cz/gen.php b/app/i18n/cz/gen.php index e73325c55..6722a02e5 100644 --- a/app/i18n/cz/gen.php +++ b/app/i18n/cz/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Email', - 'keep_logged_in' => 'Zapamatovat přihlášení (1 měsíc)', + 'keep_logged_in' => 'Zapamatovat přihlášení (%s dny)', 'login' => 'Login', 'logout' => 'Odhlášení', 'password' => array( diff --git a/app/i18n/de/gen.php b/app/i18n/de/gen.php index c6e7f1ef3..3f1238edc 100644 --- a/app/i18n/de/gen.php +++ b/app/i18n/de/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'E-Mail-Adresse', - 'keep_logged_in' => 'Eingeloggt bleiben (1 Monat)', + 'keep_logged_in' => 'Eingeloggt bleiben (%s Tage)', 'login' => 'Anmelden', 'logout' => 'Abmelden', 'password' => array( diff --git a/app/i18n/en/gen.php b/app/i18n/en/gen.php index 17b47ba2f..c68a0f07b 100644 --- a/app/i18n/en/gen.php +++ b/app/i18n/en/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Email address', - 'keep_logged_in' => 'Keep me logged in (1 month)', + 'keep_logged_in' => 'Keep me logged in (%s days)', 'login' => 'Login', 'logout' => 'Logout', 'password' => array( diff --git a/app/i18n/fr/gen.php b/app/i18n/fr/gen.php index d61a716a7..b5dc098ae 100644 --- a/app/i18n/fr/gen.php +++ b/app/i18n/fr/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Adresse courriel', - 'keep_logged_in' => 'Rester connecté (1 mois)', + 'keep_logged_in' => 'Rester connecté (%s jours)', 'login' => 'Connexion', 'logout' => 'Déconnexion', 'password' => array( diff --git a/app/i18n/it/gen.php b/app/i18n/it/gen.php index c02ddd13a..01c0afba8 100644 --- a/app/i18n/it/gen.php +++ b/app/i18n/it/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Indirizzo email', - 'keep_logged_in' => 'Ricorda i dati (1 mese)', + 'keep_logged_in' => 'Ricorda i dati (%s giorni)', 'login' => 'Accedi', 'logout' => 'Esci', 'password' => array( diff --git a/app/i18n/nl/gen.php b/app/i18n/nl/gen.php index 7e03229c9..a156697d5 100644 --- a/app/i18n/nl/gen.php +++ b/app/i18n/nl/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Email adres', - 'keep_logged_in' => 'Ingelogd blijven voor (1 maand)', + 'keep_logged_in' => 'Ingelogd blijven voor (%s dagen)', 'login' => 'Log in', 'logout' => 'Log uit', 'password' => array( diff --git a/app/i18n/ru/gen.php b/app/i18n/ru/gen.php index eecd72749..130fac4ed 100644 --- a/app/i18n/ru/gen.php +++ b/app/i18n/ru/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Email address', - 'keep_logged_in' => 'Keep me logged in (1 month)', + 'keep_logged_in' => 'Keep me logged in (%s дней)', 'login' => 'Login', 'logout' => 'Logout', 'password' => array( diff --git a/app/i18n/tr/gen.php b/app/i18n/tr/gen.php index 865dbd4e2..7f9d3d8e0 100644 --- a/app/i18n/tr/gen.php +++ b/app/i18n/tr/gen.php @@ -22,7 +22,7 @@ return array( ), 'auth' => array( 'email' => 'Email adresleri', - 'keep_logged_in' => '(1 ay) oturumu açık tut', + 'keep_logged_in' => '(%s günler) oturumu açık tut', 'login' => 'Giriş', 'logout' => 'Çıkış', 'password' => array( diff --git a/app/views/auth/formLogin.phtml b/app/views/auth/formLogin.phtml index 4bbc8ed55..a8213b7ae 100644 --- a/app/views/auth/formLogin.phtml +++ b/app/views/auth/formLogin.phtml @@ -20,7 +20,7 @@

diff --git a/data/config.default.php b/data/config.default.php index 8b07b85cd..433207a9c 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -74,6 +74,9 @@ return array( 'limits' => array( + # Duration in seconds of the login cookie. + 'cookie_duration' => 2592000, + # Duration in seconds of the SimplePie cache, # during which a query to the RSS feed will return the local cached version. # Especially important for multi-user setups. -- cgit v1.2.3 From 0150aec07eadd823a271f7e4c7371a4a8b26f085 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 24 Dec 2016 17:22:41 +0100 Subject: Send cookie FreshRSS_login only once Prior to this patch, two cookies with the same name were sent, the first one was to destroy the cookie, and the second one to create it --- app/Models/Auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/Models') diff --git a/app/Models/Auth.php b/app/Models/Auth.php index 3313fdf3f..e517e9b2c 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -236,8 +236,8 @@ class FreshRSS_FormAuth { public static function deleteCookie() { $token = Minz_Session::getLongTermCookie('FreshRSS_login'); - Minz_Session::deleteLongTermCookie('FreshRSS_login'); if (ctype_alnum($token)) { + Minz_Session::deleteLongTermCookie('FreshRSS_login'); @unlink(DATA_PATH . '/tokens/' . $token . '.txt'); } -- cgit v1.2.3