From 731cbf8980a339cf75b1dfc8a6658cb832df543c Mon Sep 17 00:00:00 2001 From: resurtm Date: Sat, 25 May 2013 21:40:11 +0600 Subject: [PATCH] New error page WIP. --- apps/bootstrap/controllers/SiteController.php | 4 +- apps/bootstrap/www/tmp/gears.png | Bin 0 -> 4579 bytes apps/bootstrap/www/tmp/main.css | 15 ++++- apps/bootstrap/www/tmp/main.js | 7 +- framework/yii/base/ErrorHandler.php | 16 ++++- framework/yii/views/errorHandler/callStackItem.php | 2 +- framework/yii/views/errorHandler/main.php | 71 +++++++-------------- 7 files changed, 60 insertions(+), 55 deletions(-) create mode 100644 apps/bootstrap/www/tmp/gears.png diff --git a/apps/bootstrap/controllers/SiteController.php b/apps/bootstrap/controllers/SiteController.php index 4652430..a6731f9 100644 --- a/apps/bootstrap/controllers/SiteController.php +++ b/apps/bootstrap/controllers/SiteController.php @@ -20,8 +20,10 @@ class SiteController extends Controller public function actionIndex() { + $x = null; + $x->y = 100; throw new \yii\base\HttpException(500, 'Test exception'); - $x = 1; +// $x = 1; echo $this->render('index'); } diff --git a/apps/bootstrap/www/tmp/gears.png b/apps/bootstrap/www/tmp/gears.png new file mode 100644 index 0000000000000000000000000000000000000000..7eaa41ce13c91790b33d25e0e3aa51425d2e48e9 GIT binary patch literal 4579 zcmaJ_c{r5&-?n8dM3O>HnzD|WA=@0wU@T+HzK3B3gISER#@LsLWM4ueHI@>xFCm01 z$(kjiEQc)Fvi0ixPUrXj@t*g&uIKqK*L~lg?f&bzYoM>m#(IgBhK7a>sf92)S#?id zI5XYJS6P;k>14S`R<|G<6P(CCC=!N71x;|k0FXG8GsXymLi>4iVH9X+=mA(03$lft zF3gdDlR*8#NciH2Cu|xT1!Z3%%Fzu&1~_1xv3Nznwfbg302Zw%XfCY>(Icv1T(DaH zB#g1YzKNs1o1;8hP+19};0rquz+uQJfG^G+?+No&6#PpUcC!C<4Hg9a1tGgB3jQZ4 z3q1pX8i9lXNJ~IKju06LKn5xSmAWY_D=Q9=gg_x+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vFE752i;E-UK;A3qX@yrmX}7g? zj35r*ath0g)XGn^(uvjr*01w3ol6_`nfe$^&3o+XCsz;8TNi7dN|tAD*UwgcDw4nq zSJPyp+Pa#+~{IXrenderFile($this->mainView, array('e' => $exception), $this); + $request = array(); + if (count($_GET) > 0) { + $request[] = '$_GET = ' . var_export($_GET, true) . ';'; + } + if (count($_POST) > 0) { + $request[] = '$_POST = ' . var_export($_POST, true) . ';'; + } + $request[] = '$_SERVER = ' . var_export($_SERVER, true) . ';'; + $request = implode("\n\n", $request); + echo $view->renderFile($this->mainView, array( + 'e' => $exception, + 'request' => $request, + 'requestLinesCount' => substr_count($request, "\n"), + ), $this); } } } diff --git a/framework/yii/views/errorHandler/callStackItem.php b/framework/yii/views/errorHandler/callStackItem.php index e4ac1bf..b319d16 100644 --- a/framework/yii/views/errorHandler/callStackItem.php +++ b/framework/yii/views/errorHandler/callStackItem.php @@ -1,13 +1,13 @@ context; ?> diff --git a/framework/yii/views/errorHandler/main.php b/framework/yii/views/errorHandler/main.php index 4ff8c8d..0ea82e1 100644 --- a/framework/yii/views/errorHandler/main.php +++ b/framework/yii/views/errorHandler/main.php @@ -2,6 +2,8 @@ /** * @var \yii\base\View $this * @var \Exception $e + * @var string $request + * @var integer $requestLinesCount * @var \yii\base\ErrorHandler $c */ $c = $this->context; @@ -27,14 +29,23 @@ $c = $this->context;
- Attention -

- ExceptionaddTypeLinks(get_class($e)); ?> - - – createHttpStatusLink($e->statusCode); ?> - -

-

htmlEncode($e->getName()); ?>

+ + Gears +

+ htmlEncode($e->getName()); ?> + – addTypeLinks(get_class($e)); ?> +

+

htmlEncode($e->getMessage()); ?>

+ + Attention +

+ ExceptionaddTypeLinks(get_class($e)); ?> + + – createHttpStatusLink($e->statusCode); ?> + +

+

htmlEncode($e->getName()); ?>

+
@@ -46,49 +57,11 @@ $c = $this->context;
- -
-
-
-
$_GET = [
-	'show-post' => 100,
-	'refresh-page' => 'yes',
-	'ascending-sort' => 1,
-];
-
-$_POST = [
-	'blog-post-form' => [
-		'title' => 'hello',
-		'author_id' => '12',
-	],
-];
-
-$_SERVER = [
-	'DOCUMENT_ROOT' => '/home/resurtm/work/data',
-	'REMOTE_ADDR' => '::1',
-	'REMOTE_PORT' => '52694',
-	'SERVER_SOFTWARE' => 'PHP 5.4.3 Development Server',
-	'SERVER_PROTOCOL' => 'HTTP/1.1',
-	'SERVER_NAME' => 'localhost',
-	'SERVER_PORT' => '8000',
-	'REQUEST_URI' => '/index.php?post-form[title]=hello&post-form[author_id]=12',
-	'REQUEST_METHOD' => 'GET',
-	'SCRIPT_NAME' => '/index.php',
-	'SCRIPT_FILENAME' => '/home/resurtm/work/data/index.php',
-	'PHP_SELF' => '/index.php',
-	'QUERY_STRING' => 'post-form[title]=hello&post-form[author_id]=12',
-	'HTTP_HOST' => 'localhost:8000',
-	'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0',
-	'HTTP_ACCEPT_LANGUAGE' => 'ru-RU,ru;q=0.8,en-US;q=0.5,en;q=0.3',
-	'HTTP_ACCEPT_ENCODING' => 'gzip, deflate',
-	'HTTP_CONNECTION' => 'keep-alive',
-	'REQUEST_TIME_FLOAT' => 1369146454.0856,
-	'REQUEST_TIME' => 1369146454,
-];
+
+
htmlEncode($request); ?>
-
- */ ?> +