MyExceptionRenderer.php 841 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. App::uses('ExceptionRenderer', 'Error');
  3. class MyExceptionRenderer extends ExceptionRenderer {
  4. /**
  5. * A safer way to render error messages, replaces all helpers, with basics
  6. * and doesn't call component methods.
  7. *
  8. * @param string $template The template to render
  9. * @return void
  10. */
  11. protected function _outputMessageSafe($template) {
  12. $this->controller->layoutPath = null;
  13. $this->controller->subDir = null;
  14. $this->controller->viewPath = 'Errors/';
  15. $this->controller->viewClass = 'View';
  16. $this->controller->layout = 'error';
  17. $this->controller->helpers = array('Form', 'Html', 'Session');
  18. $this->controller->render($template);
  19. $this->controller->response->type('html');
  20. $x = $this->controller->response->body(); $this->controller->response->body(h($x));
  21. $this->controller->response->send();
  22. }
  23. }