Changeset 2249 for trunk/system/views

Show
Ignore:
Timestamp:
03/09/2008 03:09:43 PM (9 months ago)
Author:
Shadowhand
Message:

Changes to Kohana exception/error handling:

  • Added KOHANA_ERROR_CSS to index.php
  • Updated error pages to use new KOHANA_ERROR_CSS constant
  • Reflected changes in Kohana and i18n/core.php
  • Kohana::exeception_handler will no longer include the backtrace when IN_PRODUCTION is enabled, for a small security benefit
  • Changed index.php directory checks to only execute when IN_PRODUCTION is enabled, for a small performance benefit
  • Small cleanups in index.php comments
Location:
trunk/system/views
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/system/views/kohana_error_disabled.php

    r1911 r2249  
    22<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    33<head> 
    4  
    54<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    6  
    75<title><?php echo $error ?></title> 
    8  
    9 <style type="text/css"> 
    10 /* <![CDATA[ */ 
    11 * {padding:0;margin:0;border:0;} 
    12 body { background: #fff; color: #111; font-family: sans-serif; font-size: 100%; } 
    13 h1 { font-size: 1.5em; padding: 0.2em 0.2em 0.5em; } 
    14 div#wrap { width: 40em; margin: 2em auto; text-align: center; } 
    15 p.error { color: #500; } 
    16 /* ]]> */ 
    17 </style> 
    186</head> 
    197<body> 
    20 <div id="wrap"> 
    21 <h1><?php echo $error ?></h1> 
    22 <p class="error"><?php echo $message ?></p> 
     8<style type="text/css"> 
     9<?php echo KOHANA_ERROR_CSS ?> 
     10</style> 
     11<div id="kohana_error" style="width:24em;margin:50px auto;"> 
     12<h3><?php echo $error ?></h3> 
     13<p><?php echo $message ?></p> 
    2314</div> 
    2415</body> 
  • trunk/system/views/kohana_error_page.php

    r1811 r2249  
    22<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
    33<head> 
    4  
    54<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    6  
    75<title><?php echo $error ?></title> 
    8  
    9 <style type="text/css"> 
    10 /* <![CDATA[ */ 
    11 * {padding:0;margin:0;border:0;} 
    12 body {background:#eee;font-family:sans-serif;font-size:85%;} 
    13 h1,h2,h3,h4 {margin-bottom:0.5em;padding:0.2em 0;border-bottom:solid 1px #ccc;color:#911;} 
    14 h1 {font-size:2em;} 
    15 h2 {font-size:1.5em;} 
    16 p,pre {margin-bottom:0.5em;} 
    17 strong {color:#700;} 
    18 #wrap {width:600px;margin:2em auto;padding:0.5em 1em;background:#fff;border:solid 1px #ddd;border-bottom:solid 2px #aaa;} 
    19 #stats {margin:0;padding-top: 0.5em;border-top:solid 1px #ccc;font-size:0.8em;text-align:center;color:#555;} 
    20 .message {margin:1em;padding:0.5em;background:#dfdfdf;border:solid 1px #999;} 
    21 .detail {text-align:center;} 
    22 .backtrace {margin:0 2em 1em;} 
    23 .backtrace pre {background:#eee;} 
    24 /* ]]> */ 
    25 </style> 
    26 <!-- 
    27  This is a little <script> does two things: 
    28    1. Prevents a strange bug that can happen in IE when using the <style> tag 
    29    2. Accounts for PHP's relative anchors in errors 
    30 --> 
    31 <script type="text/javascript">document.write('<base href="http://php.net/" />')</script> 
     6<base href="http://php.net/" /> 
    327</head> 
    338<body> 
    34 <div id="wrap"> 
    35 <h1><?php echo $error ?></h1> 
     9<style type="text/css"> 
     10<?php echo KOHANA_ERROR_CSS ?> 
     11</style> 
     12<div id="kohana_error" style="width:42em;margin:20px auto;"> 
     13<h3><?php echo $error ?></h3> 
    3614<p><?php echo $description ?></p> 
    37 <p class="message"><?php echo $message ?></p> 
    38 <?php if ($line != FALSE AND $file != FALSE): ?> 
    39 <p class="detail"><?php echo Kohana::lang('core.error_message', $line, $file) ?></p> 
    40 <?php endif; ?> 
    41 <?php if (isset($trace)): ?> 
    42 <h2><?php echo Kohana::lang('core.stack_trace') ?></h2> 
     15<?php if ( ! empty($line) AND ! empty($file)): ?> 
     16<p><?php echo Kohana::lang('core.error_file_line', $file, $line) ?></p> 
     17<?php endif ?> 
     18<p><code class="block"><?php echo $message ?></code></p> 
     19<?php if ( ! empty($trace)): ?> 
     20<h3><?php echo Kohana::lang('core.stack_trace') ?></h3> 
    4321<?php echo $trace ?> 
    44 <?php endif; ?> 
    45 <p id="stats"><?php echo Kohana::lang('core.stats_footer') ?></p> 
     22<?php endif ?> 
     23<p class="stats"><?php echo Kohana::lang('core.stats_footer') ?></p> 
    4624</div> 
    4725</body>