diff options
Diffstat (limited to 'app/Controllers')
| -rwxr-xr-x | app/Controllers/entryController.php | 20 | ||||
| -rwxr-xr-x | app/Controllers/feedController.php | 23 | ||||
| -rwxr-xr-x | app/Controllers/indexController.php | 2 | ||||
| -rwxr-xr-x | app/Controllers/javascriptController.php | 4 | ||||
| -rw-r--r-- | app/Controllers/userController.php | 11 |
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) |
