1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/freshrss_ynh.git synced 2024-09-03 18:36:33 +02:00
freshrss_ynh/sources/app/Controllers/errorController.php

54 lines
1.4 KiB
PHP
Raw Normal View History

2014-07-23 15:52:50 +02:00
<?php
2015-02-08 18:55:48 +01:00
/**
* Controller to handle error page.
*/
2014-07-23 15:52:50 +02:00
class FreshRSS_error_Controller extends Minz_ActionController {
2015-02-08 18:55:48 +01:00
/**
* 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())
*/
2014-09-21 12:12:35 +02:00
public function indexAction() {
2015-02-08 18:55:48 +01:00
$code_int = Minz_Session::param('error_code', 404);
$error_logs = Minz_Session::param('error_logs', array());
Minz_Session::_param('error_code');
Minz_Session::_param('error_logs');
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');
2014-07-23 15:52:50 +02:00
}
2014-09-21 12:12:35 +02:00
2015-02-08 18:55:48 +01:00
$error_message = trim(implode($error_logs));
if ($error_message !== '') {
$this->view->errorMessage = $error_message;
2014-09-21 12:12:35 +02:00
}
Minz_View::prependTitle($this->view->code . ' · ');
2014-07-23 15:52:50 +02:00
}
}