Changeset 2249
- Timestamp:
- 03/09/2008 03:09:43 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 5 modified
-
index.php (modified) (5 diffs)
-
system/core/Kohana.php (modified) (2 diffs)
-
system/i18n/en_US/core.php (modified) (1 diff)
-
system/views/kohana_error_disabled.php (modified) (1 diff)
-
system/views/kohana_error_page.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/index.php
r2242 r2249 5 5 * PHP error_reporting level may also be changed. 6 6 * 7 * @package Core 8 * @author Kohana Team 9 * @copyright (c) 2007-2008 Kohana Team 10 * @license http://kohanaphp.com/license.html 7 * @see http://kohanaphp.com 11 8 */ 12 9 … … 45 42 $kohana_system = 'system'; 46 43 44 /** 45 * Test to make sure that Kohana is running on PHP 5.2 or newer. Once you are 46 * sure that your environment is compatible with Kohana, you can comment this 47 * line out. When running an application on a new server, uncomment this line 48 * to check the PHP version quickly. 49 */ 50 version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.'); 47 51 48 52 /** … … 59 63 60 64 /** 65 * Define the Kohana-generated error message style. 66 */ 67 define('KOHANA_ERROR_CSS', 68 // Any of these styles can be changed to affect all error messages. 69 'div#kohana_error { background: #fff; border:solid 1px #ccc; font-family:sans-serif; color:#111; font-size: 14px; line-height: 130%; vertical-align: baseline; }'. 70 'div#kohana_error h3 { color:#fff; font-size:16px; padding:8px 6px; margin:0 0 8px; background: #f15a00; text-align: center; }'. 71 'div#kohana_error a { color:#228; text-decoration:none; }'. 72 'div#kohana_error a:hover { text-decoration:underline; }'. 73 'div#kohana_error strong { color:#900; }'. 74 'div#kohana_error p { margin:0; padding:4px 6px 10px; }'. 75 'div#kohana_error tt,'. 76 'div#kohana_error pre,'. 77 'div#kohana_error code { font-family:monospace; padding:2px 4px; white-space:pre; font-size:12px; color:#333; }'. 78 'div#kohana_error tt { font-style:italic; }'. 79 'div#kohana_error tt:before { content:">"; color:#aaa; }'. 80 'div#kohana_error code tt:before { content:""; }'. 81 'div#kohana_error pre,'. 82 'div#kohana_error code { background:#eaeee5; border:solid 0 #D6D8D1; border-width:0 1px 1px 0; }'. 83 'div#kohana_error .block { display:block; text-align:left; }'. 84 'div#kohana_error .stats { padding: 4px; background: #eee; border-top:solid 1px #ccc; text-align:center; font-size:10px; color: #888; }'. 85 'div#kohana_error .backtrace { margin:0; padding:0 6px; list-style:none; line-height:12px; }' 86 ); 87 88 /** 61 89 * If you rename all of your .php files to a different extension, set the new 62 90 * extension here. This option can left to .php, even if this file is has a … … 64 92 */ 65 93 define('EXT', '.php'); 66 67 /**68 * Test to make sure that Kohana is running on PHP 5.2 or newer. Once you are69 * sure that your environment is compatible with Kohana, you can disable this.70 */71 version_compare(PHP_VERSION, '5.2', '<') and exit('Kohana requires PHP 5.2 or newer.');72 94 73 95 // … … 92 114 unset($kohana_application, $kohana_modules, $kohana_system); 93 115 94 (is_dir(APPPATH) AND is_dir(APPPATH.'/config')) or die 95 ( 96 'Your <code>$kohana_application</code> directory does not exist. '. 97 'Set a valid <code>$kohana_application</code> in <tt>'.KOHANA.'</tt> and refresh the page.' 98 ); 116 if ( ! IN_PRODUCTION) 117 { 118 // Check APPPATH 119 if ( ! (is_dir(APPPATH) AND file_exists(APPPATH.'/config/config'.EXT))) 120 { 121 die 122 ( 123 '<style type="text/css">'.KOHANA_ERROR_CSS.'</style>'. 124 '<div id="kohana_error" style="width:26em;margin:50px auto;text-align:center;">'. 125 '<h3>Application Directory Not Found</h3>'. 126 '<p>The <code>$kohana_application</code> directory does not exist.</p>'. 127 '<p>Set <code>$kohana_application</code> in <tt>'.KOHANA.'</tt> to a valid directory and refresh the page.</p>'. 128 '</div>' 129 ); 130 } 99 131 100 (is_dir(SYSPATH) AND file_exists(SYSPATH.'/core/'.'Bootstrap'.EXT)) or die 101 ( 102 'Your <code>$kohana_system</code> directory does not exist. '. 103 'Set a valid <code>$kohana_system</code> in <tt>'.KOHANA.'</tt> and refresh the page.' 104 ); 132 // Check SYSPATH 133 if ( ! (is_dir(SYSPATH) AND file_exists(SYSPATH.'/core/Bootstrap'.EXT))) 134 { 135 die 136 ( 137 '<style type="text/css">'.KOHANA_ERROR_CSS.'</style>'. 138 '<div id="kohana_error" style="width:26em;margin:50px auto;text-align:center;">'. 139 '<h3>System Directory Not Found</h3>'. 140 '<p>The <code>$kohana_system</code> directory does not exist.</p>'. 141 '<p>Set <code>$kohana_system</code> in <tt>'.KOHANA.'</tt> to a valid directory and refresh the page.</p>'. 142 '</div>' 143 ); 144 } 145 } 105 146 147 // Initialize. 106 148 require SYSPATH.'core/Bootstrap'.EXT; -
trunk/system/core/Kohana.php
r2229 r2249 534 534 if (Config::item('core.display_errors')) 535 535 { 536 if ( $line != FALSE)536 if ( ! IN_PRODUCTION AND $line != FALSE) 537 537 { 538 538 // Remove the first entry of debug_backtrace(), it is the exception_handler call … … 1088 1088 if (isset($entry['file'])) 1089 1089 { 1090 // Add file (without docroot) 1091 $temp .= '<strong>'.preg_replace('!^'.preg_quote(DOCROOT).'!', '', $entry['file']); 1092 // Add line 1093 $temp .= ' ['.$entry['line'].']:</strong>'; 1090 $temp .= Kohana::lang('core.error_file_line', preg_replace('!^'.preg_quote(DOCROOT).'!', '', $entry['file']), $entry['line']); 1094 1091 } 1095 1092 -
trunk/system/i18n/en_US/core.php
r1810 r2249 13 13 'page_not_found' => 'The page you requested, <tt>%s</tt>, could not be found.', 14 14 'stats_footer' => 'Loaded in {execution_time} seconds, using {memory_usage} of memory. Generated by Kohana v{kohana_version}.', 15 'error_ message' => 'Error occurred at <strong>line %s</strong> of <strong>%s</strong>.',15 'error_file_line' => '<tt>%s <strong>[%s]:</strong></tt>', 16 16 'stack_trace' => 'Stack Trace', 17 17 'generic_error' => 'Unable to Complete Request', -
trunk/system/views/kohana_error_disabled.php
r1911 r2249 2 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 3 3 <head> 4 5 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 6 7 5 <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>18 6 </head> 19 7 <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> 23 14 </div> 24 15 </body> -
trunk/system/views/kohana_error_page.php
r1811 r2249 2 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 3 3 <head> 4 5 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 6 7 5 <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/" /> 32 7 </head> 33 8 <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> 36 14 <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 <h 2><?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> 43 21 <?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> 46 24 </div> 47 25 </body>
