CakeErrorController.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /**
  3. * Error Handling Controller
  4. *
  5. * Controller used by ErrorHandler to render error views.
  6. *
  7. * PHP 5
  8. *
  9. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  10. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. *
  12. * Licensed under The MIT License
  13. * Redistributions of files must retain the above copyright notice.
  14. *
  15. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  16. * @link http://cakephp.org CakePHP(tm) Project
  17. * @package Cake.Controller
  18. * @since CakePHP(tm) v 2.0
  19. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  20. */
  21. /**
  22. * Error Handling Controller
  23. *
  24. * Controller used by ErrorHandler to render error views.
  25. *
  26. * @package Cake.Controller
  27. */
  28. class CakeErrorController extends AppController {
  29. /**
  30. * Controller name
  31. *
  32. * @var string
  33. */
  34. public $name = 'CakeError';
  35. /**
  36. * Uses Property
  37. *
  38. * @var array
  39. */
  40. public $uses = array();
  41. /**
  42. * __construct
  43. *
  44. * @param CakeRequest $request
  45. * @param CakeResponse $response
  46. */
  47. public function __construct($request = null, $response = null) {
  48. parent::__construct($request, $response);
  49. if (count(Router::extensions())) {
  50. $this->components[] = 'RequestHandler';
  51. }
  52. $this->constructClasses();
  53. if ($this->Components->enabled('Auth')) {
  54. $this->Components->disable('Auth');
  55. }
  56. if ($this->Components->enabled('Security')) {
  57. $this->Components->disable('Security');
  58. }
  59. $this->startupProcess();
  60. $this->_set(array('cacheAction' => false, 'viewPath' => 'Errors'));
  61. }
  62. /**
  63. * Escapes the viewVars.
  64. *
  65. * @return void
  66. */
  67. public function beforeRender() {
  68. parent::beforeRender();
  69. foreach ($this->viewVars as $key => $value) {
  70. if (!is_object($value)) {
  71. $this->viewVars[$key] = h($value);
  72. }
  73. }
  74. }
  75. }