errorController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Controller to handle error page.
  4. */
  5. class FreshRSS_error_Controller extends Minz_ActionController {
  6. /**
  7. * This action is the default one for the controller.
  8. *
  9. * It is called by Minz_Error::error() method.
  10. *
  11. * Parameters are:
  12. * - code (default: 404)
  13. * - logs (default: array())
  14. */
  15. public function indexAction() {
  16. $code_int = Minz_Request::param('code', 404);
  17. switch ($code_int) {
  18. case 403:
  19. $this->view->code = 'Error 403 - Forbidden';
  20. break;
  21. case 404:
  22. $this->view->code = 'Error 404 - Not found';
  23. break;
  24. case 500:
  25. $this->view->code = 'Error 500 - Internal Server Error';
  26. break;
  27. case 503:
  28. $this->view->code = 'Error 503 - Service Unavailable';
  29. break;
  30. default:
  31. $this->view->code = 'Error 404 - Not found';
  32. }
  33. $errors = Minz_Request::param('logs', array());
  34. $this->view->errorMessage = trim(implode($errors));
  35. if ($this->view->errorMessage == '') {
  36. switch($code_int) {
  37. case 403:
  38. $this->view->errorMessage = _t('access_denied');
  39. break;
  40. case 404:
  41. default:
  42. $this->view->errorMessage = _t('page_not_found');
  43. break;
  44. }
  45. }
  46. Minz_View::prependTitle($this->view->code . ' · ');
  47. }
  48. }