From 9b6663f87a7e679ffba691cf516191fc840cf978 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 24 Nov 2009 19:20:36 -0800 Subject: Update to Kohana r4684 which is now Kohana 2.4 and has substantial changes. --- system/views/kohana/error.php | 252 +++++++++++++++++++++++++++++++++ system/views/kohana/error_disabled.php | 19 +++ system/views/kohana/template.php | 6 +- system/views/kohana_error_disabled.php | 17 --- system/views/kohana_error_page.php | 27 ---- system/views/kohana_errors.css | 21 --- system/views/kohana_profiler.php | 37 ----- system/views/kohana_profiler_table.css | 53 ------- system/views/kohana_profiler_table.php | 25 ---- system/views/profiler/profiler.php | 37 +++++ system/views/profiler/table.css | 53 +++++++ system/views/profiler/table.php | 24 ++++ 12 files changed, 388 insertions(+), 183 deletions(-) create mode 100644 system/views/kohana/error.php create mode 100644 system/views/kohana/error_disabled.php delete mode 100644 system/views/kohana_error_disabled.php delete mode 100644 system/views/kohana_error_page.php delete mode 100644 system/views/kohana_errors.css delete mode 100644 system/views/kohana_profiler.php delete mode 100644 system/views/kohana_profiler_table.css delete mode 100644 system/views/kohana_profiler_table.php create mode 100644 system/views/profiler/profiler.php create mode 100644 system/views/profiler/table.css create mode 100644 system/views/profiler/table.php (limited to 'system/views') diff --git a/system/views/kohana/error.php b/system/views/kohana/error.php new file mode 100644 index 00000000..b40c0f8a --- /dev/null +++ b/system/views/kohana/error.php @@ -0,0 +1,252 @@ + + + +
+

+ + [ ]: + + + + +

+
+

+ +[ ] + +

+ + +
 $row) : ?>
+ + + +
    + $step): ?> +
  1. +

    + + + + [ ] + + [ ] + + + {} + + + » + ( +) +

    + + + + + + +
  2. + + +
+ + +
+

+ +
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 echo htmlspecialchars(__('Unable to Complete Request'), ENT_QUOTES, Kohana::CHARSET) ?> + + +
+

+

+home page or try again.', + array('%site%' => htmlspecialchars(url::site(), ENT_QUOTES, Kohana::CHARSET), '%uri%' => htmlspecialchars(url::site(Router::$current_uri), ENT_QUOTES, Kohana::CHARSET))); +?> +

+
+ + 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 @@ - <?php echo html::specialchars($title) ?> + <?php echo html::chars(__($title)) ?> - -<?php echo $error ?> - - -
-

-

-
- - \ 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 echo $error ?> - - - -
-

-

- -

- -

- -

- - -

-
- - \ 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/kohana_profiler.php deleted file mode 100644 index da77a669..00000000 --- a/system/views/kohana_profiler.php +++ /dev/null @@ -1,37 +0,0 @@ - - -
-render(); -} -?> -

Profiler executed in s

-
\ No newline at end of file diff --git a/system/views/kohana_profiler_table.css b/system/views/kohana_profiler_table.css deleted file mode 100644 index 6e7601c9..00000000 --- a/system/views/kohana_profiler_table.css +++ /dev/null @@ -1,53 +0,0 @@ -#kohana-profiler .kp-table -{ - font-size: 1.0em; - color: #4D6171; - width: 100%; - border-collapse: collapse; - border-top: 1px solid #E5EFF8; - border-right: 1px solid #E5EFF8; - border-left: 1px solid #E5EFF8; - margin-bottom: 10px; -} -#kohana-profiler .kp-table td -{ - background-color: #FFFFFF; - border-bottom: 1px solid #E5EFF8; - padding: 3px; - vertical-align: top; -} -#kohana-profiler .kp-table .kp-title td -{ - font-weight: bold; - background-color: inherit; -} -#kohana-profiler .kp-table .kp-altrow td -{ - background-color: #F7FBFF; -} -#kohana-profiler .kp-table .kp-totalrow td -{ - background-color: #FAFAFA; - border-top: 1px solid #D2DCE5; - font-weight: bold; -} -#kohana-profiler .kp-table .kp-column -{ - width: 100px; - border-left: 1px solid #E5EFF8; - text-align: center; -} -#kohana-profiler .kp-table .kp-data, #kohana-profiler .kp-table .kp-name -{ - background-color: #FAFAFB; - vertical-align: top; -} -#kohana-profiler .kp-table .kp-name -{ - width: 200px; - border-right: 1px solid #E5EFF8; -} -#kohana-profiler .kp-table .kp-altrow .kp-data, #kohana-profiler .kp-table .kp-altrow .kp-name -{ - background-color: #F6F8FB; -} \ No newline at end of file diff --git a/system/views/kohana_profiler_table.php b/system/views/kohana_profiler_table.php deleted file mode 100644 index b6b46530..00000000 --- a/system/views/kohana_profiler_table.php +++ /dev/null @@ -1,25 +0,0 @@ - - - - > - $column) - { - $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)) ? '
'.html::specialchars(print_r($value, TRUE)).'
' : html::specialchars($value); - echo '', $value, ''; - } - ?> - - -
\ No newline at end of file diff --git a/system/views/profiler/profiler.php b/system/views/profiler/profiler.php new file mode 100644 index 00000000..7b9ae951 --- /dev/null +++ b/system/views/profiler/profiler.php @@ -0,0 +1,37 @@ + + +
+render(); +} +?> +

number_format($execution_time, 3))) ?>

+
\ No newline at end of file diff --git a/system/views/profiler/table.css b/system/views/profiler/table.css new file mode 100644 index 00000000..41a1c9a3 --- /dev/null +++ b/system/views/profiler/table.css @@ -0,0 +1,53 @@ +#kohana-profiler .kp-table +{ + font-size: 1.0em; + color: #4D6171; + width: 100%; + border-collapse: collapse; + border-top: 1px solid #E5EFF8; + border-right: 1px solid #E5EFF8; + border-left: 1px solid #E5EFF8; + margin-bottom: 10px; +} +#kohana-profiler .kp-table td +{ + background-color: #FFFFFF; + border-bottom: 1px solid #E5EFF8; + padding: 3px; + vertical-align: top; +} +#kohana-profiler .kp-table .kp-title td +{ + font-weight: bold; + background-color: inherit; +} +#kohana-profiler .kp-table .kp-altrow td +{ + background-color: #F7FBFF; +} +#kohana-profiler .kp-table .kp-totalrow td +{ + background-color: #FAFAFA; + border-top: 1px solid #D2DCE5; + font-weight: bold; +} +#kohana-profiler .kp-table .kp-column +{ + width: 100px; + border-left: 1px solid #E5EFF8; + text-align: center; +} +#kohana-profiler .kp-table .kp-data, #kohana-profiler .kp-table .kp-name +{ + background-color: #FAFAFB; + vertical-align: top; +} +#kohana-profiler .kp-table .kp-name +{ + width: 200px; + border-right: 1px solid #E5EFF8; +} +#kohana-profiler .kp-table .kp-altrow .kp-data, #kohana-profiler .kp-table .kp-altrow .kp-name +{ + background-color: #F6F8FB; +} \ No newline at end of file diff --git a/system/views/profiler/table.php b/system/views/profiler/table.php new file mode 100644 index 00000000..7cdf79dd --- /dev/null +++ b/system/views/profiler/table.php @@ -0,0 +1,24 @@ + + + + > + $column) + { + $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)) ? '
'.htmlspecialchars(print_r($value, TRUE), ENT_QUOTES, Kohana::CHARSET).'
' : htmlspecialchars($value, ENT_QUOTES, Kohana::CHARSET); + echo '' . wordwrap($value, 100, '
', true) . ''; + } + ?> + + +
-- cgit v1.2.3 From 3e8e13bd2533ff7e3493b27c8a8587dfb65e1b26 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 23 Dec 2009 12:42:57 -0800 Subject: Updated Kohana to r4728 --- system/core/Kohana.php | 7 ++--- system/core/Kohana_Exception.php | 26 ++++++++++-------- system/libraries/Input.php | 31 +-------------------- system/messages/core.php | 37 ------------------------- system/messages/kohana/core.php | 37 +++++++++++++++++++++++++ system/messages/validation/default.php | 42 ++++++++++++++++------------ system/views/kohana/error.php | 50 +++++++++++++++++----------------- 7 files changed, 104 insertions(+), 126 deletions(-) delete mode 100644 system/messages/core.php create mode 100644 system/messages/kohana/core.php (limited to 'system/views') diff --git a/system/core/Kohana.php b/system/core/Kohana.php index 740adb80..29ca708c 100644 --- a/system/core/Kohana.php +++ b/system/core/Kohana.php @@ -2,7 +2,7 @@ /** * Provides Kohana-specific helper functions. This is where the magic happens! * - * $Id: Kohana.php 4724 2009-12-21 16:28:54Z isaiah $ + * $Id: Kohana.php 4726 2009-12-23 18:58:53Z isaiah $ * * @package Core * @author Kohana Team @@ -810,11 +810,8 @@ abstract class Kohana_Core { { if ($required === TRUE) { - // Directory i18n key - $directory = 'core.'.inflector::singular($directory); - // If the file is required, throw an exception - throw new Kohana_Exception('The requested :resource:, :file:, could not be found', array(':resource:' => Kohana::message($directory), ':file:' =>$filename)); + throw new Kohana_Exception('The requested :resource:, :file:, could not be found', array(':resource:' => __($directory), ':file:' =>$filename)); } else { diff --git a/system/core/Kohana_Exception.php b/system/core/Kohana_Exception.php index 2eb28f75..0cbc472c 100644 --- a/system/core/Kohana_Exception.php +++ b/system/core/Kohana_Exception.php @@ -2,7 +2,7 @@ /** * Kohana Exceptions * - * $Id: Kohana_Exception.php 4692 2009-12-04 15:59:44Z cbandy $ + * $Id: Kohana_Exception.php 4726 2009-12-23 18:58:53Z isaiah $ * * @package Core * @author Kohana Team @@ -119,7 +119,7 @@ class Kohana_Exception_Core extends Exception { // Manually save logs after exceptions Kohana_Log::save(); - if (Kohana::config('core.display_errors') === FALSE) + if (Kohana::config('kohana/core.display_errors') === FALSE) { // Do not show the details $file = $line = NULL; @@ -146,7 +146,7 @@ class Kohana_Exception_Core extends Exception { } // Use the human-readable error name - $code = Kohana::message('core.errors.'.$code); + $code = Kohana::message('kohana/core.errors.'.$code); } else { @@ -160,7 +160,7 @@ class Kohana_Exception_Core extends Exception { if ($e instanceof ErrorException) { // Use the human-readable error name - $code = Kohana::message('core.errors.'.$e->getSeverity()); + $code = Kohana::message('kohana/core.errors.'.$e->getSeverity()); if (version_compare(PHP_VERSION, '5.3', '<')) { @@ -233,11 +233,12 @@ class Kohana_Exception_Core extends Exception { * * @param mixed variable to dump * @param integer maximum length of strings + * @param integer maximum levels of recursion * @return string */ - public static function dump($value, $length = 128) + public static function dump($value, $length = 128, $max_level = 5) { - return Kohana_Exception::_dump($value, $length); + return Kohana_Exception::_dump($value, $length, $max_level); } /** @@ -245,10 +246,11 @@ class Kohana_Exception_Core extends Exception { * * @param mixed variable to dump * @param integer maximum length of strings - * @param integer recursion level (internal) + * @param integer maximum levels of recursion + * @param integer current recursion level (internal) * @return string */ - private static function _dump( & $var, $length = 128, $level = 0) + private static function _dump( & $var, $length = 128, $max_level = 5, $level = 0) { if ($var === NULL) { @@ -327,7 +329,7 @@ class Kohana_Exception_Core extends Exception { { $output[] = "(\n$space$s*RECURSION*\n$space)"; } - elseif ($level < 5) + elseif ($level <= $max_level) { $output[] = "("; @@ -340,7 +342,7 @@ class Kohana_Exception_Core extends Exception { $key = '"'.$key.'"'; } - $output[] = "$space$s$key => ".Kohana_Exception::_dump($val, $length, $level + 1); + $output[] = "$space$s$key => ".Kohana_Exception::_dump($val, $length, $max_level, $level + 1); } unset($var[$marker]); @@ -377,7 +379,7 @@ class Kohana_Exception_Core extends Exception { { $output[] = "{\n$space$s*RECURSION*\n$space}"; } - elseif ($level < 5) + elseif ($level <= $max_level) { $output[] = "{"; @@ -397,7 +399,7 @@ class Kohana_Exception_Core extends Exception { $access = 'public'; } - $output[] = "$space$s$access $key => ".Kohana_Exception::_dump($val, $length, $level + 1); + $output[] = "$space$s$access $key => ".Kohana_Exception::_dump($val, $length, $max_level, $level + 1); } unset($objects[$hash]); diff --git a/system/libraries/Input.php b/system/libraries/Input.php index 04403854..7a277317 100644 --- a/system/libraries/Input.php +++ b/system/libraries/Input.php @@ -2,7 +2,7 @@ /** * Input library. * - * $Id: Input.php 4720 2009-12-17 21:15:03Z isaiah $ + * $Id: Input.php 4727 2009-12-23 19:03:05Z isaiah $ * * @package Core * @author Kohana Team @@ -79,35 +79,6 @@ class Input_Core { Kohana_Log::add('debug', 'Disable magic_quotes_gpc! It is evil and deprecated: http://php.net/magic_quotes'); } - // register_globals is enabled - if (ini_get('register_globals')) - { - if (isset($_REQUEST['GLOBALS'])) - { - // Prevent GLOBALS override attacks - exit('Global variable overload attack.'); - } - - // Destroy the REQUEST global - $_REQUEST = array(); - - // These globals are standard and should not be removed - $preserve = array('GLOBALS', '_REQUEST', '_GET', '_POST', '_FILES', '_COOKIE', '_SERVER', '_ENV', '_SESSION'); - - // This loop has the same effect as disabling register_globals - foreach (array_diff(array_keys($GLOBALS), $preserve) as $key) - { - global $$key; - $$key = NULL; - - // Unset the global variable - unset($GLOBALS[$key], $$key); - } - - // Warn the developer about register globals - Kohana_Log::add('debug', 'Disable register_globals! It is evil and deprecated: http://php.net/register_globals'); - } - if (is_array($_GET)) { foreach ($_GET as $key => $val) diff --git a/system/messages/core.php b/system/messages/core.php deleted file mode 100644 index 64f897e8..00000000 --- a/system/messages/core.php +++ /dev/null @@ -1,37 +0,0 @@ - array - ( - E_KOHANA => __('Framework Error'), // __('Please check the Kohana documentation for information about the following error.'), - E_PAGE_NOT_FOUND => __('Page Not Found'), // __('The requested page was not found. It may have moved, been deleted, or archived.'), - E_DATABASE_ERROR => __('Database Error'), // __('A database error occurred while performing the requested procedure. Please review the database error below for more information.'), - E_RECOVERABLE_ERROR => __('Recoverable Error'), // __('An error was detected which prevented the loading of this page. If this problem persists, please contact the website administrator.'), - E_ERROR => __('Fatal Error'), - E_COMPILE_ERROR => __('Fatal Error'), - E_CORE_ERROR => __('Fatal Error'), - E_USER_ERROR => __('Fatal Error'), - E_PARSE => __('Syntax Error'), - E_WARNING => __('Warning Message'), - E_COMPILE_WARNING => __('Warning Message'), - E_CORE_WARNING => __('Warning Message'), - E_USER_WARNING => __('Warning Message'), - E_STRICT => __('Strict Mode Error'), - E_NOTICE => __('Runtime Message'), - E_USER_NOTICE => __('Runtime Message'), - ), - 'config' => 'config file', - 'controller' => 'controller', - 'helper' => 'helper', - 'library' => 'library', - 'driver' => 'driver', - 'model' => 'model', - 'view' => 'view', -); - -// E_DEPRECATED is only defined in PHP >= 5.3.0 -if (defined('E_DEPRECATED')) -{ - $messages['errors'][E_DEPRECATED] = __('Deprecated'); -} \ No newline at end of file diff --git a/system/messages/kohana/core.php b/system/messages/kohana/core.php new file mode 100644 index 00000000..1361809b --- /dev/null +++ b/system/messages/kohana/core.php @@ -0,0 +1,37 @@ + array + ( + E_KOHANA => 'Framework Error', + E_PAGE_NOT_FOUND => 'Page Not Found', + E_DATABASE_ERROR => 'Database Error', + E_RECOVERABLE_ERROR => 'Recoverable Error', + E_ERROR => 'Fatal Error', + E_COMPILE_ERROR => 'Fatal Error', + E_CORE_ERROR => 'Fatal Error', + E_USER_ERROR => 'Fatal Error', + E_PARSE => 'Syntax Error', + E_WARNING => 'Warning Message', + E_COMPILE_WARNING => 'Warning Message', + E_CORE_WARNING => 'Warning Message', + E_USER_WARNING => 'Warning Message', + E_STRICT => 'Strict Mode Error', + E_NOTICE => 'Runtime Message', + E_USER_NOTICE => 'Runtime Message', + ), +); + +// E_DEPRECATED is only defined in PHP >= 5.3.0 +if (defined('E_DEPRECATED')) +{ + $messages['errors'][E_DEPRECATED] = 'Deprecated'; +} \ No newline at end of file diff --git a/system/messages/validation/default.php b/system/messages/validation/default.php index 2c59fa06..88580a6b 100644 --- a/system/messages/validation/default.php +++ b/system/messages/validation/default.php @@ -1,17 +1,25 @@ - 'The :field field is required', - 'length' => 'The :field field must be between :param1 and :param2 characters long', - 'depends_on' => 'The :field field requires the :param1 field', - 'matches' => 'The :field field must be the same as :param1', - 'email' => 'The :field field must be a valid email address', - 'decimal' => 'The :field field must be a decimal with :param1 places', - 'digit' => 'The :field field must be a digit', - 'in_array' => 'The :field field must be one of the available options', - 'alpha_numeric' => 'The :field field must consist only of alphabetical or numeric characters', - 'alpha_dash ' => 'The :field field must consist only of alphabetical, numeric, underscore and dash characters', - 'numeric ' => 'The :field field must be a valid number', - 'url' => 'The :field field must be a valid url', - 'phone' => 'The :field field must be a valid phone number', -); + 'The :field field is required', + 'length' => 'The :field field must be between :param1 and :param2 characters long', + 'depends_on' => 'The :field field requires the :param1 field', + 'matches' => 'The :field field must be the same as :param1', + 'email' => 'The :field field must be a valid email address', + 'decimal' => 'The :field field must be a decimal with :param1 places', + 'digit' => 'The :field field must be a digit', + 'in_array' => 'The :field field must be one of the available options', + 'alpha_numeric' => 'The :field field must consist only of alphabetical or numeric characters', + 'alpha_dash ' => 'The :field field must consist only of alphabetical, numeric, underscore and dash characters', + 'numeric ' => 'The :field field must be a valid number', + 'url' => 'The :field field must be a valid url', + 'phone' => 'The :field field must be a valid phone number', +); diff --git a/system/views/kohana/error.php b/system/views/kohana/error.php index b40c0f8a..aa6770c4 100644 --- a/system/views/kohana/error.php +++ b/system/views/kohana/error.php @@ -3,7 +3,7 @@ $error_id = uniqid('error'); ?>