diff options
Diffstat (limited to 'app/FreshRSS.php')
| -rw-r--r-- | app/FreshRSS.php | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php index e374fa827..76ced841c 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -18,7 +18,7 @@ class FreshRSS extends Minz_FrontController { * - Init notifications * - Enable user extensions (need all the other initializations) */ - public function init() { + public function init(): void { if (!isset($_SESSION)) { Minz_Session::init('FreshRSS'); } @@ -71,10 +71,10 @@ class FreshRSS extends Minz_FrontController { Minz_ExtensionManager::callHook('freshrss_init'); } - private static function initAuth() { + private static function initAuth(): void { FreshRSS_Auth::init(); if (Minz_Request::isPost()) { - if (!(FreshRSS_Auth::isCsrfOk() || + if (FreshRSS_Context::$system_conf == null || !(FreshRSS_Auth::isCsrfOk() || (Minz_Request::controllerName() === 'auth' && Minz_Request::actionName() === 'login') || (Minz_Request::controllerName() === 'user' && Minz_Request::actionName() === 'create' && !FreshRSS_Auth::hasAccess('admin')) || (Minz_Request::controllerName() === 'feed' && Minz_Request::actionName() === 'actualize' @@ -92,7 +92,7 @@ class FreshRSS extends Minz_FrontController { } } - private static function initI18n() { + private static function initI18n(): void { $userLanguage = isset(FreshRSS_Context::$user_conf) ? FreshRSS_Context::$user_conf->language : null; $systemLanguage = isset(FreshRSS_Context::$system_conf) ? FreshRSS_Context::$system_conf->language : null; $language = Minz_Translate::getLanguage($userLanguage, Minz_Request::getPreferredLanguages(), $systemLanguage); @@ -107,12 +107,15 @@ class FreshRSS extends Minz_FrontController { date_default_timezone_set($timezone); } - private static function getThemeFileUrl($theme_id, $filename) { + private static function getThemeFileUrl(string $theme_id, string $filename): string { $filetime = @filemtime(PUBLIC_PATH . '/themes/' . $theme_id . '/' . $filename); return '/themes/' . $theme_id . '/' . $filename . '?' . $filetime; } - public static function loadStylesAndScripts() { + public static function loadStylesAndScripts(): void { + if (FreshRSS_Context::$user_conf == null) { + return; + } $theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme); if ($theme) { foreach(array_reverse($theme['files']) as $file) { @@ -146,22 +149,23 @@ class FreshRSS extends Minz_FrontController { FreshRSS_View::prependScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); } - private static function loadNotifications() { + private static function loadNotifications(): void { $notif = Minz_Request::getNotification(); if ($notif) { FreshRSS_View::_param('notification', $notif); } } - public static function preLayout() { + public static function preLayout(): void { header("X-Content-Type-Options: nosniff"); FreshRSS_Share::load(join_path(APP_PATH, 'shares.php')); self::loadStylesAndScripts(); } - private static function checkEmailValidated() { - $email_not_verified = FreshRSS_Auth::hasAccess() && FreshRSS_Context::$user_conf->email_validation_token !== ''; + private static function checkEmailValidated(): void { + $email_not_verified = FreshRSS_Auth::hasAccess() && + FreshRSS_Context::$user_conf !== null && FreshRSS_Context::$user_conf->email_validation_token !== ''; $action_is_allowed = ( Minz_Request::is('user', 'validateEmail') || Minz_Request::is('user', 'sendValidationEmail') || |
