ErrorController.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * Error Handling Controller
  4. *
  5. * Controller used by ErrorHandler to render error views.
  6. *
  7. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  8. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  9. *
  10. * Licensed under The MIT License
  11. * For full copyright and license information, please see the LICENSE.txt
  12. * Redistributions of files must retain the above copyright notice.
  13. *
  14. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  15. * @link http://cakephp.org CakePHP(tm) Project
  16. * @since CakePHP(tm) v 2.0
  17. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  18. */
  19. namespace Cake\Controller;
  20. use Cake\Routing\Router;
  21. /**
  22. * Error Handling Controller
  23. *
  24. * Controller used by ErrorHandler to render error views.
  25. *
  26. */
  27. class ErrorController extends Controller {
  28. /**
  29. * Uses Property
  30. *
  31. * @var array
  32. */
  33. public $uses = array();
  34. /**
  35. * Constructor
  36. *
  37. * @param Cake\Network\Request $request
  38. * @param Cake\Network\Response $response
  39. */
  40. public function __construct($request = null, $response = null) {
  41. parent::__construct($request, $response);
  42. $this->constructClasses();
  43. if (count(Router::extensions()) &&
  44. !isset($this->RequestHandler)
  45. ) {
  46. $this->RequestHandler = $this->Components->load('RequestHandler');
  47. }
  48. $eventManager = $this->getEventManager();
  49. if (isset($this->Auth)) {
  50. $eventManager->detach($this->Auth);
  51. }
  52. if (isset($this->Security)) {
  53. $eventManager->detach($this->Security);
  54. }
  55. $this->_set(array('cacheAction' => false, 'viewPath' => 'Error'));
  56. }
  57. }