aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/errorController.php
blob: 06fa186cf71a70bdcf0d9379807cb1aca3d7e829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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:
	 *   - code (default: 404)
	 *   - logs (default: array())
	 */
	public function indexAction() {
		$code_int = Minz_Request::param('code', 404);
		switch ($code_int) {
		case 403:
			$this->view->code = 'Error 403 - Forbidden';
			break;
		case 404:
			$this->view->code = 'Error 404 - Not found';
			break;
		case 500:
			$this->view->code = 'Error 500 - Internal Server Error';
			break;
		case 503:
			$this->view->code = 'Error 503 - Service Unavailable';
			break;
		default:
			$this->view->code = 'Error 404 - Not found';
		}

		$errors = Minz_Request::param('logs', array());
		$this->view->errorMessage = trim(implode($errors));
		if ($this->view->errorMessage == '') {
			switch($code_int) {
			case 403:
				$this->view->errorMessage = _t('feedback.access.denied');
				break;
			case 404:
			default:
				$this->view->errorMessage = _t('feedback.access.not_found');
				break;
			}
		}

		Minz_View::prependTitle($this->view->code . ' · ');
	}
}