Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update to newest kohana3 on 3.3/develop branch.

  • Loading branch information...
commit 68e709c1d040b873c1013c877d00648ffa5640ba 1 parent 49fd369
@shadlaws shadlaws authored
Showing with 905 additions and 318 deletions.
  1. +13 −0 kohana3/modified/application/bootstrap.php
  2. +33 −0 kohana3/modified/modules/cache/composer.json
  3. +1 −0  kohana3/modified/modules/database/classes/Kohana/Database/MySQL.php
  4. +37 −0 kohana3/modified/modules/database/composer.json
  5. +36 −0 kohana3/modified/modules/image/composer.json
  6. +5 −5 kohana3/modified/modules/orm/classes/Kohana/ORM.php
  7. +34 −0 kohana3/modified/modules/orm/composer.json
  8. +34 −0 kohana3/modified/modules/unittest/composer.json
  9. +7 −2 kohana3/modified/system/classes/Kohana/Arr.php
  10. +1 −1  kohana3/modified/system/classes/Kohana/Controller.php
  11. +1 −1  kohana3/modified/system/classes/Kohana/Cookie.php
  12. +0 −6 kohana3/modified/system/classes/Kohana/HTTP/Header.php
  13. +4 −0 kohana3/modified/system/classes/Kohana/Inflector.php
  14. +2 −8 kohana3/modified/system/classes/Kohana/Kohana/Exception.php
  15. +5 −9 kohana3/modified/system/classes/Kohana/Request.php
  16. +2 −2 kohana3/modified/system/classes/Kohana/Request/Client.php
  17. +6 −0 kohana3/modified/system/classes/Kohana/Request/Client/Internal.php
  18. +2 −2 kohana3/modified/system/classes/Kohana/Route.php
  19. +11 −1 kohana3/modified/system/classes/Kohana/Security.php
  20. +63 −65 kohana3/modified/system/classes/Kohana/UTF8.php
  21. +1 −1  kohana3/modified/system/classes/Kohana/Validation.php
  22. +1 −1  kohana3/modified/system/classes/Kohana/View.php
  23. +35 −0 kohana3/modified/system/composer.json
  24. +0 −24 kohana3/upstream/.travis.yml
  25. +13 −0 kohana3/upstream/application/bootstrap.php
  26. +33 −0 kohana3/upstream/modules/auth/composer.json
  27. +33 −0 kohana3/upstream/modules/cache/composer.json
  28. +33 −0 kohana3/upstream/modules/codebench/composer.json
  29. +1 −0  kohana3/upstream/modules/database/classes/Kohana/Database/MySQL.php
  30. +37 −0 kohana3/upstream/modules/database/composer.json
  31. +15 −0 kohana3/upstream/modules/database/guide/database/config.md
  32. +36 −0 kohana3/upstream/modules/image/composer.json
  33. +33 −0 kohana3/upstream/modules/minion/composer.json
  34. +1 −30 kohana3/upstream/modules/minion/guide/minion/setup.md
  35. +2 −2 kohana3/upstream/modules/minion/guide/minion/tasks.md
  36. 0  kohana3/upstream/modules/minion/tests/minion/{task.php → TaskTest.php}
  37. +4 −0 kohana3/upstream/modules/orm/classes/Kohana/Auth/ORM.php
  38. +5 −5 kohana3/upstream/modules/orm/classes/Kohana/ORM.php
  39. +34 −0 kohana3/upstream/modules/orm/composer.json
  40. +34 −0 kohana3/upstream/modules/unittest/composer.json
  41. +1 −1  kohana3/upstream/modules/userguide/classes/Kohana/Controller/Userguide.php
  42. +33 −0 kohana3/upstream/modules/userguide/composer.json
  43. +7 −2 kohana3/upstream/system/classes/Kohana/Arr.php
  44. +1 −1  kohana3/upstream/system/classes/Kohana/Controller.php
  45. +1 −1  kohana3/upstream/system/classes/Kohana/Cookie.php
  46. +0 −6 kohana3/upstream/system/classes/Kohana/HTTP/Header.php
  47. +4 −0 kohana3/upstream/system/classes/Kohana/Inflector.php
  48. +2 −8 kohana3/upstream/system/classes/Kohana/Kohana/Exception.php
  49. +5 −9 kohana3/upstream/system/classes/Kohana/Request.php
  50. +2 −2 kohana3/upstream/system/classes/Kohana/Request/Client.php
  51. +6 −0 kohana3/upstream/system/classes/Kohana/Request/Client/Internal.php
  52. +2 −2 kohana3/upstream/system/classes/Kohana/Route.php
  53. +11 −1 kohana3/upstream/system/classes/Kohana/Security.php
  54. +63 −65 kohana3/upstream/system/classes/Kohana/UTF8.php
  55. +1 −1  kohana3/upstream/system/classes/Kohana/Validation.php
  56. +1 −1  kohana3/upstream/system/classes/Kohana/View.php
  57. +35 −0 kohana3/upstream/system/composer.json
  58. +53 −34 kohana3/upstream/system/guide/kohana/install.md
  59. +1 −1  kohana3/upstream/system/guide/kohana/menu.md
  60. +1 −1  kohana3/upstream/system/guide/kohana/mvc/controllers.md
  61. +2 −2 kohana3/upstream/system/guide/kohana/mvc/views.md
  62. +0 −14 kohana3/upstream/system/guide/kohana/routing.md
  63. +1 −1  kohana3/upstream/system/guide/kohana/security/validation.md
  64. +2 −0  kohana3/upstream/system/tests/kohana/ArrTest.php
  65. +22 −0 kohana3/upstream/system/tests/kohana/CoreTest.php
View
13 kohana3/modified/application/bootstrap.php
@@ -56,6 +56,13 @@
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');
+/**
+ * Set the mb_substitute_character to "none"
+ *
+ * @link http://www.php.net/manual/function.mb-substitute-character.php
+ */
+mb_substitute_character('none');
+
// -- Configuration and initialization -----------------------------------------
/**
@@ -63,6 +70,12 @@
*/
I18n::lang('en-us');
+if (isset($_SERVER['SERVER_PROTOCOL']))
+{
+ // Replace the default protocol.
+ HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
+}
+
/**
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
*
View
33 kohana3/modified/modules/cache/composer.json
@@ -0,0 +1,33 @@
+{
+ "name": "kohana/cache",
+ "type": "kohana-module",
+ "description": "The official Kohana cache management module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "cache"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
1  kohana3/modified/modules/database/classes/Kohana/Database/MySQL.php
@@ -240,6 +240,7 @@ public function datatype($type)
'fixed' => array('type' => 'float', 'exact' => TRUE),
'fixed unsigned' => array('type' => 'float', 'exact' => TRUE, 'min' => '0'),
'float unsigned' => array('type' => 'float', 'min' => '0'),
+ 'geometry' => array('type' => 'string', 'binary' => TRUE),
'int unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
'integer unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
'longblob' => array('type' => 'string', 'binary' => TRUE, 'character_maximum_length' => '4294967295'),
View
37 kohana3/modified/modules/database/composer.json
@@ -0,0 +1,37 @@
+{
+ "name": "kohana/database",
+ "type": "kohana-module",
+ "description": "The official Kohana module for database interactions, building queries, and prepared statements",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "database"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mysql": "*",
+ "ext-pdo": "*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
36 kohana3/modified/modules/image/composer.json
@@ -0,0 +1,36 @@
+{
+ "name": "kohana/image",
+ "type": "kohana-module",
+ "description": "The official Kohana module for manipulating images",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "image"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-gd": "*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
10 kohana3/modified/modules/orm/classes/Kohana/ORM.php
@@ -1504,14 +1504,14 @@ public function has_any($alias, $far_keys = NULL)
* Returns the number of relationships
*
* // Counts the number of times the login role is attached to $model
- * $model->has('roles', ORM::factory('role', array('name' => 'login')));
+ * $model->count_relations('roles', ORM::factory('role', array('name' => 'login')));
* // Counts the number of times role 5 is attached to $model
- * $model->has('roles', 5);
+ * $model->count_relations('roles', 5);
* // Counts the number of times any of roles 1, 2, 3, or 4 are attached to
* // $model
- * $model->has('roles', array(1, 2, 3, 4));
+ * $model->count_relations('roles', array(1, 2, 3, 4));
* // Counts the number roles attached to $model
- * $model->has('roles')
+ * $model->count_relations('roles')
*
* @param string $alias Alias of the has_many "through" relationship
* @param mixed $far_keys Related model, primary key, or an array of primary keys
@@ -1644,7 +1644,7 @@ public function count_all()
$this->_build(Database::SELECT);
$records = $this->_db_builder->from(array($this->_table_name, $this->_object_name))
- ->select(array(DB::expr('COUNT(*)'), 'records_found'))
+ ->select(array(DB::expr('COUNT('.$this->_db->quote_column($this->_object_name.'.'.$this->_primary_key).')'), 'records_found'))
->execute($this->_db)
->get('records_found');
View
34 kohana3/modified/modules/orm/composer.json
@@ -0,0 +1,34 @@
+{
+ "name": "kohana/orm",
+ "type": "kohana-module",
+ "description": "The official Kohana ORM module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "ORM", "database"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "kohana/database": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
34 kohana3/modified/modules/unittest/composer.json
@@ -0,0 +1,34 @@
+{
+ "name": "kohana/unittest",
+ "type": "kohana-module",
+ "description": "PHPUnit integration for running unit tests on the Kohana framework",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
9 kohana3/modified/system/classes/Kohana/Arr.php
@@ -207,8 +207,13 @@ public static function set_path( & $array, $path, $value, $delimiter = NULL)
$delimiter = Arr::$delimiter;
}
- // Split the keys by delimiter
- $keys = explode($delimiter, $path);
+ // The path has already been separated into keys
+ $keys = $path;
+ if ( ! is_array($path))
+ {
+ // Split the keys by delimiter
+ $keys = explode($delimiter, $path);
+ }
// Set current $array to inner-most array path
while (count($keys) > 1)
View
2  kohana3/modified/system/classes/Kohana/Controller.php
@@ -124,7 +124,7 @@ public function after()
*/
public static function redirect($uri = '', $code = 302)
{
- return HTTP::redirect($uri, $code);
+ return HTTP::redirect( (string) $uri, $code);
}
/**
View
2  kohana3/modified/system/classes/Kohana/Cookie.php
@@ -149,7 +149,7 @@ public static function salt($name, $value)
// Require a valid salt
if ( ! Cookie::$salt)
{
- throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt.');
+ throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt in your bootstrap.php. For more information check the documentation');
}
// Determine the user agent
View
6 kohana3/modified/system/classes/Kohana/HTTP/Header.php
@@ -859,12 +859,6 @@ public function preferred_language(array $languages, $explicit = FALSE)
*/
public function send_headers(HTTP_Response $response = NULL, $replace = FALSE, $callback = NULL)
{
- if ($response === NULL)
- {
- // Default to the initial request message
- $response = Request::initial()->response();
- }
-
$protocol = $response->protocol();
$status = $response->status();
View
4 kohana3/modified/system/classes/Kohana/Inflector.php
@@ -183,6 +183,10 @@ public static function plural($str, $count = NULL)
{
$str = Inflector::$irregular[$str];
}
+ elseif (in_array($str, Inflector::$irregular))
+ {
+ // Do nothing
+ }
elseif (preg_match('/[sxz]$/', $str) OR preg_match('/[^aeioudgkprt]h$/', $str))
{
$str .= 'es';
View
10 kohana3/modified/system/classes/Kohana/Kohana/Exception.php
@@ -79,7 +79,7 @@ public function __toString()
*
* @uses Kohana_Exception::response
* @param Exception $e
- * @return boolean
+ * @return void
*/
public static function handler(Exception $e)
{
@@ -97,7 +97,7 @@ public static function handler(Exception $e)
*
* @uses Kohana_Exception::response
* @param Exception $e
- * @return boolean
+ * @return Response
*/
public static function _handler(Exception $e)
{
@@ -185,12 +185,6 @@ public static function response(Exception $e)
$line = $e->getLine();
$trace = $e->getTrace();
- if ( ! headers_sent())
- {
- // Make sure the proper http header is sent
- $http_header_status = ($e instanceof HTTP_Exception) ? $code : 500;
- }
-
/**
* HTTP_Exceptions are constructed in the HTTP_Exception::factory()
* method. We need to remove that entry from the trace and overwrite
View
14 kohana3/modified/system/classes/Kohana/Request.php
@@ -59,14 +59,7 @@ public static function factory($uri = TRUE, $client_params = array(), $allow_ext
// If this is the initial request
if ( ! Request::$initial)
{
- if (isset($_SERVER['SERVER_PROTOCOL']))
- {
- $protocol = $_SERVER['SERVER_PROTOCOL'];
- }
- else
- {
- $protocol = HTTP::$protocol;
- }
+ $protocol = HTTP::$protocol;
if (isset($_SERVER['REQUEST_METHOD']))
{
@@ -79,7 +72,10 @@ public static function factory($uri = TRUE, $client_params = array(), $allow_ext
$method = HTTP_Request::GET;
}
- if ( ! empty($_SERVER['HTTPS']) AND filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
+ if (( ! empty($_SERVER['HTTPS']) AND filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
+ OR (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
+ AND $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
+ AND in_array($_SERVER['REMOTE_ADDR'], Request::$trusted_proxies))
{
// This request is secure
$secure = TRUE;
View
4 kohana3/modified/system/classes/Kohana/Request/Client.php
@@ -105,8 +105,8 @@ public function execute(Request $request)
':depth' => $this->callback_depth() - 1,
));
- // Execute the request
- $orig_response = $response = Response::factory();
+ // Execute the request and pass the currently used protocol
+ $orig_response = $response = Response::factory(array('_protocol' => $request->protocol()));
if (($cache = $this->cache()) instanceof HTTP_Cache)
return $cache->execute($this, $request, $response);
View
6 kohana3/modified/system/classes/Kohana/Request/Client/Internal.php
@@ -104,6 +104,12 @@ public function execute_request(Request $request, Response $response)
}
catch (HTTP_Exception $e)
{
+ // Store the request context in the Exception
+ if ($e->request() === NULL)
+ {
+ $e->request($request);
+ }
+
// Get the response via the Exception
$response = $e->get_response();
}
View
4 kohana3/modified/system/classes/Kohana/Route.php
@@ -216,9 +216,9 @@ public static function url($name, array $params = NULL, $protocol = NULL)
// Create a URI with the route and convert it to a URL
if ($route->is_external())
- return Route::get($name)->uri($params);
+ return $route->uri($params);
else
- return URL::site(Route::get($name)->uri($params), $protocol);
+ return URL::site($route->uri($params), $protocol);
}
/**
View
12 kohana3/modified/system/classes/Kohana/Security.php
@@ -48,7 +48,17 @@ public static function token($new = FALSE)
if ($new === TRUE OR ! $token)
{
// Generate a new unique token
- $token = sha1(uniqid(NULL, TRUE));
+ if (function_exists('openssl_random_pseudo_bytes'))
+ {
+ // Generate a random pseudo bytes token if openssl_random_pseudo_bytes is available
+ // This is more secure than uniqid, because uniqid relies on microtime, which is predictable
+ $token = base64_encode(openssl_random_pseudo_bytes(32));
+ }
+ else
+ {
+ // Otherwise, fall back to a hashed uniqid
+ $token = sha1(uniqid(NULL, TRUE));
+ }
// Store the new token
$session->set(Security::$token_name, $token);
View
128 kohana3/modified/system/classes/Kohana/UTF8.php
@@ -8,8 +8,6 @@
* - PCRE needs to be compiled with UTF-8 support (--enable-utf8)
* - Support for [Unicode properties](http://php.net/manual/reference.pcre.pattern.modifiers.php)
* is highly recommended (--enable-unicode-properties)
- * - UTF-8 conversion will be much more reliable if the
- * [iconv extension](http://php.net/iconv) is loaded
* - The [mbstring extension](http://php.net/mbstring) is highly recommended,
* but must not be overloading string functions
*
@@ -42,11 +40,10 @@ class Kohana_UTF8 {
*
* UTF8::clean($_GET); // Clean GET data
*
- * [!!] This method requires [Iconv](http://php.net/iconv)
- *
* @param mixed $var variable to clean
* @param string $charset character set, defaults to Kohana::$charset
* @return mixed
+ * @uses UTF8::clean
* @uses UTF8::strip_ascii_ctrl
* @uses UTF8::is_ascii
*/
@@ -63,21 +60,20 @@ public static function clean($var, $charset = NULL)
foreach ($var as $key => $val)
{
// Recursion!
- $var[self::clean($key)] = self::clean($val);
+ $var[UTF8::clean($key)] = UTF8::clean($val);
}
}
elseif (is_string($var) AND $var !== '')
{
// Remove control characters
- $var = self::strip_ascii_ctrl($var);
+ $var = UTF8::strip_ascii_ctrl($var);
- if ( ! self::is_ascii($var))
+ if ( ! UTF8::is_ascii($var))
{
// Disable notices
$error_reporting = error_reporting(~E_NOTICE);
- // iconv is expensive, so it is only used when needed
- $var = iconv($charset, $charset.'//IGNORE', $var);
+ $var = mb_convert_encoding($var, $charset, $charset);
// Turn notices back on
error_reporting($error_reporting);
@@ -144,12 +140,12 @@ public static function strip_non_ascii($str)
*/
public static function transliterate_to_ascii($str, $case = 0)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _transliterate_to_ascii($str, $case);
@@ -164,18 +160,19 @@ public static function transliterate_to_ascii($str, $case = 0)
* @param string $str string being measured for length
* @return integer
* @uses UTF8::$server_utf8
+ * @uses Kohana::$charset
*/
public static function strlen($str)
{
if (UTF8::$server_utf8)
return mb_strlen($str, Kohana::$charset);
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strlen($str);
@@ -194,18 +191,19 @@ public static function strlen($str)
* @return integer position of needle
* @return boolean FALSE if the needle is not found
* @uses UTF8::$server_utf8
+ * @uses Kohana::$charset
*/
public static function strpos($str, $search, $offset = 0)
{
if (UTF8::$server_utf8)
return mb_strpos($str, $search, $offset, Kohana::$charset);
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strpos($str, $search, $offset);
@@ -230,12 +228,12 @@ public static function strrpos($str, $search, $offset = 0)
if (UTF8::$server_utf8)
return mb_strrpos($str, $search, $offset, Kohana::$charset);
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strrpos($str, $search, $offset);
@@ -262,12 +260,12 @@ public static function substr($str, $offset, $length = NULL)
? mb_substr($str, $offset, mb_strlen($str), Kohana::$charset)
: mb_substr($str, $offset, $length, Kohana::$charset);
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _substr($str, $offset, $length);
@@ -287,12 +285,12 @@ public static function substr($str, $offset, $length = NULL)
*/
public static function substr_replace($str, $replacement, $offset, $length = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _substr_replace($str, $replacement, $offset, $length);
@@ -305,21 +303,22 @@ public static function substr_replace($str, $replacement, $offset, $length = NUL
* $str = UTF8::strtolower($str);
*
* @author Andreas Gohr <andi@splitbrain.org>
- * @param string $str mixed case string
+ * @param string $str mixed case string
* @return string
* @uses UTF8::$server_utf8
+ * @uses Kohana::$charset
*/
public static function strtolower($str)
{
if (UTF8::$server_utf8)
return mb_strtolower($str, Kohana::$charset);
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strtolower($str);
@@ -330,7 +329,7 @@ public static function strtolower($str)
* of [strtoupper](http://php.net/strtoupper).
*
* @author Andreas Gohr <andi@splitbrain.org>
- * @param string $str mixed case string
+ * @param string $str mixed case string
* @return string
* @uses UTF8::$server_utf8
* @uses Kohana::$charset
@@ -340,12 +339,12 @@ public static function strtoupper($str)
if (UTF8::$server_utf8)
return mb_strtoupper($str, Kohana::$charset);
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strtoupper($str);
@@ -358,17 +357,17 @@ public static function strtoupper($str)
* $str = UTF8::ucfirst($str);
*
* @author Harry Fuecks <hfuecks@gmail.com>
- * @param string $str mixed case string
+ * @param string $str mixed case string
* @return string
*/
public static function ucfirst($str)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _ucfirst($str);
@@ -381,18 +380,17 @@ public static function ucfirst($str)
* $str = UTF8::ucwords($str);
*
* @author Harry Fuecks <hfuecks@gmail.com>
- * @param string $str mixed case string
+ * @param string $str mixed case string
* @return string
- * @uses UTF8::$server_utf8
*/
public static function ucwords($str)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _ucwords($str);
@@ -413,12 +411,12 @@ public static function ucwords($str)
*/
public static function strcasecmp($str1, $str2)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strcasecmp($str1, $str2);
@@ -442,12 +440,12 @@ public static function strcasecmp($str1, $str2)
*/
public static function str_ireplace($search, $replace, $str, & $count = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _str_ireplace($search, $replace, $str, $count);
@@ -460,7 +458,7 @@ public static function str_ireplace($search, $replace, $str, & $count = NULL)
*
* $found = UTF8::stristr($str, $search);
*
- * @author Harry Fuecks <hfuecks@gmail.com>
+ * @author Harry Fuecks <hfuecks@gmail.com>
* @param string $str input string
* @param string $search needle
* @return string matched substring if found
@@ -468,12 +466,12 @@ public static function str_ireplace($search, $replace, $str, & $count = NULL)
*/
public static function stristr($str, $search)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _stristr($str, $search);
@@ -485,7 +483,7 @@ public static function stristr($str, $search)
*
* $found = UTF8::strspn($str, $mask);
*
- * @author Harry Fuecks <hfuecks@gmail.com>
+ * @author Harry Fuecks <hfuecks@gmail.com>
* @param string $str input string
* @param string $mask mask for search
* @param integer $offset start position of the string to examine
@@ -494,12 +492,12 @@ public static function stristr($str, $search)
*/
public static function strspn($str, $mask, $offset = NULL, $length = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strspn($str, $mask, $offset, $length);
@@ -520,12 +518,12 @@ public static function strspn($str, $mask, $offset = NULL, $length = NULL)
*/
public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strcspn($str, $mask, $offset, $length);
@@ -546,12 +544,12 @@ public static function strcspn($str, $mask, $offset = NULL, $length = NULL)
*/
public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_RIGHT)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _str_pad($str, $final_str_length, $pad_str, $pad_type);
@@ -570,12 +568,12 @@ public static function str_pad($str, $final_str_length, $pad_str = ' ', $pad_typ
*/
public static function str_split($str, $split_length = 1)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _str_split($str, $split_length);
@@ -587,17 +585,17 @@ public static function str_split($str, $split_length = 1)
* $str = UTF8::strrev($str);
*
* @author Harry Fuecks <hfuecks@gmail.com>
- * @param string $str string to be reversed
+ * @param string $str string to be reversed
* @return string
*/
public static function strrev($str)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _strrev($str);
@@ -616,12 +614,12 @@ public static function strrev($str)
*/
public static function trim($str, $charlist = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _trim($str, $charlist);
@@ -640,12 +638,12 @@ public static function trim($str, $charlist = NULL)
*/
public static function ltrim($str, $charlist = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _ltrim($str, $charlist);
@@ -664,12 +662,12 @@ public static function ltrim($str, $charlist = NULL)
*/
public static function rtrim($str, $charlist = NULL)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _rtrim($str, $charlist);
@@ -687,12 +685,12 @@ public static function rtrim($str, $charlist = NULL)
*/
public static function ord($chr)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _ord($chr);
@@ -717,12 +715,12 @@ public static function ord($chr)
*/
public static function to_unicode($str)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _to_unicode($str);
@@ -747,12 +745,12 @@ public static function to_unicode($str)
*/
public static function from_unicode($arr)
{
- if ( ! isset(self::$called[__FUNCTION__]))
+ if ( ! isset(UTF8::$called[__FUNCTION__]))
{
require Kohana::find_file('utf8', __FUNCTION__);
// Function has been called
- self::$called[__FUNCTION__] = TRUE;
+ UTF8::$called[__FUNCTION__] = TRUE;
}
return _from_unicode($arr);
View
2  kohana3/modified/system/classes/Kohana/Validation.php
@@ -302,7 +302,7 @@ public function check()
$expected = Arr::merge(array_keys($original), array_keys($this->_labels));
// Import the rules locally
- $rules = $this->_rules;
+ $rules = $this->_rules;
foreach ($expected as $field)
{
View
2  kohana3/modified/system/classes/Kohana/View.php
@@ -235,7 +235,7 @@ public function __toString()
* We use this method here because it's impossible to throw and
* exception from __toString().
*/
- $error_response = Kohana_exception::_handler($e);
+ $error_response = Kohana_Exception::_handler($e);
return $error_response->body();
}
View
35 kohana3/modified/system/composer.json
@@ -0,0 +1,35 @@
+{
+ "name": "kohana/core",
+ "description": "Core system classes for the Kohana application framework",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-http": "*",
+ "ext-curl": "*",
+ "ext-mcrypt": "*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
24 kohana3/upstream/.travis.yml
@@ -1,24 +0,0 @@
-language: php
-
-php:
- - 5.3
-
-before_install:
- - "git submodule update --init --recursive"
-
-before_script:
- - "pear channel-discover pear.phing.info"
- - "pear install phing/phing"
- - "phpenv rehash"
- - "composer install"
-
-script: "phing test"
-
-notifications:
- irc:
- channels:
- - "irc.freenode.org#kohana"
- template:
- - "%{repository}/%{branch} (%{commit}) - %{author}: %{message}"
- - "Build details: %{build_url}"
- email: false
View
13 kohana3/upstream/application/bootstrap.php
@@ -56,6 +56,13 @@
*/
ini_set('unserialize_callback_func', 'spl_autoload_call');
+/**
+ * Set the mb_substitute_character to "none"
+ *
+ * @link http://www.php.net/manual/function.mb-substitute-character.php
+ */
+mb_substitute_character('none');
+
// -- Configuration and initialization -----------------------------------------
/**
@@ -63,6 +70,12 @@
*/
I18n::lang('en-us');
+if (isset($_SERVER['SERVER_PROTOCOL']))
+{
+ // Replace the default protocol.
+ HTTP::$protocol = $_SERVER['SERVER_PROTOCOL'];
+}
+
/**
* Set Kohana::$environment if a 'KOHANA_ENV' environment variable has been supplied.
*
View
33 kohana3/upstream/modules/auth/composer.json
@@ -0,0 +1,33 @@
+{
+ "name": "kohana/auth",
+ "type": "kohana-module",
+ "description": "The official Kohana auth module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "authentication"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
33 kohana3/upstream/modules/cache/composer.json
@@ -0,0 +1,33 @@
+{
+ "name": "kohana/cache",
+ "type": "kohana-module",
+ "description": "The official Kohana cache management module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "cache"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
33 kohana3/upstream/modules/codebench/composer.json
@@ -0,0 +1,33 @@
+{
+ "name": "kohana/codebench",
+ "type": "kohana-module",
+ "description": "The official Kohana benchmarking module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "benchmarking"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
1  kohana3/upstream/modules/database/classes/Kohana/Database/MySQL.php
@@ -240,6 +240,7 @@ public function datatype($type)
'fixed' => array('type' => 'float', 'exact' => TRUE),
'fixed unsigned' => array('type' => 'float', 'exact' => TRUE, 'min' => '0'),
'float unsigned' => array('type' => 'float', 'min' => '0'),
+ 'geometry' => array('type' => 'string', 'binary' => TRUE),
'int unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
'integer unsigned' => array('type' => 'int', 'min' => '0', 'max' => '4294967295'),
'longblob' => array('type' => 'string', 'binary' => TRUE, 'character_maximum_length' => '4294967295'),
View
37 kohana3/upstream/modules/database/composer.json
@@ -0,0 +1,37 @@
+{
+ "name": "kohana/database",
+ "type": "kohana-module",
+ "description": "The official Kohana module for database interactions, building queries, and prepared statements",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "database"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-mysql": "*",
+ "ext-pdo": "*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
15 kohana3/upstream/modules/database/guide/database/config.md
@@ -25,6 +25,21 @@ CONNECTION_ARRAY
TABLE_PREFIX
: Prefix that will be added to all table names by the [query builder](#query_building).
+CHARACTER_SET
+: The character set to use for the connection with the database.
+
+[!!] Setting Character Set won't work for PDO based connections because of incompatibility with PHP prior to 5.3.6. Use the DSN or options config instead. Example Below:
+
+ return array
+ (
+ 'default' => array
+ (
+ 'type' => 'PDO',
+ 'connection' => array(
+ 'options' => array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"),
+ ),
+ ),
+ );
## Example
View
36 kohana3/upstream/modules/image/composer.json
@@ -0,0 +1,36 @@
+{
+ "name": "kohana/image",
+ "type": "kohana-module",
+ "description": "The official Kohana module for manipulating images",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "image"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "suggest": {
+ "ext-gd": "*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
33 kohana3/upstream/modules/minion/composer.json
@@ -0,0 +1,33 @@
+{
+ "name": "kohana/minion",
+ "type": "kohana-module",
+ "description": "The official kohana module for running tasks via the CLI",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "task"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
31 kohana3/upstream/modules/minion/guide/minion/setup.md
@@ -1,32 +1,3 @@
# Minion Setup
-To use minion, you'll need to make a small change to your index.php file:
-
- -/**
- - * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
- - * If no source is specified, the URI will be automatically detected.
- - */
- -echo Request::factory()
- - ->execute()
- - ->send_headers(TRUE)
- - ->body();
- +if (PHP_SAPI == 'cli') // Try and load minion
- +{
- + class_exists('Minion_Task') OR die('minion required!');
- + set_exception_handler(array('Kohana_Minion_Exception_Handler', 'handler'));
- +
- + Minion_Task::factory(Minion_CLI::options())->execute();
- +}
- +else
- +{
- + /**
- + * Execute the main request. A source of the URI can be passed, eg: $_SERVER['PATH_INFO'].
- + * If no source is specified, the URI will be automatically detected.
- + */
- + echo Request::factory()
- + ->execute()
- + ->send_headers(TRUE)
- + ->body();
- +}
-
-This will short-circuit your index file to intercept any cli calls, and route them to the minion module.
+[!!] Since Kohana `3.3.x`, minion requires no additional setup to use.
View
4 kohana3/upstream/modules/minion/guide/minion/tasks.md
@@ -6,7 +6,7 @@ Writing a task in minion is very easy. Simply create a new class called `Task_<T
class Task_Demo extends Minion_Task
{
- protected $_defaults = array(
+ protected $_options = array(
'foo' = 'bar',
'bar' => NULL,
);
@@ -28,7 +28,7 @@ You'll notice a few things here:
- You need a main `_execute()` method. It should take one array parameter.
- This parameter contains any command line options passed to the task.
- For example, if you call the task above with `./minion --task=demo --foo=foobar` then `$params` will contain: `array('foo' => 'foobar', 'bar' => NULL)`
- - It needs to have a `protected $_defaults` array. This is a list of parameters you want to accept for this task. Any parameters passed to the task not in this list will be rejected.
+ - It needs to have a `protected $_options` array. This is a list of parameters you want to accept for this task. Any parameters passed to the task not in this list will be rejected.
## Namespacing Tasks
View
0  ...ream/modules/minion/tests/minion/task.php → .../modules/minion/tests/minion/TaskTest.php
File renamed without changes
View
4 kohana3/upstream/modules/orm/classes/Kohana/Auth/ORM.php
@@ -51,6 +51,10 @@ public function logged_in($role = NULL)
if ( ! $roles->loaded())
return FALSE;
}
+ else
+ {
+ $roles = $role;
+ }
}
return $user->has('roles', $roles);
View
10 kohana3/upstream/modules/orm/classes/Kohana/ORM.php
@@ -1504,14 +1504,14 @@ public function has_any($alias, $far_keys = NULL)
* Returns the number of relationships
*
* // Counts the number of times the login role is attached to $model
- * $model->has('roles', ORM::factory('role', array('name' => 'login')));
+ * $model->count_relations('roles', ORM::factory('role', array('name' => 'login')));
* // Counts the number of times role 5 is attached to $model
- * $model->has('roles', 5);
+ * $model->count_relations('roles', 5);
* // Counts the number of times any of roles 1, 2, 3, or 4 are attached to
* // $model
- * $model->has('roles', array(1, 2, 3, 4));
+ * $model->count_relations('roles', array(1, 2, 3, 4));
* // Counts the number roles attached to $model
- * $model->has('roles')
+ * $model->count_relations('roles')
*
* @param string $alias Alias of the has_many "through" relationship
* @param mixed $far_keys Related model, primary key, or an array of primary keys
@@ -1644,7 +1644,7 @@ public function count_all()
$this->_build(Database::SELECT);
$records = $this->_db_builder->from(array($this->_table_name, $this->_object_name))
- ->select(array(DB::expr('COUNT(*)'), 'records_found'))
+ ->select(array(DB::expr('COUNT('.$this->_db->quote_column($this->_object_name.'.'.$this->_primary_key).')'), 'records_found'))
->execute($this->_db)
->get('records_found');
View
34 kohana3/upstream/modules/orm/composer.json
@@ -0,0 +1,34 @@
+{
+ "name": "kohana/orm",
+ "type": "kohana-module",
+ "description": "The official Kohana ORM module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "ORM", "database"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "kohana/database": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
34 kohana3/upstream/modules/unittest/composer.json
@@ -0,0 +1,34 @@
+{
+ "name": "kohana/unittest",
+ "type": "kohana-module",
+ "description": "PHPUnit integration for running unit tests on the Kohana framework",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3",
+ "phpunit/phpunit": "3.7.*"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
2  kohana3/upstream/modules/userguide/classes/Kohana/Controller/Userguide.php
@@ -198,7 +198,7 @@ public function action_api()
// (different case, orm vs ORM, auth vs Auth) redirect
if ($_class->class->name != $class)
{
- $this->request->redirect($this->request->route()->uri(array('class'=>$_class->class->name)));
+ $this->redirect($this->request->route()->uri(array('class'=>$_class->class->name)));
}
// If this classes immediate parent is Kodoc_Missing, then it should 404
View
33 kohana3/upstream/modules/userguide/composer.json
@@ -0,0 +1,33 @@
+{
+ "name": "kohana/userguide",
+ "type": "kohana-module",
+ "description": "Kohana user guide and live API documentation module",
+ "homepage": "http://kohanaframework.org",
+ "license": "BSD-3-Clause",
+ "keywords": ["kohana", "framework", "docs"],
+ "authors": [
+ {
+ "name": "Kohana Team",
+ "email": "team@kohanaframework.org",
+ "homepage": "http://kohanaframework.org/team",
+ "role": "developer"
+ }
+ ],
+ "support": {
+ "issues": "http://dev.kohanaframework.org",
+ "forum": "http://forum.kohanaframework.org",
+ "irc": "irc://irc.freenode.net/kohana",
+ "source": "http://github.com/kohana/core"
+ },
+ "require": {
+ "composer/installers": "~1.0",
+ "kohana/core": ">=3.3",
+ "php": ">=5.3.3"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-3.3/develop": "3.3.x-dev",
+ "dev-3.4/develop": "3.4.x-dev"
+ }
+ }
+}
View
9 kohana3/upstream/system/classes/Kohana/Arr.php
@@ -207,8 +207,13 @@ public static function set_path( & $array, $path, $value, $delimiter = NULL)
$delimiter = Arr::$delimiter;
}
- // Split the keys by delimiter
- $keys = explode($delimiter, $path);
+ // The path has already been separated into keys
+ $keys = $path;
+ if ( ! is_array($path))
+ {
+ // Split the keys by delimiter
+ $keys = explode($delimiter, $path);
+ }
// Set current $array to inner-most array path
while (count($keys) > 1)
View
2  kohana3/upstream/system/classes/Kohana/Controller.php
@@ -124,7 +124,7 @@ public function after()
*/
public static function redirect($uri = '', $code = 302)
{
- return HTTP::redirect($uri, $code);
+ return HTTP::redirect( (string) $uri, $code);
}
/**
View
2  kohana3/upstream/system/classes/Kohana/Cookie.php
@@ -149,7 +149,7 @@ public static function salt($name, $value)
// Require a valid salt
if ( ! Cookie::$salt)
{
- throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt.');
+ throw new Kohana_Exception('A valid cookie salt is required. Please set Cookie::$salt in your bootstrap.php. For more information check the documentation');
}
// Determine the user agent
View
6 kohana3/upstream/system/classes/Kohana/HTTP/Header.php
@@ -859,12 +859,6 @@ public function preferred_language(array $languages, $explicit = FALSE)
*/
public function send_headers(HTTP_Response $response = NULL, $replace = FALSE, $callback = NULL)
{
- if ($response === NULL)
- {
- // Default to the initial request message
- $response = Request::initial()->response();
- }
-
$protocol = $response->protocol();
$status = $response->status();
View
4 kohana3/upstream/system/classes/Kohana/Inflector.php
@@ -183,6 +183,10 @@ public static function plural($str, $count = NULL)
{
$str = Inflector::$irregular[$str];
}
+ elseif (in_array($str, Inflector::$irregular))
+ {
+ // Do nothing
+ }
elseif (preg_match('/[sxz]$/', $str) OR preg_match('/[^aeioudgkprt]h$/', $str))
{
$str .= 'es';
View
10 kohana3/upstream/system/classes/Kohana/Kohana/Exception.php
@@ -79,7 +79,7 @@ public function __toString()
*
* @uses Kohana_Exception::response
* @param Exception $e
- * @return boolean
+ * @return void
*/
public static function handler(Exception $e)
{
@@ -97,7 +97,7 @@ public static function handler(Exception $e)
*
* @uses Kohana_Exception::response
* @param Exception $e
- * @return boolean
+ * @return Response
*/
public static function _handler(Exception $e)
{
@@ -185,12 +185,6 @@ public static function response(Exception $e)
$line = $e->getLine();
$trace = $e->getTrace();
- if ( ! headers_sent())
- {
- // Make sure the proper http header is sent
- $http_header_status = ($e instanceof HTTP_Exception) ? $code : 500;
- }
-
/**
* HTTP_Exceptions are constructed in the HTTP_Exception::factory()
* method. We need to remove that entry from the trace and overwrite
View
14 kohana3/upstream/system/classes/Kohana/Request.php
@@ -59,14 +59,7 @@ public static function factory($uri = TRUE, $client_params = array(), $allow_ext
// If this is the initial request
if ( ! Request::$initial)
{
- if (isset($_SERVER['SERVER_PROTOCOL']))
- {
- $protocol = $_SERVER['SERVER_PROTOCOL'];
- }
- else
- {
- $protocol = HTTP::$protocol;
- }
+ $protocol = HTTP::$protocol;
if (isset($_SERVER['REQUEST_METHOD']))
{
@@ -79,7 +72,10 @@ public static function factory($uri = TRUE, $client_params = array(), $allow_ext
$method = HTTP_Request::GET;
}
- if ( ! empty($_SERVER['HTTPS']) AND filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
+ if (( ! empty($_SERVER['HTTPS']) AND filter_var($_SERVER['HTTPS'], FILTER_VALIDATE_BOOLEAN))
+ OR (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])
+ AND $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https')
+ AND in_array($_SERVER['REMOTE_ADDR'], Request::$trusted_proxies))
{
// This request is secure
$secure = TRUE;
View
4 kohana3/upstream/system/classes/Kohana/Request/Client.php
@@ -105,8 +105,8 @@ public function execute(Request $request)
':depth' => $this->callback_depth() - 1,
));
- // Execute the request
- $orig_response = $response = Response::factory();
+ // Execute the request and pass the currently used protocol
+ $orig_response = $response = Response::factory(array('_protocol' => $request->protocol()));
if (($cache = $this->cache()) instanceof HTTP_Cache)
return $cache->execute($this, $request, $response);
View
6 kohana3/upstream/system/classes/Kohana/Request/Client/Internal.php
@@ -104,6 +104,12 @@ public function execute_request(Request $request, Response $response)
}
catch (HTTP_Exception $e)
{
+ // Store the request context in the Exception
+ if ($e->request() === NULL)
+ {
+ $e->request($request);
+ }
+
// Get the response via the Exception
$response = $e->get_response();
}
View
4 kohana3/upstream/system/classes/Kohana/Route.php
@@ -216,9 +216,9 @@ public static function url($name, array $params = NULL, $protocol = NULL)
// Create a URI with the route and convert it to a URL
if ($route->is_external())
- return Route::get($name)->uri($params);
+ return $route->uri($params);
else
- return URL::site(Route::get($name)->uri($params), $protocol);
+ return URL::site($route->uri($params), $protocol);
}
/**
View
12 kohana3/upstream/system/classes/Kohana/Security.php
@@ -48,7 +48,17 @@ public static function token($new = FALSE)
if ($new === TRUE OR ! $token)
{
// Generate a new unique token
- $token = sha1(uniqid(NULL, TRUE));
+ if (function_exists('openssl_random_pseudo_bytes'))
+ {
+ // Generate a random pseudo bytes token if openssl_random_pseudo_bytes is available
+ // This is more secure than uniqid, because uniqid relies on microtime, which is predictable
+ $token = base64_encode(openssl_random_pseudo_bytes(32));
+ }
+ else
+ {
+ // Otherwise, fall back to a hashed uniqid
+ $token = sha1(uniqid(NULL, TRUE));
+ }
// Store the new token
$session->set(Security::$token_name, $token);
View
128 kohana3/upstream/system/classes/Kohana/UTF8.php
@@ -8,8 +8,6 @@
* - PCRE needs to be compiled with UTF-8 support (--enable-utf8)
* - Support for [Unicode properties](http://php.net/manual/reference.pcre.pattern.modifiers.php)
* is highly recommended (--enable-unicode-properties)
- * - UTF-8 conversion will be much more reliable if the
- * [iconv extension](http://php.net/iconv) is loaded
* - The [mbstring extension](http://php.net/mbstring) is highly recommended,
* but must not be overloading string functions
*
@@ -42,11 +40,10 @@ class Kohana_UTF8 {
*
* UTF8::clean($_GET); // Clean GET data
*
- * [!!] This method requires [Iconv](http://php.net/iconv)
- *
* @param mixed $var variable to clean
* @param string $charset character set, defaults to Kohana::$charset
* @return mixed
+ * @uses UTF8::clean
* @uses UTF8::strip_ascii_ctrl
* @uses UTF8::is_ascii
*/
@@ -63,21 +60,20 @@ public static function clean($var, $charset = NULL)
foreach ($var as $key => $val)
{
// Recursion!
- $var[self::clean($key)] = self::clean($val);
+ $