-
Notifications
You must be signed in to change notification settings - Fork 2
/
app_error.php
107 lines (95 loc) · 2.38 KB
/
app_error.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* Chaw : source code and project management
*
* @copyright Copyright 2009, Garrett J. Woodworth ([email protected])
* @license GNU AFFERO GENERAL PUBLIC LICENSE v3 (http://opensource.org/licenses/agpl-v3.html)
*
*/
/**
* undocumented class
*
* @package default
*/
class AppError extends ErrorHandler {
/**
* Controller instance.
*
* @var object
* @access public
*/
var $controller = null;
/**
* Class constructor.
*
* @param string $method Method producing the error
* @param array $messages Error messages
*/
function __construct($method, $messages) {
App::import('Core', 'Sanitize');
static $__previousError = null;
if ($__previousError != array($method, $messages)) {
$__previousError = array($method, $messages);
$this->controller =& new CakeErrorController();
} else {
$this->controller =& new Controller();
$this->controller->viewPath = 'errors';
}
$options = array('escape' => false);
$messages = Sanitize::clean($messages, $options);
if (!isset($messages[0])) {
$messages = array($messages);
}
if (method_exists($this->controller, 'apperror')) {
return $this->controller->appError($method, $messages);
}
if (!in_array(strtolower($method), array_map('strtolower', get_class_methods($this)))) {
$method = 'error';
}
if (!in_array($method, array('error'))) {
if (Configure::read() == 0) {
$method = 'error404';
if (isset($code) && $code == 500) {
$method = 'error500';
}
}
}
if (defined('CAKE_TEST_OUTPUT_HTML')) {
$this->controller->layout = 'ajax';
debug(Debugger::trace());
}
$this->dispatchMethod($method, $messages);
$this->_stop();
}
/**
* undocumented function
*
* @param string $messages
* @return void
*/
function missingAction($messages = array()) {
return parent::missingAction($messages);
/*
$this->controller->redirect(array_merge(
array('controller' => 'wiki', 'action' => 'index', $this->controller->params['action']),
$this->controller->params['pass']
));
*/
}
/**
* undocumented function
*
* @param string $messages
* @return void
*/
function missingController($messages = array()) {
return parent::missingController($messages);
/*
$this->controller->redirect(array_merge(
array('controller' => 'wiki', 'action' => 'index', $this->controller->params['controller']),
$this->controller->params['pass']
));
*/
}
}
?>