true, "is_visitor" => false]; } // Legacy: Visitors and Friends. $visitors = array_merge( Config::get_safe("friends", []), Config::get_safe("visitor", []) ); if(!empty($visitors) && isset($visitors[$nick]) && $visitors[$nick] === $pass){ $_SESSION[User::SESSION_NAME] = 'visitor'; return ["logged_in" => false, "is_visitor" => true]; } Log::put("login_fails", $nick); throw new Exception(__("The nick or password is incorrect.")); } public static function logout(){ if(!Config::get_safe("force_login", false)){ throw new Exception(__("You can't log out. There is no account.")); } if(!self::is_logged_in() && !self::is_visitor()){ throw new Exception(__("You are not even logged in.")); } $_SESSION[User::SESSION_NAME] = false; return true; } }