summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/core/Kohana.php7
-rw-r--r--system/core/Kohana_Exception.php26
-rw-r--r--system/libraries/Input.php31
-rw-r--r--system/messages/core.php37
-rw-r--r--system/messages/kohana/core.php37
-rw-r--r--system/messages/validation/default.php42
-rw-r--r--system/views/kohana/error.php50
7 files changed, 104 insertions, 126 deletions
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[] = "<span>(";
@@ -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[] = "<code>{";
@@ -397,7 +399,7 @@ class Kohana_Exception_Core extends Exception {
$access = '<small>public</small>';
}
- $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 @@
-<?php
-
-$messages = array
-(
- 'errors' => 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 @@
+<?php defined('SYSPATH') OR die('No direct access allowed.');
+/**
+ * Core Kohana messages
+ *
+ * @package Core
+ * @author Kohana Team
+ * @copyright (c) 2009 Kohana Team
+ * @license http://kohanaphp.com/license
+ */
+$messages = array
+(
+ 'errors' => 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 @@
-<?php defined('SYSPATH') or die('No direct script access.');
-
-$messages = array(
- 'required' => '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',
-);
+<?php defined('SYSPATH') or die('No direct script access.');
+/**
+ * Default validation messages
+ *
+ * @package Validation
+ * @author Kohana Team
+ * @copyright (c) 2009 Kohana Team
+ * @license http://kohanaphp.com/license
+ */
+
+$messages = array(
+ 'required' => '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');
?>
<style type="text/css">
-
+
#kohana_error {
background: #CFF292;
font-size: 1em;
@@ -11,7 +11,7 @@ $error_id = uniqid('error');
text-align: left;
color: #111;
}
-
+
#kohana_error h1, #kohana_error h2 {
margin: 0;
padding: 1em;
@@ -20,37 +20,37 @@ $error_id = uniqid('error');
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;
@@ -59,20 +59,20 @@ $error_id = uniqid('error');
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;
@@ -80,26 +80,26 @@ $error_id = uniqid('error');
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;
@@ -110,19 +110,19 @@ $error_id = uniqid('error');
function koggle(elem)
{
elem = document.getElementById(elem);
-
- if (elem.style && elem.style['display'])
+
+ if (elem.style && elem.style['display'])
// Only works with the "style" attr
var disp = elem.style['display'];
- else
- if (elem.currentStyle)
+ else
+ if (elem.currentStyle)
// For MSIE, naturally
var disp = elem.currentStyle['display'];
- else
- if (window.getComputedStyle)
+ 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;
@@ -131,7 +131,7 @@ $error_id = uniqid('error');
<div id="kohana_error">
<h1>
<span class="type">
-<?php echo $type?> [ <?php echo $code?> ]:
+<?php echo $type?> [ <?php echo __($code)?> ]:
</span>
<span class="message">
<?php echo $message?>