예제 #1
0
 /**
  * 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);
     }
 }
예제 #2
0
 public function init()
 {
     if (!isset($_SESSION)) {
         Minz_Session::init('FreshRSS');
     }
     $loginOk = $this->accessControl(Minz_Session::param('currentUser', ''));
     $this->loadParamsView();
     $this->loadStylesAndScripts($loginOk);
     //TODO: Do not load that when not needed, e.g. some Ajax requests
     $this->loadNotifications();
 }
예제 #3
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# ***** END LICENSE BLOCK *****
require '../../constants.php';
require LIB_PATH . '/lib_rss.php';
//Includes class autoloader
if (file_exists(DATA_PATH . '/do-install.txt')) {
    require APP_PATH . '/install.php';
} else {
    session_cache_limiter('');
    Minz_Session::init('FreshRSS');
    Minz_Session::_param('keepAlive', 1);
    //For Persona
    if (!file_exists(DATA_PATH . '/no-cache.txt')) {
        require LIB_PATH . '/http-conditional.php';
        $currentUser = Minz_Session::param('currentUser', '');
        $dateLastModification = $currentUser === '' ? time() : max(@filemtime(join_path(USERS_PATH, $currentUser, 'log.txt')), @filemtime(join_path(DATA_PATH, 'config.php')));
        if (httpConditional($dateLastModification, 0, 0, false, PHP_COMPRESSION, true)) {
            exit;
            //No need to send anything
        }
    }
    try {
        $front_controller = new FreshRSS();
        $front_controller->init();
        $front_controller->run();