Merge branch 'maint/7.0'
[ninja.git] / application / hooks / errors.php
blob84ba06101b9279f2e55a21279fae8dea071a9757
1 <?php
3 class errors {
4 public function __construct()
6 Event::add('system.403', array($this, 'eventhandler'));
7 Event::replace('system.404', array('Kohana', 'show_404'), array($this, 'eventhandler'));
8 Event::add('application.livestatus', array($this, 'eventhandler'));
11 public function eventhandler()
13 $error = new Error_Controller;
14 Kohana::$instance = $error;
15 switch (Event::$name) {
16 case 'system.403':
17 $error->show_403();
18 break;
19 case 'system.404':
20 $error->show_404();
21 break;
22 case 'application.livestatus':
23 $error->show_livestatus(Event::$data);
24 break;
25 default:
26 return;
28 $error->_render();
29 exit(13);
33 new errors;