aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-09-09 13:03:51 +0200
committerGravatar GitHub <noreply@github.com> 2018-09-09 13:03:51 +0200
commit44bd07e506ade204151c276fdc05994d51efdd7a (patch)
tree2efe48133d2c874c65a99ae3a6cd92bb0dff4fe8 /app/Controllers
parent3306a1679c2570c30d4b662c887b4a71ce147398 (diff)
parent1802c1e9ae7d3d55a0e37e1cc2e7c0acc25f70ba (diff)
Merge pull request #2001 from FreshRSS/dev1.11.2
FreshRSS 1.11.2
Diffstat (limited to 'app/Controllers')
-rwxr-xr-xapp/Controllers/entryController.php20
-rwxr-xr-xapp/Controllers/feedController.php23
-rwxr-xr-xapp/Controllers/indexController.php2
-rwxr-xr-xapp/Controllers/javascriptController.php4
-rw-r--r--app/Controllers/userController.php11
5 files changed, 35 insertions, 25 deletions
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php
index 73e181b07..16a15c447 100755
--- a/app/Controllers/entryController.php
+++ b/app/Controllers/entryController.php
@@ -40,6 +40,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
$get = Minz_Request::param('get');
$next_get = Minz_Request::param('nextGet', $get);
$id_max = Minz_Request::param('idMax', 0);
+ $is_read = (bool)(Minz_Request::param('is_read', true));
FreshRSS_Context::$search = new FreshRSS_BooleanSearch(Minz_Request::param('search', ''));
FreshRSS_Context::$state = Minz_Request::param('state', 0);
@@ -63,39 +64,38 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
if (!$get) {
// No get? Mark all entries as read (from $id_max)
- $entryDAO->markReadEntries($id_max);
+ $entryDAO->markReadEntries($id_max, $is_read);
} else {
$type_get = $get[0];
$get = substr($get, 2);
switch($type_get) {
case 'c':
- $entryDAO->markReadCat($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state);
+ $entryDAO->markReadCat($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read);
break;
case 'f':
- $entryDAO->markReadFeed($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state);
+ $entryDAO->markReadFeed($get, $id_max, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read);
break;
case 's':
- $entryDAO->markReadEntries($id_max, true, 0, FreshRSS_Context::$search);
+ $entryDAO->markReadEntries($id_max, true, 0, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read);
break;
case 'a':
- $entryDAO->markReadEntries($id_max, false, 0, FreshRSS_Context::$search, FreshRSS_Context::$state);
+ $entryDAO->markReadEntries($id_max, false, 0, FreshRSS_Context::$search, FreshRSS_Context::$state, $is_read);
break;
}
if ($next_get !== 'a') {
// Redirect to the correct page (category, feed or starred)
- // Not "a" because it is the default value if nothing is
- // given.
+ // Not "a" because it is the default value if nothing is given.
$params['get'] = $next_get;
}
}
} else {
- $is_read = (bool)(Minz_Request::param('is_read', true));
$entryDAO->markRead($id, $is_read);
}
if (!$this->ajax) {
- Minz_Request::good(_t('feedback.sub.feed.marked_read'), array(
+ Minz_Request::good(_t($is_read ? 'feedback.sub.articles.marked_read' : 'feedback.sub.articles.marked_unread'),
+ array(
'c' => 'index',
'a' => 'index',
'params' => $params,
@@ -186,7 +186,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController {
$nb = $entryDAO->cleanOldEntries($feed->id(), $date_min, $feed_history);
if ($nb > 0) {
$nb_total += $nb;
- Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url() . ']');
+ Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url(false) . ']');
}
}
}
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index ec88156f9..2f7495884 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -295,12 +295,12 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if ($feed->lastUpdate() + 10 >= $mtime) {
continue; //Nothing newer from other users
}
- //Minz_Log::debug($feed->url() . ' was updated at ' . date('c', $mtime) . ' by another user');
+ //Minz_Log::debug($feed->url(false) . ' was updated at ' . date('c', $mtime) . ' by another user');
//Will take advantage of the newer cache
}
if (!$feed->lock()) {
- Minz_Log::notice('Feed already being actualized: ' . $feed->url());
+ Minz_Log::notice('Feed already being actualized: ' . $feed->url(false));
continue;
}
@@ -351,7 +351,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
//This entry already exists and is unchanged. TODO: Remove the test with the zero'ed hash in FreshRSS v1.3
$oldGuids[] = $entry->guid();
} else { //This entry already exists but has been updated
- //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url() .
+ //Minz_Log::debug('Entry with GUID `' . $entry->guid() . '` updated in feed ' . $feed->url(false) .
//', old hash ' . $existingHash . ', new hash ' . $entry->hash());
$mark_updated_article_unread = $feed->attributes('mark_updated_article_unread') !== null ? (
$feed->attributes('mark_updated_article_unread')
@@ -413,7 +413,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
$entryDAO->updateLastSeen($feed->id(), $oldGuids, $mtime);
}
- if ($feed_history >= 0 && rand(0, 30) === 1) {
+ if ($feed_history >= 0 && mt_rand(0, 30) === 1) {
// TODO: move this function in web cron when available (see entry::purge)
// Remove old entries once in 30.
if (!$entryDAO->inTransaction()) {
@@ -425,8 +425,7 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
max($feed_history, count($entries) + 10));
if ($nb > 0) {
$needFeedCacheRefresh = true;
- Minz_Log::debug($nb . ' old entries cleaned in feed [' .
- $feed->url() . ']');
+ Minz_Log::debug($nb . ' old entries cleaned in feed [' . $feed->url(false) . ']');
}
}
@@ -442,25 +441,25 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
if ($feed->selfUrl() !== $url) { //https://code.google.com/p/pubsubhubbub/wiki/MovingFeedsOrChangingHubs
$selfUrl = checkUrl($feed->selfUrl());
if ($selfUrl) {
- Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url());
+ Minz_Log::debug('PubSubHubbub unsubscribe ' . $feed->url(false));
if (!$feed->pubSubHubbubSubscribe(false)) { //Unsubscribe
- Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url());
+ Minz_Log::warning('Error while PubSubHubbub unsubscribing from ' . $feed->url(false));
}
$feed->_url($selfUrl, false);
- Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url());
+ Minz_Log::notice('Feed ' . $url . ' canonical address moved to ' . $feed->url(false));
$feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));
}
}
} elseif ($feed->url() !== $url) { // HTTP 301 Moved Permanently
- Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url());
+ Minz_Log::notice('Feed ' . $url . ' moved permanently to ' . $feed->url(false));
$feedDAO->updateFeed($feed->id(), array('url' => $feed->url()));
}
$feed->faviconPrepare();
if ($pubsubhubbubEnabledGeneral && $feed->pubSubHubbubPrepare()) {
- Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url());
+ Minz_Log::notice('PubSubHubbub subscribe ' . $feed->url(false));
if (!$feed->pubSubHubbubSubscribe(true)) { //Subscribe
- Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url());
+ Minz_Log::warning('Error while PubSubHubbub subscribing to ' . $feed->url(false));
}
}
$feed->unlock();
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 8567b4657..ddffdba73 100755
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -139,7 +139,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
}
// No layout for RSS output.
- $this->view->url = empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING'];
+ $this->view->url = PUBLIC_TO_INDEX_PATH . '/' . (empty($_SERVER['QUERY_STRING']) ? '' : '?' . $_SERVER['QUERY_STRING']);
$this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title();
$this->view->_useLayout(false);
header('Content-Type: application/rss+xml; charset=utf-8');
diff --git a/app/Controllers/javascriptController.php b/app/Controllers/javascriptController.php
index 6336106a9..9d7acf647 100755
--- a/app/Controllers/javascriptController.php
+++ b/app/Controllers/javascriptController.php
@@ -47,8 +47,8 @@ class FreshRSS_javascript_Controller extends Minz_ActionController {
$this->view->salt1 = sprintf('$2a$%02d$', FreshRSS_user_Controller::BCRYPT_COST);
$alphabet = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 22; $i > 0; $i--) {
- $this->view->salt1 .= $alphabet[rand(0, 63)];
+ $this->view->salt1 .= $alphabet[mt_rand(0, 63)];
}
- $this->view->nonce = sha1(rand());
+ $this->view->nonce = sha1(mt_rand());
}
}
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index 47f0ecc62..75a4303d6 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -230,6 +230,17 @@ class FreshRSS_user_Controller extends Minz_ActionController {
$_POST['new_user_passwordPlain'] = '';
invalidateHttpCache();
+ // If the user has admin access, it means he's already logged in
+ // and we don't want to login with the new account. Otherwise, the
+ // user just created its account himself so he probably wants to
+ // get started immediately.
+ if ($ok && !FreshRSS_Auth::hasAccess('admin')) {
+ $user_conf = get_user_configuration($new_user_name);
+ Minz_Session::_param('currentUser', $new_user_name);
+ Minz_Session::_param('passwordHash', $user_conf->passwordHash);
+ FreshRSS_Auth::giveAccess();
+ }
+
$notif = array(
'type' => $ok ? 'good' : 'bad',
'content' => _t('feedback.user.created' . (!$ok ? '.error' : ''), $new_user_name)