mirror of
https://github.com/FreshRSS/FreshRSS.git
synced 2026-01-10 22:37:50 -05:00
* Minz allow parallel sessions #fix https://github.com/FreshRSS/FreshRSS/issues/3093 * Array optimisation * Array optimisation missing * Reduce direct access to $_SESSION except in install process * Fix session start headers warning * Use cookie only the first time the session is started: `PHP Warning: session_start(): Cannot start session when headers already sent in /var/www/FreshRSS/lib/Minz/Session.php on line 39` * New concept of volatile session for API calls Optimisation: do not use cookies or local storage at all for API calls without a Web session Fix warning: ``` PHP Warning: session_destroy(): Trying to destroy uninitialized session in Unknown on line 0 ``` * Only call Minz_Session::init once in our index It was called twice (once indirectly via FreshRSS->init()) * Whitespace * Mutex for notifications Implement mutex for notifications https://github.com/FreshRSS/FreshRSS/pull/3208#discussion_r499509809 * Typo * Install script is not ready for using Minz_Session
56 lines
1.4 KiB
PHP
56 lines
1.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Controller to handle error page.
|
|
*/
|
|
class FreshRSS_error_Controller extends Minz_ActionController {
|
|
/**
|
|
* This action is the default one for the controller.
|
|
*
|
|
* It is called by Minz_Error::error() method.
|
|
*
|
|
* Parameters are passed by Minz_Session to have a proper url:
|
|
* - error_code (default: 404)
|
|
* - error_logs (default: array())
|
|
*/
|
|
public function indexAction() {
|
|
$code_int = Minz_Session::param('error_code', 404);
|
|
$error_logs = Minz_Session::param('error_logs', array());
|
|
Minz_Session::_params([
|
|
'error_code' => false,
|
|
'error_logs' => false,
|
|
]);
|
|
|
|
switch ($code_int) {
|
|
case 200 :
|
|
header('HTTP/1.1 200 OK');
|
|
break;
|
|
case 403:
|
|
header('HTTP/1.1 403 Forbidden');
|
|
$this->view->code = 'Error 403 - Forbidden';
|
|
$this->view->errorMessage = _t('feedback.access.denied');
|
|
break;
|
|
case 500:
|
|
header('HTTP/1.1 500 Internal Server Error');
|
|
$this->view->code = 'Error 500 - Internal Server Error';
|
|
break;
|
|
case 503:
|
|
header('HTTP/1.1 503 Service Unavailable');
|
|
$this->view->code = 'Error 503 - Service Unavailable';
|
|
break;
|
|
case 404:
|
|
default:
|
|
header('HTTP/1.1 404 Not Found');
|
|
$this->view->code = 'Error 404 - Not found';
|
|
$this->view->errorMessage = _t('feedback.access.not_found');
|
|
}
|
|
|
|
$error_message = trim(implode($error_logs));
|
|
if ($error_message !== '') {
|
|
$this->view->errorMessage = $error_message;
|
|
}
|
|
|
|
Minz_View::prependTitle($this->view->code . ' · ');
|
|
}
|
|
}
|