Browse Source

Better view/template variables naming and more superglobals.

tags/2.0.0-beta
resurtm 12 years ago
parent
commit
a0def9c0ca
  1. 17
      framework/yii/base/ErrorHandler.php
  2. 10
      framework/yii/views/errorHandler/callStackItem.php
  3. 41
      framework/yii/views/errorHandler/main.php

17
framework/yii/base/ErrorHandler.php

@ -95,19 +95,16 @@ class ErrorHandler extends Component
} }
$view = new View(); $view = new View();
$request = array(); $request = '';
if (count($_GET) > 0) { foreach (array('GET', 'POST', 'SERVER', 'FILES', 'COOKIE', 'SESSION', 'ENV') as $name) {
$request[] = '$_GET = ' . var_export($_GET, true) . ';'; if (!empty($GLOBALS['_' . $name])) {
} $request .= '$_' . $name . ' = ' . var_export($GLOBALS['_' . $name], true) . ";\n\n";
if (count($_POST) > 0) { }
$request[] = '$_POST = ' . var_export($_POST, true) . ';';
} }
$request[] = '$_SERVER = ' . var_export($_SERVER, true) . ';'; $request = rtrim($request, "\n\n");
$request = implode("\n\n", $request);
echo $view->renderFile($this->mainView, array( echo $view->renderFile($this->mainView, array(
'e' => $exception, 'exception' => $exception,
'request' => $request, 'request' => $request,
'requestLinesCount' => substr_count($request, "\n"),
), $this); ), $this);
} }
} }

10
framework/yii/views/errorHandler/callStackItem.php

@ -7,16 +7,16 @@
* @var string[] $lines * @var string[] $lines
* @var integer $begin * @var integer $begin
* @var integer $end * @var integer $end
* @var \yii\base\ErrorHandler $c * @var \yii\base\ErrorHandler $context
*/ */
$c = $this->context; $context = $this->context;
?> ?>
<li class="<?php if (!$c->isCoreFile($file)) echo 'application'; ?> call-stack-item"> <li class="<?php if (!$context->isCoreFile($file)) echo 'application'; ?> call-stack-item">
<div class="element-wrap"> <div class="element-wrap">
<div class="element"> <div class="element">
<span class="number"><?php echo (int)$index; ?>.</span> <span class="number"><?php echo (int)$index; ?>.</span>
<span class="text">in <?php echo $c->htmlEncode($file); ?></span> <span class="text">in <?php echo $context->htmlEncode($file); ?></span>
<span class="at">at line</span> <span class="at">at line</span>
<span class="line"><?php echo (int)$line; ?></span> <span class="line"><?php echo (int)$line; ?></span>
</div> </div>
@ -28,7 +28,7 @@ $c = $this->context;
<?php endfor; ?> <?php endfor; ?>
<div class="code"> <div class="code">
<span class="lines"><?php for ($i = $begin; $i <= $end; ++$i) echo (int)$i . '<br/>'; ?></span> <span class="lines"><?php for ($i = $begin; $i <= $end; ++$i) echo (int)$i . '<br/>'; ?></span>
<pre><?php for ($i = $begin; $i <= $end; ++$i) echo $c->htmlEncode($lines[$i]); ?></pre> <pre><?php for ($i = $begin; $i <= $end; ++$i) echo $context->htmlEncode($lines[$i]); ?></pre>
</div> </div>
</div> </div>
</li> </li>

41
framework/yii/views/errorHandler/main.php

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save