Skip to content

Commit

Permalink
Updated Kohana to r4728
Browse files Browse the repository at this point in the history
  • Loading branch information
bharat committed Dec 23, 2009
1 parent 05c50a0 commit 3e8e13b
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 126 deletions.
7 changes: 2 additions & 5 deletions system/core/Kohana.php
Expand Up @@ -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
Expand Down Expand Up @@ -810,11 +810,8 @@ public static function find_file($directory, $filename, $required = FALSE, $ext
{
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
{
Expand Down
26 changes: 14 additions & 12 deletions system/core/Kohana_Exception.php
Expand Up @@ -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
Expand Down Expand Up @@ -119,7 +119,7 @@ public static function handle(Exception $e)
// 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;
Expand All @@ -146,7 +146,7 @@ public static function handle(Exception $e)
}

// Use the human-readable error name
$code = Kohana::message('core.errors.'.$code);
$code = Kohana::message('kohana/core.errors.'.$code);
}
else
{
Expand All @@ -160,7 +160,7 @@ public static function handle(Exception $e)
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', '<'))
{
Expand Down Expand Up @@ -233,22 +233,24 @@ public function sendHeaders()
*
* @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);
}

/**
* Helper for Kohana_Exception::dump(), handles recursion in arrays and objects.
*
* @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)
{
Expand Down Expand Up @@ -327,7 +329,7 @@ private static function _dump( & $var, $length = 128, $level = 0)
{
$output[] = "(\n$space$s*RECURSION*\n$space)";
}
elseif ($level < 5)
elseif ($level <= $max_level)
{
$output[] = "<span>(";

Expand All @@ -340,7 +342,7 @@ private static function _dump( & $var, $length = 128, $level = 0)
$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]);

Expand Down Expand Up @@ -377,7 +379,7 @@ private static function _dump( & $var, $length = 128, $level = 0)
{
$output[] = "{\n$space$s*RECURSION*\n$space}";
}
elseif ($level < 5)
elseif ($level <= $max_level)
{
$output[] = "<code>{";

Expand All @@ -397,7 +399,7 @@ private static function _dump( & $var, $length = 128, $level = 0)
$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]);

Expand Down
31 changes: 1 addition & 30 deletions system/libraries/Input.php
Expand Up @@ -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
Expand Down Expand Up @@ -79,35 +79,6 @@ public function __construct()
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)
Expand Down
37 changes: 0 additions & 37 deletions system/messages/core.php

This file was deleted.

37 changes: 37 additions & 0 deletions 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';
}
42 changes: 25 additions & 17 deletions 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',
);

0 comments on commit 3e8e13b

Please sign in to comment.