/** * Initialize the different FreshRSS / Minz components. * * PLEASE DON'T CHANGE THE ORDER OF INITIALIZATIONS UNLESS YOU KNOW WHAT * YOU DO!! * * Here is the list of components: * - Create a configuration setter and register it to system conf * - Init extension manager and enable system extensions (has to be done asap) * - Init authentication system * - Init user configuration (need auth system) * - Init FreshRSS context (need user conf) * - Init i18n (need context) * - Init sharing system (need user conf and i18n) * - Init generic styles and scripts (need user conf) * - Init notifications * - Enable user extensions (need all the other initializations) */ public function init() { if (!isset($_SESSION)) { Minz_Session::init('FreshRSS'); } // Register the configuration setter for the system configuration $configuration_setter = new FreshRSS_ConfigurationSetter(); $system_conf = Minz_Configuration::get('system'); $system_conf->_configurationSetter($configuration_setter); // Load list of extensions and enable the "system" ones. Minz_ExtensionManager::init(); // Auth has to be initialized before using currentUser session parameter // because it's this part which create this parameter. $this->initAuth(); // Then, register the user configuration and use the configuration setter // created above. $current_user = Minz_Session::param('currentUser', '_'); Minz_Configuration::register('user', join_path(USERS_PATH, $current_user, 'config.php'), join_path(USERS_PATH, '_', 'config.default.php'), $configuration_setter); // Finish to initialize the other FreshRSS / Minz components. FreshRSS_Context::init(); $this->initI18n(); FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php')); $this->loadStylesAndScripts(); $this->loadNotifications(); // Enable extensions for the current (logged) user. if (FreshRSS_Auth::hasAccess()) { $ext_list = FreshRSS_Context::$user_conf->extensions_enabled; Minz_ExtensionManager::enableByList($ext_list); } }
//header('HTTP/1.1 422 Unprocessable Entity'); logMe('Warning: Self URL [' . $self . '] does not match registered canonical URL!: ' . base64url_decode($canonical64)); //die('Self URL does not match registered canonical URL!'); $self = base64url_decode($canonical64); } Minz_Request::_param('url', $self); $nb = 0; foreach ($users as $userFilename) { $username = basename($userFilename, '.txt'); if (!file_exists(USERS_PATH . '/' . $username . '/config.php')) { break; } try { Minz_Session::_param('currentUser', $username); Minz_Configuration::register('user', join_path(USERS_PATH, $username, 'config.php'), join_path(USERS_PATH, '_', 'config.default.php')); FreshRSS_Context::init(); if ($feedController->actualizeAction($simplePie) > 0) { $nb++; } } catch (Exception $e) { logMe('Error: ' . $e->getMessage()); } } $simplePie->__destruct(); unset($simplePie); if ($nb === 0) { header('HTTP/1.1 410 Gone'); logMe('Error: Nobody is subscribed to this feed anymore after all!: ' . $self); die('Nobody is subscribed to this feed anymore after all!'); } elseif (!empty($hubJson['error'])) { $hubJson['error'] = false;
/** * Set the value of $next_get attribute. */ public static function _nextGet() { $get = self::currentGet(); // By default, $next_get == $get self::$next_get = $get; if (self::$user_conf->onread_jump_next && strlen($get) > 2) { $another_unread_id = ''; $found_current_get = false; switch ($get[0]) { case 'f': // We search the next feed with at least one unread article in // same category as the currend feed. foreach (self::$categories as $cat) { if ($cat->id() != self::$current_get['category']) { // We look into the category of the current feed! continue; } foreach ($cat->feeds() as $feed) { if ($feed->id() == self::$current_get['feed']) { // Here is our current feed! Fine, the next one will // be a potential candidate. $found_current_get = true; continue; } if ($feed->nbNotRead() > 0) { $another_unread_id = $feed->id(); if ($found_current_get) { // We have found our current feed and now we // have an feed with unread articles. Leave the // loop! break; } } } break; } // If no feed have been found, next_get is the current category. self::$next_get = empty($another_unread_id) ? 'c_' . self::$current_get['category'] : 'f_' . $another_unread_id; break; case 'c': // We search the next category with at least one unread article. foreach (self::$categories as $cat) { if ($cat->id() == self::$current_get['category']) { // Here is our current category! Next one could be our // champion if it has unread articles. $found_current_get = true; continue; } if ($cat->nbNotRead() > 0) { $another_unread_id = $cat->id(); if ($found_current_get) { // Unread articles and the current category has // already been found? Leave the loop! break; } } } // No unread category? The main stream will be our destination! self::$next_get = empty($another_unread_id) ? 'a' : 'c_' . $another_unread_id; break; } } }
/** * This method returns a list of entries based on the Context object. */ private function listEntriesByContext() { $entryDAO = FreshRSS_Factory::createEntryDao(); $get = FreshRSS_Context::currentGet(true); if (count($get) > 1) { $type = $get[0]; $id = $get[1]; } else { $type = $get; $id = ''; } return $entryDAO->listWhere($type, $id, FreshRSS_Context::$state, FreshRSS_Context::$order, FreshRSS_Context::$number + 1, FreshRSS_Context::$first_id, FreshRSS_Context::$search); }