diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..36bae9e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,167 @@ +# Developing locally + +Since Kohana maintains many concurrent versions at once, there is no single `master` branch. All versions have branches named with a prefix of it's version: + + - 3.2/master + - 3.2/develop + - 3.3/master + - 3.3/develop + +and so on. All development of versions happens in the develop branch of that version. Before a release, new features are added here. After a major release is actually released, only bugfixes can happen here. New features and api changes must happen in the develop branch of the next version. + +## Branch name meanings + + - **3.3/master** - master branches are for releases. Only release merge commits can be applied to this branch. You should never make a non-merge commit to this branch, and all merge commits should come from the release branch or hotfix branch (detailed below). This branch lasts forever. + - **3.3/hotfix/*** - hotfix branches are for emergency maintenance after a release. If an important security or other kind of important issue is discovered after a release, it should be done here, and merged to master. This branch should be created from master and merged back into master and develop when complete. This branch is deleted after it's done. + - **3.3/develop** - If a version is not released, this branch is for merging features into. If the version is released, this branch is for applying bugfix commits to. This branch lasts forever. + - **3.3/release/*** - release branches are for maintenance work before a release. This branch should be branched from the develop branch only. Change the version number/code name here, and apply any other maintenance items needed before actually releasing. Merges from master should only come from this branch. It should be merged to develop when it's complete as well. This branch is deleted after it's done. + - **3.3/feature/*** - Details on these branches are outlined below. This branch is deleted after it's done. + +If an bug/issue applies to multiple versions of kohana, it is first fixed in the lowest supported version it applies to, then merged to each higher branch it applies to. Each merge should only happen one version up. 3.1 should merge to 3.2, and 3.2 should merge to 3.3. 3.1 should not merge directly to 3.3. + +To work on a specific release branch you need to check it out then check out the appropriate system branch. +Release branch names follow the same convention in both kohana/kohana and kohana/core. + +To work on 3.3.x you'd do the following: + + > git clone git://github.com/kohana/kohana.git + # .... + + > cd kohana + > git submodule update --init + # .... + + > git checkout 3.3/develop + # Switched to branch '3.3/develop' + + > git submodule foreach "git fetch && git checkout 3.3/develop" + # ... + +It's important that you follow the last step, because unlike svn, git submodules point at a +specific commit rather than the tip of a branch. If you cd into the system folder after +a `git submodule update` and run `git status` you'll be told: + + # Not currently on any branch. + nothing to commit (working directory clean) + +*** + +# Contributing to the project + +All features and bugfixes must be fully tested and reference an issue in the [tracker](http://dev.kohanaframework.org/projects/kohana3), **there are absolutely no exceptions**. + +It's highly recommended that you write/run unit tests during development as it can help you pick up on issues early on. See the Unit Testing section below. + +## Creating new features + +New features or API breaking modifications should be developed in separate branches so as to isolate them +until they're stable. + +**Features without tests written will be rejected! There are NO exceptions.** + +The naming convention for feature branches is: + + {version}/feature/{issue number}-{short hyphenated description} + + // e.g. + + 3.2/feature/4045-rewriting-config-system + +When a new feature is complete and fully tested it can be merged into its respective release branch using +`git pull --no-ff`. The `--no-ff` switch is important as it tells git to always create a commit +detailing what branch you're merging from. This makes it a lot easier to analyse a feature's history. + +Here's a quick example: + + > git status + # On branch 3.2/feature/4045-rewriting-everything + + > git checkout 3.1/develop + # Switched to branch '3.1/develop' + + > git merge --no-ff 3.2/feature/4045-rewriting-everything + +**If a change you make intentionally breaks the api then please correct the relevant tests before pushing!** + +## Bug fixing + +If you're making a bugfix then before you start create a unit test which reproduces the bug, +using the `@ticket` notation in the test to reference the bug's issue number +(e.g. `@ticket 4045` for issue #4045). + +If you run the unit tests then the one you've just made should fail. + +Once you've written the bugfix, run the tests again before you commit to make sure that the +fix actually works,then commit both the fix and the test. + +**Bug fixes without tests written will be rejected! There are NO exceptions.** + +There is no need to create separate branches for bugfixes, creating them in the main develop +branch is perfectly acceptable. + +## Tagging releases + +Tag names should be prefixed with a `v`, this helps to separate tag references from branch references in git. + +For example, if you were creating a tag for the `3.1.0` release the tag name would be `v3.1.0` + +# Merging Changes from Remote Repositories + +Now that you have a remote repository, you can pull changes in the remote "kohana" repository +into your local repository: + + > git pull kohana 3.1/master + +**Note:** Before you pull changes you should make sure that any modifications you've made locally +have been committed. + +Sometimes a commit you've made locally will conflict with one made in the "kohana" one. + +There are a couple of scenarios where this might happen: + +## The conflict is to do with a few unrelated commits and you want to keep changes made in both commits + +You'll need to manually modify the files to resolve the conflict, see the "Resolving a merge" +section [in the git-scm book](http://book.git-scm.com/3_basic_branching_and_merging.html) for more info + +## You've fixed something locally which someone else has already done in the remote repo + +The simplest way to fix this is to remove all the changes that you've made locally. + +You can do this using + + > git reset --hard kohana + +## You've fixed something locally which someone else has already fixed but you also have separate commits you'd like to keep + +If this is the case then you'll want to use a tool called rebase. First of all we need to +get rid of the conflicts created due to the merge: + + > git reset --hard HEAD + +Then find the hash of the offending local commit and run: + + > git rebase -i {offending commit hash} + +i.e. + + > git rebase -i 57d0b28 + +A text editor will open with a list of commits, delete the line containing the offending commit +before saving the file & closing your editor. + +Git will remove the commit and you can then pull/merge the remote changes. + +# Unit Testing + +Kohana currently uses phpunit for unit testing. This is installed with composer. + +## How to run the tests + + * Install [Phing](http://phing.info) + * Make sure you have the [unittest](http://github.com/kohana/unittest) module enabled. + * Install [Composer](http://getcomposer.org) + * Run `php composer.phar install` from the root of this repository + * Finally, run `phing test` + +This will run the unit tests for core and all the modules and tell you if anything failed. If you haven't changed anything and you get failures, please create a new issue on [the tracker](http://dev.kohanaframework.org) and paste the output (including the error) in the issue. diff --git a/application/bootstrap.php b/application/bootstrap.php index 96b8b19..b603a1f 100644 --- a/application/bootstrap.php +++ b/application/bootstrap.php @@ -56,6 +56,13 @@ spl_autoload_register(array('Kohana', 'auto_load')); */ 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 @@ ini_set('unserialize_callback_func', 'spl_autoload_call'); */ 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. * diff --git a/composer.json b/composer.json index a473df1..33babb4 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,6 @@ { "require": { - "phpunit/phpunit": "3.7.*" + "phpunit/phpunit": "3.7.24", + "phing/phing": "dev-master" } } diff --git a/modules/auth/composer.json b/modules/auth/composer.json new file mode 100644 index 0000000..c35732f --- /dev/null +++ b/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" + } + } +} diff --git a/modules/cache/composer.json b/modules/cache/composer.json new file mode 100644 index 0000000..beb2564 --- /dev/null +++ b/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" + } + } +} diff --git a/modules/codebench/composer.json b/modules/codebench/composer.json new file mode 100644 index 0000000..8857c68 --- /dev/null +++ b/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" + } + } +} diff --git a/modules/database/classes/Kohana/Database/MySQL.php b/modules/database/classes/Kohana/Database/MySQL.php index 8700904..9a3738b 100644 --- a/modules/database/classes/Kohana/Database/MySQL.php +++ b/modules/database/classes/Kohana/Database/MySQL.php @@ -240,6 +240,7 @@ class Kohana_Database_MySQL extends Database { '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'), diff --git a/modules/database/composer.json b/modules/database/composer.json new file mode 100644 index 0000000..33b1962 --- /dev/null +++ b/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" + } + } +} diff --git a/modules/database/guide/database/config.md b/modules/database/guide/database/config.md index 240a6bb..27ae9b4 100644 --- a/modules/database/guide/database/config.md +++ b/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 diff --git a/modules/image/classes/Kohana/Image/GD.php b/modules/image/classes/Kohana/Image/GD.php index 6f383e3..e9c7988 100644 --- a/modules/image/classes/Kohana/Image/GD.php +++ b/modules/image/classes/Kohana/Image/GD.php @@ -10,13 +10,17 @@ */ class Kohana_Image_GD extends Image { - // Is GD bundled or separate? - protected static $_bundled; + // Which GD functions are available? + const IMAGEROTATE = 'imagerotate'; + const IMAGECONVOLUTION = 'imageconvolution'; + const IMAGEFILTER = 'imagefilter'; + const IMAGELAYEREFFECT = 'imagelayereffect'; + protected static $_available_functions = array(); /** - * Checks if GD is enabled and bundled. Bundled GD is required for some - * methods to work. Exceptions will be thrown from those methods when GD is - * not bundled. + * Checks if GD is enabled and verify that key methods exist, some of which require GD to + * be bundled with PHP. Exceptions will be thrown from those methods when GD is not + * bundled. * * @return boolean */ @@ -26,19 +30,15 @@ class Kohana_Image_GD extends Image { { throw new Kohana_Exception('GD is either not installed or not enabled, check your configuration'); } - - if (defined('GD_BUNDLED')) + $functions = array( + Image_GD::IMAGEROTATE, + Image_GD::IMAGECONVOLUTION, + Image_GD::IMAGEFILTER, + Image_GD::IMAGELAYEREFFECT + ); + foreach ($functions as $function) { - // Get the version via a constant, available in PHP 5. - Image_GD::$_bundled = GD_BUNDLED; - } - else - { - // Get the version information - $info = gd_info(); - - // Extract the bundled status - Image_GD::$_bundled = (bool) preg_match('/\bbundled\b/i', $info['GD Version']); + Image_GD::$_available_functions[$function] = function_exists($function); } if (defined('GD_VERSION')) @@ -246,7 +246,7 @@ class Kohana_Image_GD extends Image { */ protected function _do_rotate($degrees) { - if ( ! Image_GD::$_bundled) + if (empty(Image_GD::$_available_functions[Image_GD::IMAGEROTATE])) { throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', array(':function' => 'imagerotate')); @@ -328,7 +328,7 @@ class Kohana_Image_GD extends Image { */ protected function _do_sharpen($amount) { - if ( ! Image_GD::$_bundled) + if (empty(Image_GD::$_available_functions[Image_GD::IMAGECONVOLUTION])) { throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', array(':function' => 'imageconvolution')); @@ -367,7 +367,7 @@ class Kohana_Image_GD extends Image { */ protected function _do_reflection($height, $opacity, $fade_in) { - if ( ! Image_GD::$_bundled) + if (empty(Image_GD::$_available_functions[Image_GD::IMAGEFILTER])) { throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', array(':function' => 'imagefilter')); @@ -448,7 +448,7 @@ class Kohana_Image_GD extends Image { */ protected function _do_watermark(Image $watermark, $offset_x, $offset_y, $opacity) { - if ( ! Image_GD::$_bundled) + if (empty(Image_GD::$_available_functions[Image_GD::IMAGELAYEREFFECT])) { throw new Kohana_Exception('This method requires :function, which is only available in the bundled version of GD', array(':function' => 'imagelayereffect')); diff --git a/modules/image/composer.json b/modules/image/composer.json new file mode 100644 index 0000000..ed5cae4 --- /dev/null +++ b/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" + } + } +} diff --git a/modules/minion/classes/Kohana/Minion/CLI.php b/modules/minion/classes/Kohana/Minion/CLI.php index 13c1de6..bab6c1c 100644 --- a/modules/minion/classes/Kohana/Minion/CLI.php +++ b/modules/minion/classes/Kohana/Minion/CLI.php @@ -170,7 +170,7 @@ class Kohana_Minion_CLI { // Create temporary file file_put_contents($vbscript, 'wscript.echo(InputBox("'.addslashes($text).'"))'); - $password = shell_exec('cscript //nologo '.escapeshellarg($command)); + $password = shell_exec('cscript //nologo '.escapeshellarg($text)); // Remove temporary file. unlink($vbscript); diff --git a/modules/minion/classes/Kohana/Minion/Exception.php b/modules/minion/classes/Kohana/Minion/Exception.php index 442e82d..735dac4 100644 --- a/modules/minion/classes/Kohana/Minion/Exception.php +++ b/modules/minion/classes/Kohana/Minion/Exception.php @@ -33,7 +33,7 @@ class Kohana_Minion_Exception extends Kohana_Exception { { echo Kohana_Exception::text($e); } - + $exit_code = $e->getCode(); // Never exit "0" after an exception. @@ -59,6 +59,6 @@ class Kohana_Minion_Exception extends Kohana_Exception { public function format_for_cli() { - return Kohana_Exception::text($e); + return Kohana_Exception::text($this); } } diff --git a/modules/minion/classes/Kohana/Minion/Task.php b/modules/minion/classes/Kohana/Minion/Task.php index be4fcc0..36c5ac7 100644 --- a/modules/minion/classes/Kohana/Minion/Task.php +++ b/modules/minion/classes/Kohana/Minion/Task.php @@ -206,7 +206,7 @@ abstract class Kohana_Minion_Task { public function build_validation(Validation $validation) { // Add a rule to each key making sure it's in the task - foreach ($validation->as_array() as $key => $value) + foreach ($validation->data() as $key => $value) { $validation->rule($key, array($this, 'valid_option'), array(':validation', ':field')); } diff --git a/modules/minion/composer.json b/modules/minion/composer.json new file mode 100644 index 0000000..af7e9a0 --- /dev/null +++ b/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" + } + } +} diff --git a/modules/minion/guide/minion/setup.md b/modules/minion/guide/minion/setup.md index 11e6256..b9ec765 100644 --- a/modules/minion/guide/minion/setup.md +++ b/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. \ No newline at end of file +[!!] Since Kohana `3.3.x`, minion requires no additional setup to use. \ No newline at end of file diff --git a/modules/minion/guide/minion/tasks.md b/modules/minion/guide/minion/tasks.md index 4bda3ef..0923892 100644 --- a/modules/minion/guide/minion/tasks.md +++ b/modules/minion/guide/minion/tasks.md @@ -6,8 +6,8 @@ Writing a task in minion is very easy. Simply create a new class called `Task_ '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 @@ -68,4 +68,4 @@ Tasks can have built-in help. Minion will read class docblocks that you specify: */ class Minion_Task_Demo extends Minion_Task -The `@` tags in the class comments will also be displayed in a human readable format. When writing your task comments, you should specify how to use it, and any parameters it accepts. \ No newline at end of file +The `@` tags in the class comments will also be displayed in a human readable format. When writing your task comments, you should specify how to use it, and any parameters it accepts. diff --git a/modules/minion/tests/minion/TaskTest.php b/modules/minion/tests/minion/TaskTest.php new file mode 100644 index 0000000..e7918a0 --- /dev/null +++ b/modules/minion/tests/minion/TaskTest.php @@ -0,0 +1,70 @@ +assertSame($expected, Minion_Task::convert_task_to_class_name($task_name)); + } + + /** + * Provides test data for test_convert_class_to_task() + * + * @return array + */ + public function provider_convert_class_to_task() + { + return array( + array('db:migrate', 'Task_Db_Migrate'), + ); + } + + /** + * Tests that the task name can be found from a class name / object + * + * @test + * @covers Minion_Task::convert_class_to_task + * @dataProvider provider_convert_class_to_task + * @param string Expected task name + * @param mixed Input class + */ + public function test_convert_class_to_task($expected, $class) + { + $this->assertSame($expected, Minion_Task::convert_class_to_task($class)); + } +} diff --git a/modules/orm/classes/Kohana/Auth/ORM.php b/modules/orm/classes/Kohana/Auth/ORM.php index e12491c..315c018 100644 --- a/modules/orm/classes/Kohana/Auth/ORM.php +++ b/modules/orm/classes/Kohana/Auth/ORM.php @@ -51,6 +51,10 @@ class Kohana_Auth_ORM extends Auth { if ( ! $roles->loaded()) return FALSE; } + else + { + $roles = $role; + } } return $user->has('roles', $roles); diff --git a/modules/orm/classes/Kohana/ORM.php b/modules/orm/classes/Kohana/ORM.php index 716e51d..50067c4 100644 --- a/modules/orm/classes/Kohana/ORM.php +++ b/modules/orm/classes/Kohana/ORM.php @@ -288,8 +288,11 @@ class Kohana_ORM extends Model implements serializable { */ protected function _initialize() { - // Set the object name and plural name - $this->_object_name = strtolower(substr(get_class($this), 6)); + // Set the object name if none predefined + if (empty($this->_object_name)) + { + $this->_object_name = strtolower(substr(get_class($this), 6)); + } // Check if this model has already been initialized if ( ! $init = Arr::get(ORM::$_init_cache, $this->_object_name, FALSE)) @@ -1501,14 +1504,14 @@ class Kohana_ORM extends Model implements serializable { * 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 @@ -1641,7 +1644,7 @@ class Kohana_ORM extends Model implements serializable { $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'); @@ -1651,7 +1654,7 @@ class Kohana_ORM extends Model implements serializable { $this->reset(); // Return the total number of records in a table - return $records; + return (int) $records; } /** diff --git a/modules/orm/composer.json b/modules/orm/composer.json new file mode 100644 index 0000000..faa776f --- /dev/null +++ b/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" + } + } +} diff --git a/modules/unittest/classes/Kohana/Unittest/Database/TestCase.php b/modules/unittest/classes/Kohana/Unittest/Database/TestCase.php index e39e366..a6353c8 100644 --- a/modules/unittest/classes/Kohana/Unittest/Database/TestCase.php +++ b/modules/unittest/classes/Kohana/Unittest/Database/TestCase.php @@ -89,9 +89,9 @@ abstract class Kohana_Unittest_Database_TestCase extends PHPUnit_Extensions_Data // Get the unittesting db connection $config = Kohana::$config->load('database.'.$this->_database_connection); - if($config['type'] !== 'pdo') + if(strtolower($config['type']) !== 'pdo') { - $config['connection']['dsn'] = $config['type'].':'. + $config['connection']['dsn'] = strtolower($config['type']).':'. 'host='.$config['connection']['hostname'].';'. 'dbname='.$config['connection']['database']; } diff --git a/modules/unittest/classes/Kohana/Unittest/TestCase.php b/modules/unittest/classes/Kohana/Unittest/TestCase.php index d47d69f..5db43c9 100644 --- a/modules/unittest/classes/Kohana/Unittest/TestCase.php +++ b/modules/unittest/classes/Kohana/Unittest/TestCase.php @@ -163,7 +163,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase { return self::assertNotType($expected, $actual, $message); } - return self::assertNotInstanceOf($expected, $actual, $message); + return parent::assertNotInstanceOf($expected, $actual, $message); } /** @@ -182,7 +182,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase { return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message); } - return self::assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message); + return parent::assertAttributeNotInstanceOf($expected, $attributeName, $classOrObject, $message); } /** @@ -219,7 +219,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase { return self::assertAttributeType($expected, $attributeName, $classOrObject, $message); } - return self::assertAttributeInternalType($expected, $attributeName, $classOrObject, $message); + return parent::assertAttributeInternalType($expected, $attributeName, $classOrObject, $message); } /** @@ -237,7 +237,7 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase { return self::assertNotType($expected, $actual, $message); } - return self::assertNotInternalType($expected, $actual, $message); + return parent::assertNotInternalType($expected, $actual, $message); } /** @@ -256,6 +256,6 @@ abstract class Kohana_Unittest_TestCase extends PHPUnit_Framework_TestCase { return self::assertAttributeNotType($expected, $attributeName, $classOrObject, $message); } - return self::assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message); + return parent::assertAttributeNotInternalType($expected, $attributeName, $classOrObject, $message); } } diff --git a/modules/unittest/composer.json b/modules/unittest/composer.json new file mode 100644 index 0000000..829fefd --- /dev/null +++ b/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" + } + } +} diff --git a/modules/userguide/classes/Kohana/Controller/Userguide.php b/modules/userguide/classes/Kohana/Controller/Userguide.php index 1c4c10e..fc7d94b 100644 --- a/modules/userguide/classes/Kohana/Controller/Userguide.php +++ b/modules/userguide/classes/Kohana/Controller/Userguide.php @@ -198,7 +198,7 @@ abstract class Kohana_Controller_Userguide extends Controller_Template { // (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 diff --git a/modules/userguide/composer.json b/modules/userguide/composer.json new file mode 100644 index 0000000..b27114e --- /dev/null +++ b/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" + } + } +} diff --git a/system/classes/Arr.php b/system/classes/Arr.php index 376cb97..3206129 100644 --- a/system/classes/Arr.php +++ b/system/classes/Arr.php @@ -1,3 +1,3 @@ 1) @@ -283,7 +288,7 @@ class Kohana_Arr { * * // Get the values "username", "password" from $_POST * $auth = Arr::extract($_POST, array('username', 'password')); - * + * * // Get the value "level1.level2a" from $data * $data = array('level1' => array('level2a' => 'value 1', 'level2b' => 'value 2')); * Arr::extract($data, array('level1.level2a', 'password')); @@ -617,4 +622,4 @@ class Kohana_Arr { return $flat; } -} // End arr +} diff --git a/system/classes/Kohana/Config.php b/system/classes/Kohana/Config.php index 8a9798d..fda72bb 100644 --- a/system/classes/Kohana/Config.php +++ b/system/classes/Kohana/Config.php @@ -3,7 +3,7 @@ * Wrapper for configuration arrays. Multiple configuration readers can be * attached to allow loading configuration from files, database, etc. * - * Configuration directives cascade across config sources in the same way that + * Configuration directives cascade across config sources in the same way that * files cascade across the filesystem. * * Directives from sources high in the sources list will override ones from those @@ -74,9 +74,9 @@ class Kohana_Config { } /** - * Load a configuration group. Searches all the config sources, merging all the - * directives found into a single config group. Any changes made to the config - * in this group will be mirrored across all writable sources. + * Load a configuration group. Searches all the config sources, merging all the + * directives found into a single config group. Any changes made to the config + * in this group will be mirrored across all writable sources. * * $array = $config->load($name); * @@ -146,7 +146,7 @@ class Kohana_Config { /** * Copy one configuration group to all of the other writers. - * + * * $config->copy($name); * * @param string $group configuration group name @@ -181,7 +181,7 @@ class Kohana_Config { { continue; } - + // Copy each value in the config $source->write($group, $key, $value); } @@ -189,4 +189,4 @@ class Kohana_Config { return $this; } -} // End Kohana_Config +} diff --git a/system/classes/Kohana/Config/File.php b/system/classes/Kohana/Config/File.php index 8d514f6..4b4c3d7 100644 --- a/system/classes/Kohana/Config/File.php +++ b/system/classes/Kohana/Config/File.php @@ -9,7 +9,7 @@ * @copyright (c) 2009-2012 Kohana Team * @license http://kohanaframework.org/license */ -class Kohana_Config_File extends Kohana_Config_File_Reader +class Kohana_Config_File extends Kohana_Config_File_Reader { // @see Kohana_Config_File_Reader } diff --git a/system/classes/Kohana/Config/File/Reader.php b/system/classes/Kohana/Config/File/Reader.php index 2e75e2e..5e237b1 100644 --- a/system/classes/Kohana/Config/File/Reader.php +++ b/system/classes/Kohana/Config/File/Reader.php @@ -1,4 +1,4 @@ -_group_name; } - + /** * Get a variable from the configuration or return the default value. * @@ -110,7 +110,7 @@ class Kohana_Config_Group extends ArrayObject { /** * Overrides ArrayObject::offsetSet() - * This method is called when config is changed via + * This method is called when config is changed via * * $config->var = 'asd'; * @@ -127,4 +127,5 @@ class Kohana_Config_Group extends ArrayObject { return parent::offsetSet($key, $value); } + } diff --git a/system/classes/Kohana/Config/Reader.php b/system/classes/Kohana/Config/Reader.php index 6b08a3b..3434cc7 100644 --- a/system/classes/Kohana/Config/Reader.php +++ b/system/classes/Kohana/Config/Reader.php @@ -11,9 +11,9 @@ */ interface Kohana_Config_Reader extends Kohana_Config_Source { - + /** - * Tries to load the specificed configuration group + * Tries to load the specified configuration group * * Returns FALSE if group does not exist or an array if it does * @@ -21,5 +21,5 @@ interface Kohana_Config_Reader extends Kohana_Config_Source * @return boolean|array */ public function load($group); - + } diff --git a/system/classes/Kohana/Config/Source.php b/system/classes/Kohana/Config/Source.php index cfce076..3889860 100644 --- a/system/classes/Kohana/Config/Source.php +++ b/system/classes/Kohana/Config/Source.php @@ -7,8 +7,8 @@ * @package Kohana * @category Configuration * @author Kohana Team - * @copyright (c) 2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2012-2014 Kohana Team + * @license http://kohanaframework.org/license */ interface Kohana_Config_Source {} diff --git a/system/classes/Kohana/Config/Writer.php b/system/classes/Kohana/Config/Writer.php index 5c666a1..856ebde 100644 --- a/system/classes/Kohana/Config/Writer.php +++ b/system/classes/Kohana/Config/Writer.php @@ -3,19 +3,19 @@ /** * Interface for config writers * - * Specifies the methods that a config writer must implement - * + * Specifies the methods that a config writer must implement + * * @package Kohana * @author Kohana Team - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ interface Kohana_Config_Writer extends Kohana_Config_Source { /** * Writes the passed config for $group * - * Returns chainable instance on success or throws + * Returns chainable instance on success or throws * Kohana_Config_Exception on failure * * @param string $group The config group @@ -24,4 +24,5 @@ interface Kohana_Config_Writer extends Kohana_Config_Source * @return boolean */ public function write($group, $key, $config); + } diff --git a/system/classes/Kohana/Controller.php b/system/classes/Kohana/Controller.php index b2c95b3..c743360 100644 --- a/system/classes/Kohana/Controller.php +++ b/system/classes/Kohana/Controller.php @@ -51,15 +51,15 @@ abstract class Kohana_Controller { /** * Executes the given action and calls the [Controller::before] and [Controller::after] methods. - * + * * Can also be used to catch exceptions from actions in a single place. - * + * * 1. Before the controller action is called, the [Controller::before] method * will be called. * 2. Next the controller action will be called. * 3. After the controller action is called, the [Controller::after] method * will be called. - * + * * @throws HTTP_Exception_404 * @return Response */ @@ -105,7 +105,7 @@ abstract class Kohana_Controller { * Automatically executed after the controller action. Can be used to apply * transformation to the response, add extra output, and execute * other custom code. - * + * * @return void */ public function after() @@ -124,16 +124,16 @@ abstract class Kohana_Controller { */ public static function redirect($uri = '', $code = 302) { - return HTTP::redirect($uri, $code); + return HTTP::redirect( (string) $uri, $code); } /** * Checks the browser cache to see the response needs to be returned, * execution will halt and a 304 Not Modified will be sent if the * browser cache is up to date. - * + * * $this->check_cache(sha1($content)); - * + * * @param string $etag Resource Etag * @return Response */ @@ -142,4 +142,4 @@ abstract class Kohana_Controller { return HTTP::check_cache($this->request, $this->response, $etag); } -} // End Controller \ No newline at end of file +} diff --git a/system/classes/Kohana/Controller/Template.php b/system/classes/Kohana/Controller/Template.php index e091757..39045da 100644 --- a/system/classes/Kohana/Controller/Template.php +++ b/system/classes/Kohana/Controller/Template.php @@ -47,4 +47,4 @@ abstract class Kohana_Controller_Template extends Controller { parent::after(); } -} // End Controller_Template +} diff --git a/system/classes/Kohana/Cookie.php b/system/classes/Kohana/Cookie.php index 239d8c8..dafb7f5 100644 --- a/system/classes/Kohana/Cookie.php +++ b/system/classes/Kohana/Cookie.php @@ -124,7 +124,6 @@ class Kohana_Cookie { * * @param string $name cookie name * @return boolean - * @uses Cookie::set */ public static function delete($name) { @@ -149,7 +148,7 @@ class Kohana_Cookie { // 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 @@ -158,4 +157,4 @@ class Kohana_Cookie { return sha1($agent.$name.$value.Cookie::$salt); } -} // End cookie +} diff --git a/system/classes/Kohana/Core.php b/system/classes/Kohana/Core.php index 227da32..081d4bb 100644 --- a/system/classes/Kohana/Core.php +++ b/system/classes/Kohana/Core.php @@ -16,8 +16,8 @@ class Kohana_Core { // Release version and codename - const VERSION = '3.3.0'; - const CODENAME = 'badius'; + const VERSION = '3.3.1'; + const CODENAME = 'peregrinus'; // Common environment type constants for consistency and convenience const PRODUCTION = 10; @@ -383,7 +383,7 @@ class Kohana_Core { /** * Reverts the effects of the `register_globals` PHP setting by unsetting - * all global varibles except for the default super globals (GPCS, etc), + * all global variables except for the default super globals (GPCS, etc), * which is a [potential security hole.][ref-wikibooks] * * This is called automatically by [Kohana::init] if `register_globals` is @@ -521,7 +521,7 @@ class Kohana_Core { /** * Provides auto-loading support of classes that follow Kohana's old class * naming conventions. - * + * * This is included for compatibility purposes with older modules. * * @param string $class Class name @@ -927,7 +927,7 @@ class Kohana_Core { } /** - * Get a message from a file. Messages are arbitary strings that are stored + * Get a message from a file. Messages are arbitrary strings that are stored * in the `messages/` directory and reference by a key. Translation is not * performed on the returned values. See [message files](kohana/files/messages) * for more information. @@ -1037,7 +1037,7 @@ class Kohana_Core { /** * Generates a version string based on the variables defined above. - * + * * @return string */ public static function version() @@ -1045,4 +1045,4 @@ class Kohana_Core { return 'Kohana Framework '.Kohana::VERSION.' ('.Kohana::CODENAME.')'; } -} // End Kohana +} diff --git a/system/classes/Kohana/Date.php b/system/classes/Kohana/Date.php index 2c2ce39..692d658 100644 --- a/system/classes/Kohana/Date.php +++ b/system/classes/Kohana/Date.php @@ -600,4 +600,4 @@ class Kohana_Date { return $time->format($timestamp_format); } -} // End date +} diff --git a/system/classes/Kohana/Debug.php b/system/classes/Kohana/Debug.php index 9d1efdf..5a82bb6 100644 --- a/system/classes/Kohana/Debug.php +++ b/system/classes/Kohana/Debug.php @@ -5,8 +5,8 @@ * @package Kohana * @category Base * @author Kohana Team - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_Debug { diff --git a/system/classes/Kohana/Encrypt.php b/system/classes/Kohana/Encrypt.php index 46cfe57..6428607 100644 --- a/system/classes/Kohana/Encrypt.php +++ b/system/classes/Kohana/Encrypt.php @@ -210,4 +210,4 @@ class Kohana_Encrypt { return rtrim(mcrypt_decrypt($this->_cipher, $this->_key, $data, $this->_mode, $iv), "\0"); } -} // End Encrypt +} diff --git a/system/classes/Kohana/Feed.php b/system/classes/Kohana/Feed.php index b4e6969..4f3f397 100644 --- a/system/classes/Kohana/Feed.php +++ b/system/classes/Kohana/Feed.php @@ -182,4 +182,4 @@ class Kohana_Feed { return $feed; } -} // End Feed +} diff --git a/system/classes/Kohana/File.php b/system/classes/Kohana/File.php index b4fff2d..65f29a1 100644 --- a/system/classes/Kohana/File.php +++ b/system/classes/Kohana/File.php @@ -163,16 +163,16 @@ class Kohana_File { // Write files in 8k blocks $block_size = 1024 * 8; - // Total number of peices - $peices = 0; + // Total number of pieces + $pieces = 0; while ( ! feof($file)) { // Create another piece - $peices += 1; + $pieces += 1; // Create a new file piece - $piece = str_pad($peices, 3, '0', STR_PAD_LEFT); + $piece = str_pad($pieces, 3, '0', STR_PAD_LEFT); $piece = fopen($filename.'.'.$piece, 'wb+'); // Number of bytes read @@ -195,7 +195,7 @@ class Kohana_File { // Close the file fclose($file); - return $peices; + return $pieces; } /** @@ -214,7 +214,7 @@ class Kohana_File { // Read files in 8k blocks $block_size = 1024 * 8; - // Total number of peices + // Total number of pieces $pieces = 0; while (is_file($piece = $filename.'.'.str_pad($pieces + 1, 3, '0', STR_PAD_LEFT))) @@ -231,11 +231,11 @@ class Kohana_File { fwrite($file, fread($piece, $block_size)); } - // Close the peice + // Close the piece fclose($piece); } return $pieces; } -} // End file +} diff --git a/system/classes/Kohana/Form.php b/system/classes/Kohana/Form.php index 6cf529b..510bd81 100644 --- a/system/classes/Kohana/Form.php +++ b/system/classes/Kohana/Form.php @@ -2,7 +2,7 @@ /** * Form helper class. Unless otherwise noted, all generated HTML will be made * safe using the [HTML::chars] method. This prevents against simple XSS - * attacks that could otherwise be trigged by inserting HTML characters into + * attacks that could otherwise be triggered by inserting HTML characters into * form fields. * * @package Kohana @@ -431,4 +431,4 @@ class Kohana_Form { return ''.$text.''; } -} // End form +} diff --git a/system/classes/Kohana/Fragment.php b/system/classes/Kohana/Fragment.php index 3072fc9..e632ecc 100644 --- a/system/classes/Kohana/Fragment.php +++ b/system/classes/Kohana/Fragment.php @@ -144,4 +144,4 @@ class Kohana_Fragment { Kohana::cache(Fragment::_cache_key($name, $i18n), NULL, -3600); } -} // End Fragment +} diff --git a/system/classes/Kohana/HTML.php b/system/classes/Kohana/HTML.php index 171856c..a78bc76 100644 --- a/system/classes/Kohana/HTML.php +++ b/system/classes/Kohana/HTML.php @@ -342,4 +342,4 @@ class Kohana_HTML { return $compiled; } -} // End html +} diff --git a/system/classes/Kohana/HTTP.php b/system/classes/Kohana/HTTP.php index 2dec59f..eca52c4 100644 --- a/system/classes/Kohana/HTTP.php +++ b/system/classes/Kohana/HTTP.php @@ -11,8 +11,8 @@ * @category HTTP * @author Kohana Team * @since 3.1.0 - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ abstract class Kohana_HTTP { @@ -44,7 +44,7 @@ abstract class Kohana_HTTP { * Checks the browser cache to see the response needs to be returned, * execution will halt and a 304 Not Modified will be sent if the * browser cache is up to date. - * + * * @param Request $request Request * @param Response $response Response * @param string $etag Resource ETag @@ -214,4 +214,5 @@ abstract class Kohana_HTTP { return implode('&', $encoded); } -} // End Kohana_HTTP \ No newline at end of file + +} diff --git a/system/classes/Kohana/HTTP/Exception.php b/system/classes/Kohana/HTTP/Exception.php index 0c878d7..65c4f31 100644 --- a/system/classes/Kohana/HTTP/Exception.php +++ b/system/classes/Kohana/HTTP/Exception.php @@ -4,7 +4,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception { /** * Creates an HTTP_Exception of the specified type. - * + * * @param integer $code the http status code * @param string $message status message, custom content to display with error * @param array $variables translation variables @@ -13,7 +13,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception { public static function factory($code, $message = NULL, array $variables = NULL, Exception $previous = NULL) { $class = 'HTTP_Exception_'.$code; - + return new $class($message, $variables, $previous); } @@ -44,15 +44,15 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception { /** * Store the Request that triggered this exception. - * + * * @param Request $request Request object that triggered this exception. - * @return Response + * @return HTTP_Exception */ public function request(Request $request = NULL) { if ($request === NULL) return $this->_request; - + $this->_request = $request; return $this; @@ -60,7 +60,7 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception { /** * Generate a Response for the current Exception - * + * * @uses Kohana_Exception::response() * @return Response */ @@ -69,4 +69,4 @@ abstract class Kohana_HTTP_Exception extends Kohana_Exception { return Kohana_Exception::response($this); } -} // End Kohana_HTTP_Exception \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/300.php b/system/classes/Kohana/HTTP/Exception/300.php index cc5a450..9eafcf0 100644 --- a/system/classes/Kohana/HTTP/Exception/300.php +++ b/system/classes/Kohana/HTTP/Exception/300.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_300 extends HTTP_Exception_Redirect { */ protected $_code = 300; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/301.php b/system/classes/Kohana/HTTP/Exception/301.php index 9cef69e..f176d1c 100644 --- a/system/classes/Kohana/HTTP/Exception/301.php +++ b/system/classes/Kohana/HTTP/Exception/301.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_301 extends HTTP_Exception_Redirect { */ protected $_code = 301; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/302.php b/system/classes/Kohana/HTTP/Exception/302.php index d5f3b35..d717544 100644 --- a/system/classes/Kohana/HTTP/Exception/302.php +++ b/system/classes/Kohana/HTTP/Exception/302.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_302 extends HTTP_Exception_Redirect { */ protected $_code = 302; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/303.php b/system/classes/Kohana/HTTP/Exception/303.php index f222625..4be7c9e 100644 --- a/system/classes/Kohana/HTTP/Exception/303.php +++ b/system/classes/Kohana/HTTP/Exception/303.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_303 extends HTTP_Exception_Redirect { */ protected $_code = 303; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/304.php b/system/classes/Kohana/HTTP/Exception/304.php index 27b64b5..6d76990 100644 --- a/system/classes/Kohana/HTTP/Exception/304.php +++ b/system/classes/Kohana/HTTP/Exception/304.php @@ -6,5 +6,5 @@ class Kohana_HTTP_Exception_304 extends HTTP_Exception_Expected { * @var integer HTTP 304 Not Modified */ protected $_code = 304; - -} \ No newline at end of file + +} diff --git a/system/classes/Kohana/HTTP/Exception/305.php b/system/classes/Kohana/HTTP/Exception/305.php index ccfcb83..d010d7c 100644 --- a/system/classes/Kohana/HTTP/Exception/305.php +++ b/system/classes/Kohana/HTTP/Exception/305.php @@ -9,7 +9,7 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected { /** * Specifies the proxy to replay this request via - * + * * @param string $location URI of the proxy */ public function location($uri = NULL) @@ -24,7 +24,7 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected { /** * Validate this exception contains everything needed to continue. - * + * * @throws Kohana_Exception * @return bool */ @@ -38,4 +38,5 @@ class Kohana_HTTP_Exception_305 extends HTTP_Exception_Expected { return TRUE; } -} \ No newline at end of file + +} diff --git a/system/classes/Kohana/HTTP/Exception/307.php b/system/classes/Kohana/HTTP/Exception/307.php index 1294f27..07afb7a 100644 --- a/system/classes/Kohana/HTTP/Exception/307.php +++ b/system/classes/Kohana/HTTP/Exception/307.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_307 extends HTTP_Exception_Redirect { */ protected $_code = 307; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/400.php b/system/classes/Kohana/HTTP/Exception/400.php index cf04e9f..fbbf025 100644 --- a/system/classes/Kohana/HTTP/Exception/400.php +++ b/system/classes/Kohana/HTTP/Exception/400.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_400 extends HTTP_Exception { */ protected $_code = 400; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/401.php b/system/classes/Kohana/HTTP/Exception/401.php index c00258a..70bcaf1 100644 --- a/system/classes/Kohana/HTTP/Exception/401.php +++ b/system/classes/Kohana/HTTP/Exception/401.php @@ -9,14 +9,14 @@ class Kohana_HTTP_Exception_401 extends HTTP_Exception_Expected { /** * Specifies the WWW-Authenticate challenge. - * + * * @param string $challenge WWW-Authenticate challenge (eg `Basic realm="Control Panel"`) */ public function authenticate($challenge = NULL) { if ($challenge === NULL) return $this->headers('www-authenticate'); - + $this->headers('www-authenticate', $challenge); return $this; @@ -24,7 +24,7 @@ class Kohana_HTTP_Exception_401 extends HTTP_Exception_Expected { /** * Validate this exception contains everything needed to continue. - * + * * @throws Kohana_Exception * @return bool */ @@ -35,4 +35,5 @@ class Kohana_HTTP_Exception_401 extends HTTP_Exception_Expected { return TRUE; } + } diff --git a/system/classes/Kohana/HTTP/Exception/402.php b/system/classes/Kohana/HTTP/Exception/402.php index 54d9ff1..f7837fe 100644 --- a/system/classes/Kohana/HTTP/Exception/402.php +++ b/system/classes/Kohana/HTTP/Exception/402.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_402 extends HTTP_Exception { */ protected $_code = 402; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/403.php b/system/classes/Kohana/HTTP/Exception/403.php index 5ce7f3d..e84527f 100644 --- a/system/classes/Kohana/HTTP/Exception/403.php +++ b/system/classes/Kohana/HTTP/Exception/403.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_403 extends HTTP_Exception { */ protected $_code = 403; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/404.php b/system/classes/Kohana/HTTP/Exception/404.php index 4debe5a..9b8b850 100644 --- a/system/classes/Kohana/HTTP/Exception/404.php +++ b/system/classes/Kohana/HTTP/Exception/404.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_404 extends HTTP_Exception { */ protected $_code = 404; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/405.php b/system/classes/Kohana/HTTP/Exception/405.php index 19f1195..edce607 100644 --- a/system/classes/Kohana/HTTP/Exception/405.php +++ b/system/classes/Kohana/HTTP/Exception/405.php @@ -9,7 +9,7 @@ class Kohana_HTTP_Exception_405 extends HTTP_Exception_Expected { /** * Specifies the list of allowed HTTP methods - * + * * @param array $methods List of allowed methods */ public function allowed($methods) @@ -26,7 +26,7 @@ class Kohana_HTTP_Exception_405 extends HTTP_Exception_Expected { /** * Validate this exception contains everything needed to continue. - * + * * @throws Kohana_Exception * @return bool */ @@ -38,4 +38,4 @@ class Kohana_HTTP_Exception_405 extends HTTP_Exception_Expected { return TRUE; } -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/406.php b/system/classes/Kohana/HTTP/Exception/406.php index b23861a..8d25e99 100644 --- a/system/classes/Kohana/HTTP/Exception/406.php +++ b/system/classes/Kohana/HTTP/Exception/406.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_406 extends HTTP_Exception { */ protected $_code = 406; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/407.php b/system/classes/Kohana/HTTP/Exception/407.php index 5b325ce..a46ca1a 100644 --- a/system/classes/Kohana/HTTP/Exception/407.php +++ b/system/classes/Kohana/HTTP/Exception/407.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_407 extends HTTP_Exception { */ protected $_code = 407; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/408.php b/system/classes/Kohana/HTTP/Exception/408.php index 84011d3..e7be11b 100644 --- a/system/classes/Kohana/HTTP/Exception/408.php +++ b/system/classes/Kohana/HTTP/Exception/408.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_408 extends HTTP_Exception { */ protected $_code = 408; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/409.php b/system/classes/Kohana/HTTP/Exception/409.php index 9b1ddb2..761cba6 100644 --- a/system/classes/Kohana/HTTP/Exception/409.php +++ b/system/classes/Kohana/HTTP/Exception/409.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_409 extends HTTP_Exception { */ protected $_code = 409; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/410.php b/system/classes/Kohana/HTTP/Exception/410.php index e62d6d0..4d47ee0 100644 --- a/system/classes/Kohana/HTTP/Exception/410.php +++ b/system/classes/Kohana/HTTP/Exception/410.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_410 extends HTTP_Exception { */ protected $_code = 410; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/411.php b/system/classes/Kohana/HTTP/Exception/411.php index 67ddb4f..c459ca8 100644 --- a/system/classes/Kohana/HTTP/Exception/411.php +++ b/system/classes/Kohana/HTTP/Exception/411.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_411 extends HTTP_Exception { */ protected $_code = 411; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/412.php b/system/classes/Kohana/HTTP/Exception/412.php index ae17eb5..a49db4e 100644 --- a/system/classes/Kohana/HTTP/Exception/412.php +++ b/system/classes/Kohana/HTTP/Exception/412.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_412 extends HTTP_Exception { */ protected $_code = 412; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/413.php b/system/classes/Kohana/HTTP/Exception/413.php index edc3c35..ea01cde 100644 --- a/system/classes/Kohana/HTTP/Exception/413.php +++ b/system/classes/Kohana/HTTP/Exception/413.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_413 extends HTTP_Exception { */ protected $_code = 413; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/414.php b/system/classes/Kohana/HTTP/Exception/414.php index 533a3e9..83c71cb 100644 --- a/system/classes/Kohana/HTTP/Exception/414.php +++ b/system/classes/Kohana/HTTP/Exception/414.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_414 extends HTTP_Exception { */ protected $_code = 414; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/415.php b/system/classes/Kohana/HTTP/Exception/415.php index 3bc591c..a771a65 100644 --- a/system/classes/Kohana/HTTP/Exception/415.php +++ b/system/classes/Kohana/HTTP/Exception/415.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_415 extends HTTP_Exception { */ protected $_code = 415; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/416.php b/system/classes/Kohana/HTTP/Exception/416.php index 0ad127b..9d2d44f 100644 --- a/system/classes/Kohana/HTTP/Exception/416.php +++ b/system/classes/Kohana/HTTP/Exception/416.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_416 extends HTTP_Exception { */ protected $_code = 416; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/417.php b/system/classes/Kohana/HTTP/Exception/417.php index 14f88a7..6f702e1 100644 --- a/system/classes/Kohana/HTTP/Exception/417.php +++ b/system/classes/Kohana/HTTP/Exception/417.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_417 extends HTTP_Exception { */ protected $_code = 417; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/500.php b/system/classes/Kohana/HTTP/Exception/500.php index 9a5c918..97c825d 100644 --- a/system/classes/Kohana/HTTP/Exception/500.php +++ b/system/classes/Kohana/HTTP/Exception/500.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_500 extends HTTP_Exception { */ protected $_code = 500; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/501.php b/system/classes/Kohana/HTTP/Exception/501.php index 4b40886..93c92bf 100644 --- a/system/classes/Kohana/HTTP/Exception/501.php +++ b/system/classes/Kohana/HTTP/Exception/501.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_501 extends HTTP_Exception { */ protected $_code = 501; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/502.php b/system/classes/Kohana/HTTP/Exception/502.php index 2f45654..6e880ef 100644 --- a/system/classes/Kohana/HTTP/Exception/502.php +++ b/system/classes/Kohana/HTTP/Exception/502.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_502 extends HTTP_Exception { */ protected $_code = 502; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/503.php b/system/classes/Kohana/HTTP/Exception/503.php index 8d56abd..4b0c359 100644 --- a/system/classes/Kohana/HTTP/Exception/503.php +++ b/system/classes/Kohana/HTTP/Exception/503.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_503 extends HTTP_Exception { */ protected $_code = 503; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/504.php b/system/classes/Kohana/HTTP/Exception/504.php index a708baa..b71d227 100644 --- a/system/classes/Kohana/HTTP/Exception/504.php +++ b/system/classes/Kohana/HTTP/Exception/504.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_504 extends HTTP_Exception { */ protected $_code = 504; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/505.php b/system/classes/Kohana/HTTP/Exception/505.php index f61a7b6..2b33dbc 100644 --- a/system/classes/Kohana/HTTP/Exception/505.php +++ b/system/classes/Kohana/HTTP/Exception/505.php @@ -7,4 +7,4 @@ class Kohana_HTTP_Exception_505 extends HTTP_Exception { */ protected $_code = 505; -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/Expected.php b/system/classes/Kohana/HTTP/Exception/Expected.php index 448a0a9..4d08def 100644 --- a/system/classes/Kohana/HTTP/Exception/Expected.php +++ b/system/classes/Kohana/HTTP/Exception/Expected.php @@ -1,8 +1,8 @@ _response; } -} // End Kohana_HTTP_Exception \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Exception/Redirect.php b/system/classes/Kohana/HTTP/Exception/Redirect.php index e065289..c3e6c08 100644 --- a/system/classes/Kohana/HTTP/Exception/Redirect.php +++ b/system/classes/Kohana/HTTP/Exception/Redirect.php @@ -2,7 +2,7 @@ /** * Redirect HTTP exception class. Used for all [HTTP_Exception]'s where the status * code indicates a redirect. - * + * * Eg [HTTP_Exception_301], [HTTP_Exception_302] and most of the other 30x's * * @package Kohana @@ -15,14 +15,14 @@ abstract class Kohana_HTTP_Exception_Redirect extends HTTP_Exception_Expected { /** * Specifies the URI to redirect to. - * + * * @param string $location URI of the proxy */ public function location($uri = NULL) { if ($uri === NULL) return $this->headers('Location'); - + if (strpos($uri, '://') === FALSE) { // Make the URI into a URL @@ -36,7 +36,7 @@ abstract class Kohana_HTTP_Exception_Redirect extends HTTP_Exception_Expected { /** * Validate this exception contains everything needed to continue. - * + * * @throws Kohana_Exception * @return bool */ @@ -48,4 +48,4 @@ abstract class Kohana_HTTP_Exception_Redirect extends HTTP_Exception_Expected { return TRUE; } -} // End Kohana_HTTP_Exception_Redirect \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Header.php b/system/classes/Kohana/HTTP/Header.php index 5850537..0debabf 100644 --- a/system/classes/Kohana/HTTP/Header.php +++ b/system/classes/Kohana/HTTP/Header.php @@ -9,8 +9,8 @@ * @category HTTP * @author Kohana Team * @since 3.1.0 - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_HTTP_Header extends ArrayObject { @@ -287,7 +287,7 @@ class Kohana_HTTP_Header extends ArrayObject { * @param int $flags Flags * @param string $iterator_class The iterator class to use */ - public function __construct(array $input = array(), $flags = NULL, $iterator_class = 'ArrayIterator') + public function __construct(array $input = array(), $flags = 0, $iterator_class = 'ArrayIterator') { /** * @link http://www.w3.org/Protocols/rfc2616/rfc2616.html @@ -859,12 +859,6 @@ class Kohana_HTTP_Header extends ArrayObject { */ 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(); @@ -946,4 +940,4 @@ class Kohana_HTTP_Header extends ArrayObject { return $this; } -} // End Kohana_HTTP_Header +} diff --git a/system/classes/Kohana/HTTP/Message.php b/system/classes/Kohana/HTTP/Message.php index 096a20a..c24046e 100644 --- a/system/classes/Kohana/HTTP/Message.php +++ b/system/classes/Kohana/HTTP/Message.php @@ -7,8 +7,8 @@ * @category HTTP * @author Kohana Team * @since 3.1.0 - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ interface Kohana_HTTP_Message { @@ -53,4 +53,5 @@ interface Kohana_HTTP_Message { * @return string */ public function render(); -} \ No newline at end of file + +} diff --git a/system/classes/Kohana/HTTP/Request.php b/system/classes/Kohana/HTTP/Request.php index 2ee97f3..b899272 100644 --- a/system/classes/Kohana/HTTP/Request.php +++ b/system/classes/Kohana/HTTP/Request.php @@ -8,8 +8,8 @@ * @category HTTP * @author Kohana Team * @since 3.1.0 - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ interface Kohana_HTTP_Request extends HTTP_Message { @@ -61,4 +61,4 @@ interface Kohana_HTTP_Request extends HTTP_Message { */ public function post($key = NULL, $value = NULL); -} \ No newline at end of file +} diff --git a/system/classes/Kohana/HTTP/Response.php b/system/classes/Kohana/HTTP/Response.php index 9ed00fc..ddce6b4 100644 --- a/system/classes/Kohana/HTTP/Response.php +++ b/system/classes/Kohana/HTTP/Response.php @@ -1,6 +1,6 @@ $username)); * * [!!] The target language is defined by [I18n::$lang]. - * + * * @uses I18n::get * @param string $string text to translate * @param array $values values to replace in the translated text diff --git a/system/classes/Kohana/Inflector.php b/system/classes/Kohana/Inflector.php index 2d7c2df..c91d33a 100644 --- a/system/classes/Kohana/Inflector.php +++ b/system/classes/Kohana/Inflector.php @@ -70,7 +70,7 @@ class Kohana_Inflector { * * [!!] Special inflections are defined in `config/inflector.php`. * - * @param string $str word to singularize + * @param string $str word to make singular * @param integer $count count of thing * @return string * @uses Inflector::uncountable @@ -183,6 +183,10 @@ class Kohana_Inflector { { $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'; @@ -197,7 +201,7 @@ class Kohana_Inflector { $str .= 's'; } - // Convert to uppsecase if nessasary + // Convert to uppercase if necessary if ($is_uppercase) { $str = strtoupper($str); @@ -266,4 +270,4 @@ class Kohana_Inflector { return preg_replace('/[_-]+/', ' ', trim($str)); } -} // End Inflector +} diff --git a/system/classes/Kohana/Kohana/Exception.php b/system/classes/Kohana/Kohana/Exception.php index 2955bec..d54b464 100644 --- a/system/classes/Kohana/Kohana/Exception.php +++ b/system/classes/Kohana/Kohana/Exception.php @@ -1,4 +1,4 @@ -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 @@ -230,7 +224,7 @@ class Kohana_Kohana_Exception extends Exception { } } } - + if (isset(Kohana_Exception::$php_errors[$code])) { // Use the human-readable error name @@ -251,13 +245,13 @@ class Kohana_Kohana_Exception extends Exception { // Instantiate the error view. $view = View::factory(Kohana_Exception::$error_view, get_defined_vars()); - + // Prepare the response object. $response = Response::factory(); // Set the response status $response->status(($e instanceof HTTP_Exception) ? $e->getCode() : 500); - + // Set the response headers $response->headers('Content-Type', Kohana_Exception::$error_view_content_type.'; charset='.Kohana::$charset); @@ -279,4 +273,4 @@ class Kohana_Kohana_Exception extends Exception { return $response; } -} // End Kohana_Exception +} diff --git a/system/classes/Kohana/Log.php b/system/classes/Kohana/Log.php index d06b07c..07f0434 100644 --- a/system/classes/Kohana/Log.php +++ b/system/classes/Kohana/Log.php @@ -80,7 +80,7 @@ class Kohana_Log { { $levels = range($min_level, $levels); } - + $this->_writers["{$writer}"] = array ( 'object' => $writer, @@ -225,4 +225,4 @@ class Kohana_Log { } } -} // End Kohana_Log +} diff --git a/system/classes/Kohana/Log/File.php b/system/classes/Kohana/Log/File.php index f603cf2..17235c7 100644 --- a/system/classes/Kohana/Log/File.php +++ b/system/classes/Kohana/Log/File.php @@ -91,4 +91,4 @@ class Kohana_Log_File extends Log_Writer { } } -} // End Kohana_Log_File \ No newline at end of file +} diff --git a/system/classes/Kohana/Log/StdErr.php b/system/classes/Kohana/Log/StdErr.php index 6e6486f..5384038 100644 --- a/system/classes/Kohana/Log/StdErr.php +++ b/system/classes/Kohana/Log/StdErr.php @@ -5,8 +5,8 @@ * @package Kohana * @category Logging * @author Kohana Team - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_Log_StdErr extends Log_Writer { /** @@ -26,4 +26,4 @@ class Kohana_Log_StdErr extends Log_Writer { } } -} // End Kohana_Log_StdErr +} diff --git a/system/classes/Kohana/Log/StdOut.php b/system/classes/Kohana/Log/StdOut.php index 3fb5e1d..608c653 100644 --- a/system/classes/Kohana/Log/StdOut.php +++ b/system/classes/Kohana/Log/StdOut.php @@ -5,8 +5,8 @@ * @package Kohana * @category Logging * @author Kohana Team - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_Log_StdOut extends Log_Writer { @@ -27,4 +27,4 @@ class Kohana_Log_StdOut extends Log_Writer { } } -} // End Kohana_Log_StdOut +} diff --git a/system/classes/Kohana/Log/Syslog.php b/system/classes/Kohana/Log/Syslog.php index 809629c..c747d58 100644 --- a/system/classes/Kohana/Log/Syslog.php +++ b/system/classes/Kohana/Log/Syslog.php @@ -62,4 +62,4 @@ class Kohana_Log_Syslog extends Log_Writer { closelog(); } -} // End Kohana_Log_Syslog +} diff --git a/system/classes/Kohana/Log/Writer.php b/system/classes/Kohana/Log/Writer.php index 4449958..c7c9678 100644 --- a/system/classes/Kohana/Log/Writer.php +++ b/system/classes/Kohana/Log/Writer.php @@ -12,21 +12,21 @@ abstract class Kohana_Log_Writer { /** * @var string timestamp format for log entries. - * + * * Defaults to Date::$timestamp_format */ public static $timestamp; /** * @var string timezone for log entries - * + * * Defaults to Date::$timezone, which defaults to date_default_timezone_get() */ public static $timezone; /** * Numeric log level to string lookup table. - * @var array + * @var array */ protected $_log_levels = array( LOG_EMERG => 'EMERGENCY', @@ -68,7 +68,7 @@ abstract class Kohana_Log_Writer { /** * Formats a log entry. - * + * * @param array $message * @param string $format * @return string @@ -78,7 +78,7 @@ abstract class Kohana_Log_Writer { $message['time'] = Date::formatted_time('@'.$message['time'], Log_Writer::$timestamp, Log_Writer::$timezone, TRUE); $message['level'] = $this->_log_levels[$message['level']]; - $string = strtr($format, $message); + $string = strtr($format, array_filter($message, 'is_scalar')); if (isset($message['additional']['exception'])) { @@ -86,10 +86,10 @@ abstract class Kohana_Log_Writer { $message['body'] = $message['additional']['exception']->getTraceAsString(); $message['level'] = $this->_log_levels[Log_Writer::$strace_level]; - $string .= PHP_EOL.strtr($format, $message); + $string .= PHP_EOL.strtr($format, array_filter($message, 'is_scalar')); } return $string; } -} // End Kohana_Log_Writer +} diff --git a/system/classes/Kohana/Model.php b/system/classes/Kohana/Model.php index 0baf9d1..995dde2 100644 --- a/system/classes/Kohana/Model.php +++ b/system/classes/Kohana/Model.php @@ -26,4 +26,4 @@ abstract class Kohana_Model { return new $class; } -} // End Model +} diff --git a/system/classes/Kohana/Num.php b/system/classes/Kohana/Num.php index d07fd05..329dcf7 100644 --- a/system/classes/Kohana/Num.php +++ b/system/classes/Kohana/Num.php @@ -231,4 +231,4 @@ class Kohana_Num { return $bytes; } -} // End num +} diff --git a/system/classes/Kohana/Profiler.php b/system/classes/Kohana/Profiler.php index fc03511..021eaef 100644 --- a/system/classes/Kohana/Profiler.php +++ b/system/classes/Kohana/Profiler.php @@ -14,7 +14,7 @@ class Kohana_Profiler { /** - * @var integer maximium number of application stats to keep + * @var integer maximum number of application stats to keep */ public static $rollover = 1000; @@ -382,4 +382,4 @@ class Kohana_Profiler { return $stats; } -} // End Profiler +} diff --git a/system/classes/Kohana/Request.php b/system/classes/Kohana/Request.php index e5ee71e..ba77385 100644 --- a/system/classes/Kohana/Request.php +++ b/system/classes/Kohana/Request.php @@ -59,14 +59,7 @@ class Kohana_Request implements HTTP_Request { // 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 @@ class Kohana_Request implements HTTP_Request { $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; @@ -1223,7 +1219,8 @@ class Kohana_Request implements HTTP_Request { } else { - $this->headers('content-type', 'application/x-www-form-urlencoded'); + $this->headers('content-type', + 'application/x-www-form-urlencoded; charset='.Kohana::$charset); $body = http_build_query($post, NULL, '&'); } @@ -1328,4 +1325,4 @@ class Kohana_Request implements HTTP_Request { return $this; } -} // End Request +} diff --git a/system/classes/Kohana/Request/Client.php b/system/classes/Kohana/Request/Client.php index d23b15f..1190a30 100644 --- a/system/classes/Kohana/Request/Client.php +++ b/system/classes/Kohana/Request/Client.php @@ -105,8 +105,8 @@ abstract class Kohana_Request_Client { ':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); @@ -405,10 +405,13 @@ abstract class Kohana_Request_Client { break; } - // Prepare the additional request + // Prepare the additional request, copying any follow_headers that were present on the original request + $orig_headers = $request->headers()->getArrayCopy(); + $follow_headers = array_intersect_assoc($orig_headers, array_fill_keys($client->follow_headers(), TRUE)); + $follow_request = Request::factory($response->headers('Location')) ->method($follow_method) - ->headers(Arr::extract($request->headers(), $client->follow_headers())); + ->headers($follow_headers); if ($follow_method !== Request::GET) { @@ -421,4 +424,4 @@ abstract class Kohana_Request_Client { return NULL; } -} \ No newline at end of file +} diff --git a/system/classes/Kohana/Request/Client/Curl.php b/system/classes/Kohana/Request/Client/Curl.php index c5c85d3..c5dffa6 100644 --- a/system/classes/Kohana/Request/Client/Curl.php +++ b/system/classes/Kohana/Request/Client/Curl.php @@ -2,7 +2,7 @@ /** * [Request_Client_External] Curl driver performs external requests using the * php-curl extention. This is the default driver for all external requests. - * + * * @package Kohana * @category Base * @author Kohana Team @@ -63,7 +63,7 @@ class Kohana_Request_Client_Curl extends Request_Client_External { $this->_options[CURLOPT_RETURNTRANSFER] = TRUE; $this->_options[CURLOPT_HEADER] = FALSE; - // Apply any additional options set to + // Apply any additional options set to $options += $this->_options; $uri = $request->uri(); @@ -110,8 +110,9 @@ class Kohana_Request_Client_Curl extends Request_Client_External { } /** - * Sets the appropriate curl request options. Uses the responding options - * for POST and PUT, uses CURLOPT_CUSTOMREQUEST otherwise + * Sets the appropriate curl request options. Uses the responding option + * for POST or CURLOPT_CUSTOMREQUEST otherwise + * * @param Request $request * @param array $options * @return array @@ -122,9 +123,6 @@ class Kohana_Request_Client_Curl extends Request_Client_External { case Request::POST: $options[CURLOPT_POST] = TRUE; break; - case Request::PUT: - $options[CURLOPT_PUT] = TRUE; - break; default: $options[CURLOPT_CUSTOMREQUEST] = $request->method(); break; @@ -132,4 +130,4 @@ class Kohana_Request_Client_Curl extends Request_Client_External { return $options; } -} // End Kohana_Request_Client_Curl \ No newline at end of file +} diff --git a/system/classes/Kohana/Request/Client/External.php b/system/classes/Kohana/Request/Client/External.php index 7bd754f..985b915 100644 --- a/system/classes/Kohana/Request/Client/External.php +++ b/system/classes/Kohana/Request/Client/External.php @@ -3,25 +3,25 @@ * [Request_Client_External] provides a wrapper for all external request * processing. This class should be extended by all drivers handling external * requests. - * + * * Supported out of the box: * - Curl (default) * - PECL HTTP * - Streams - * + * * To select a specific external driver to use as the default driver, set the * following property within the Application bootstrap. Alternatively, the * client can be injected into the request object. - * + * * @example - * + * * // In application bootstrap * Request_Client_External::$client = 'Request_Client_Stream'; - * + * * // Add client to request * $request = Request::factory('http://some.host.tld/foo/bar') * ->client(Request_Client_External::factory('Request_Client_HTTP)); - * + * * @package Kohana * @category Base * @author Kohana Team @@ -36,7 +36,7 @@ abstract class Kohana_Request_Client_External extends Request_Client { * - Request_Client_Curl (default) * - Request_Client_HTTP * - Request_Client_Stream - * + * * @var string defines the external client to use by default */ public static $client = 'Request_Client_Curl'; @@ -45,7 +45,7 @@ abstract class Kohana_Request_Client_External extends Request_Client { * Factory method to create a new Request_Client_External object based on * the client name passed, or defaulting to Request_Client_External::$client * by default. - * + * * Request_Client_External::$client can be set in the application bootstrap. * * @param array $params parameters to pass to the client @@ -124,7 +124,7 @@ abstract class Kohana_Request_Client_External extends Request_Client { if ($post = $request->post()) { $request->body(http_build_query($post, NULL, '&')) - ->headers('content-type', 'application/x-www-form-urlencoded'); + ->headers('content-type', 'application/x-www-form-urlencoded; charset='.Kohana::$charset); } // If Kohana expose, set the user-agent @@ -204,4 +204,4 @@ abstract class Kohana_Request_Client_External extends Request_Client { */ abstract protected function _send_message(Request $request, Response $response); -} // End Kohana_Request_Client_External \ No newline at end of file +} diff --git a/system/classes/Kohana/Request/Client/HTTP.php b/system/classes/Kohana/Request/Client/HTTP.php index c74f5c1..5a9ceb6 100644 --- a/system/classes/Kohana/Request/Client/HTTP.php +++ b/system/classes/Kohana/Request/Client/HTTP.php @@ -1,14 +1,14 @@ request() === NULL) + { + $e->request($request); + } + // Get the response via the Exception $response = $e->get_response(); } @@ -125,4 +131,5 @@ class Kohana_Request_Client_Internal extends Request_Client { // Return the response return $response; } -} // End Kohana_Request_Client_Internal + +} diff --git a/system/classes/Kohana/Request/Client/Recursion/Exception.php b/system/classes/Kohana/Request/Client/Recursion/Exception.php index 3029a8f..47ae2e3 100644 --- a/system/classes/Kohana/Request/Client/Recursion/Exception.php +++ b/system/classes/Kohana/Request/Client/Recursion/Exception.php @@ -1,5 +1,4 @@ -cookie(); - * + * * // Set a cookie to the response * $response->cookie('session', array( * 'value' => $value, @@ -710,4 +710,5 @@ class Kohana_Response implements HTTP_Response { return array($start, $end); } -} // End Kohana_Response + +} diff --git a/system/classes/Kohana/Route.php b/system/classes/Kohana/Route.php index 808d374..718bf17 100644 --- a/system/classes/Kohana/Route.php +++ b/system/classes/Kohana/Route.php @@ -35,6 +35,9 @@ */ class Kohana_Route { + // Matches a URI group and captures the contents + const REGEX_GROUP = '\(((?:(?>[^()]+)|(?R))*)\)'; + // Defines the pattern of a const REGEX_KEY = '<([a-zA-Z0-9_]++)>'; @@ -213,9 +216,9 @@ class Kohana_Route { // 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); } /** @@ -394,23 +397,23 @@ class Kohana_Route { } /** - * Tests if the route matches a given URI. A successful match will return + * Tests if the route matches a given Request. A successful match will return * all of the routed parameters as an array. A failed match will return * boolean FALSE. * * // Params: controller = users, action = edit, id = 10 - * $params = $route->matches('users/edit/10'); + * $params = $route->matches(Request::factory('users/edit/10')); * * This method should almost always be used within an if/else block: * - * if ($params = $route->matches($uri)) + * if ($params = $route->matches($request)) * { * // Parse the parameters * } * - * @param string $uri URI to match - * @return array on success - * @return FALSE on failure + * @param Request $request Request object to match + * @return array on success + * @return FALSE on failure */ public function matches(Request $request) { @@ -501,109 +504,81 @@ class Kohana_Route { * @param array $params URI parameters * @return string * @throws Kohana_Exception - * @uses Route::REGEX_Key + * @uses Route::REGEX_GROUP + * @uses Route::REGEX_KEY */ public function uri(array $params = NULL) { - // Start with the routed URI - $uri = $this->_uri; + $defaults = $this->_defaults; - if (strpos($uri, '<') === FALSE AND strpos($uri, '(') === FALSE) + /** + * Recursively compiles a portion of a URI specification by replacing + * the specified parameters and any optional parameters that are needed. + * + * @param string $portion Part of the URI specification + * @param boolean $required Whether or not parameters are required (initially) + * @return array Tuple of the compiled portion and whether or not it contained specified parameters + */ + $compile = function ($portion, $required) use (&$compile, $defaults, $params) { - // This is a static route, no need to replace anything + $missing = array(); - if ( ! $this->is_external()) - return $uri; - - // If the localhost setting does not have a protocol - if (strpos($this->_defaults['host'], '://') === FALSE) + $pattern = '#(?:'.Route::REGEX_KEY.'|'.Route::REGEX_GROUP.')#'; + $result = preg_replace_callback($pattern, function ($matches) use (&$compile, $defaults, &$missing, $params, &$required) { - // Use the default defined protocol - $params['host'] = Route::$default_protocol.$this->_defaults['host']; - } - else - { - // Use the supplied host with protocol - $params['host'] = $this->_defaults['host']; - } - - // Compile the final uri and return it - return rtrim($params['host'], '/').'/'.$uri; - } - - // Keep track of whether an optional param was replaced - $provided_optional = FALSE; - - while (preg_match('#\([^()]++\)#', $uri, $match)) - { - - // Search for the matched value - $search = $match[0]; - - // Remove the parenthesis from the match as the replace - $replace = substr($match[0], 1, -1); - - while (preg_match('#'.Route::REGEX_KEY.'#', $replace, $match)) - { - list($key, $param) = $match; - - if (isset($params[$param]) AND $params[$param] !== Arr::get($this->_defaults, $param)) + if ($matches[0][0] === '<') { - // Future optional params should be required - $provided_optional = TRUE; + // Parameter, unwrapped + $param = $matches[1]; - // Replace the key with the parameter value - $replace = str_replace($key, $params[$param], $replace); - } - elseif ($provided_optional) - { - // Look for a default - if (isset($this->_defaults[$param])) + if (isset($params[$param])) { - $replace = str_replace($key, $this->_defaults[$param], $replace); - } - else - { - // Ungrouped parameters are required - throw new Kohana_Exception('Required route parameter not passed: :param', array( - ':param' => $param, - )); + // This portion is required when a specified + // parameter does not match the default + $required = ($required OR ! isset($defaults[$param]) OR $params[$param] !== $defaults[$param]); + + // Add specified parameter to this result + return $params[$param]; } + + // Add default parameter to this result + if (isset($defaults[$param])) + return $defaults[$param]; + + // This portion is missing a parameter + $missing[] = $param; } else { - // This group has missing parameters - $replace = ''; - break; + // Group, unwrapped + $result = $compile($matches[2], FALSE); + + if ($result[1]) + { + // This portion is required when it contains a group + // that is required + $required = TRUE; + + // Add required groups to this result + return $result[0]; + } + + // Do not add optional groups to this result } - } + }, $portion); - // Replace the group in the URI - $uri = str_replace($search, $replace, $uri); - } - - while (preg_match('#'.Route::REGEX_KEY.'#', $uri, $match)) - { - list($key, $param) = $match; - - if ( ! isset($params[$param])) + if ($required AND $missing) { - // Look for a default - if (isset($this->_defaults[$param])) - { - $params[$param] = $this->_defaults[$param]; - } - else - { - // Ungrouped parameters are required - throw new Kohana_Exception('Required route parameter not passed: :param', array( - ':param' => $param, - )); - } + throw new Kohana_Exception( + 'Required route parameter not passed: :param', + array(':param' => reset($missing)) + ); } - $uri = str_replace($key, $params[$param], $uri); - } + return array($result, $required); + }; + + list($uri) = $compile($this->_uri, TRUE); // Trim all extra slashes from the URI $uri = preg_replace('#//+#', '/', rtrim($uri, '/')); @@ -626,4 +601,4 @@ class Kohana_Route { return $uri; } -} // End Route +} diff --git a/system/classes/Kohana/Security.php b/system/classes/Kohana/Security.php index 826347f..b8f66c6 100644 --- a/system/classes/Kohana/Security.php +++ b/system/classes/Kohana/Security.php @@ -48,7 +48,17 @@ class Kohana_Security { 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); @@ -100,4 +110,4 @@ class Kohana_Security { return str_replace(array(''), array('<?', '?>'), $str); } -} // End security +} diff --git a/system/classes/Kohana/Session.php b/system/classes/Kohana/Session.php index aafe607..b15bf43 100644 --- a/system/classes/Kohana/Session.php +++ b/system/classes/Kohana/Session.php @@ -502,4 +502,4 @@ abstract class Kohana_Session { */ abstract protected function _restart(); -} // End Session +} diff --git a/system/classes/Kohana/Session/Cookie.php b/system/classes/Kohana/Session/Cookie.php index 270d3bd..17ae36d 100644 --- a/system/classes/Kohana/Session/Cookie.php +++ b/system/classes/Kohana/Session/Cookie.php @@ -52,4 +52,4 @@ class Kohana_Session_Cookie extends Session { return Cookie::delete($this->_name); } -} // End Session_Cookie +} diff --git a/system/classes/Kohana/Session/Exception.php b/system/classes/Kohana/Session/Exception.php index a6adc4f..917ea67 100644 --- a/system/classes/Kohana/Session/Exception.php +++ b/system/classes/Kohana/Session/Exception.php @@ -7,5 +7,7 @@ * @license http://kohanaframework.org/license */ class Kohana_Session_Exception extends Kohana_Exception { + const SESSION_CORRUPT = 1; -} \ No newline at end of file + +} diff --git a/system/classes/Kohana/Session/Native.php b/system/classes/Kohana/Session/Native.php index 82a2e82..a5c8917 100644 --- a/system/classes/Kohana/Session/Native.php +++ b/system/classes/Kohana/Session/Native.php @@ -104,4 +104,4 @@ class Kohana_Session_Native extends Session { return $status; } -} // End Session_Native +} diff --git a/system/classes/Kohana/Text.php b/system/classes/Kohana/Text.php index 5209586..7514fd6 100644 --- a/system/classes/Kohana/Text.php +++ b/system/classes/Kohana/Text.php @@ -235,11 +235,11 @@ class Kohana_Text { /** * Uppercase words that are not separated by spaces, using a custom * delimiter or the default. - * - * $str = Text::ucfirst('content-type'); // returns "Content-Type" + * + * $str = Text::ucfirst('content-type'); // returns "Content-Type" * * @param string $string string to transform - * @param string $delimiter delemiter to use + * @param string $delimiter delimiter to use * @return string */ public static function ucfirst($string, $delimiter = '-') @@ -272,7 +272,7 @@ class Kohana_Text { * @param string $str phrase to replace words in * @param array $badwords words to replace * @param string $replacement replacement string - * @param boolean $replace_partial_words replace words across word boundries (space, period, etc) + * @param boolean $replace_partial_words replace words across word boundaries (space, period, etc) * @return string * @uses UTF8::strlen */ @@ -531,7 +531,7 @@ class Kohana_Text { { if ($number / $unit >= 1) { - // $value = the number of times the number is divisble by unit + // $value = the number of times the number is divisible by unit $number -= $unit * ($value = (int) floor($number / $unit)); // Temporary var for textifying the current unit $item = ''; @@ -683,4 +683,4 @@ class Kohana_Text { return FALSE; } -} // End text +} diff --git a/system/classes/Kohana/URL.php b/system/classes/Kohana/URL.php index 390a6a0..b758095 100644 --- a/system/classes/Kohana/URL.php +++ b/system/classes/Kohana/URL.php @@ -122,7 +122,7 @@ class Kohana_URL { /** * Callback used for encoding all non-ASCII characters, as per RFC 1738 * Used by URL::site() - * + * * @param array $matches Array of matches from preg_replace_callback() * @return string Encoded string */ @@ -210,4 +210,4 @@ class Kohana_URL { return trim($title, $separator); } -} // End url +} diff --git a/system/classes/Kohana/UTF8.php b/system/classes/Kohana/UTF8.php index 26e18de..ca5e315 100644 --- a/system/classes/Kohana/UTF8.php +++ b/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 @@ class Kohana_UTF8 { 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { * @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 @@ class Kohana_UTF8 { * @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 @@ class Kohana_UTF8 { 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 @@ class Kohana_UTF8 { ? 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { * $str = UTF8::strtolower($str); * * @author Andreas Gohr - * @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 @@ class Kohana_UTF8 { * of [strtoupper](http://php.net/strtoupper). * * @author Andreas Gohr - * @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 @@ class Kohana_UTF8 { 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 @@ class Kohana_UTF8 { * $str = UTF8::ucfirst($str); * * @author Harry Fuecks - * @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 @@ class Kohana_UTF8 { * $str = UTF8::ucwords($str); * * @author Harry Fuecks - * @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 @@ class Kohana_UTF8 { */ 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,25 +440,25 @@ class Kohana_UTF8 { */ 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); } /** - * Case-insenstive UTF-8 version of strstr. Returns all of input string + * Case-insensitive UTF-8 version of strstr. Returns all of input string * from the first occurrence of needle to the end. This is a UTF8-aware * version of [stristr](http://php.net/stristr). * * $found = UTF8::stristr($str, $search); * - * @author Harry Fuecks + * @author Harry Fuecks * @param string $str input string * @param string $search needle * @return string matched substring if found @@ -468,12 +466,12 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { * * $found = UTF8::strspn($str, $mask); * - * @author Harry Fuecks + * @author Harry Fuecks * @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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { * $str = UTF8::strrev($str); * * @author Harry Fuecks - * @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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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 @@ class Kohana_UTF8 { */ 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); @@ -731,7 +729,7 @@ class Kohana_UTF8 { /** * Takes an array of ints representing the Unicode characters and returns a UTF-8 string. * Astral planes are supported i.e. the ints in the input can be > 0xFFFF. - * Occurrances of the BOM are ignored. Surrogates are not allowed. + * Occurrences of the BOM are ignored. Surrogates are not allowed. * * $str = UTF8::to_unicode($array); * @@ -747,18 +745,18 @@ class Kohana_UTF8 { */ 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); } -} // End UTF8 +} if (Kohana_UTF8::$server_utf8 === NULL) { diff --git a/system/classes/Kohana/Upload.php b/system/classes/Kohana/Upload.php index dca8279..2d0aca3 100644 --- a/system/classes/Kohana/Upload.php +++ b/system/classes/Kohana/Upload.php @@ -253,4 +253,4 @@ class Kohana_Upload { return FALSE; } -} // End upload +} diff --git a/system/classes/Kohana/Valid.php b/system/classes/Kohana/Valid.php index 5e526e6..9c14b0e 100644 --- a/system/classes/Kohana/Valid.php +++ b/system/classes/Kohana/Valid.php @@ -478,7 +478,7 @@ class Kohana_Valid { */ public static function range($number, $min, $max, $step = NULL) { - if ($number <= $min OR $number >= $max) + if ($number < $min OR $number > $max) { // Number is outside of range return FALSE; @@ -548,4 +548,4 @@ class Kohana_Valid { return ($array[$field] === $array[$match]); } -} // End Valid +} diff --git a/system/classes/Kohana/Validation.php b/system/classes/Kohana/Validation.php index 0934bc4..4b46497 100644 --- a/system/classes/Kohana/Validation.php +++ b/system/classes/Kohana/Validation.php @@ -302,7 +302,7 @@ class Kohana_Validation implements ArrayAccess { $expected = Arr::merge(array_keys($original), array_keys($this->_labels)); // Import the rules locally - $rules = $this->_rules; + $rules = $this->_rules; foreach ($expected as $field) { @@ -609,4 +609,4 @@ class Kohana_Validation implements ArrayAccess { return $messages; } -} // End Validation +} diff --git a/system/classes/Kohana/Validation/Exception.php b/system/classes/Kohana/Validation/Exception.php index 9a60c67..f22ed36 100644 --- a/system/classes/Kohana/Validation/Exception.php +++ b/system/classes/Kohana/Validation/Exception.php @@ -26,4 +26,4 @@ class Kohana_Validation_Exception extends Kohana_Exception { parent::__construct($message, $values, $code, $previous); } -} // End Kohana_Validation_Exception +} diff --git a/system/classes/Kohana/View.php b/system/classes/Kohana/View.php index cb0b5b5..662a932 100644 --- a/system/classes/Kohana/View.php +++ b/system/classes/Kohana/View.php @@ -232,10 +232,10 @@ class Kohana_View { /** * Display the exception message. * - * We use this method here because it's impossible to throw and + * We use this method here because it's impossible to throw an * exception from __toString(). */ - $error_response = Kohana_exception::_handler($e); + $error_response = Kohana_Exception::_handler($e); return $error_response->body(); } @@ -348,4 +348,4 @@ class Kohana_View { return View::capture($this->_file, $this->_data); } -} // End View +} diff --git a/system/classes/Kohana/View/Exception.php b/system/classes/Kohana/View/Exception.php index 536c550..461e936 100644 --- a/system/classes/Kohana/View/Exception.php +++ b/system/classes/Kohana/View/Exception.php @@ -6,4 +6,4 @@ * @copyright (c) 2009-2012 Kohana Team * @license http://kohanaframework.org/license */ -class Kohana_View_Exception extends Kohana_Exception { } +class Kohana_View_Exception extends Kohana_Exception {} diff --git a/system/classes/Log.php b/system/classes/Log.php index 286a573..44ad17c 100644 --- a/system/classes/Log.php +++ b/system/classes/Log.php @@ -1,3 +1,3 @@ =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" + } + } +} diff --git a/system/config/credit_cards.php b/system/config/credit_cards.php index 35a4101..b32424a 100644 --- a/system/config/credit_cards.php +++ b/system/config/credit_cards.php @@ -57,4 +57,4 @@ return array( 'luhn' => TRUE, ), -); \ No newline at end of file +); diff --git a/system/config/curl.php b/system/config/curl.php index ae015b5..6a79da5 100644 --- a/system/config/curl.php +++ b/system/config/curl.php @@ -1,8 +1,10 @@ 'Mozilla/5.0 (compatible; Kohana v'.Kohana::VERSION.' +http://kohanaframework.org/)', CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => 5, CURLOPT_HEADER => FALSE, -); \ No newline at end of file + +); diff --git a/system/config/inflector.php b/system/config/inflector.php index ea28db1..c9cfd62 100644 --- a/system/config/inflector.php +++ b/system/config/inflector.php @@ -50,49 +50,49 @@ return array( ), 'irregular' => array( - 'appendix' => 'appendices', - 'cactus' => 'cacti', - 'calf' => 'calves', - 'child' => 'children', - 'crisis' => 'crises', - 'criterion' => 'criteria', - 'curriculum' => 'curricula', - 'diagnosis' => 'diagnoses', - 'elf' => 'elves', - 'ellipsis' => 'ellipses', - 'foot' => 'feet', - 'goose' => 'geese', - 'hero' => 'heroes', - 'hoof' => 'hooves', - 'hypothesis' => 'hypotheses', - 'is' => 'are', - 'knife' => 'knives', - 'leaf' => 'leaves', - 'life' => 'lives', - 'loaf' => 'loaves', - 'man' => 'men', - 'mouse' => 'mice', - 'nucleus' => 'nuclei', - 'oasis' => 'oases', - 'octopus' => 'octopi', - 'ox' => 'oxen', - 'paralysis' => 'paralyses', + 'appendix' => 'appendices', + 'cactus' => 'cacti', + 'calf' => 'calves', + 'child' => 'children', + 'crisis' => 'crises', + 'criterion' => 'criteria', + 'curriculum' => 'curricula', + 'diagnosis' => 'diagnoses', + 'elf' => 'elves', + 'ellipsis' => 'ellipses', + 'foot' => 'feet', + 'goose' => 'geese', + 'hero' => 'heroes', + 'hoof' => 'hooves', + 'hypothesis' => 'hypotheses', + 'is' => 'are', + 'knife' => 'knives', + 'leaf' => 'leaves', + 'life' => 'lives', + 'loaf' => 'loaves', + 'man' => 'men', + 'mouse' => 'mice', + 'nucleus' => 'nuclei', + 'oasis' => 'oases', + 'octopus' => 'octopi', + 'ox' => 'oxen', + 'paralysis' => 'paralyses', 'parenthesis' => 'parentheses', - 'person' => 'people', - 'phenomenon' => 'phenomena', - 'potato' => 'potatoes', - 'quiz' => 'quizzes', - 'radius' => 'radii', - 'scarf' => 'scarves', - 'stimulus' => 'stimuli', - 'syllabus' => 'syllabi', - 'synthesis' => 'syntheses', - 'thief' => 'thieves', - 'tooth' => 'teeth', - 'was' => 'were', - 'wharf' => 'wharves', - 'wife' => 'wives', - 'woman' => 'women', - 'release' => 'releases', + 'person' => 'people', + 'phenomenon' => 'phenomena', + 'potato' => 'potatoes', + 'quiz' => 'quizzes', + 'radius' => 'radii', + 'scarf' => 'scarves', + 'stimulus' => 'stimuli', + 'syllabus' => 'syllabi', + 'synthesis' => 'syntheses', + 'thief' => 'thieves', + 'tooth' => 'teeth', + 'was' => 'were', + 'wharf' => 'wharves', + 'wife' => 'wives', + 'woman' => 'women', + 'release' => 'releases', ), ); diff --git a/system/config/mimes.php b/system/config/mimes.php index 70084f3..2e31b0b 100644 --- a/system/config/mimes.php +++ b/system/config/mimes.php @@ -7,221 +7,220 @@ * http://kohanaphp.com/trac/newticket. Be sure to give the filename and * expected MIME type, as well as any additional information you can provide. */ -return array -( - '323' => array('text/h323'), - '7z' => array('application/x-7z-compressed'), - 'abw' => array('application/x-abiword'), - 'acx' => array('application/internet-property-stream'), - 'ai' => array('application/postscript'), - 'aif' => array('audio/x-aiff'), - 'aifc' => array('audio/x-aiff'), - 'aiff' => array('audio/x-aiff'), - 'amf' => array('application/x-amf'), - 'asf' => array('video/x-ms-asf'), - 'asr' => array('video/x-ms-asf'), - 'asx' => array('video/x-ms-asf'), - 'atom' => array('application/atom+xml'), - 'avi' => array('video/avi', 'video/msvideo', 'video/x-msvideo'), - 'bin' => array('application/octet-stream','application/macbinary'), - 'bmp' => array('image/bmp'), - 'c' => array('text/x-csrc'), - 'c++' => array('text/x-c++src'), - 'cab' => array('application/x-cab'), - 'cc' => array('text/x-c++src'), - 'cda' => array('application/x-cdf'), - 'class' => array('application/octet-stream'), - 'cpp' => array('text/x-c++src'), - 'cpt' => array('application/mac-compactpro'), - 'csh' => array('text/x-csh'), - 'css' => array('text/css'), - 'csv' => array('text/x-comma-separated-values', 'application/vnd.ms-excel', 'text/comma-separated-values', 'text/csv'), - 'dbk' => array('application/docbook+xml'), - 'dcr' => array('application/x-director'), - 'deb' => array('application/x-debian-package'), - 'diff' => array('text/x-diff'), - 'dir' => array('application/x-director'), - 'divx' => array('video/divx'), - 'dll' => array('application/octet-stream', 'application/x-msdos-program'), - 'dmg' => array('application/x-apple-diskimage'), - 'dms' => array('application/octet-stream'), - 'doc' => array('application/msword'), - 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document'), - 'dvi' => array('application/x-dvi'), - 'dxr' => array('application/x-director'), - 'eml' => array('message/rfc822'), - 'eps' => array('application/postscript'), - 'evy' => array('application/envoy'), - 'exe' => array('application/x-msdos-program', 'application/octet-stream'), - 'fla' => array('application/octet-stream'), - 'flac' => array('application/x-flac'), - 'flc' => array('video/flc'), - 'fli' => array('video/fli'), - 'flv' => array('video/x-flv'), - 'gif' => array('image/gif'), - 'gtar' => array('application/x-gtar'), - 'gz' => array('application/x-gzip'), - 'h' => array('text/x-chdr'), - 'h++' => array('text/x-c++hdr'), - 'hh' => array('text/x-c++hdr'), - 'hpp' => array('text/x-c++hdr'), - 'hqx' => array('application/mac-binhex40'), - 'hs' => array('text/x-haskell'), - 'htm' => array('text/html'), - 'html' => array('text/html'), - 'ico' => array('image/x-icon'), - 'ics' => array('text/calendar'), - 'iii' => array('application/x-iphone'), - 'ins' => array('application/x-internet-signup'), - 'iso' => array('application/x-iso9660-image'), - 'isp' => array('application/x-internet-signup'), - 'jar' => array('application/java-archive'), - 'java' => array('application/x-java-applet'), - 'jpe' => array('image/jpeg', 'image/pjpeg'), - 'jpeg' => array('image/jpeg', 'image/pjpeg'), - 'jpg' => array('image/jpeg', 'image/pjpeg'), - 'js' => array('application/javascript'), - 'json' => array('application/json'), - 'latex' => array('application/x-latex'), - 'lha' => array('application/octet-stream'), - 'log' => array('text/plain', 'text/x-log'), - 'lzh' => array('application/octet-stream'), - 'm4a' => array('audio/mpeg'), - 'm4p' => array('video/mp4v-es'), - 'm4v' => array('video/mp4'), - 'man' => array('application/x-troff-man'), - 'mdb' => array('application/x-msaccess'), - 'midi' => array('audio/midi'), - 'mid' => array('audio/midi'), - 'mif' => array('application/vnd.mif'), - 'mka' => array('audio/x-matroska'), - 'mkv' => array('video/x-matroska'), - 'mov' => array('video/quicktime'), - 'movie' => array('video/x-sgi-movie'), - 'mp2' => array('audio/mpeg'), - 'mp3' => array('audio/mpeg'), - 'mp4' => array('application/mp4','audio/mp4','video/mp4'), - 'mpa' => array('video/mpeg'), - 'mpe' => array('video/mpeg'), - 'mpeg' => array('video/mpeg'), - 'mpg' => array('video/mpeg'), - 'mpg4' => array('video/mp4'), - 'mpga' => array('audio/mpeg'), - 'mpp' => array('application/vnd.ms-project'), - 'mpv' => array('video/x-matroska'), - 'mpv2' => array('video/mpeg'), - 'ms' => array('application/x-troff-ms'), - 'msg' => array('application/msoutlook','application/x-msg'), - 'msi' => array('application/x-msi'), - 'nws' => array('message/rfc822'), - 'oda' => array('application/oda'), - 'odb' => array('application/vnd.oasis.opendocument.database'), - 'odc' => array('application/vnd.oasis.opendocument.chart'), - 'odf' => array('application/vnd.oasis.opendocument.forumla'), - 'odg' => array('application/vnd.oasis.opendocument.graphics'), - 'odi' => array('application/vnd.oasis.opendocument.image'), - 'odm' => array('application/vnd.oasis.opendocument.text-master'), - 'odp' => array('application/vnd.oasis.opendocument.presentation'), - 'ods' => array('application/vnd.oasis.opendocument.spreadsheet'), - 'odt' => array('application/vnd.oasis.opendocument.text'), - 'oga' => array('audio/ogg'), - 'ogg' => array('application/ogg'), - 'ogv' => array('video/ogg'), - 'otg' => array('application/vnd.oasis.opendocument.graphics-template'), - 'oth' => array('application/vnd.oasis.opendocument.web'), - 'otp' => array('application/vnd.oasis.opendocument.presentation-template'), - 'ots' => array('application/vnd.oasis.opendocument.spreadsheet-template'), - 'ott' => array('application/vnd.oasis.opendocument.template'), - 'p' => array('text/x-pascal'), - 'pas' => array('text/x-pascal'), - 'patch' => array('text/x-diff'), - 'pbm' => array('image/x-portable-bitmap'), - 'pdf' => array('application/pdf', 'application/x-download'), - 'php' => array('application/x-httpd-php'), - 'php3' => array('application/x-httpd-php'), - 'php4' => array('application/x-httpd-php'), - 'php5' => array('application/x-httpd-php'), - 'phps' => array('application/x-httpd-php-source'), - 'phtml' => array('application/x-httpd-php'), - 'pl' => array('text/x-perl'), - 'pm' => array('text/x-perl'), - 'png' => array('image/png', 'image/x-png'), - 'po' => array('text/x-gettext-translation'), - 'pot' => array('application/vnd.ms-powerpoint'), - 'pps' => array('application/vnd.ms-powerpoint'), - 'ppt' => array('application/powerpoint'), - 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation'), - 'ps' => array('application/postscript'), - 'psd' => array('application/x-photoshop', 'image/x-photoshop'), - 'pub' => array('application/x-mspublisher'), - 'py' => array('text/x-python'), - 'qt' => array('video/quicktime'), - 'ra' => array('audio/x-realaudio'), - 'ram' => array('audio/x-realaudio', 'audio/x-pn-realaudio'), - 'rar' => array('application/rar'), - 'rgb' => array('image/x-rgb'), - 'rm' => array('audio/x-pn-realaudio'), - 'rpm' => array('audio/x-pn-realaudio-plugin', 'application/x-redhat-package-manager'), - 'rss' => array('application/rss+xml'), - 'rtf' => array('text/rtf'), - 'rtx' => array('text/richtext'), - 'rv' => array('video/vnd.rn-realvideo'), - 'sea' => array('application/octet-stream'), - 'sh' => array('text/x-sh'), - 'shtml' => array('text/html'), - 'sit' => array('application/x-stuffit'), - 'smi' => array('application/smil'), - 'smil' => array('application/smil'), - 'so' => array('application/octet-stream'), - 'src' => array('application/x-wais-source'), - 'svg' => array('image/svg+xml'), - 'swf' => array('application/x-shockwave-flash'), - 't' => array('application/x-troff'), - 'tar' => array('application/x-tar'), - 'tcl' => array('text/x-tcl'), - 'tex' => array('application/x-tex'), - 'text' => array('text/plain'), - 'texti' => array('application/x-texinfo'), +return array( + '323' => array('text/h323'), + '7z' => array('application/x-7z-compressed'), + 'abw' => array('application/x-abiword'), + 'acx' => array('application/internet-property-stream'), + 'ai' => array('application/postscript'), + 'aif' => array('audio/x-aiff'), + 'aifc' => array('audio/x-aiff'), + 'aiff' => array('audio/x-aiff'), + 'amf' => array('application/x-amf'), + 'asf' => array('video/x-ms-asf'), + 'asr' => array('video/x-ms-asf'), + 'asx' => array('video/x-ms-asf'), + 'atom' => array('application/atom+xml'), + 'avi' => array('video/avi', 'video/msvideo', 'video/x-msvideo'), + 'bin' => array('application/octet-stream','application/macbinary'), + 'bmp' => array('image/bmp'), + 'c' => array('text/x-csrc'), + 'c++' => array('text/x-c++src'), + 'cab' => array('application/x-cab'), + 'cc' => array('text/x-c++src'), + 'cda' => array('application/x-cdf'), + 'class' => array('application/octet-stream'), + 'cpp' => array('text/x-c++src'), + 'cpt' => array('application/mac-compactpro'), + 'csh' => array('text/x-csh'), + 'css' => array('text/css'), + 'csv' => array('text/x-comma-separated-values', 'application/vnd.ms-excel', 'text/comma-separated-values', 'text/csv'), + 'dbk' => array('application/docbook+xml'), + 'dcr' => array('application/x-director'), + 'deb' => array('application/x-debian-package'), + 'diff' => array('text/x-diff'), + 'dir' => array('application/x-director'), + 'divx' => array('video/divx'), + 'dll' => array('application/octet-stream', 'application/x-msdos-program'), + 'dmg' => array('application/x-apple-diskimage'), + 'dms' => array('application/octet-stream'), + 'doc' => array('application/msword'), + 'docx' => array('application/vnd.openxmlformats-officedocument.wordprocessingml.document'), + 'dvi' => array('application/x-dvi'), + 'dxr' => array('application/x-director'), + 'eml' => array('message/rfc822'), + 'eps' => array('application/postscript'), + 'evy' => array('application/envoy'), + 'exe' => array('application/x-msdos-program', 'application/octet-stream'), + 'fla' => array('application/octet-stream'), + 'flac' => array('application/x-flac'), + 'flc' => array('video/flc'), + 'fli' => array('video/fli'), + 'flv' => array('video/x-flv'), + 'gif' => array('image/gif'), + 'gtar' => array('application/x-gtar'), + 'gz' => array('application/x-gzip'), + 'h' => array('text/x-chdr'), + 'h++' => array('text/x-c++hdr'), + 'hh' => array('text/x-c++hdr'), + 'hpp' => array('text/x-c++hdr'), + 'hqx' => array('application/mac-binhex40'), + 'hs' => array('text/x-haskell'), + 'htm' => array('text/html'), + 'html' => array('text/html'), + 'ico' => array('image/x-icon'), + 'ics' => array('text/calendar'), + 'iii' => array('application/x-iphone'), + 'ins' => array('application/x-internet-signup'), + 'iso' => array('application/x-iso9660-image'), + 'isp' => array('application/x-internet-signup'), + 'jar' => array('application/java-archive'), + 'java' => array('application/x-java-applet'), + 'jpe' => array('image/jpeg', 'image/pjpeg'), + 'jpeg' => array('image/jpeg', 'image/pjpeg'), + 'jpg' => array('image/jpeg', 'image/pjpeg'), + 'js' => array('application/javascript'), + 'json' => array('application/json'), + 'latex' => array('application/x-latex'), + 'lha' => array('application/octet-stream'), + 'log' => array('text/plain', 'text/x-log'), + 'lzh' => array('application/octet-stream'), + 'm4a' => array('audio/mpeg'), + 'm4p' => array('video/mp4v-es'), + 'm4v' => array('video/mp4'), + 'man' => array('application/x-troff-man'), + 'mdb' => array('application/x-msaccess'), + 'midi' => array('audio/midi'), + 'mid' => array('audio/midi'), + 'mif' => array('application/vnd.mif'), + 'mka' => array('audio/x-matroska'), + 'mkv' => array('video/x-matroska'), + 'mov' => array('video/quicktime'), + 'movie' => array('video/x-sgi-movie'), + 'mp2' => array('audio/mpeg'), + 'mp3' => array('audio/mpeg'), + 'mp4' => array('application/mp4','audio/mp4','video/mp4'), + 'mpa' => array('video/mpeg'), + 'mpe' => array('video/mpeg'), + 'mpeg' => array('video/mpeg'), + 'mpg' => array('video/mpeg'), + 'mpg4' => array('video/mp4'), + 'mpga' => array('audio/mpeg'), + 'mpp' => array('application/vnd.ms-project'), + 'mpv' => array('video/x-matroska'), + 'mpv2' => array('video/mpeg'), + 'ms' => array('application/x-troff-ms'), + 'msg' => array('application/msoutlook','application/x-msg'), + 'msi' => array('application/x-msi'), + 'nws' => array('message/rfc822'), + 'oda' => array('application/oda'), + 'odb' => array('application/vnd.oasis.opendocument.database'), + 'odc' => array('application/vnd.oasis.opendocument.chart'), + 'odf' => array('application/vnd.oasis.opendocument.forumla'), + 'odg' => array('application/vnd.oasis.opendocument.graphics'), + 'odi' => array('application/vnd.oasis.opendocument.image'), + 'odm' => array('application/vnd.oasis.opendocument.text-master'), + 'odp' => array('application/vnd.oasis.opendocument.presentation'), + 'ods' => array('application/vnd.oasis.opendocument.spreadsheet'), + 'odt' => array('application/vnd.oasis.opendocument.text'), + 'oga' => array('audio/ogg'), + 'ogg' => array('application/ogg'), + 'ogv' => array('video/ogg'), + 'otg' => array('application/vnd.oasis.opendocument.graphics-template'), + 'oth' => array('application/vnd.oasis.opendocument.web'), + 'otp' => array('application/vnd.oasis.opendocument.presentation-template'), + 'ots' => array('application/vnd.oasis.opendocument.spreadsheet-template'), + 'ott' => array('application/vnd.oasis.opendocument.template'), + 'p' => array('text/x-pascal'), + 'pas' => array('text/x-pascal'), + 'patch' => array('text/x-diff'), + 'pbm' => array('image/x-portable-bitmap'), + 'pdf' => array('application/pdf', 'application/x-download'), + 'php' => array('application/x-httpd-php'), + 'php3' => array('application/x-httpd-php'), + 'php4' => array('application/x-httpd-php'), + 'php5' => array('application/x-httpd-php'), + 'phps' => array('application/x-httpd-php-source'), + 'phtml' => array('application/x-httpd-php'), + 'pl' => array('text/x-perl'), + 'pm' => array('text/x-perl'), + 'png' => array('image/png', 'image/x-png'), + 'po' => array('text/x-gettext-translation'), + 'pot' => array('application/vnd.ms-powerpoint'), + 'pps' => array('application/vnd.ms-powerpoint'), + 'ppt' => array('application/powerpoint'), + 'pptx' => array('application/vnd.openxmlformats-officedocument.presentationml.presentation'), + 'ps' => array('application/postscript'), + 'psd' => array('application/x-photoshop', 'image/x-photoshop'), + 'pub' => array('application/x-mspublisher'), + 'py' => array('text/x-python'), + 'qt' => array('video/quicktime'), + 'ra' => array('audio/x-realaudio'), + 'ram' => array('audio/x-realaudio', 'audio/x-pn-realaudio'), + 'rar' => array('application/rar'), + 'rgb' => array('image/x-rgb'), + 'rm' => array('audio/x-pn-realaudio'), + 'rpm' => array('audio/x-pn-realaudio-plugin', 'application/x-redhat-package-manager'), + 'rss' => array('application/rss+xml'), + 'rtf' => array('text/rtf'), + 'rtx' => array('text/richtext'), + 'rv' => array('video/vnd.rn-realvideo'), + 'sea' => array('application/octet-stream'), + 'sh' => array('text/x-sh'), + 'shtml' => array('text/html'), + 'sit' => array('application/x-stuffit'), + 'smi' => array('application/smil'), + 'smil' => array('application/smil'), + 'so' => array('application/octet-stream'), + 'src' => array('application/x-wais-source'), + 'svg' => array('image/svg+xml'), + 'swf' => array('application/x-shockwave-flash'), + 't' => array('application/x-troff'), + 'tar' => array('application/x-tar'), + 'tcl' => array('text/x-tcl'), + 'tex' => array('application/x-tex'), + 'text' => array('text/plain'), + 'texti' => array('application/x-texinfo'), 'textinfo' => array('application/x-texinfo'), - 'tgz' => array('application/x-tar'), - 'tif' => array('image/tiff'), - 'tiff' => array('image/tiff'), - 'torrent' => array('application/x-bittorrent'), - 'tr' => array('application/x-troff'), - 'tsv' => array('text/tab-separated-values'), - 'txt' => array('text/plain'), - 'wav' => array('audio/x-wav'), - 'wax' => array('audio/x-ms-wax'), - 'wbxml' => array('application/wbxml'), - 'webm' => array('video/webm'), - 'wm' => array('video/x-ms-wm'), - 'wma' => array('audio/x-ms-wma'), - 'wmd' => array('application/x-ms-wmd'), - 'wmlc' => array('application/wmlc'), - 'wmv' => array('video/x-ms-wmv', 'application/octet-stream'), - 'wmx' => array('video/x-ms-wmx'), - 'wmz' => array('application/x-ms-wmz'), - 'word' => array('application/msword', 'application/octet-stream'), - 'wp5' => array('application/wordperfect5.1'), - 'wpd' => array('application/vnd.wordperfect'), - 'wvx' => array('video/x-ms-wvx'), - 'xbm' => array('image/x-xbitmap'), - 'xcf' => array('image/xcf'), - 'xhtml' => array('application/xhtml+xml'), - 'xht' => array('application/xhtml+xml'), - 'xl' => array('application/excel', 'application/vnd.ms-excel'), - 'xla' => array('application/excel', 'application/vnd.ms-excel'), - 'xlc' => array('application/excel', 'application/vnd.ms-excel'), - 'xlm' => array('application/excel', 'application/vnd.ms-excel'), - 'xls' => array('application/excel', 'application/vnd.ms-excel'), - 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'), - 'xlt' => array('application/excel', 'application/vnd.ms-excel'), - 'xml' => array('text/xml', 'application/xml'), - 'xof' => array('x-world/x-vrml'), - 'xpm' => array('image/x-xpixmap'), - 'xsl' => array('text/xml'), - 'xvid' => array('video/x-xvid'), - 'xwd' => array('image/x-xwindowdump'), - 'z' => array('application/x-compress'), - 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed') + 'tgz' => array('application/x-tar'), + 'tif' => array('image/tiff'), + 'tiff' => array('image/tiff'), + 'torrent' => array('application/x-bittorrent'), + 'tr' => array('application/x-troff'), + 'tsv' => array('text/tab-separated-values'), + 'txt' => array('text/plain'), + 'wav' => array('audio/x-wav'), + 'wax' => array('audio/x-ms-wax'), + 'wbxml' => array('application/wbxml'), + 'webm' => array('video/webm'), + 'wm' => array('video/x-ms-wm'), + 'wma' => array('audio/x-ms-wma'), + 'wmd' => array('application/x-ms-wmd'), + 'wmlc' => array('application/wmlc'), + 'wmv' => array('video/x-ms-wmv', 'application/octet-stream'), + 'wmx' => array('video/x-ms-wmx'), + 'wmz' => array('application/x-ms-wmz'), + 'word' => array('application/msword', 'application/octet-stream'), + 'wp5' => array('application/wordperfect5.1'), + 'wpd' => array('application/vnd.wordperfect'), + 'wvx' => array('video/x-ms-wvx'), + 'xbm' => array('image/x-xbitmap'), + 'xcf' => array('image/xcf'), + 'xhtml' => array('application/xhtml+xml'), + 'xht' => array('application/xhtml+xml'), + 'xl' => array('application/excel', 'application/vnd.ms-excel'), + 'xla' => array('application/excel', 'application/vnd.ms-excel'), + 'xlc' => array('application/excel', 'application/vnd.ms-excel'), + 'xlm' => array('application/excel', 'application/vnd.ms-excel'), + 'xls' => array('application/excel', 'application/vnd.ms-excel'), + 'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'), + 'xlt' => array('application/excel', 'application/vnd.ms-excel'), + 'xml' => array('text/xml', 'application/xml'), + 'xof' => array('x-world/x-vrml'), + 'xpm' => array('image/x-xpixmap'), + 'xsl' => array('text/xml'), + 'xvid' => array('video/x-xvid'), + 'xwd' => array('image/x-xwindowdump'), + 'z' => array('application/x-compress'), + 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed') ); diff --git a/system/config/session.php b/system/config/session.php index c130044..1b858ae 100644 --- a/system/config/session.php +++ b/system/config/session.php @@ -1,7 +1,9 @@ array( 'encrypted' => FALSE, ), + ); diff --git a/system/config/user_agents.php b/system/config/user_agents.php index 7960f5e..f4b92ea 100644 --- a/system/config/user_agents.php +++ b/system/config/user_agents.php @@ -105,4 +105,5 @@ return array( 'infoseek' => 'InfoSeek Robot 1.0', 'lycos' => 'Lycos', ), + ); diff --git a/system/config/userguide.php b/system/config/userguide.php index b240d7a..ff75968 100644 --- a/system/config/userguide.php +++ b/system/config/userguide.php @@ -9,15 +9,16 @@ return array( // Whether this modules userguide pages should be shown 'enabled' => TRUE, - + // The name that should show up on the userguide index page 'name' => 'Kohana', // A short description of this module, shown on the index page 'description' => 'Documentation for Kohana core/system.', - + // Copyright message, shown in the footer for this module 'copyright' => '© 2008–2012 Kohana Team', - ) - ) -); \ No newline at end of file + ), + ), + +); diff --git a/system/guide/kohana/install.md b/system/guide/kohana/install.md index 77b504d..f8e0e42 100644 --- a/system/guide/kohana/install.md +++ b/system/guide/kohana/install.md @@ -1,45 +1,64 @@ -# Installation +# Requirements -1. Download the latest **stable** release from the [Kohana website](http://kohanaframework.org/). -2. Unzip the downloaded package to create a `kohana` directory. -3. Upload the contents of this folder to your webserver. -4. Open `application/bootstrap.php` and make the following changes: - - Set the default [timezone](http://php.net/timezones) for your application. - - ~~~ - // Example of changing timezone from Chicago to Sao Paulo, Brazil - date_default_timezone_set('America/Sao_Paulo'); - ~~~ - - Set the `base_url` in the [Kohana::init] call to reflect the location of the kohana folder on your server relative to the document root. +[!!] Before continuing, make sure you have a web server (like Apache) configured with the following requirements. - ~~~ - // Example of kohana's installation at /var/www/mywebsite and - // Apache's DocumentRoot configured to /var/www - Kohana::init(array( - 'base_url' => '/mywebsite', - )); - ~~~ -6. Make sure the `application/cache` and `application/logs` directories are writable by the web server. + - PHP 5.3.3 or newer. + - [Iconv Extension](http://php.net/iconv) + - [Character Type (CTYPE) Extension](http://php.net/ctype) - ~~~ - sudo chmod 777 -R application/cache - sudo chmod 777 -R application/logs - ~~~ - -7. Test your installation by opening the URL you set as the `base_url` in your favorite browser. +# Download -[!!] Depending on your platform, the installation's subdirs may have lost their permissions thanks to zip extraction. Chmod them all to 755 by running `find . -type d -exec chmod 0755 {} \;` from the root of your Kohana installation. +You can get the latest **stable** release on the [Kohana website](http://kohanaframework.org/). This will give you a fully functional application with an `application`, `modules`, and `system` directory. + +[!!] You can find information about the file structure on the [Cascading Filesystem](files) page. + +Once downloaded, you should extract the Kohana application to a directory where the web server can access it. Going forward, we are going to assume you've extracted the application to a `kohana` directory such that `http://localhost/kohana/index.php` is pointing to the `index.php` file in the Kohana release. + +# Configure + +Before the application can be run, you will need to make a few changes to the `application/bootstrap.php` file. This file is the first one to be included by `index.php` and sets up most of the global options for the application. Open `application/bootstrap.php` and make the following changes: + + - Set the default [timezone](http://php.net/timezones) for your application. +~~~ +// Example of changing timezone to Sao Paulo, Brazil +date_default_timezone_set('America/Sao_Paulo'); +~~~ + - Set the `base_url` in the [Kohana::init] call to reflect the location of the kohana folder on your server relative to the document root. +~~~ +/** + * Example of kohana's installation at /var/www/kohana and + * Apache's DocumentRoot configured to /var/www + */ +Kohana::init(array( + 'base_url' => '/kohana/', +)); +~~~ + + - Make sure the `application/cache` and `application/logs` directories are writable by the web server. +~~~ +sudo chmod -R a+rwx application/cache +sudo chmod -R a+rwx application/logs +~~~ + + - Define a salt for the `Cookie` class. +~~~ +Cookie::$salt = [really-long-cookie-salt-here] +~~~ + +[!!] Make sure to use a unique salt for your application and never to share it. Take a look at the [Cookies](cookies) page for more information on how cookies work in Kohana. If you do not define a `Cookie::$salt` value, Kohana will throw an exception when it encounters any cookie on your domain. + + - Test your installation by opening [http://localhost/kohana](http://localhost/kohana). You should see the installation page. If it reports any errors, you will need to correct them before continuing. ![Install Page](install.png "Example of install page") -Once your install page reports that your environment is set up correctly you need to either rename or delete `install.php` in the root directory. Kohana is now installed and you should see the output of the welcome controller: +Once your install page reports that your environment is set up correctly you need to either rename or delete `install.php`. Kohana is now installed and you should see the output of the welcome controller: ![Welcome Page](welcome.png "Example of welcome page") ## Installing Kohana From GitHub -The [source code](http://github.com/kohana/kohana) for Kohana is hosted with [GitHub](http://github.com). To install Kohana using the github source code first you need to install [git](http://git-scm.com/). Visit [http://help.github.com](http://help.github.com) for details on how to install git on your platform. +The [source code](http://github.com/kohana/kohana) for Kohana is hosted with [GitHub](http://github.com). To install Kohana using the github source code first you need to install [git](http://git-scm.com/). Visit [http://help.github.com](http://help.github.com) for details on how to install git on your platform. -[!!] For more information on installing Kohana using git submodules, see the [Working with Git](tutorials/git) tutorial. \ No newline at end of file +[!!] For more information on installing Kohana using git, see the [Working with Git](tutorials/git) tutorial. diff --git a/system/guide/kohana/menu.md b/system/guide/kohana/menu.md index a124623..01e1de4 100644 --- a/system/guide/kohana/menu.md +++ b/system/guide/kohana/menu.md @@ -1,7 +1,7 @@ ## [Kohana]() +- [Installation](install) - Getting Started - - [Installation](install) - [Conventions and Style](conventions) - [Model View Controller](mvc) - [Controllers](mvc/controllers) @@ -37,13 +37,11 @@ - [Database](security/database) - [Encryption](security/encryption) - [Deploying](security/deploying) -- [Tutorials](tutorials) +- Tutorials - [Hello World](tutorials/hello-world) - [Simple MVC](tutorials/simple-mvc) - [Custom Error Pages](tutorials/error-pages) - - [Content Translation](tutorials/translation) - [Clean URLs](tutorials/clean-urls) - [Sharing Kohana](tutorials/sharing-kohana) - [Kohana as a Library](tutorials/library-kohana) - - [Template Driven Site](tutorials/templates) - [Working with Git](tutorials/git) diff --git a/system/guide/kohana/mvc/controllers.md b/system/guide/kohana/mvc/controllers.md index 52b4181..3a155db 100644 --- a/system/guide/kohana/mvc/controllers.md +++ b/system/guide/kohana/mvc/controllers.md @@ -128,7 +128,7 @@ A user login action. // Try to login if (Auth::instance()->login($this->request->post('username'), $this->request->post('password'))) { - $this->redirect('home', 302); + $this->redirect('home', 303); } $view->errors = 'Invalid email or password'; diff --git a/system/guide/kohana/mvc/views.md b/system/guide/kohana/mvc/views.md index 4ff0543..93368ab 100644 --- a/system/guide/kohana/mvc/views.md +++ b/system/guide/kohana/mvc/views.md @@ -126,9 +126,9 @@ You can also assign a variable of your parent view to be the child view from wit // In your controller: - public functin action_index() + public function action_index() { - $view = View::factory('common/template); + $view = View::factory('common/template'); $view->title = "Some title"; $view->body = View::factory('pages/foobar'); diff --git a/system/guide/kohana/routing.md b/system/guide/kohana/routing.md index 379c76d..bbf1dca 100644 --- a/system/guide/kohana/routing.md +++ b/system/guide/kohana/routing.md @@ -241,17 +241,3 @@ However, Kohana also provides a method to generate the uri from the route's defi )); Let's say you decided later to make that route definition more verbose by changing it to `feeds/(/).`. If you wrote your code with the above uri generation method you wouldn't have to change a single line! When a part of the uri is enclosed in parentheses and specifies a key for which there in no value provided for uri generation and no default value specified in the route, then that part will be removed from the uri. An example of this is the `(/)` part of the default route; this will not be included in the generated uri if an id is not provided. - -One method you might use frequently is the shortcut [Request::uri] which is the same as the above except it assumes the current route, directory, controller and action. If our current route is the default and the uri was `users/list`, we can do the following to generate uris in the format `users/view/$id`: - - $this->request->uri(array('action' => 'view', 'id' => $user_id)); - -Or if within a view, the preferable method is: - - Request::instance()->uri(array('action' => 'view', 'id' => $user_id)); - -TODO: examples of using html::anchor in addition to the above examples - -## Testing routes - -TODO: mention bluehawk's devtools module \ No newline at end of file diff --git a/system/guide/kohana/security/validation.md b/system/guide/kohana/security/validation.md index af67f22..43b1e1c 100644 --- a/system/guide/kohana/security/validation.md +++ b/system/guide/kohana/security/validation.md @@ -230,7 +230,7 @@ Next, we need a controller and action to process the registration, which will be $user->register($this->request->post()); // Always redirect after a successful POST to prevent refresh warnings - $this->redirect('user/profile', 302); + $this->redirect('user/profile', 303); } // Validation failed, collect the errors diff --git a/system/i18n/es.php b/system/i18n/es.php index 70eac92..f2f5b16 100644 --- a/system/i18n/es.php +++ b/system/i18n/es.php @@ -1,7 +1,8 @@ 'Español', 'Hello, world!' => '¡Hola, mundo!', -); \ No newline at end of file + +); diff --git a/system/i18n/fr.php b/system/i18n/fr.php index a2e86fa..a4ab944 100644 --- a/system/i18n/fr.php +++ b/system/i18n/fr.php @@ -1,7 +1,8 @@ 'Français', 'Hello, world!' => 'Bonjour, monde!', -); \ No newline at end of file + +); diff --git a/system/messages/tests/validation/error_type_check.php b/system/messages/tests/validation/error_type_check.php index 554b6c3..6c5a5fd 100644 --- a/system/messages/tests/validation/error_type_check.php +++ b/system/messages/tests/validation/error_type_check.php @@ -1,7 +1,9 @@ array( 'custom' => 'very nice email address you have there', ), + ); diff --git a/system/messages/validation.php b/system/messages/validation.php index 2d79cb4..236c2ab 100644 --- a/system/messages/validation.php +++ b/system/messages/validation.php @@ -1,6 +1,7 @@ ':field must contain only letters', 'alpha_dash' => ':field must contain only numbers, letters and dashes', 'alpha_numeric' => ':field must contain only letters and numbers', @@ -24,4 +25,5 @@ return array( 'range' => ':field must be within the range of :param2 to :param3', 'regex' => ':field does not match the required format', 'url' => ':field must be a url', + ); diff --git a/system/tests/kohana/ArrTest.php b/system/tests/kohana/ArrTest.php index 150016f..12a85ef 100644 --- a/system/tests/kohana/ArrTest.php +++ b/system/tests/kohana/ArrTest.php @@ -481,6 +481,8 @@ class Kohana_ArrTest extends Unittest_TestCase array(array('kohana' => array('is' => 'awesome')), array(), 'kohana/is', 'awesome', '/'), // Ensures set_path() casts ints to actual integers for keys array(array('foo' => array('bar')), array('foo' => array('test')), 'foo.0', 'bar'), + // Tests if it allows arrays + array(array('kohana' => array('is' => 'awesome')), array(), array('kohana', 'is'), 'awesome'), ); } diff --git a/system/tests/kohana/Config/File/ReaderTest.php b/system/tests/kohana/Config/File/ReaderTest.php index ab22d14..bfc755e 100644 --- a/system/tests/kohana/Config/File/ReaderTest.php +++ b/system/tests/kohana/Config/File/ReaderTest.php @@ -10,8 +10,8 @@ * @author Kohana Team * @author Jeremy Bush * @author Matt Button - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_Config_File_ReaderTest extends Kohana_Unittest_TestCase { diff --git a/system/tests/kohana/Config/GroupTest.php b/system/tests/kohana/Config/GroupTest.php index 66fd058..6222c8d 100644 --- a/system/tests/kohana/Config/GroupTest.php +++ b/system/tests/kohana/Config/GroupTest.php @@ -10,8 +10,8 @@ * @author Kohana Team * @author Jeremy Bush * @author Matt Button - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_Config_GroupTest extends Kohana_Unittest_TestCase { diff --git a/system/tests/kohana/CoreTest.php b/system/tests/kohana/CoreTest.php index beb508b..a0099d1 100644 --- a/system/tests/kohana/CoreTest.php +++ b/system/tests/kohana/CoreTest.php @@ -107,11 +107,33 @@ class Kohana_CoreTest extends Unittest_TestCase */ public function test_globals_removes_user_def_globals() { + // Store the globals + $temp_globals = array( + 'cookie' => $_COOKIE, + 'get' => $_GET, + 'files' => $_FILES, + 'post' => $_POST, + 'request' => $_REQUEST, + 'server' => $_SERVER, + 'session' => $_SESSION, + 'globals' => $GLOBALS, + ); + $GLOBALS = array('hackers' => 'foobar','name' => array('','',''), '_POST' => array()); Kohana::globals(); $this->assertEquals(array('_POST' => array()), $GLOBALS); + + // Reset the globals for other tests + $_COOKIE = $temp_globals['cookie']; + $_GET = $temp_globals['get']; + $_FILES = $temp_globals['files']; + $_POST = $temp_globals['post']; + $_REQUEST = $temp_globals['request']; + $_SERVER = $temp_globals['server']; + $_SESSION = $temp_globals['session']; + $GLOBALS = $temp_globals['globals']; } /** diff --git a/system/tests/kohana/DebugTest.php b/system/tests/kohana/DebugTest.php index 39176ec..3f84536 100644 --- a/system/tests/kohana/DebugTest.php +++ b/system/tests/kohana/DebugTest.php @@ -13,8 +13,8 @@ * @category Tests * @author Kohana Team * @author Jeremy Bush - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_DebugTest extends Unittest_TestCase { diff --git a/system/tests/kohana/Http/HeaderTest.php b/system/tests/kohana/Http/HeaderTest.php index 0894b46..8f241d3 100644 --- a/system/tests/kohana/Http/HeaderTest.php +++ b/system/tests/kohana/Http/HeaderTest.php @@ -11,8 +11,8 @@ * @package Kohana * @category Tests * @author Kohana Team - * @copyright (c) 2008-2012 Kohana Team - * @license http://kohanaphp.com/license + * @copyright (c) 2008-2014 Kohana Team + * @license http://kohanaframework.org/license */ class Kohana_HTTP_HeaderTest extends Unittest_TestCase { diff --git a/system/tests/kohana/RouteTest.php b/system/tests/kohana/RouteTest.php index ef37f99..dd7a3f9 100644 --- a/system/tests/kohana/RouteTest.php +++ b/system/tests/kohana/RouteTest.php @@ -361,34 +361,6 @@ class Kohana_RouteTest extends Unittest_TestCase ), '', ), - /** - * Specifying this should cause controller and action to show up - * refs #4113 - */ - array( - '((/(/)))', - NULL, - array('controller' => 'welcome', 'action' => 'index'), - 'Welcome', - 'index', - 'welcome/index/1', - array( - 'id' => '1' - ), - '', - ), - array( - '(/(/))', - NULL, - array('controller' => 'welcome', 'action' => 'index'), - 'Welcome', - 'index', - 'welcome/foo', - array( - 'action' => 'foo', - ), - 'welcome', - ), ); } @@ -427,6 +399,107 @@ class Kohana_RouteTest extends Unittest_TestCase $this->assertSame($default_uri, $route->uri()); } + /** + * Provider for test_optional_groups_containing_specified_params + * + * @return array + */ + public function provider_optional_groups_containing_specified_params() + { + return array( + /** + * Specifying this should cause controller and action to show up + * refs #4113 + */ + array( + '((/(/)))', + array('controller' => 'welcome', 'action' => 'index'), + array('id' => '1'), + 'welcome/index/1', + ), + array( + '(/(/))', + array('controller' => 'welcome', 'action' => 'index'), + array('action' => 'foo'), + 'welcome/foo', + ), + array( + '(/(/))', + array('controller' => 'welcome', 'action' => 'index'), + array('action' => 'index'), + 'welcome', + ), + /** + * refs #4630 + */ + array( + 'api(/)/const(/)(/)', + array('version' => 1), + NULL, + 'api/const', + ), + array( + 'api(/)/const(/)(/)', + array('version' => 1), + array('version' => 9), + 'api/9/const', + ), + array( + 'api(/)/const(/)(/)', + array('version' => 1), + array('id' => 2), + 'api/const/2', + ), + array( + 'api(/)/const(/)(/)', + array('version' => 1), + array('custom' => 'x'), + 'api/const/x', + ), + array( + '((/(/)(/)))', + array('controller' => 'test', 'action' => 'index', 'type' => 'html'), + array('type' => 'json'), + 'test/index/json', + ), + array( + '((/(/)(/)))', + array('controller' => 'test', 'action' => 'index', 'type' => 'html'), + array('id' => 123), + 'test/index/123', + ), + array( + '((/(/)(/)))', + array('controller' => 'test', 'action' => 'index', 'type' => 'html'), + array('id' => 123, 'type' => 'html'), + 'test/index/123', + ), + array( + '((/(/)(/)))', + array('controller' => 'test', 'action' => 'index', 'type' => 'html'), + array('id' => 123, 'type' => 'json'), + 'test/index/123/json', + ), + ); + } + + /** + * When an optional param is specified, the optional params leading up to it + * must be in the URI. + * + * @dataProvider provider_optional_groups_containing_specified_params + * + * @ticket 4113 + * @ticket 4630 + */ + public function test_optional_groups_containing_specified_params($uri, $defaults, $params, $expected) + { + $route = new Route($uri, NULL); + $route->defaults($defaults); + + $this->assertSame($expected, $route->uri($params)); + } + /** * Optional params should not be used if what is passed in is identical * to the default. @@ -556,6 +629,15 @@ class Kohana_RouteTest extends Unittest_TestCase NULL, array('action' => 'awesome-action'), ), + /** + * Optional params are required when they lead to a specified param + * refs #4113 + */ + array( + '((/))', + NULL, + array('action' => 'awesome-action'), + ), ); } @@ -573,18 +655,8 @@ class Kohana_RouteTest extends Unittest_TestCase { $route = new Route($uri, $regex); - try - { - $route->uri($uri_array); - - $this->fail('Route::uri should throw exception if required param is not provided'); - } - catch(Exception $e) - { - $this->assertInstanceOf('Kohana_Exception', $e); - // Check that the error in question is about the controller param - $this->assertContains('controller', $e->getMessage()); - } + $this->setExpectedException('Kohana_Exception', 'controller'); + $route->uri($uri_array); } /** diff --git a/system/tests/kohana/ValidTest.php b/system/tests/kohana/ValidTest.php index 929e0f0..764e049 100644 --- a/system/tests/kohana/ValidTest.php +++ b/system/tests/kohana/ValidTest.php @@ -858,6 +858,15 @@ class Kohana_ValidTest extends Unittest_TestCase // #4043 array(2, 0, 10, 2, TRUE), array(3, 0, 10, 2, FALSE), + // #4672 + array(0, 0, 10, NULL, TRUE), + array(10, 0, 10, NULL, TRUE), + array(-10, -10, 10, NULL, TRUE), + array(-10, -1, 1, NULL, FALSE), + array(0, 0, 10, 2, TRUE), // with $step + array(10, 0, 10, 2, TRUE), + array(10, 0, 10, 3, FALSE), // max outside $step + array(12, 0, 12, 3, TRUE), // Empty test array('', 5, 10, NULL, FALSE), array(NULL, 5, 10, NULL, FALSE), diff --git a/system/tests/kohana/request/ClientTest.php b/system/tests/kohana/request/ClientTest.php index fffc1d5..9ad8702 100644 --- a/system/tests/kohana/request/ClientTest.php +++ b/system/tests/kohana/request/ClientTest.php @@ -175,6 +175,29 @@ class Kohana_Request_ClientTest extends Unittest_TestCase $this->assertFalse(isset($headers['x-not-in-follow']), 'X-Not-In-Follow should not be passed to next request'); } + /** + * Tests that the follow_headers are only added to a redirect request if they were present in the original + * + * @ticket 4790 + */ + public function test_follow_does_not_add_extra_headers() + { + $response = Request::factory( + $this->_dummy_redirect_uri(301), + array( + 'follow' => TRUE, + 'follow_headers' => array('Authorization') + )) + ->headers(array()) + ->execute(); + + $data = json_decode($response->body(),TRUE); + $headers = $data['rq_headers']; + + $this->assertArrayNotHasKey('authorization', $headers, 'Empty headers should not be added when following redirects'); + } + + /** * Provider for test_follows_with_strict_method * diff --git a/system/tests/kohana/request/client/ExternalTest.php b/system/tests/kohana/request/client/ExternalTest.php index 63d792f..2c97501 100644 --- a/system/tests/kohana/request/client/ExternalTest.php +++ b/system/tests/kohana/request/client/ExternalTest.php @@ -148,7 +148,7 @@ class Kohana_Request_Client_ExternalTest extends Unittest_TestCase { $json, $post, array( - 'content-type' => 'application/x-www-form-urlencoded', + 'content-type' => 'application/x-www-form-urlencoded; charset='.Kohana::$charset, 'body' => http_build_query($post, NULL, '&') ) ) diff --git a/system/utf8/ltrim.php b/system/utf8/ltrim.php index c49e131..a4ac843 100644 --- a/system/utf8/ltrim.php +++ b/system/utf8/ltrim.php @@ -19,4 +19,4 @@ function _ltrim($str, $charlist = NULL) $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist); return preg_replace('/^['.$charlist.']+/u', '', $str); -} \ No newline at end of file +} diff --git a/system/utf8/ord.php b/system/utf8/ord.php index 41b8227..28a5254 100644 --- a/system/utf8/ord.php +++ b/system/utf8/ord.php @@ -69,4 +69,4 @@ function _ord($chr) ':ordinal' => $ord0, )); } -} \ No newline at end of file +} diff --git a/system/utf8/rtrim.php b/system/utf8/rtrim.php index 9dfca8e..a116af3 100644 --- a/system/utf8/rtrim.php +++ b/system/utf8/rtrim.php @@ -19,4 +19,4 @@ function _rtrim($str, $charlist = NULL) $charlist = preg_replace('#[-\[\]:\\\\^/]#', '\\\\$0', $charlist); return preg_replace('/['.$charlist.']++$/uD', '', $str); -} \ No newline at end of file +} diff --git a/system/utf8/str_pad.php b/system/utf8/str_pad.php index 1ef1187..1812a30 100644 --- a/system/utf8/str_pad.php +++ b/system/utf8/str_pad.php @@ -49,4 +49,4 @@ function _str_pad($str, $final_str_length, $pad_str = ' ', $pad_type = STR_PAD_R throw new UTF8_Exception("UTF8::str_pad: Unknown padding type (:pad_type)", array( ':pad_type' => $pad_type, )); -} \ No newline at end of file +} diff --git a/system/utf8/str_split.php b/system/utf8/str_split.php index 97cfa24..dfc6d92 100644 --- a/system/utf8/str_split.php +++ b/system/utf8/str_split.php @@ -24,4 +24,4 @@ function _str_split($str, $split_length = 1) preg_match_all('/.{'.$split_length.'}|[^\x00]{1,'.$split_length.'}$/us', $str, $matches); return $matches[0]; -} \ No newline at end of file +} diff --git a/system/utf8/strcasecmp.php b/system/utf8/strcasecmp.php index 402d4bd..6e4dc5f 100644 --- a/system/utf8/strcasecmp.php +++ b/system/utf8/strcasecmp.php @@ -16,4 +16,4 @@ function _strcasecmp($str1, $str2) $str1 = UTF8::strtolower($str1); $str2 = UTF8::strtolower($str2); return strcmp($str1, $str2); -} \ No newline at end of file +} diff --git a/system/utf8/strcspn.php b/system/utf8/strcspn.php index c36a65d..9f1f71b 100644 --- a/system/utf8/strcspn.php +++ b/system/utf8/strcspn.php @@ -27,4 +27,4 @@ function _strcspn($str, $mask, $offset = NULL, $length = NULL) preg_match('/^[^'.$mask.']+/u', $str, $matches); return isset($matches[0]) ? UTF8::strlen($matches[0]) : 0; -} \ No newline at end of file +} diff --git a/system/utf8/stristr.php b/system/utf8/stristr.php index d79e28e..1179727 100644 --- a/system/utf8/stristr.php +++ b/system/utf8/stristr.php @@ -25,4 +25,4 @@ function _stristr($str, $search) return substr($str, strlen($matches[1])); return FALSE; -} \ No newline at end of file +} diff --git a/system/utf8/strlen.php b/system/utf8/strlen.php index 540a3c9..147b337 100644 --- a/system/utf8/strlen.php +++ b/system/utf8/strlen.php @@ -14,4 +14,4 @@ function _strlen($str) return strlen($str); return strlen(utf8_decode($str)); -} \ No newline at end of file +} diff --git a/system/utf8/strpos.php b/system/utf8/strpos.php index 82cb576..bbc6321 100644 --- a/system/utf8/strpos.php +++ b/system/utf8/strpos.php @@ -24,4 +24,4 @@ function _strpos($str, $search, $offset = 0) $str = UTF8::substr($str, $offset); $pos = UTF8::strpos($str, $search); return ($pos === FALSE) ? FALSE : ($pos + $offset); -} \ No newline at end of file +} diff --git a/system/utf8/strrev.php b/system/utf8/strrev.php index bbf9b92..6e2f0ca 100644 --- a/system/utf8/strrev.php +++ b/system/utf8/strrev.php @@ -15,4 +15,4 @@ function _strrev($str) preg_match_all('/./us', $str, $matches); return implode('', array_reverse($matches[0])); -} \ No newline at end of file +} diff --git a/system/utf8/strrpos.php b/system/utf8/strrpos.php index d230919..0565dbf 100644 --- a/system/utf8/strrpos.php +++ b/system/utf8/strrpos.php @@ -24,4 +24,4 @@ function _strrpos($str, $search, $offset = 0) $str = UTF8::substr($str, $offset); $pos = UTF8::strrpos($str, $search); return ($pos === FALSE) ? FALSE : ($pos + $offset); -} \ No newline at end of file +} diff --git a/system/utf8/strspn.php b/system/utf8/strspn.php index 524b8a0..e95fe85 100644 --- a/system/utf8/strspn.php +++ b/system/utf8/strspn.php @@ -27,4 +27,4 @@ function _strspn($str, $mask, $offset = NULL, $length = NULL) preg_match('/^[^'.$mask.']+/u', $str, $matches); return isset($matches[0]) ? UTF8::strlen($matches[0]) : 0; -} \ No newline at end of file +} diff --git a/system/utf8/strtolower.php b/system/utf8/strtolower.php index 67c39fd..fd1cc94 100644 --- a/system/utf8/strtolower.php +++ b/system/utf8/strtolower.php @@ -78,4 +78,4 @@ function _strtolower($str) } return UTF8::from_unicode($uni); -} \ No newline at end of file +} diff --git a/system/utf8/strtoupper.php b/system/utf8/strtoupper.php index c3895db..a69568d 100644 --- a/system/utf8/strtoupper.php +++ b/system/utf8/strtoupper.php @@ -78,4 +78,4 @@ function _strtoupper($str) } return UTF8::from_unicode($uni); -} \ No newline at end of file +} diff --git a/system/utf8/substr.php b/system/utf8/substr.php index efb008d..bf17dcc 100644 --- a/system/utf8/substr.php +++ b/system/utf8/substr.php @@ -69,4 +69,4 @@ function _substr($str, $offset, $length = NULL) preg_match('/'.$regex.'/us', $str, $matches); return $matches[1]; -} \ No newline at end of file +} diff --git a/system/utf8/substr_replace.php b/system/utf8/substr_replace.php index 494521f..b3a896c 100644 --- a/system/utf8/substr_replace.php +++ b/system/utf8/substr_replace.php @@ -19,4 +19,4 @@ function _substr_replace($str, $replacement, $offset, $length = NULL) array_splice($str_array[0], $offset, $length, $replacement_array[0]); return implode('', $str_array[0]); -} \ No newline at end of file +} diff --git a/system/utf8/to_unicode.php b/system/utf8/to_unicode.php index 1fe6c9b..d03eb62 100644 --- a/system/utf8/to_unicode.php +++ b/system/utf8/to_unicode.php @@ -142,4 +142,4 @@ function _to_unicode($str) } return $out; -} \ No newline at end of file +} diff --git a/system/utf8/transliterate_to_ascii.php b/system/utf8/transliterate_to_ascii.php index 33dc05c..898862d 100644 --- a/system/utf8/transliterate_to_ascii.php +++ b/system/utf8/transliterate_to_ascii.php @@ -74,4 +74,4 @@ function _transliterate_to_ascii($str, $case = 0) } return $str; -} \ No newline at end of file +} diff --git a/system/utf8/trim.php b/system/utf8/trim.php index 9003ce0..aca558e 100644 --- a/system/utf8/trim.php +++ b/system/utf8/trim.php @@ -14,4 +14,4 @@ function _trim($str, $charlist = NULL) return trim($str); return UTF8::ltrim(UTF8::rtrim($str, $charlist), $charlist); -} \ No newline at end of file +} diff --git a/system/utf8/ucfirst.php b/system/utf8/ucfirst.php index 6e73952..37bb956 100644 --- a/system/utf8/ucfirst.php +++ b/system/utf8/ucfirst.php @@ -15,4 +15,4 @@ function _ucfirst($str) preg_match('/^(.?)(.*)$/us', $str, $matches); return UTF8::strtoupper($matches[1]).$matches[2]; -} \ No newline at end of file +} diff --git a/system/utf8/ucwords.php b/system/utf8/ucwords.php index 7d285e0..1411ff1 100644 --- a/system/utf8/ucwords.php +++ b/system/utf8/ucwords.php @@ -20,4 +20,4 @@ function _ucwords($str) 'UTF8::strtoupper(\'$0\')', $str ); -} \ No newline at end of file +} diff --git a/system/views/kohana/error.php b/system/views/kohana/error.php index 19d4191..4d8b1d8 100644 --- a/system/views/kohana/error.php +++ b/system/views/kohana/error.php @@ -1,3 +1,4 @@ +
-

[ ]:

+

[ ]:

[ ]

@@ -117,7 +118,7 @@ function koggle(elem) $value): ?> - +