diff options
Diffstat (limited to 'system/views')
-rw-r--r-- | system/views/kohana/error.php | 252 | ||||
-rw-r--r-- | system/views/kohana/error_disabled.php | 19 | ||||
-rw-r--r-- | system/views/kohana/template.php | 6 | ||||
-rw-r--r-- | system/views/kohana_error_disabled.php | 17 | ||||
-rw-r--r-- | system/views/kohana_error_page.php | 27 | ||||
-rw-r--r-- | system/views/kohana_errors.css | 21 | ||||
-rw-r--r-- | system/views/profiler/profiler.php (renamed from system/views/kohana_profiler.php) | 2 | ||||
-rw-r--r-- | system/views/profiler/table.css (renamed from system/views/kohana_profiler_table.css) | 0 | ||||
-rw-r--r-- | system/views/profiler/table.php (renamed from system/views/kohana_profiler_table.php) | 7 |
9 files changed, 278 insertions, 73 deletions
diff --git a/system/views/kohana/error.php b/system/views/kohana/error.php new file mode 100644 index 00000000..aa6770c4 --- /dev/null +++ b/system/views/kohana/error.php @@ -0,0 +1,252 @@ +<?php defined('SYSPATH') OR die('No direct access allowed.'); +// Unique error identifier +$error_id = uniqid('error'); +?> +<style type="text/css"> + + #kohana_error { + background: #CFF292; + font-size: 1em; + font-family: sans-serif; + text-align: left; + color: #111; + } + + #kohana_error h1, #kohana_error h2 { + margin: 0; + padding: 1em; + font-size: 1em; + font-weight: normal; + background: #CFF292; + color: #000000; + } + + #kohana_error h1 a, #kohana_error h2 a { + color: #000; + } + + #kohana_error h2 { + background: #CFF292; + border-top: 1px dotted; + } + + #kohana_error h3 { + margin: 0; + padding: 0.4em 0 0; + font-size: 1em; + font-weight: normal; + } + + #kohana_error p { + margin: 0; + padding: 0.2em 0; + } + + #kohana_error a { + color: #1b323b; + } + + #kohana_error pre { + overflow: auto; + white-space: pre-wrap; + } + + #kohana_error table { + width: 100%; + display: block; + margin: 0 0 0.4em; + padding: 0; + border-collapse: collapse; + background: #fff; + } + + #kohana_error table td { + border: solid 1px #ddd; + text-align: left; + vertical-align: top; + padding: 0.4em; + } + + #kohana_error div.content { + padding: 0.4em 1em 1em; + overflow: hidden; + border-top: 1px dotted; + } + + #kohana_error pre.source { + margin: 0 0 1em; + padding: 0.4em; + background: #fff; + border: dotted 1px #b7c680; + line-height: 1.2em; + } + + #kohana_error pre.source span.line { + display: block; + } + + #kohana_error pre.source span.highlight { + background: #f0eb96; + } + + #kohana_error pre.source span.line span.number { + color: #666; + } + + #kohana_error ol.trace { + display: block; + margin: 0 0 0 2em; + padding: 0; + list-style: decimal; + } + + #kohana_error ol.trace li { + margin: 0; + padding: 0; + } +</style> +<script type="text/javascript"> + document.write('<style type="text/css"> .collapsed { display: none; } </style>'); + function koggle(elem) + { + elem = document.getElementById(elem); + + if (elem.style && elem.style['display']) + // Only works with the "style" attr + var disp = elem.style['display']; + else + if (elem.currentStyle) + // For MSIE, naturally + var disp = elem.currentStyle['display']; + else + if (window.getComputedStyle) + // For most other browsers + var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display'); + + // Toggle the state of the "display" style + elem.style.display = disp == 'block' ? 'none' : 'block'; + return false; + } +</script> +<div id="kohana_error"> + <h1> + <span class="type"> +<?php echo $type?> [ <?php echo __($code)?> ]: + </span> + <span class="message"> +<?php echo $message?> + </span> + </h1> + <div id="<?php echo $error_id ?>" class="content"> + <p> + <span class="file"> +<?php echo Kohana_Exception::debug_path($file)?>[ <?php echo $line?> ] + </span> + </p> + +<?php if (Kohana_Exception::$source_output AND $source_code = Kohana_Exception::debug_source($file, $line)) : ?> + <pre class="source"><code><?php foreach ($source_code as $num => $row) : ?><span class="line <?php if ($num == $line) echo 'highlight' ?>"><span class="number"><?php echo $num ?></span><?php echo htmlspecialchars($row, ENT_NOQUOTES, Kohana::CHARSET) ?></span><?php endforeach ?></code></pre> +<?php endif ?> + +<?php if (Kohana_Exception::$trace_output) : ?> + <ol class="trace"> + <?php foreach (Kohana_Exception::trace($trace) as $i=>$step): ?> + <li> + <p> + <span class="file"> + <?php if ($step['file']): $source_id = $error_id.'source'.$i; ?> + <?php if (Kohana_Exception::$source_output AND $step['source']) : ?> + <a href="#<?php echo $source_id ?>" onclick="return koggle('<?php echo $source_id ?>')"><?php echo Kohana_Exception::debug_path($step['file'])?>[ <?php echo $step['line']?> ]</a> + <?php else : ?> + <span class="file"><?php echo Kohana_Exception::debug_path($step['file'])?>[ <?php echo $step['line']?> ]</span> + <?php endif ?> + <?php else : ?> + {<?php echo __('PHP internal call')?>} + <?php endif?> + </span> + » + <?php echo $step['function']?>(<?php if ($step['args']): $args_id = $error_id.'args'.$i; ?><a href="#<?php echo $args_id ?>" onclick="return koggle('<?php echo $args_id ?>')"><?php echo __('arguments')?></a> +<?php endif?>) + </p> + <?php if (isset($args_id)): ?> + <div id="<?php echo $args_id ?>" class="collapsed"> + <table cellspacing="0"> + <?php foreach ($step['args'] as $name=>$arg): ?> + <tr> + <td> + <code> +<?php echo $name?> + </code> + </td> + <td> + <pre><?php echo Kohana_Exception::dump($arg) ?></pre> + </td> + </tr> + <?php endforeach?> + </table> + </div> + <?php endif?> + <?php if (Kohana_Exception::$source_output AND $step['source'] AND isset($source_id)): ?> + <pre id="<?php echo $source_id ?>" class="source collapsed"><code><?php foreach ($step['source'] as $num => $row) : ?><span class="line <?php if ($num == $step['line']) echo 'highlight' ?>"><span class="number"><?php echo $num ?></span><?php echo htmlspecialchars($row, ENT_NOQUOTES, Kohana::CHARSET) ?></span><?php endforeach ?></code></pre> + <?php endif?> + </li> + <?php unset($args_id, $source_id); ?> + <?php endforeach?> + </ol> +<?php endif ?> + + </div> + <h2><a href="#<?php echo $env_id = $error_id.'environment' ?>" onclick="return koggle('<?php echo $env_id ?>')"><?php echo __('Environment')?></a></h2> + <div id="<?php echo $env_id ?>" class="content collapsed"> + <?php $included = get_included_files()?> + <h3><a href="#<?php echo $env_id = $error_id.'environment_included' ?>" onclick="return koggle('<?php echo $env_id ?>')"><?php echo __('Included files')?></a>(<?php echo count($included)?>)</h3> + <div id="<?php echo $env_id ?>" class="collapsed"> + <table cellspacing="0"> + <?php foreach ($included as $file): ?> + <tr> + <td> + <code> +<?php echo Kohana_Exception::debug_path($file)?> + </code> + </td> + </tr> + <?php endforeach?> + </table> + </div> + <?php $included = get_loaded_extensions()?> + <h3><a href="#<?php echo $env_id = $error_id.'environment_loaded' ?>" onclick="return koggle('<?php echo $env_id ?>')"><?php echo __('Loaded extensions')?></a>(<?php echo count($included)?>)</h3> + <div id="<?php echo $env_id ?>" class="collapsed"> + <table cellspacing="0"> + <?php foreach ($included as $file): ?> + <tr> + <td> + <code> +<?php echo Kohana_Exception::debug_path($file)?> + </code> + </td> + </tr> + <?php endforeach?> + </table> + </div> + <?php foreach (array('_SESSION', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER') as $var): ?> + <?php if ( empty($GLOBALS[$var]) OR ! is_array($GLOBALS[$var])) continue ?> + <h3><a href="#<?php echo $env_id = $error_id.'environment'.strtolower($var) ?>" onclick="return koggle('<?php echo $env_id ?>')">$<?php echo $var?></a></h3> + <div id="<?php echo $env_id ?>" class="collapsed"> + <table cellspacing="0"> + <?php foreach ($GLOBALS[$var] as $key=>$value): ?> + <tr> + <td> + <code> +<?php echo $key?> + </code> + </td> + <td> + <pre><?php echo Kohana_Exception::dump($value) ?></pre> + </td> + </tr> + <?php endforeach?> + </table> + </div> + <?php endforeach?> + </div> +</div> diff --git a/system/views/kohana/error_disabled.php b/system/views/kohana/error_disabled.php new file mode 100644 index 00000000..1024eb1e --- /dev/null +++ b/system/views/kohana/error_disabled.php @@ -0,0 +1,19 @@ +<?php defined('SYSPATH') OR die('No direct access allowed.'); ?> + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + <title><?php echo htmlspecialchars(__('Unable to Complete Request'), ENT_QUOTES, Kohana::CHARSET) ?></title> + </head> + <body> + <div id="framework_error" style="width:24em;margin:50px auto;"> + <h3 style="text-align:center"><?php echo htmlspecialchars(__('Unable to Complete Request'), ENT_QUOTES, Kohana::CHARSET) ?></h3> + <p style="text-align:center"> +<?php + echo __('You can go to the <a href="%site%">home page</a> or <a href="%uri%">try again</a>.', + array('%site%' => htmlspecialchars(url::site(), ENT_QUOTES, Kohana::CHARSET), '%uri%' => htmlspecialchars(url::site(Router::$current_uri), ENT_QUOTES, Kohana::CHARSET))); +?> + </p> + </div> + </body> +</html> diff --git a/system/views/kohana/template.php b/system/views/kohana/template.php index b090fd88..84ddbff5 100644 --- a/system/views/kohana/template.php +++ b/system/views/kohana/template.php @@ -5,7 +5,7 @@ <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> - <title><?php echo html::specialchars($title) ?></title> + <title><?php echo html::chars(__($title)) ?></title> <style type="text/css"> html { background: #83c018 url(<?php echo url::base(FALSE) ?>kohana.png) 50% 0 no-repeat; } @@ -24,11 +24,11 @@ </head> <body> - <h1><?php echo html::specialchars($title) ?></h1> + <h1><?php echo html::chars(__($title)) ?></h1> <?php echo $content ?> <p class="copyright"> - Rendered in {execution_time} seconds, using {memory_usage} of memory<br /> + <?php echo __('Rendered in {execution_time} seconds, using {memory_usage} of memory')?><br /> Copyright ©2007–2008 Kohana Team </p> diff --git a/system/views/kohana_error_disabled.php b/system/views/kohana_error_disabled.php deleted file mode 100644 index cd911328..00000000 --- a/system/views/kohana_error_disabled.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php defined('SYSPATH') OR die('No direct access allowed.'); ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> -<style type="text/css"> -<?php include Kohana::find_file('views', 'kohana_errors', FALSE, 'css') ?> -</style> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<title><?php echo $error ?></title> -</head> -<body> -<div id="framework_error" style="width:24em;margin:50px auto;"> -<h3><?php echo html::specialchars($error) ?></h3> -<p style="text-align:center"><?php echo $message ?></p> -</div> -</body> -</html>
\ No newline at end of file diff --git a/system/views/kohana_error_page.php b/system/views/kohana_error_page.php deleted file mode 100644 index 944064cc..00000000 --- a/system/views/kohana_error_page.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php defined('SYSPATH') OR die('No direct access allowed.'); ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> -<head> -<style type="text/css"> -<?php include Kohana::find_file('views', 'kohana_errors', FALSE, 'css') ?> -</style> -<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> -<title><?php echo $error ?></title> -<base href="http://php.net/" /> -</head> -<body> -<div id="framework_error" style="width:42em;margin:20px auto;"> -<h3><?php echo html::specialchars($error) ?></h3> -<p><?php echo html::specialchars($description) ?></p> -<?php if ( ! empty($line) AND ! empty($file)): ?> -<p><?php echo Kohana::lang('core.error_file_line', $file, $line) ?></p> -<?php endif ?> -<p><code class="block"><?php echo $message ?></code></p> -<?php if ( ! empty($trace)): ?> -<h3><?php echo Kohana::lang('core.stack_trace') ?></h3> -<?php echo $trace ?> -<?php endif ?> -<p class="stats"><?php echo Kohana::lang('core.stats_footer') ?></p> -</div> -</body> -</html>
\ No newline at end of file diff --git a/system/views/kohana_errors.css b/system/views/kohana_errors.css deleted file mode 100644 index 1341f57d..00000000 --- a/system/views/kohana_errors.css +++ /dev/null @@ -1,21 +0,0 @@ -div#framework_error { background:#fff; border:solid 1px #ccc; font-family:sans-serif; color:#111; font-size:14px; line-height:130%; } -div#framework_error h3 { color:#fff; font-size:16px; padding:8px 6px; margin:0 0 8px; background:#f15a00; text-align:center; } -div#framework_error a { color:#228; text-decoration:none; } -div#framework_error a:hover { text-decoration:underline; } -div#framework_error strong { color:#900; } -div#framework_error p { margin:0; padding:4px 6px 10px; } -div#framework_error tt, -div#framework_error pre, -div#framework_error code { font-family:monospace; padding:2px 4px; font-size:12px; color:#333; - white-space:pre-wrap; /* CSS 2.1 */ - white-space:-moz-pre-wrap; /* For Mozilla */ - word-wrap:break-word; /* For IE5.5+ */ -} -div#framework_error tt { font-style:italic; } -div#framework_error tt:before { content:">"; color:#aaa; } -div#framework_error code tt:before { content:""; } -div#framework_error pre, -div#framework_error code { background:#eaeee5; border:solid 0 #D6D8D1; border-width:0 1px 1px 0; } -div#framework_error .block { display:block; text-align:left; } -div#framework_error .stats { padding:4px; background: #eee; border-top:solid 1px #ccc; text-align:center; font-size:10px; color:#888; } -div#framework_error .backtrace { margin:0; padding:0 6px; list-style:none; line-height:12px; }
\ No newline at end of file diff --git a/system/views/kohana_profiler.php b/system/views/profiler/profiler.php index da77a669..7b9ae951 100644 --- a/system/views/kohana_profiler.php +++ b/system/views/profiler/profiler.php @@ -33,5 +33,5 @@ foreach ($profiles as $profile) echo $profile->render(); } ?> -<p class="kp-meta">Profiler executed in <?php echo number_format($execution_time, 3) ?>s</p> +<p class="kp-meta"><?php echo __('Profiler executed in :execution_timess', array(':execution_times' => number_format($execution_time, 3))) ?></p> </div>
\ No newline at end of file diff --git a/system/views/kohana_profiler_table.css b/system/views/profiler/table.css index 41a1c9a3..41a1c9a3 100644 --- a/system/views/kohana_profiler_table.css +++ b/system/views/profiler/table.css diff --git a/system/views/kohana_profiler_table.php b/system/views/profiler/table.php index b6b46530..7cdf79dd 100644 --- a/system/views/kohana_profiler_table.php +++ b/system/views/profiler/table.php @@ -13,13 +13,12 @@ $style = empty($row['style']) ? '' : ' style="'.$row['style'].'"'; $class = empty($column['class']) ? '' : ' class="'.$column['class'].'"'; $style = empty($column['style']) ? '' : ' style="'.$column['style'].'"'; $value = $row['data'][$index]; - $value = (is_array($value) OR is_object($value)) ? '<pre>'.html::specialchars(print_r($value, TRUE)).'</pre>' : html::specialchars($value); - echo '<td', $style, $class, '>', $value, '</td>'; + $value = (is_array($value) OR is_object($value)) ? '<pre>'.htmlspecialchars(print_r($value, TRUE), ENT_QUOTES, Kohana::CHARSET).'</pre>' : htmlspecialchars($value, ENT_QUOTES, Kohana::CHARSET); + echo '<td' . $style . $class . '>' . wordwrap($value, 100, '<br />', true) . '</td>'; } ?> </tr> <?php - endforeach; ?> -</table>
\ No newline at end of file +</table> |