18 return $this->
render(dirname(__FILE__) .
'/../views/panels/request_bar.php', array(
19 'statusCode' =>
$data[
'statusCode'],
20 'route' =>
$data[
'route'],
21 'action' =>
$data[
'action'],
27 return $this->
render(dirname(__FILE__) .
'/../views/panels/request.php', array(
34 if (function_exists(
'apache_request_headers')) {
35 $requestHeaders = apache_request_headers();
36 } elseif (function_exists(
'http_get_request_headers')) {
37 $requestHeaders = http_get_request_headers();
39 $requestHeaders = array();
41 $responseHeaders = array();
42 foreach (headers_list() as $header) {
43 if (($pos = strpos($header,
':')) !==
false) {
44 $name = substr($header, 0, $pos);
45 $value = trim(substr($header, $pos + 1));
46 if (isset($responseHeaders[$name])) {
47 if (!is_array($responseHeaders[$name])) {
48 $responseHeaders[$name] = array($responseHeaders[$name], $value);
50 $responseHeaders[$name][] = $value;
53 $responseHeaders[$name] = $value;
56 $responseHeaders[] = $header;
60 $route = Yii::app()->getUrlManager()->parseUrl(Yii::app()->getRequest());
62 $actionParams = array();
63 if (($ca = @Yii::app()->createController($route)) !== null) {
66 list($controller, $actionID) = $ca;
67 if (!$actionID) $actionID = $controller->defaultAction;
68 if (($a = $controller->createAction($actionID)) !== null) {
69 if ($a instanceof CInlineAction) {
70 $action = get_class($controller) .
'::action' . ucfirst($actionID) .
'()';
72 $action = get_class($a) .
'::run()';
75 $actionParams = $controller->actionParams;
79 $user = Yii::app()->getComponent(
'user',
false);
80 if ($user instanceof CWebUser) {
81 $flashes = $user->getFlashes(
false);
85 'flashes' => $flashes,
87 'requestHeaders' => $requestHeaders,
88 'responseHeaders' => $responseHeaders,
91 'actionParams' => $actionParams,
92 'SERVER' => empty($_SERVER) ? array() : $_SERVER,
93 'GET' => empty($_GET) ? array() : $_GET,
94 'POST' => empty($_POST) ? array() : $_POST,
95 'COOKIE' => empty($_COOKIE) ? array() : $_COOKIE,
96 'FILES' => empty($_FILES) ? array() : $_FILES,
97 'SESSION' => empty($_SESSION) ? array() : $_SESSION,
108 if (function_exists(
'http_response_code')) {
109 return http_response_code();
118 if (!function_exists(
'http_response_code')) {
119 Yii::app()->attachEventHandler(
'onException', array($this,
'onException'));
128 if ($event->exception instanceof CHttpException) {
129 $this->_statusCode = $event->exception->statusCode;
131 $this->_statusCode = 500;
142 if ($statusCode >= 100 && $statusCode < 200) {
144 } elseif ($statusCode >= 200 && $statusCode < 300) {
146 } elseif ($statusCode >= 300 && $statusCode < 400) {
149 return CHtml::tag(
'span', array(
'class' =>
'label label-' . $type), $statusCode);