├── application ├── views │ └── .gitignore ├── cache │ └── .gitignore ├── i18n │ └── .gitignore ├── logs │ └── .gitignore ├── config │ └── .gitignore ├── messages │ └── .gitignore └── classes │ ├── Model │ └── .gitignore │ └── Controller │ └── Welcome.php ├── modules ├── orm │ ├── guide │ │ └── orm │ │ │ ├── tutorials.md │ │ │ ├── menu.md │ │ │ ├── upgrading.md │ │ │ ├── examples.md │ │ │ ├── models.md │ │ │ └── index.md │ ├── classes │ │ ├── ORM.php │ │ ├── Auth │ │ │ └── ORM.php │ │ ├── Model │ │ │ ├── Role.php │ │ │ ├── User.php │ │ │ ├── User │ │ │ │ └── Token.php │ │ │ └── Auth │ │ │ │ └── Role.php │ │ └── ORM │ │ │ └── Validation │ │ │ └── Exception.php │ ├── config │ │ └── userguide.php │ └── auth-schema-postgresql.sql ├── userguide │ ├── guide │ │ └── userguide │ │ │ ├── modules.md │ │ │ ├── using.md │ │ │ ├── index.md │ │ │ ├── menu.md │ │ │ ├── config.md │ │ │ └── works.md │ ├── classes │ │ ├── Kodoc.php │ │ ├── Kodoc │ │ │ ├── Class.php │ │ │ ├── Method.php │ │ │ ├── Markdown.php │ │ │ ├── Property.php │ │ │ ├── Missing.php │ │ │ └── Method │ │ │ │ └── Param.php │ │ ├── Controller │ │ │ └── Userguide.php │ │ └── Kohana │ │ │ └── Kodoc │ │ │ └── Missing.php │ ├── views │ │ └── userguide │ │ │ ├── error.php │ │ │ ├── examples │ │ │ └── error.php │ │ │ ├── api │ │ │ ├── tags.php │ │ │ └── menu.php │ │ │ ├── menu.php │ │ │ ├── page-toc.php │ │ │ └── index.php │ ├── media │ │ └── guide │ │ │ ├── img │ │ │ ├── lines.png │ │ │ ├── arrows.png │ │ │ ├── content.png │ │ │ ├── h2_line.png │ │ │ ├── h3_line.png │ │ │ ├── header.png │ │ │ ├── kohana.png │ │ │ ├── wrapper.png │ │ │ ├── ext_link.png │ │ │ ├── orange-tab.png │ │ │ ├── breadcrumbs.png │ │ │ └── lightbulb_48.png │ │ │ ├── userguide │ │ │ ├── contrib-github-edit.png │ │ │ ├── contrib-github-fork.png │ │ │ └── contrib-github-pull.png │ │ │ └── css │ │ │ ├── print.css │ │ │ └── api.css │ ├── messages │ │ └── userguide.php │ ├── init.php │ ├── config │ │ └── userguide.php │ └── vendor │ │ └── markdown │ │ └── License.text ├── codebench │ ├── guide │ │ └── codebench │ │ │ └── menu.md │ ├── classes │ │ ├── Codebench.php │ │ └── Bench │ │ │ ├── LtrimDigits.php │ │ │ ├── StripNullBytes.php │ │ │ ├── ExplodeLimit.php │ │ │ ├── MDDoIncludeViews.php │ │ │ ├── UserFuncArray.php │ │ │ └── ArrCallback.php │ ├── media │ │ └── guide │ │ │ └── codebench │ │ │ ├── codebench_screenshot1.png │ │ │ └── codebench_screenshot2.png │ ├── config │ │ ├── codebench.php │ │ └── userguide.php │ └── init.php ├── unittest │ ├── guide │ │ └── unittest │ │ │ ├── index.md │ │ │ ├── menu.md │ │ │ └── troubleshooting.md │ ├── classes │ │ └── Unittest │ │ │ ├── Tests.php │ │ │ ├── Helpers.php │ │ │ ├── TestSuite.php │ │ │ ├── TestCase.php │ │ │ └── Database │ │ │ └── TestCase.php │ ├── config │ │ ├── userguide.php │ │ └── unittest.php │ ├── bootstrap_all_modules.php │ ├── tests.php │ └── example.phpunit.xml ├── cache │ ├── guide │ │ └── cache │ │ │ └── menu.md │ ├── classes │ │ ├── Cache.php │ │ ├── Cache │ │ │ ├── Apc.php │ │ │ ├── Apcu.php │ │ │ ├── File.php │ │ │ ├── Sqlite.php │ │ │ ├── Memcache.php │ │ │ ├── Tagging.php │ │ │ ├── Wincache.php │ │ │ ├── Exception.php │ │ │ ├── Memcached.php │ │ │ ├── Arithmetic.php │ │ │ ├── MemcacheTag.php │ │ │ └── GarbageCollect.php │ │ ├── HTTP │ │ │ └── Cache.php │ │ └── Kohana │ │ │ └── Cache │ │ │ ├── Exception.php │ │ │ ├── GarbageCollect.php │ │ │ ├── Arithmetic.php │ │ │ └── Tagging.php │ ├── config │ │ └── userguide.php │ └── tests │ │ └── cache │ │ ├── WincacheTest.php │ │ ├── SqliteTest.php │ │ └── arithmetic │ │ └── MemcachedTest.php ├── database │ ├── classes │ │ ├── DB.php │ │ ├── Database.php │ │ ├── Database │ │ │ ├── PDO.php │ │ │ ├── MySQLi.php │ │ │ ├── Query.php │ │ │ ├── Exception.php │ │ │ ├── Result.php │ │ │ ├── Expression.php │ │ │ ├── MySQLi │ │ │ │ └── Result.php │ │ │ ├── Result │ │ │ │ └── Cached.php │ │ │ └── Query │ │ │ │ ├── Builder.php │ │ │ │ └── Builder │ │ │ │ ├── Join.php │ │ │ │ ├── Delete.php │ │ │ │ ├── Insert.php │ │ │ │ ├── Select.php │ │ │ │ ├── Update.php │ │ │ │ └── Where.php │ │ ├── Model │ │ │ └── Database.php │ │ ├── Session │ │ │ └── Database.php │ │ ├── Kohana │ │ │ ├── Database │ │ │ │ ├── Exception.php │ │ │ │ └── Result │ │ │ │ │ └── Cached.php │ │ │ ├── Config │ │ │ │ └── Database.php │ │ │ └── Model │ │ │ │ └── Database.php │ │ └── Config │ │ │ ├── Database.php │ │ │ └── Database │ │ │ ├── Reader.php │ │ │ └── Writer.php │ ├── guide │ │ └── database │ │ │ ├── menu.md │ │ │ ├── query.md │ │ │ └── index.md │ └── config │ │ ├── userguide.php │ │ └── session.php ├── minion │ ├── guide │ │ └── minion │ │ │ ├── index.md │ │ │ ├── menu.md │ │ │ └── setup.md │ ├── classes │ │ ├── Minion │ │ │ ├── CLI.php │ │ │ ├── Exception.php │ │ │ ├── Exception │ │ │ │ └── InvalidTask.php │ │ │ └── Task.php │ │ ├── Kohana │ │ │ └── Minion │ │ │ │ ├── Exception │ │ │ │ └── InvalidTask.php │ │ │ │ └── Exception.php │ │ └── Task │ │ │ └── Help.php │ ├── views │ │ └── minion │ │ │ ├── help │ │ │ ├── error.php │ │ │ ├── task.php │ │ │ └── list.php │ │ │ └── error │ │ │ └── validation.php │ ├── messages │ │ └── validation.php │ ├── minion │ ├── config │ │ └── userguide.php │ └── miniond ├── auth │ ├── classes │ │ ├── Auth.php │ │ └── Auth │ │ │ └── File.php │ ├── guide │ │ └── auth │ │ │ ├── menu.md │ │ │ ├── index.md │ │ │ ├── driver │ │ │ └── file.md │ │ │ ├── config.md │ │ │ └── login.md │ └── config │ │ ├── auth.php │ │ └── userguide.php └── image │ ├── classes │ ├── Image.php │ └── Image │ │ ├── GD.php │ │ └── Imagick.php │ ├── tests │ ├── test_data │ │ └── test_image │ └── kohana │ │ └── ImageTest.php │ ├── media │ └── guide │ │ └── image │ │ ├── Thumbs.db │ │ ├── crop_form.jpg │ │ ├── crop_orig.jpg │ │ ├── crop_result.jpg │ │ ├── dynamic-400.jpg │ │ ├── dynamic-600.jpg │ │ ├── upload_form.jpg │ │ └── upload_result.jpg │ ├── guide │ └── image │ │ ├── menu.md │ │ ├── examples.md │ │ └── index.md │ └── config │ ├── image.php │ └── userguide.php ├── system ├── i18n │ ├── en.php │ ├── es.php │ └── fr.php ├── tests │ ├── test_data │ │ ├── views │ │ │ └── test.css.php │ │ ├── github.png │ │ ├── message_tests │ │ │ ├── top_module │ │ │ │ └── messages │ │ │ │ │ └── kohana_core_message_tests.php │ │ │ └── bottom_module │ │ │ │ └── messages │ │ │ │ └── kohana_core_message_tests.php │ │ ├── feeds │ │ │ └── example.rss20 │ │ └── callback_routes.php │ └── kohana │ │ └── ModelTest.php ├── classes │ ├── Arr.php │ ├── Log.php │ ├── Num.php │ ├── URL.php │ ├── Date.php │ ├── Debug.php │ ├── Feed.php │ ├── File.php │ ├── Form.php │ ├── HTML.php │ ├── I18n.php │ ├── Kohana.php │ ├── Route.php │ ├── Text.php │ ├── UTF8.php │ ├── Valid.php │ ├── View.php │ ├── Config.php │ ├── Cookie.php │ ├── HTTP.php │ ├── Request.php │ ├── Upload.php │ ├── Fragment.php │ ├── Log │ │ ├── File.php │ │ ├── StdErr.php │ │ ├── StdOut.php │ │ ├── Syslog.php │ │ └── Writer.php │ ├── Model.php │ ├── Profiler.php │ ├── Response.php │ ├── Security.php │ ├── Encrypt.php │ ├── Inflector.php │ ├── Session.php │ ├── Validation.php │ ├── Config │ │ ├── File.php │ │ └── Group.php │ ├── HTTP │ │ ├── Header.php │ │ ├── Message.php │ │ ├── Request.php │ │ ├── Exception.php │ │ ├── Response.php │ │ └── Exception │ │ │ ├── 300.php │ │ │ ├── 301.php │ │ │ ├── 302.php │ │ │ ├── 303.php │ │ │ ├── 304.php │ │ │ ├── 305.php │ │ │ ├── 307.php │ │ │ ├── 400.php │ │ │ ├── 401.php │ │ │ ├── 402.php │ │ │ ├── 403.php │ │ │ ├── 404.php │ │ │ ├── 405.php │ │ │ ├── 406.php │ │ │ ├── 407.php │ │ │ ├── 408.php │ │ │ ├── 409.php │ │ │ ├── 410.php │ │ │ ├── 411.php │ │ │ ├── 412.php │ │ │ ├── 413.php │ │ │ ├── 414.php │ │ │ ├── 415.php │ │ │ ├── 416.php │ │ │ ├── 417.php │ │ │ ├── 500.php │ │ │ ├── 501.php │ │ │ ├── 502.php │ │ │ ├── 503.php │ │ │ ├── 504.php │ │ │ ├── 505.php │ │ │ ├── Expected.php │ │ │ └── Redirect.php │ ├── Controller.php │ ├── Encrypt │ │ ├── Mcrypt.php │ │ └── Openssl.php │ ├── Session │ │ ├── Cookie.php │ │ ├── Native.php │ │ └── Exception.php │ ├── UTF8 │ │ └── Exception.php │ ├── View │ │ └── Exception.php │ ├── Kohana │ │ ├── Exception.php │ │ ├── HTTP │ │ │ ├── Exception │ │ │ │ ├── 410.php │ │ │ │ ├── 400.php │ │ │ │ ├── 403.php │ │ │ │ ├── 404.php │ │ │ │ ├── 409.php │ │ │ │ ├── 502.php │ │ │ │ ├── 302.php │ │ │ │ ├── 402.php │ │ │ │ ├── 406.php │ │ │ │ ├── 408.php │ │ │ │ ├── 411.php │ │ │ │ ├── 501.php │ │ │ │ ├── 504.php │ │ │ │ ├── 303.php │ │ │ │ ├── 304.php │ │ │ │ ├── 412.php │ │ │ │ ├── 414.php │ │ │ │ ├── 417.php │ │ │ │ ├── 500.php │ │ │ │ ├── 503.php │ │ │ │ ├── 300.php │ │ │ │ ├── 301.php │ │ │ │ ├── 413.php │ │ │ │ ├── 415.php │ │ │ │ ├── 505.php │ │ │ │ ├── 307.php │ │ │ │ ├── 407.php │ │ │ │ ├── 416.php │ │ │ │ ├── 405.php │ │ │ │ ├── 401.php │ │ │ │ ├── 305.php │ │ │ │ └── Redirect.php │ │ │ ├── Response.php │ │ │ ├── Request.php │ │ │ └── Message.php │ │ ├── UTF8 │ │ │ └── Exception.php │ │ ├── View │ │ │ └── Exception.php │ │ ├── Request │ │ │ ├── Exception.php │ │ │ └── Client │ │ │ │ └── Recursion │ │ │ │ └── Exception.php │ │ ├── Session │ │ │ ├── Exception.php │ │ │ └── Cookie.php │ │ ├── Config │ │ │ ├── Source.php │ │ │ ├── File.php │ │ │ ├── Reader.php │ │ │ ├── Writer.php │ │ │ └── File │ │ │ │ └── Reader.php │ │ ├── Model.php │ │ ├── Log │ │ │ ├── StdErr.php │ │ │ ├── StdOut.php │ │ │ └── Syslog.php │ │ ├── Validation │ │ │ └── Exception.php │ │ └── Controller │ │ │ └── Template.php │ ├── Request │ │ ├── Client.php │ │ ├── Exception.php │ │ └── Client │ │ │ ├── Curl.php │ │ │ ├── HTTP.php │ │ │ ├── Stream.php │ │ │ ├── Internal.php │ │ │ ├── External.php │ │ │ └── Recursion │ │ │ └── Exception.php │ ├── Validation │ │ └── Exception.php │ └── Controller │ │ └── Template.php ├── guide │ └── kohana │ │ ├── mvc.md │ │ ├── security │ │ ├── database.md │ │ ├── cookies.md │ │ ├── deploying.md │ │ └── xss.md │ │ ├── tutorials │ │ └── simple-mvc.md │ │ ├── controllers.md │ │ ├── security.md │ │ ├── files │ │ ├── messages.md │ │ └── i18n.md │ │ ├── mvc │ │ └── models.md │ │ ├── debugging.md │ │ ├── menu.md │ │ ├── flow.md │ │ ├── upgrading.md │ │ └── index.md ├── config │ ├── session.php │ ├── curl.php │ ├── url.php │ ├── userguide.php │ ├── encrypt.php │ └── credit_cards.php ├── media │ └── guide │ │ └── kohana │ │ ├── install.png │ │ ├── welcome.png │ │ ├── hello_world_1.png │ │ ├── hello_world_2.png │ │ ├── cascading_filesystem.png │ │ └── hello_world_2_error.png ├── messages │ ├── tests │ │ └── validation │ │ │ └── error_type_check.php │ └── validation.php ├── utf8 │ ├── strlen.php │ ├── trim.php │ ├── strrev.php │ ├── ucfirst.php │ ├── strcasecmp.php │ ├── ltrim.php │ ├── rtrim.php │ ├── str_split.php │ ├── strpos.php │ ├── stristr.php │ ├── ucwords.php │ ├── strrpos.php │ ├── substr_replace.php │ ├── strspn.php │ ├── strcspn.php │ └── str_pad.php └── views │ └── kohana │ └── generate_logo.php ├── .gitignore ├── public └── example.htaccess ├── package.json ├── LICENSE ├── composer.json └── .github └── workflows └── test.yml /application/views/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/cache/.gitignore: -------------------------------------------------------------------------------- 1 | [^.]* -------------------------------------------------------------------------------- /application/i18n/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /application/logs/.gitignore: -------------------------------------------------------------------------------- 1 | [^.]* -------------------------------------------------------------------------------- /application/config/.gitignore: -------------------------------------------------------------------------------- 1 | [^.]* -------------------------------------------------------------------------------- /application/messages/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /modules/orm/guide/orm/tutorials.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/classes/Model/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /modules/userguide/guide/userguide/modules.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /system/i18n/en.php: -------------------------------------------------------------------------------- 1 | Kodoc - 2 | 3 |

-------------------------------------------------------------------------------- /system/classes/Controller.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'encrypted' => false, 6 | ], 7 | ]; 8 | -------------------------------------------------------------------------------- /system/media/guide/kohana/install.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muffetlab/kohana/HEAD/system/media/guide/kohana/install.png -------------------------------------------------------------------------------- /system/media/guide/kohana/welcome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/muffetlab/kohana/HEAD/system/media/guide/kohana/welcome.png -------------------------------------------------------------------------------- /modules/cache/classes/Cache/Memcache.php: -------------------------------------------------------------------------------- 1 | 'Español', 5 | 'Hello, world!' => '¡Hola, mundo!', 6 | ]; 7 | -------------------------------------------------------------------------------- /system/i18n/fr.php: -------------------------------------------------------------------------------- 1 | 'Français', 5 | 'Hello, world!' => 'Bonjour, monde!', 6 | ]; 7 | -------------------------------------------------------------------------------- /modules/cache/classes/Cache/Exception.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Run 4 | 5 | index.php --uri=minion 6 | 7 | for more help 8 | -------------------------------------------------------------------------------- /modules/unittest/classes/Unittest/Tests.php: -------------------------------------------------------------------------------- 1 | ':field is not a valid option for this task!', 5 | ]; 6 | -------------------------------------------------------------------------------- /modules/unittest/classes/Unittest/TestSuite.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /system/classes/HTTP/Exception/Expected.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'custom' => 'very nice email address you have there', 6 | ], 7 | ]; 8 | -------------------------------------------------------------------------------- /modules/minion/minion: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | response->body('hello, world!'); 8 | } 9 | 10 | } 11 | -------------------------------------------------------------------------------- /system/classes/Kohana/HTTP/Exception/302.php: -------------------------------------------------------------------------------- 1 | Tags 2 | -------------------------------------------------------------------------------- /system/config/curl.php: -------------------------------------------------------------------------------- 1 | 'Mozilla/5.0 (compatible; Kohana v' . Kohana::VERSION . ' +https://kohana.top/)', 5 | CURLOPT_CONNECTTIMEOUT => 5, 6 | CURLOPT_TIMEOUT => 5, 7 | CURLOPT_HEADER => false, 8 | ]; 9 | -------------------------------------------------------------------------------- /system/tests/test_data/message_tests/top_module/messages/kohana_core_message_tests.php: -------------------------------------------------------------------------------- 1 | 'top only message', 6 | 'cfs_replaced' => 'overriding cfs_replaced message', 7 | ]; 8 | -------------------------------------------------------------------------------- /system/tests/test_data/message_tests/bottom_module/messages/kohana_core_message_tests.php: -------------------------------------------------------------------------------- 1 | 'inherited bottom message', 6 | 'cfs_replaced' => 'inherited cfs_replaced message', 7 | ]; 8 | -------------------------------------------------------------------------------- /modules/minion/views/minion/error/validation.php: -------------------------------------------------------------------------------- 1 | Parameter Errors: 2 | $error): ?> 3 | - 4 | 5 | 6 | Run 7 | 8 | php index.php --task= --help 9 | 10 | for more help -------------------------------------------------------------------------------- /modules/userguide/guide/userguide/menu.md: -------------------------------------------------------------------------------- 1 | ## [Userguide]() 2 | 3 | - Getting Started 4 | - [Using the Userguide](using) 5 | - [How the Userguide works](works) 6 | - [Configuration](config) 7 | - Learning More 8 | - [Contributing](contributing) 9 | - [Markdown Syntax](markdown) 10 | - [Adding your module](adding) -------------------------------------------------------------------------------- /system/classes/Kohana/UTF8/Exception.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'unittest' => [ 6 | 'enabled' => true, 7 | 'name' => 'Unittest', 8 | 'description' => 'Unit testing module', 9 | 'copyright' => '© 2009-2011 Kohana Team', 10 | ] 11 | ] 12 | ]; 13 | -------------------------------------------------------------------------------- /modules/minion/config/userguide.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'minion' => [ 6 | 'enabled' => true, 7 | 'name' => 'Minion', 8 | 'description' => 'Minion is a simple command line task runner', 9 | 'copyright' => '© 2009-2011 Kohana Team', 10 | ] 11 | ] 12 | ]; 13 | -------------------------------------------------------------------------------- /modules/orm/classes/ORM/Validation/Exception.php: -------------------------------------------------------------------------------- 1 | null, 8 | ]; 9 | -------------------------------------------------------------------------------- /modules/cache/classes/Kohana/Cache/Exception.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'de-de' => 'Deutsch', 6 | 'en-us' => 'English', 7 | 'es-es' => 'Español', 8 | 'zh-cn' => '简体中文', 9 | 'ru-ru' => 'Русский', 10 | 'fr-fr' => 'Français', 11 | 'he-il' => 'עברית', 12 | 'nl' => 'Nederlands', 13 | ], 14 | ]; 15 | -------------------------------------------------------------------------------- /modules/database/classes/Kohana/Database/Exception.php: -------------------------------------------------------------------------------- 1 | 0, 9 | /** 10 | * Expand all benchmark details by default. 11 | */ 12 | 'expand_all' => false, 13 | ]; 14 | -------------------------------------------------------------------------------- /modules/database/classes/Config/Database.php: -------------------------------------------------------------------------------- 1 | [--option1=value1] [--option2=value2] 5 | 6 | Details 7 | ======= 8 | $tag_content): ?> 9 | : 10 | 11 | 12 | 13 | Description 14 | =========== 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /modules/database/classes/Kohana/Config/Database.php: -------------------------------------------------------------------------------- 1 | 'File', 5 | 'hash_method' => 'sha256', 6 | 'hash_key' => null, 7 | 'lifetime' => 1209600, 8 | 'session_type' => Session::$default, 9 | 'session_key' => 'auth_user', 10 | // Username/password combinations for the Auth File driver 11 | 'users' => [ 12 | // 'admin' => 'b3154acf3a344170077d11bdb5fff31532f679a1919e716a02', 13 | ], 14 | ]; 15 | -------------------------------------------------------------------------------- /modules/database/classes/Config/Database/Reader.php: -------------------------------------------------------------------------------- 1 | Modules 2 | 3 | 4 | 5 | 12 | 13 | 14 | 15 |

No modules.

16 | 17 | -------------------------------------------------------------------------------- /system/config/url.php: -------------------------------------------------------------------------------- 1 | [ 5 | // Set up your hostnames here. 6 | // 7 | // Example: 8 | // 9 | // 'example\.org', 10 | // '.*\.example\.org', 11 | // 12 | // Do not forget to escape your dots (.) as these are regex patterns. 13 | // These patterns should always fully match, as they are prepended with `^` 14 | // and appended with `$`. 15 | ], 16 | ]; 17 | -------------------------------------------------------------------------------- /system/classes/Kohana/Config/Source.php: -------------------------------------------------------------------------------- 1 | 'image/png', 'data' => '$data']; ?>"); 15 | -------------------------------------------------------------------------------- /modules/minion/views/minion/help/list.php: -------------------------------------------------------------------------------- 1 | Minion is a cli tool for performing tasks 2 | 3 | Usage 4 | 5 | {task} --task=[options] 6 | 7 | Where {task} is one of the following: 8 | 9 | 10 | * 11 | 12 | 13 | 14 | For more information on what a task does and usage details execute 15 | 16 | --task={task} --help 17 | 18 | -------------------------------------------------------------------------------- /modules/userguide/views/userguide/page-toc.php: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 1): ?> 5 | 6 | 7 |
8 | 9 |
10 | 14 | -------------------------------------------------------------------------------- /system/utf8/trim.php: -------------------------------------------------------------------------------- 1 | 9 | Order Deny,Allow 10 | Deny From All 11 | 12 | 13 | # Allow any files or directories that exist to be displayed directly 14 | RewriteCond %{REQUEST_FILENAME} !-f 15 | RewriteCond %{REQUEST_FILENAME} !-d 16 | 17 | # Rewrite all other URLs to index.php/URL 18 | RewriteRule .* index.php?/$0 [PT] 19 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kohana", 3 | "version": "3.4.3", 4 | "description": "The Kohana PHP framework", 5 | "repository": { 6 | "type": "git", 7 | "url": "git+https://github.com/kilofox/kohana.git" 8 | }, 9 | "keywords": [ 10 | "framework", 11 | "kohana" 12 | ], 13 | "author": "Kohana Group", 14 | "license": "MIT", 15 | "bugs": { 16 | "url": "https://github.com/kilofox/kohana/issues" 17 | }, 18 | "homepage": "https://github.com/kilofox/kohana#readme" 19 | } 20 | -------------------------------------------------------------------------------- /system/utf8/strrev.php: -------------------------------------------------------------------------------- 1 | getMessage() . PHP_EOL; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /system/classes/Kohana/Config/File.php: -------------------------------------------------------------------------------- 1 | )', ['file' => '.+']) 5 | ->defaults([ 6 | 'controller' => 'Codebench', 7 | 'action' => 'media', 8 | 'file' => null, 9 | ]); 10 | 11 | // Catch-all route for Codebench classes to run 12 | Route::set('codebench', 'codebench(/)') 13 | ->defaults([ 14 | 'controller' => 'Codebench', 15 | 'action' => 'index', 16 | 'class' => null 17 | ]); 18 | -------------------------------------------------------------------------------- /modules/unittest/bootstrap_all_modules.php: -------------------------------------------------------------------------------- 1 | isDir() && !$module->isDot()) { 12 | $modules[$module->getFilename()] = MODPATH . $module->getFilename(); 13 | } 14 | } 15 | 16 | Kohana::modules(Kohana::modules() + $modules); 17 | 18 | unset($modules_iterator, $modules, $module); 19 | -------------------------------------------------------------------------------- /system/utf8/ucfirst.php: -------------------------------------------------------------------------------- 1 | _db_builder->from($this->_table_name); 9 | 10 | As of 3.2 it is now aliased like so: 11 | 12 | $this->_db_builder->from([$this->_table_name, $this->_object_name]); 13 | 14 | If you have a model `Model_Order` then when building a query use the alias like so: 15 | 16 | $model->where('order.id', '=', $id); 17 | -------------------------------------------------------------------------------- /modules/unittest/tests.php: -------------------------------------------------------------------------------- 1 | User Guide 2 | 3 |

The following modules have userguide pages:

4 | 5 | 6 | 7 | $options): ?> 8 | 9 |

10 | uri(['module' => $url]), $options['name']) ?> - 11 | 12 |

13 | 14 | 15 | 16 | 17 | 18 |

I couldn't find any modules with userguide pages.

19 | 20 | -------------------------------------------------------------------------------- /modules/database/guide/database/query.md: -------------------------------------------------------------------------------- 1 | # Making Queries 2 | 3 | There are two different ways to make queries. The simplest way to make a query is to use [Database_Query], via [DB::query], to manually create queries. These queries are called [parameterized statements](query/parameterized) and allow you to set query parameters which are automatically escaped. The second way to make a query is by building the query using method calls. This is done using the [query builder](query/builder). 4 | 5 | [!!] All queries are run using the `execute` method, which accepts a [Database] object or instance name. See [Database_Query::execute] for more information. -------------------------------------------------------------------------------- /modules/unittest/example.phpunit.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 12 | 13 | rel/path/to/unittest/tests.php 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /system/utf8/ltrim.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | class Bench_LtrimDigits extends Codebench 9 | { 10 | public $description = 'Chopping off leading digits: regex vs ltrim.'; 11 | public $loops = 100000; 12 | public $subjects = [ 13 | '123digits', 14 | 'no-digits', 15 | ]; 16 | 17 | public function bench_regex($subject) 18 | { 19 | return preg_replace('/^\d+/', '', $subject); 20 | } 21 | 22 | public function bench_ltrim($subject) 23 | { 24 | return ltrim($subject, '0..9'); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /system/classes/Kohana/Model.php: -------------------------------------------------------------------------------- 1 | _compile_task_list(Kohana::list_files('classes/Task')); 22 | 23 | $view = new View('minion/help/list'); 24 | 25 | $view->set('tasks', $tasks); 26 | 27 | echo $view; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /modules/auth/guide/auth/index.md: -------------------------------------------------------------------------------- 1 | # Auth 2 | 3 | User authentication and authorization is provided by the auth module. 4 | 5 | The auth module is included with Kohana, but needs to be enabled before you can use it. To enable, open your `application/bootstrap.php` file and modify the call to [Kohana::modules] by including the auth module like so: 6 | 7 | ~~~ 8 | Kohana::modules([ 9 | // ... 10 | 'auth' => MODPATH . 'auth', 11 | // ... 12 | ]); 13 | ~~~ 14 | 15 | Next, you will then need to [configure](config) the auth module. 16 | 17 | The auth module provides the [Auth::File] driver for you. There is also an auth driver included with the ORM module. 18 | 19 | As your application needs change you may need to find another driver or [develop](driver/develop) your own. 20 | -------------------------------------------------------------------------------- /modules/cache/classes/Kohana/Cache/GarbageCollect.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | RSS Title 5 | This is an example of an RSS feed 6 | http://www.example.com/main.html 7 | Mon, 06 Sep 2010 00:01:00 +0000 8 | Sun, 06 Sep 2009 16:20:00 +0000 9 | 1800 10 | 11 | 12 | Example entry 13 | Here is some text containing an interesting description. 14 | http://www.example.com/blog/post/1 15 | 7bd204c6-1655-4c27-aeee-53f933c5395f 16 | Sun, 06 Sep 2009 16:20:00 +0000 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /system/utf8/str_split.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'image' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'Image', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'Image manipulation.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /modules/auth/config/userguide.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'auth' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'Auth', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'User authentication and authorization.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /modules/codebench/config/userguide.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'codebench' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'Codebench', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'Code benchmarking tool.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /system/config/userguide.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'kohana' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'Kohana', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'Documentation for Kohana core/system.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ], 17 | ], 18 | ]; 19 | -------------------------------------------------------------------------------- /modules/cache/config/userguide.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'cache' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'Cache', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'Common interface for caching engines.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /system/utf8/strpos.php: -------------------------------------------------------------------------------- 1 | password (_hashed_) array of all the users in your application | 10 | 11 | ## Forcing Login 12 | 13 | [Auth_File::force_login] allows you to force a user login without a password. 14 | 15 | ~~~ 16 | // Force the user with a username of admin to be logged into your application 17 | Auth::instance()->force_login('admin'); 18 | $user = Auth::instance()->get_user(); 19 | ~~~ 20 | -------------------------------------------------------------------------------- /modules/database/config/userguide.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'database' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'Database', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'Database agnostic querying and result management.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /system/utf8/ucwords.php: -------------------------------------------------------------------------------- 1 | [ 6 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 7 | 'orm' => [ 8 | // Whether this module's userguide pages should be shown 9 | 'enabled' => true, 10 | // The name that should show up on the userguide index page 11 | 'name' => 'ORM', 12 | // A short description of this module, shown on the index page 13 | 'description' => 'Official ORM module, a modeling library for object relational mapping.', 14 | // Copyright message, shown in the footer for this module 15 | 'copyright' => '© 2008–2012 Kohana Team', 16 | ] 17 | ] 18 | ]; 19 | -------------------------------------------------------------------------------- /modules/orm/classes/Model/Auth/Role.php: -------------------------------------------------------------------------------- 1 | ['model' => 'User', 'through' => 'roles_users'], 16 | ]; 17 | 18 | public function rules() 19 | { 20 | return [ 21 | 'name' => [ 22 | ['not_empty'], 23 | ['min_length', [':value', 4]], 24 | ['max_length', [':value', 32]], 25 | ], 26 | 'description' => [ 27 | ['max_length', [':value', 255]], 28 | ] 29 | ]; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /system/classes/Kohana/Log/StdErr.php: -------------------------------------------------------------------------------- 1 | write($messages); 18 | * 19 | * @param array $messages 20 | * @return void 21 | * @throws Exception 22 | */ 23 | public function write(array $messages) 24 | { 25 | foreach ($messages as $message) { 26 | // Writes out each message 27 | fwrite(STDERR, $this->format_message($message) . PHP_EOL); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /system/classes/Kohana/Log/StdOut.php: -------------------------------------------------------------------------------- 1 | write($messages); 18 | * 19 | * @param array $messages 20 | * @return void 21 | * @throws Exception 22 | */ 23 | public function write(array $messages) 24 | { 25 | foreach ($messages as $message) { 26 | // Writes out each message 27 | fwrite(STDOUT, $this->format_message($message) . PHP_EOL); 28 | } 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /system/utf8/strrpos.php: -------------------------------------------------------------------------------- 1 | 14 | * @copyright (c) 2008-2012 Kohana Team 15 | * @license https://kohana.top/license 16 | */ 17 | class Kohana_ModelTest extends Unittest_TestCase 18 | { 19 | /** 20 | * Test the model's factory. 21 | * 22 | * @test 23 | * @covers Model::factory 24 | */ 25 | public function test_create() 26 | { 27 | $foobar = Model::factory('Foobar'); 28 | 29 | $this->assertTrue($foobar instanceof Model); 30 | } 31 | 32 | } 33 | 34 | class Model_Foobar extends Model 35 | { 36 | 37 | } 38 | -------------------------------------------------------------------------------- /system/config/encrypt.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'driver' => 'openssl', 6 | /** 7 | * The following options must be set: 8 | * 9 | * string key Secret passphrase. 10 | * integer method The cipher method, one of the return value from openssl_get_cipher_methods(). 11 | */ 12 | 'method' => 'AES-256-CTR', 13 | ], 14 | 'mcrypt' => [ 15 | 'driver' => 'mcrypt', 16 | /** 17 | * The following options must be set: 18 | * 19 | * string key Secret passphrase. 20 | * integer cipher Encryption cipher, one of the Mcrpyt cipher constants. 21 | * integer mode Encryption mode, one of MCRYPT_MODE_*. 22 | */ 23 | 'cipher' => MCRYPT_RIJNDAEL_128, 24 | 'mode' => MCRYPT_MODE_NOFB, 25 | ] 26 | ]; 27 | -------------------------------------------------------------------------------- /system/utf8/substr_replace.php: -------------------------------------------------------------------------------- 1 | Modules 3 | -------------------------------------------------------------------------------- /modules/database/config/session.php: -------------------------------------------------------------------------------- 1 | [ 5 | /** 6 | * Database settings for session storage. 7 | * 8 | * string group configuration group name 9 | * string table session table name 10 | * integer gc number of requests before gc is invoked 11 | * columns array custom column names 12 | */ 13 | 'group' => 'default', 14 | 'table' => 'sessions', 15 | 'gc' => 500, 16 | 'columns' => [ 17 | /** 18 | * session_id: session identifier 19 | * last_active: timestamp of the last activity 20 | * contents: serialized session data 21 | */ 22 | 'session_id' => 'session_id', 23 | 'last_active' => 'last_active', 24 | 'contents' => 'contents' 25 | ], 26 | ], 27 | ]; 28 | -------------------------------------------------------------------------------- /system/tests/test_data/callback_routes.php: -------------------------------------------------------------------------------- 1 | array = $array; 27 | 28 | parent::__construct($message, $values, $code, $previous); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /system/classes/Kohana/HTTP/Response.php: -------------------------------------------------------------------------------- 1 | status(404); 23 | * 24 | * // Get the current status 25 | * $status = $response->status(); 26 | * 27 | * @param int|null $code Status to set to this response 28 | * @return mixed 29 | */ 30 | public function status($code = null); 31 | } 32 | -------------------------------------------------------------------------------- /system/guide/kohana/files/messages.md: -------------------------------------------------------------------------------- 1 | # Messages 2 | 3 | Kohana has a robust key based lookup system, so you can define system messages. 4 | 5 | ## Getting a message 6 | 7 | Use the Kohana::message() method to get a message key: 8 | 9 | Kohana::message('forms', 'foobar'); 10 | 11 | This will look in the `messages/forms.php` file for the `foobar` key: 12 | 13 | 'Hello, world!', 17 | ]; 18 | 19 | You can also look in subfolders and sub-keys: 20 | 21 | Kohana::message('forms/contact', 'foobar.bar'); 22 | 23 | This will look in the `messages/forms/contact.php` for the `[foobar][bar]` key: 24 | 25 | [ 29 | 'bar' => 'Hello, world!', 30 | ], 31 | ]; 32 | 33 | ## Notes 34 | 35 | * Don't use __() in your messages files, as these files can be cached and will not work properly. 36 | * Messages are merged by the cascading file system, not overwritten like classes and views. 37 | -------------------------------------------------------------------------------- /modules/codebench/classes/Bench/StripNullBytes.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | class Bench_StripNullBytes extends Codebench 9 | { 10 | public $description = 'String replacement comparisons related to #2676.'; 11 | public $loops = 1000; 12 | public $subjects = [ 13 | "\0", 14 | "\0\0\0\0\0\0\0\0\0\0", 15 | "bla\0bla\0bla\0bla\0bla\0bla\0bla\0bla\0bla\0bla", 16 | "blablablablablablablablablablablablablablablabla", 17 | ]; 18 | 19 | public function bench_str_replace($subject) 20 | { 21 | return str_replace("\0", '', $subject); 22 | } 23 | 24 | public function bench_strtr($subject) 25 | { 26 | return strtr($subject, ["\0" => '']); 27 | } 28 | 29 | public function bench_preg_replace($subject) 30 | { 31 | return preg_replace('~\0+~', '', $subject); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /modules/unittest/guide/unittest/troubleshooting.md: -------------------------------------------------------------------------------- 1 | # Troubleshooting 2 | 3 | ## Some of my classes aren't getting whitelisted for code coverage even though their module is 4 | 5 | Only the "highest" files in the cascading filesystem are whitelisted for code coverage. 6 | 7 | To test your module's file, remove the higher file from the cascading filesystem by disabling their respective module. 8 | 9 | A good way of testing is to create a "vanilla" testing environment for your module, devoid of anything that isn't required by the module. 10 | 11 | ## I get a blank page when trying to generate a code coverage report 12 | 13 | Try the following: 14 | 15 | 1. Generate an HTML report from the command line using `phpunit {bootstrap info} --coverage-html ./report {insert path to tests.php}`. If any error messages show up, fix them and try to generate the report again. 16 | 2. Increase the php memory limit. 17 | 3. Make sure that display_errors is set to "on" in your php.ini config file (this value can sometimes be overridden in a .htaccess file). 18 | -------------------------------------------------------------------------------- /modules/database/guide/database/index.md: -------------------------------------------------------------------------------- 1 | # Database 2 | 3 | Kohana comes with a robust module for working with databases. By default, the database module supports drivers for [PDO](https://www.php.net/pdo) and [MySQLi](https://www.php.net/mysqli), but new drivers can be made for other database servers. 4 | 5 | The database module needs to be enabled before you can use it. To enable, open your `application/bootstrap.php` file and modify the call to [Kohana::modules] by including the database module like so: 6 | 7 | Kohana::modules([ 8 | // ... 9 | 'database' => MODPATH . 'database', 10 | // ... 11 | ]); 12 | 13 | Next, you will then need to [configure](config) the database module to connect to your database. 14 | 15 | Once that is done then you can make [queries](query) and use the [results](results). 16 | 17 | The database module also provides a [config driver](../../guide-api/Config_Database) (for storing [configuration](../kohana/files/config) in the database) and a [session driver](../../guide-api/Session_Database). 18 | -------------------------------------------------------------------------------- /system/classes/Kohana/HTTP/Exception/405.php: -------------------------------------------------------------------------------- 1 | headers('allow', $methods); 22 | 23 | return $this; 24 | } 25 | 26 | /** 27 | * Validate this exception contains everything needed to continue. 28 | * 29 | * @throws Kohana_Exception 30 | * @return bool 31 | */ 32 | public function check() 33 | { 34 | if ($this->headers('allow') === null) 35 | throw new Kohana_Exception('A list of allowed methods must be specified'); 36 | 37 | return true; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /modules/image/tests/kohana/ImageTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('The GD extension is not available.'); 18 | } 19 | } 20 | 21 | /** 22 | * Tests the Image::save() method for files that don't have extensions 23 | * 24 | * @return void 25 | * @throws Kohana_Exception 26 | */ 27 | public function test_save_without_extension() 28 | { 29 | $image = Image::factory(MODPATH . 'image/tests/test_data/test_image'); 30 | $this->assertTrue($image->save(Kohana::$cache_dir . '/test_image')); 31 | 32 | unlink(Kohana::$cache_dir . '/test_image'); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /system/guide/kohana/mvc/models.md: -------------------------------------------------------------------------------- 1 | # Models 2 | 3 | From Wikipedia: 4 | 5 | > The model manages the behavior and data of the application domain, 6 | > responds to requests for information about its state (usually from the view), 7 | > and responds to instructions to change state (usually from the controller). 8 | 9 | Creating a simple model: 10 | 11 | class Model_Post extends Model 12 | { 13 | public function do_stuff() 14 | { 15 | // This is where you do domain logic... 16 | } 17 | } 18 | 19 | If you want database access, have your model extend the Model_Database class: 20 | 21 | class Model_Post extends Model_Database 22 | { 23 | public function do_stuff() 24 | { 25 | // This is where you do domain logic... 26 | } 27 | 28 | public function get_stuff() 29 | { 30 | // Get stuff from the database: 31 | return $this->db->query(...); 32 | } 33 | } 34 | 35 | If you want CRUD/ORM capabilities, see the [ORM Module](../../guide/orm) -------------------------------------------------------------------------------- /modules/codebench/classes/Bench/ExplodeLimit.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | class Bench_ExplodeLimit extends Codebench 9 | { 10 | public $description = 'Having a look at the effect of adding a limit to the explode function.
11 | https://stackoverflow.com/questions/1308149/how-to-get-a-part-of-url-between-4th-and-5th-slashes'; 12 | public $loops = 10000; 13 | public $subjects = [ 14 | 'http://example.com/articles/123a/view', 15 | 'http://example.com/articles/123a/view/x/x/x/x/x', 16 | 'http://example.com/articles/123a/view/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x/x', 17 | ]; 18 | 19 | public function bench_explode_without_limit($subject) 20 | { 21 | $parts = explode('/', $subject); 22 | return $parts[4]; 23 | } 24 | 25 | public function bench_explode_with_limit($subject) 26 | { 27 | $parts = explode('/', $subject, 6); 28 | return $parts[4]; 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /system/guide/kohana/debugging.md: -------------------------------------------------------------------------------- 1 | # Debugging 2 | 3 | Kohana includes several tools to help you debug your application. 4 | 5 | The most basic of these is [Debug::vars]. This simple method will display any number of variables, similar to [var_export](https://www.php.net/var_export) or [print_r](https://www.php.net/print_r), but using HTML for extra formatting. 6 | 7 | // Display a dump of the $foo and $bar variables 8 | echo Debug::vars($foo, $bar); 9 | 10 | Kohana also provides a method to show the source code of a particular file using [Debug::source]. 11 | 12 | // Display this line of source code 13 | echo Debug::source(__FILE__, __LINE__); 14 | 15 | If you want to display information about your application files without exposing the installation directory, you can use [Debug::path]: 16 | 17 | // Displays "APPPATH/cache" rather than the real path 18 | echo Debug::path(APPPATH.'cache'); 19 | 20 | If you are having trouble getting something to work correctly, you could check your Kohana logs and your webserver logs, as well as using a debugging tool like [Xdebug](http://www.xdebug.org/). -------------------------------------------------------------------------------- /system/utf8/strspn.php: -------------------------------------------------------------------------------- 1 | headers('www-authenticate'); 19 | 20 | $this->headers('www-authenticate', $challenge); 21 | 22 | return $this; 23 | } 24 | 25 | /** 26 | * Validate this exception contains everything needed to continue. 27 | * 28 | * @throws Kohana_Exception 29 | * @return bool 30 | */ 31 | public function check() 32 | { 33 | if ($this->headers('www-authenticate') === null) 34 | throw new Kohana_Exception('A \'www-authenticate\' header must be specified for a HTTP 401 Unauthorized'); 35 | 36 | return true; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /modules/userguide/classes/Kohana/Kodoc/Missing.php: -------------------------------------------------------------------------------- 1 | true, 7 | // Items to whitelist, only used in cli 8 | 'whitelist' => [ 9 | // Should the app be whitelisted? 10 | // Useful if you just want to test your application 11 | 'app' => true, 12 | // Set to [true] to include all modules, or use an array of module names 13 | // (the keys of the array passed to Kohana::modules() in the bootstrap) 14 | // Or set to "false" to exclude all modules 15 | 'modules' => [true], 16 | // If you don't want the Kohana code coverage reports to pollute your app's, 17 | // then set this to false 18 | 'system' => true, 19 | ], 20 | // Does what it says on the tin 21 | // Blacklisted files won't be included in code coverage reports 22 | // If you use a whitelist then the blacklist will be ignored 23 | 'use_blacklist' => false, 24 | // List of individual files/folders to blacklist 25 | 'blacklist' => [ 26 | ], 27 | ]; 28 | -------------------------------------------------------------------------------- /system/classes/Kohana/HTTP/Exception/305.php: -------------------------------------------------------------------------------- 1 | headers('Location'); 19 | 20 | $this->headers('Location', $uri); 21 | 22 | return $this; 23 | } 24 | 25 | /** 26 | * Validate this exception contains everything needed to continue. 27 | * 28 | * @throws Kohana_Exception 29 | * @return bool 30 | */ 31 | public function check() 32 | { 33 | if (($location = $this->headers('location')) === null) 34 | throw new Kohana_Exception('A \'location\' must be specified for a redirect'); 35 | 36 | if (strpos($location, '://') === false) 37 | throw new Kohana_Exception('An absolute URI to the proxy server must be specified'); 38 | 39 | return true; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "kilofox/kohana", 3 | "type": "project", 4 | "description": "The Kohana PHP framework", 5 | "keywords": ["framework", "kohana"], 6 | "homepage": "https://kohana.top", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Kohana Team", 11 | "homepage": "https://kohanaframework.org" 12 | }, 13 | { 14 | "name": "Kohana Group", 15 | "homepage": "https://kohana.top/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.6,<7.2", 20 | "ext-ctype": "*", 21 | "ext-curl": "*", 22 | "ext-dom": "*", 23 | "ext-fileinfo": "*", 24 | "ext-gd": "*", 25 | "ext-iconv": "*", 26 | "ext-json": "*", 27 | "ext-libxml": "*", 28 | "ext-mbstring": "*", 29 | "ext-mysqli": "*", 30 | "ext-openssl": "*", 31 | "ext-pdo": "*", 32 | "ext-simplexml": "*" 33 | }, 34 | "require-dev": { 35 | "ext-apcu": "*", 36 | "ext-imagick": "*", 37 | "ext-memcached": "*", 38 | "phpunit/phpunit": "^5.7", 39 | "phpunit/phpunit-dom-assertions": "^0.1.0" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /modules/auth/guide/auth/config.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | The default configuration file is located in `MODPATH/auth/config/auth.php`. You should copy this file to `APPPATH/config/auth.php` and make changes there, in keeping with the [cascading filesystem](../kohana/files). 4 | 5 | [Config merging](../kohana/config#config-merging) allows these default configuration settings to apply if you don't overwrite them in your application configuration file. 6 | 7 | | Name | Type | Default | Description | 8 | |--------------|----------|---------------------|---------------------------------------------------------| 9 | | driver | `string` | file | The name of the auth driver to use. | 10 | | hash_method | `string` | sha256 | The hashing function to use on the passwords. | 11 | | hash_key | `string` | null | The key to use when hashing the password. | 12 | | session_type | `string` | [Session::$default] | The type of session to use when storing the auth user. | 13 | | session_key | `string` | auth_user | The name of the session variable used to save the user. | 14 | -------------------------------------------------------------------------------- /modules/cache/classes/Kohana/Cache/Arithmetic.php: -------------------------------------------------------------------------------- 1 | auto_render === true) { 32 | // Load the template 33 | $this->template = View::factory($this->template); 34 | } 35 | } 36 | 37 | /** 38 | * Assigns the template [View] as the request response. 39 | */ 40 | public function after() 41 | { 42 | if ($this->auto_render === true) { 43 | $this->response->body($this->template->render()); 44 | } 45 | 46 | parent::after(); 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /modules/userguide/media/guide/css/print.css: -------------------------------------------------------------------------------- 1 | 2 | /* Smaller font for printing */ 3 | body { 4 | font:14px/1.5 Helvetica,Arial; 5 | } 6 | 7 | /* Show link urls, imitating markdown syntax */ 8 | a:link, a:visited { text-decoration:none; } 9 | a:link:before, a:visited:before { content:"["; } 10 | a:link:after, a:visited:after { content:"](" attr(href) ")"; } 11 | 12 | /* Hide things like navigation, header links, etc. */ 13 | #kodoc-header, 14 | #kodoc-nav, 15 | #kodoc-menu, 16 | #kodoc-page-toc, 17 | .syntaxhighlighter .toolbar, 18 | h1 a.permalink, 19 | h2 a.permalink, 20 | h3 a.permalink, 21 | h4 a.permalink, 22 | h5 a.permalink, 23 | h6 a.permalink 24 | { display:none; } 25 | 26 | pre { 27 | padding:1em; 28 | border:1px dashed #999; 29 | } 30 | 31 | table { 32 | border-left: 1px solid #999; 33 | border-top: 1px solid #999; 34 | } 35 | 36 | table td, table th { 37 | padding:0.4em 0.8em; 38 | border-right: 1px solid #999; 39 | border-bottom: 1px solid #999; 40 | } 41 | 42 | /* syntax highlighter tables inside pre cause problems */ 43 | pre table, pre table td, pre table th { 44 | padding:0; 45 | border:none; 46 | } 47 | 48 | p.note { padding:1em; border: 1px solid black; } 49 | 50 | p.note:before { content:"Note: "; font-weight:bold; } -------------------------------------------------------------------------------- /modules/userguide/guide/userguide/config.md: -------------------------------------------------------------------------------- 1 | # Configuration 2 | 3 | The userguide has the following config options, available in `config/userguide.php`. 4 | 5 | return [ 6 | // Enable the API browser. true or false 7 | 'api_browser' => true, 8 | // Enable these packages in the API browser. true for all packages, or a string of comma seperated packages, using 'None' for a class with no @package 9 | // Example: 'api_packages' => 'Kohana,Kohana/Database,Kohana/ORM,None', 10 | 'api_packages' => true, 11 | ]; 12 | 13 | You can enable or disable the entire API browser, or limit it to only show certain packages. To disable a module from showing pages in the userguide, simply change that module's `enabled` option within the `application/config/userguide.php` file. For example: 14 | 15 | return [ 16 | 'modules' => [ 17 | 'kohana' => [ 18 | 'enabled' => false, 19 | ], 20 | 'database' => [ 21 | 'enabled' => false, 22 | ] 23 | ] 24 | ] 25 | 26 | Using this you could make the userguide only show your modules and classes in the API browser, if you wanted to host your own documentation on your site. Feel free to change the styles and views as well, but be sure to give credit where credit is due! -------------------------------------------------------------------------------- /system/classes/Kohana/Session/Cookie.php: -------------------------------------------------------------------------------- 1 | _name); 22 | } 23 | 24 | /** 25 | * @return null 26 | */ 27 | protected function _regenerate() 28 | { 29 | // Cookie sessions have no id 30 | return null; 31 | } 32 | 33 | /** 34 | * @return bool 35 | * @throws Kohana_Exception 36 | */ 37 | protected function _write() 38 | { 39 | return Cookie::set($this->_name, $this->__toString(), $this->_lifetime); 40 | } 41 | 42 | /** 43 | * @return bool 44 | */ 45 | protected function _restart() 46 | { 47 | return true; 48 | } 49 | 50 | /** 51 | * @return bool 52 | */ 53 | protected function _destroy() 54 | { 55 | return Cookie::delete($this->_name); 56 | } 57 | 58 | } 59 | -------------------------------------------------------------------------------- /modules/userguide/init.php: -------------------------------------------------------------------------------- 1 | )', ['file' => '.+']) 5 | ->defaults([ 6 | 'controller' => 'Userguide', 7 | 'action' => 'media', 8 | 'file' => null, 9 | ]); 10 | 11 | // API Browser, if enabled 12 | if (Kohana::$config->load('userguide.api_browser') === true) { 13 | Route::set('docs/api', 'guide-api(/)', ['class' => '[a-zA-Z0-9_]+']) 14 | ->defaults([ 15 | 'controller' => 'Userguide', 16 | 'action' => 'api', 17 | 'class' => null, 18 | ]); 19 | } 20 | 21 | // User guide pages, in modules 22 | Route::set('docs/guide', 'guide(/(/))', ['page' => '.+']) 23 | ->defaults([ 24 | 'controller' => 'Userguide', 25 | 'action' => 'docs', 26 | 'module' => '', 27 | ]); 28 | 29 | // Simple autoloader used to encourage PHPUnit to behave itself. 30 | class Markdown_Autoloader 31 | { 32 | public static function autoload($class) 33 | { 34 | if ($class === 'Markdown_Parser' || $class === 'MarkdownExtra_Parser') { 35 | include_once Kohana::find_file('vendor', 'markdown/markdown'); 36 | } 37 | } 38 | 39 | } 40 | 41 | // Register the autoloader 42 | spl_autoload_register(['Markdown_Autoloader', 'autoload']); 43 | -------------------------------------------------------------------------------- /modules/image/guide/image/index.md: -------------------------------------------------------------------------------- 1 | # Image 2 | 3 | Kohana 3.x provides a simple yet powerful image manipulation module. The [Image] module provides features that allows your application to resize images, crop, rotate, flip and many more. 4 | 5 | ## Drivers 6 | 7 | [Image] module ships with [Image_GD] driver which requires `GD` extension enabled in your PHP installation, and 8 | [Image_Imagick] driver which requires the `imagick` PHP extension. Additional drivers can be created by extending 9 | the [Image] class. 10 | 11 | The [Image_GD] driver is the default. You can change this by providing an `image.default_driver` configuration option 12 | - for example: 13 | 14 | ~~~ 15 | // application/config/image.php 16 | 'Imagick' 19 | ]; 20 | ~~~ 21 | 22 | [!!] Older versions of Kohana allowed you to configure the driver with the `Image::$default_driver` static variable in 23 | the bootstrap, an extension class, or elsewhere. That variable is now deprecated and will be ignored if you set a 24 | config value. 25 | 26 | ## Getting Started 27 | 28 | Before using the image module, we must enable it first on `APPPATH/bootstrap.php`: 29 | 30 | ~~~ 31 | Kohana::modules([ 32 | // ... 33 | 'image' => MODPATH . 'image', // Image manipulation 34 | // ... 35 | ]); 36 | ~~~ 37 | 38 | Next: [Using the image module](using). 39 | -------------------------------------------------------------------------------- /system/guide/kohana/security/deploying.md: -------------------------------------------------------------------------------- 1 | Changes that should happen when you deploy. (Production) 2 | 3 | ## Setting up a production environment 4 | 5 | There are a few things you'll want to do with your application before moving into production. 6 | 7 | 1. See the [Bootstrap page](bootstrap) in the docs. 8 | This covers most of the global settings that would change between environments. 9 | As a general rule, you should enable caching and disable profiling ([Kohana::init] settings) for production sites. 10 | [Route::cache] can also help if you have a lot of routes. 11 | 2. Turn on APC or some kind of opcode caching. 12 | This is the single easiest performance boost you can make to PHP itself. The more complex your application, the bigger the benefit of using opcode caching. 13 | 14 | /** 15 | * Set the environment string by the domain (defaults to Kohana::DEVELOPMENT). 16 | */ 17 | Kohana::$environment = $_SERVER['SERVER_NAME'] !== 'localhost' ? Kohana::PRODUCTION : Kohana::DEVELOPMENT; 18 | /** 19 | * Initialise Kohana based on environment 20 | */ 21 | Kohana::init([ 22 | 'base_url' => '/', 23 | 'index_file' => false, 24 | 'profile' => Kohana::$environment !== Kohana::PRODUCTION, 25 | 'caching' => Kohana::$environment === Kohana::PRODUCTION, 26 | ]); 27 | -------------------------------------------------------------------------------- /modules/database/classes/Kohana/Database/Result/Cached.php: -------------------------------------------------------------------------------- 1 | _total_rows = count($result); 20 | } 21 | 22 | public function __destruct() 23 | { 24 | // Cached results do not use resources 25 | } 26 | 27 | public function cached() 28 | { 29 | return $this; 30 | } 31 | 32 | public function seek($offset) 33 | { 34 | if ($this->offsetExists($offset)) { 35 | $this->_current_row = $offset; 36 | 37 | return true; 38 | } else { 39 | return false; 40 | } 41 | } 42 | 43 | public function current() 44 | { 45 | // Return an array of the row 46 | return $this->valid() ? $this->_result[$this->_current_row] : null; 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /system/messages/validation.php: -------------------------------------------------------------------------------- 1 | ':field must contain only letters', 5 | 'alpha_dash' => ':field must contain only numbers, letters and dashes', 6 | 'alpha_numeric' => ':field must contain only letters and numbers', 7 | 'color' => ':field must be a color', 8 | 'credit_card' => ':field must be a credit card number', 9 | 'date' => ':field must be a date', 10 | 'decimal' => ':field must be a decimal with :param2 places', 11 | 'digit' => ':field must be a digit', 12 | 'email' => ':field must be an email address', 13 | 'email_domain' => ':field must contain a valid email domain', 14 | 'equals' => ':field must equal :param2', 15 | 'exact_length' => ':field must be exactly :param2 characters long', 16 | 'in_array' => ':field must be one of the available options', 17 | 'ip' => ':field must be an ip address', 18 | 'matches' => ':field must be the same as :param3', 19 | 'min_length' => ':field must be at least :param2 characters long', 20 | 'max_length' => ':field must not exceed :param2 characters long', 21 | 'not_empty' => ':field must not be empty', 22 | 'numeric' => ':field must be numeric', 23 | 'phone' => ':field must be a phone number', 24 | 'range' => ':field must be within the range of :param2 to :param3', 25 | 'regex' => ':field does not match the required format', 26 | 'url' => ':field must be a url', 27 | ]; 28 | -------------------------------------------------------------------------------- /modules/userguide/config/userguide.php: -------------------------------------------------------------------------------- 1 | true, 6 | // Enable these packages in the API browser. true for all packages, or a string of comma seperated packages, using 'None' for a class with no @package 7 | // Example: 'api_packages' => 'Kohana,Kohana/Database,Kohana/ORM,None', 8 | 'api_packages' => true, 9 | // Enables Disqus comments on the API and User Guide pages 10 | 'show_comments' => Kohana::$environment === Kohana::PRODUCTION, 11 | // Leave this alone 12 | 'modules' => [ 13 | // This should be the path to this module's userguide pages, without the 'guide/'. Ex: '/guide/modulename/' would be 'modulename' 14 | 'userguide' => [ 15 | // Whether this module's userguide pages should be shown 16 | 'enabled' => true, 17 | // The name that should show up on the userguide index page 18 | 'name' => 'Userguide', 19 | // A short description of this module, shown on the index page 20 | 'description' => 'Documentation viewer and api generation.', 21 | // Copyright message, shown in the footer for this module 22 | 'copyright' => '© 2008–2014 Kohana Team', 23 | ] 24 | ], 25 | // Set transparent class name segments 26 | 'transparent_prefixes' => [ 27 | 'Kohana' => true, 28 | ] 29 | ]; 30 | -------------------------------------------------------------------------------- /system/guide/kohana/security/xss.md: -------------------------------------------------------------------------------- 1 | # Cross-Site Scripting (XSS) Security 2 | 3 | *This page is not comprehensive and should not be considered a complete guide to XSS prevention.* 4 | 5 | The first step to preventing [XSS](https://wikipedia.org/wiki/Cross-Site_Scripting) attacks is knowing when you need to protect yourself. XSS can only be triggered when it is displayed within HTML content, sometimes via a form input or being displayed from database results. Any global variable that contains client information can be tainted. This includes `$_GET`, `$_POST`, and `$_COOKIE` data. 6 | 7 | ## Prevention 8 | 9 | There are a few simple rules to follow to guard your application HTML against XSS. If you do not want HTML in a variable, use [strip_tags](https://www.php.net/strip_tags) to remove all unwanted HTML tags from a value. 10 | 11 | [!!] If you allow users to submit HTML to your application, it is highly recommended to use an HTML cleaning tool such as [HTML Purifier](http://htmlpurifier.org/) or [HTML Tidy](https://www.php.net/tidy). 12 | 13 | The second is to always escape data when inserting into HTML. The [HTML] class provides generators for many common tags, including script and stylesheet links, anchors, images, and email (mailto) links. Any untrusted content should be escaped using [HTML::chars]. 14 | 15 | ## References 16 | 17 | * [OWASP XSS Cheat Sheet](http://www.owasp.org/index.php/XSS_(Cross_Site_Scripting)_Prevention_Cheat_Sheet) -------------------------------------------------------------------------------- /system/config/credit_cards.php: -------------------------------------------------------------------------------- 1 | [ 13 | 'length' => '13,14,15,16,17,18,19', 14 | 'prefix' => '', 15 | 'luhn' => true, 16 | ], 17 | 'american express' => [ 18 | 'length' => '15', 19 | 'prefix' => '3[47]', 20 | 'luhn' => true, 21 | ], 22 | 'diners club' => [ 23 | 'length' => '14,16', 24 | 'prefix' => '36|55|30[0-5]', 25 | 'luhn' => true, 26 | ], 27 | 'discover' => [ 28 | 'length' => '16', 29 | 'prefix' => '6(?:5|011)', 30 | 'luhn' => true, 31 | ], 32 | 'jcb' => [ 33 | 'length' => '15,16', 34 | 'prefix' => '3|1800|2131', 35 | 'luhn' => true, 36 | ], 37 | 'maestro' => [ 38 | 'length' => '16,18', 39 | 'prefix' => '50(?:20|38)|6(?:304|759)', 40 | 'luhn' => true, 41 | ], 42 | 'mastercard' => [ 43 | 'length' => '16', 44 | 'prefix' => '5[1-5]', 45 | 'luhn' => true, 46 | ], 47 | 'visa' => [ 48 | 'length' => '13,16', 49 | 'prefix' => '4', 50 | 'luhn' => true, 51 | ], 52 | ]; 53 | -------------------------------------------------------------------------------- /modules/auth/guide/auth/login.md: -------------------------------------------------------------------------------- 1 | # Log in and out 2 | 3 | The auth module provides methods to help you log users in and out of your application. 4 | 5 | ## Log in 6 | 7 | The [Auth::login] method handles the login. 8 | 9 | ~~~ 10 | // Handled from a form with inputs with names email / password 11 | $post = $this->request->post(); 12 | $success = Auth::instance()->login($post['email'], $post['password']); 13 | 14 | if ($success) { 15 | // Login successful, send to app 16 | } else { 17 | // Login failed, send back to form with error message 18 | } 19 | ~~~ 20 | 21 | ## Logged in User 22 | 23 | There are two ways to check if a user is logged in. If you just need to check if the user is logged in use [Auth::logged_in]. 24 | 25 | ~~~ 26 | if (Auth::instance()->logged_in()) { 27 | // User is logged in, continue on 28 | } else { 29 | // User isn't logged in, redirect to the login form. 30 | } 31 | ~~~ 32 | 33 | You can also get the logged-in user object by using [Auth::get_user]. If the user is null, then no user was found. 34 | 35 | ~~~ 36 | $user = Auth::instance()->get_user(); 37 | 38 | // Check for a user (null if not user is found) 39 | if ($user !== null) { 40 | // User is found, continue on 41 | } else { 42 | // User was not found, redirect to the login form 43 | } 44 | ~~~ 45 | 46 | ## Log out 47 | 48 | The [Auth::logout] method will take care of logging out a user. 49 | 50 | ~~~ 51 | Auth::instance()->logout(); 52 | // Redirect the user back to login page 53 | ~~~ 54 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | 3 | on: 4 | push: 5 | branches: [ 3.4 ] 6 | pull_request: 7 | branches: [ 3.4 ] 8 | 9 | jobs: 10 | build: 11 | name: PHP ${{ matrix.php-versions }} 12 | runs-on: ubuntu-latest 13 | 14 | strategy: 15 | matrix: 16 | php-versions: ['5.6', '7.0', '7.1'] 17 | 18 | services: 19 | memcached: 20 | image: memcached:1.6-alpine 21 | ports: 22 | - 11211:11211 23 | 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v3 27 | 28 | - name: Setup PHP with composer and extensions 29 | uses: shivammathur/setup-php@v2 30 | with: 31 | php-version: ${{ matrix.php-versions }} 32 | tools: composer 33 | extensions: mcrypt, memcached 34 | 35 | - name: Get composer cache directory 36 | id: composer-cache 37 | run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT 38 | 39 | - name: Cache dependencies 40 | uses: actions/cache@v3 41 | with: 42 | path: ${{ steps.composer-cache.outputs.dir }} 43 | key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} 44 | restore-keys: | 45 | ${{ runner.os }}-composer- 46 | 47 | - name: Install dependencies 48 | run: composer install --prefer-dist --no-progress 49 | 50 | - name: Run test suite 51 | run: vendor/bin/phpunit --bootstrap=modules/unittest/bootstrap_all_modules.php modules/unittest/tests.php 52 | -------------------------------------------------------------------------------- /system/classes/Kohana/HTTP/Exception/Redirect.php: -------------------------------------------------------------------------------- 1 | headers('Location'); 27 | 28 | if (strpos($uri, '://') === false) { 29 | // Make the URI into a URL 30 | $uri = URL::site($uri, true, !empty(Kohana::$index_file)); 31 | } 32 | 33 | $this->headers('Location', $uri); 34 | 35 | return $this; 36 | } 37 | 38 | /** 39 | * Validate this exception contains everything needed to continue. 40 | * 41 | * @throws Kohana_Exception 42 | * @return bool 43 | */ 44 | public function check() 45 | { 46 | if ($this->headers('location') === null) 47 | throw new Kohana_Exception('A \'location\' must be specified for a redirect'); 48 | 49 | return true; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /modules/codebench/classes/Bench/MDDoIncludeViews.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | class Bench_MDDoIncludeViews extends Codebench 9 | { 10 | public $description = 'Optimization for the doIncludeViews() method of Kohana_Kodoc_Markdown 11 | for the Kohana Userguide.'; 12 | public $loops = 10000; 13 | public $subjects = [ 14 | // Valid matches 15 | '{{one}} two {{three}}', 16 | '{{userguide/examples/hello_world_error}}', 17 | // Invalid matches 18 | '{}', 19 | '{{}}', 20 | '{{userguide/examples/hello_world_error}', 21 | '{{userguide/examples/hello_world_error }}', 22 | '{{userguide/examples/{{hello_world_error }}', 23 | ]; 24 | 25 | public function bench_original($subject) 26 | { 27 | preg_match_all('/{{(\S+?)}}/m', $subject, $matches, PREG_SET_ORDER); 28 | return $matches; 29 | } 30 | 31 | public function bench_possessive($subject) 32 | { 33 | // Using a possessive character class 34 | // Removed useless /m modifier 35 | preg_match_all('/{{([^\s{}]++)}}/', $subject, $matches, PREG_SET_ORDER); 36 | return $matches; 37 | } 38 | 39 | public function bench_lookaround($subject) 40 | { 41 | // Using lookaround to move $matches[1] into $matches[0] 42 | preg_match_all('/(?<={{)[^\s{}]++(?=}})/', $subject, $matches, PREG_SET_ORDER); 43 | return $matches; 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /system/guide/kohana/menu.md: -------------------------------------------------------------------------------- 1 | ## [Kohana]() 2 | 3 | - [Installation](install) 4 | - Getting Started 5 | - [Conventions and Style](conventions) 6 | - [Model View Controller](mvc) 7 | - [Controllers](mvc/controllers) 8 | - [Models](mvc/models) 9 | - [Views](mvc/views) 10 | - [Cascading Filesystem](files) 11 | - [Class Files](files/classes) 12 | - [Config Files](files/config) 13 | - [Translation Files](files/i18n) 14 | - [Message Files](files/messages) 15 | - [Configuration](config) 16 | - [Request Flow](flow) 17 | - [Bootstrap](bootstrap) 18 | - [Modules](modules) 19 | - [Routing](routing) 20 | - [Error Handling](errors) 21 | - [Tips & Common Mistakes](tips) 22 | - [Upgrading from 3.3](upgrading) 23 | - Basic Usage 24 | - [Debugging](debugging) 25 | - [Loading Classes](autoloading) 26 | - [Transparent Extension](extension) 27 | - [Helpers](helpers) 28 | - [Requests](requests) 29 | - [Sessions](sessions) 30 | - [Cookies](cookies) 31 | - [Fragments](fragments) 32 | - [Profiling](profiling) 33 | - [Security](security) 34 | - [XSS](security/xss) 35 | - [Validation](security/validation) 36 | - [Cookies](security/cookies) 37 | - [Database](security/database) 38 | - [Encryption](security/encryption) 39 | - [Deploying](security/deploying) 40 | - Tutorials 41 | - [Hello World](tutorials/hello-world) 42 | - [Simple MVC](tutorials/simple-mvc) 43 | - [Custom Error Pages](tutorials/error-pages) 44 | - [Clean URLs](tutorials/clean-urls) 45 | - [Kohana as a Library](tutorials/library-kohana) 46 | -------------------------------------------------------------------------------- /modules/codebench/classes/Bench/UserFuncArray.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | class Bench_UserFuncArray extends Codebench 9 | { 10 | public $description = 'Testing the speed difference of using call_user_func_array 11 | compared to counting args and doing manual calls.'; 12 | public $loops = 100000; 13 | public $subjects = [ 14 | // Argument sets 15 | [], 16 | ['one'], 17 | ['one', 'two'], 18 | ['one', 'two', 'three'], 19 | ]; 20 | 21 | public function bench_count_args($args) 22 | { 23 | $name = 'callme'; 24 | switch (count($args)) { 25 | case 1: 26 | $this->$name($args[0]); 27 | break; 28 | case 2: 29 | $this->$name($args[0], $args[1]); 30 | break; 31 | case 3: 32 | $this->$name($args[0], $args[1], $args[2]); 33 | break; 34 | case 4: 35 | $this->$name($args[0], $args[1], $args[2], $args[3]); 36 | break; 37 | default: 38 | call_user_func_array([$this, $name], $args); 39 | break; 40 | } 41 | } 42 | 43 | public function bench_direct_call($args) 44 | { 45 | $name = 'callme'; 46 | call_user_func_array([$this, $name], $args); 47 | } 48 | 49 | protected function callme() 50 | { 51 | return count(func_get_args()); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /modules/orm/guide/orm/index.md: -------------------------------------------------------------------------------- 1 | # ORM 2 | 3 | Kohana 3.x includes a powerful Object Relational Mapping (ORM) module that uses the active record pattern and database introspection to determine a model's column information. ORM is integrated tightly with the [Validation] library. 4 | 5 | The ORM allows for manipulation and control of data within a database as though it was a PHP object. Once you define the relationships ORM allows you to pull data from your database, manipulate the data in any way you like, and then save the result back to the database without the use of SQL. By creating relationships between models that follow convention over configuration, much of the repetition of writing queries to create, read, update, and delete information from the database can be reduced or entirely removed. All the relationships can be handled automatically by the ORM library, and you can access related data as standard object properties. 6 | 7 | ORM is included with the Kohana 3.x installation but needs to be enabled before you can use it. In your `application/bootstrap.php` file modify the call to Kohana::modules and include the ORM modules. 8 | 9 | ## Getting started 10 | 11 | Before we use ORM, we must enable the modules required 12 | 13 | Kohana::modules([ 14 | // ... 15 | 'database' => MODPATH . 'database', 16 | 'orm' => MODPATH . 'orm', 17 | // ... 18 | ]); 19 | 20 | [!!] The database module is required for the ORM module to work. Of course the database module has to be configured to use an existing database. 21 | 22 | You can now create your [models](models) and [use ORM](using). 23 | -------------------------------------------------------------------------------- /system/guide/kohana/flow.md: -------------------------------------------------------------------------------- 1 | # Request Flow 2 | 3 | Every application follows the same flow: 4 | 5 | 1. Application starts from `index.php`. 6 | 1. The application, module, and system paths are set. (`APPPATH`, `MODPATH`, and `SYSPATH`) 7 | 2. Error reporting levels are set. 8 | 3. Install file is loaded, if it exists. 9 | 4. The bootstrap file, `APPPATH/bootstrap.php`, is included. 10 | 2. Once we are in `bootstrap.php`: 11 | 1. The [Kohana] class is loaded. 12 | 2. [Kohana::init] is called, which sets up error handling, caching, and logging. 13 | 3. [Kohana_Config] readers and [Kohana_Log] writers are attached. 14 | 4. [Kohana::modules] is called to enable additional modules. 15 | * Module paths are added to the [cascading filesystem](files). 16 | * Includes each module's `init.php` file, if it exists. 17 | * The `init.php` file can perform additional environment setup, including adding routes. 18 | 5. [Route::set] is called multiple times to define the [application routes](routing). 19 | 6. [Request::factory] is called to start processing the request. 20 | 1. Checks each route that has been set until a match is found. 21 | 2. Creates the controller instance and passes the request to it. 22 | 3. Calls the [Controller::before] method. 23 | 4. Calls the controller action, which generates the request response. 24 | 5. Calls the [Controller::after] method. 25 | * The above 5 steps can be repeated multiple times when using [HMVC sub-requests](requests). 26 | 3. Application flow returns to index.php 27 | 1. The main [Request] response is displayed 28 | -------------------------------------------------------------------------------- /modules/userguide/media/guide/css/api.css: -------------------------------------------------------------------------------- 1 | /* Api browser stuff */ 2 | 3 | /* api index page */ 4 | div.class-list div.class { width: 50%; } 5 | div.class-list div.class.left { float: left; clear: both; } 6 | div.class-list div.class.right { float: right; } 7 | div.class-list div.class h2 { background:none; } 8 | 9 | /* table of contents at the top of each class */ 10 | div.toc { } 11 | div.toc div {float:left; width: 33%;} 12 | div.toc div h3 {margin-top:0; background:none; } 13 | 14 | 15 | /* constants */ 16 | div.constants dl dt {font-weight:bold; margin-bottom:1.5em;} 17 | div.constants dl dd {margin-left:1.5em; margin-bottom:1.5em;} 18 | 19 | /* properties */ 20 | div.properties dl dt { font-weight:bold; margin-top:1.5em; margin-bottom:1.5em;} 21 | div.properties dl dt small, div.properties dl dt code { font-weight:normal; font-size:0.9em; } 22 | div.properties dl dd {margin-left:1.5em; margin-bottom:1.5em;} 23 | 24 | /* functions */ 25 | 26 | div.method { padding:0 1.5em; border:1px solid #c8cfaf; border-radius:5px; margin-bottom:1.5em; } 27 | div.method h3 { background:none; margin-top:0; margin-left:-1em; margin-right:-1em; padding:.75em 0 .75em 1.17em; background:#e8efcf; border-top-left-radius:5px; border-top-right-radius:5px; } 28 | div.method h3 .param { font-weight: normal; cursor: help; border-bottom:1px dashed #666;} 29 | div.method h3 abbr.param { text-transform: none; font-size: 1em; } 30 | 31 | dl.tags { overflow: auto; background: #e8efcf; padding: 1em; border: solid 6px #d8dfbf; margin-bottom:1.5em; } 32 | dl.tags dt { margin: 0; clear: both; float: left; width: 25%; } 33 | dl.tags dd { margin: 0; padding: 0; clear: right; float: right; } 34 | 35 | -------------------------------------------------------------------------------- /system/guide/kohana/upgrading.md: -------------------------------------------------------------------------------- 1 | # Upgrading from 3.3 to 3.4 2 | 3 | ## Requirements 4 | 5 | Kohana 3.4 supports PHP versions 5.6, 7.0, and 7.1. Compatibility with other PHP versions has not been fully tested, and 6 | certain features may not function as expected. 7 | 8 | ## Changes 9 | 10 | - The global EXT constant has been deprecated. Explicitly specify `.php` or another file extension instead. 11 | 12 | ### Auth 13 | 14 | - The `Auth::hash_password()` method has been removed. Use `Auth::hash()` instead. 15 | 16 | ### Cache 17 | 18 | - Added a new `Memcached` driver. 19 | - The `APC` driver was deprecated. Use `APCu` or other drivers instead. 20 | - The `Memcache` driver was deprecated. Use `Memcached` or other drivers instead. 21 | - The `MemcacheTag` driver was deprecated. 22 | 23 | ### Core 24 | 25 | - The `Kohana::CODENAME` constant was deprecated. 26 | 27 | ### Database 28 | 29 | - The `MySQL` driver has been removed. Use `PDO` or other drivers instead. 30 | 31 | ### Encrypt 32 | 33 | - Now `Encrypt` acts as an interface and a new `OpenSSL` driver for it was added. 34 | - The `Mcrypt` driver was deprecated. Use `OpenSSL` instead. 35 | 36 | ### Security 37 | 38 | - The `Security::strip_image_tags()` method has been removed 39 | for [security reasons](https://github.com/kohana/kohana/issues/107) as it is not reliable to parse and sanitize HTML 40 | with regular expressions. You should either encode HTML tags entirely, e.g. with `HTML::chars()`, or use a more robust 41 | HTML filtering solution such as [HTML Purifier](http://htmlpurifier.org). 42 | 43 | ### Validation 44 | 45 | - The `Validation::as_array()` method has been removed. Use `Validation::data()` instead. 46 | -------------------------------------------------------------------------------- /modules/codebench/classes/Bench/ArrCallback.php: -------------------------------------------------------------------------------- 1 | 7 | */ 8 | class Bench_ArrCallback extends Codebench 9 | { 10 | public $description = 'Parsing command(param,param) strings in Arr::callback().'; 11 | public $loops = 10000; 12 | public $subjects = [ 13 | // Valid callback strings 14 | 'foo', 15 | 'foo::bar', 16 | 'foo(apple,orange)', 17 | 'foo::bar(apple,orange)', 18 | '(apple,orange)', // no command, only params 19 | 'foo((apple),(orange))', // params with brackets inside 20 | // Invalid callback strings 21 | 'foo[apple,orange', // no closing bracket 22 | ]; 23 | 24 | public function bench_geert_regex_1($subject) 25 | { 26 | if (preg_match('/^([^(]*+)\((.*)\)$/', $subject, $matches)) 27 | return $matches; 28 | 29 | return []; 30 | } 31 | 32 | public function bench_geert_regex_2($subject) 33 | { 34 | // A rather experimental approach using \K which requires PCRE 7.2 ~ PHP 5.2.4 35 | // Note: $matches[0] = params, $matches[1] = command 36 | if (preg_match('/^([^(]*+)\(\K.*(?=\)$)/', $subject, $matches)) 37 | return $matches; 38 | 39 | return []; 40 | } 41 | 42 | public function bench_geert_str($subject) 43 | { 44 | // A native string function approach which beats all the regexes 45 | if (strpos($subject, '(') !== false && substr($subject, -1) === ')') 46 | return explode('(', substr($subject, 0, -1), 2); 47 | 48 | return []; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /system/classes/Kohana/Config/File/Reader.php: -------------------------------------------------------------------------------- 1 | _directory = trim($directory, '/'); 30 | } 31 | 32 | /** 33 | * Load and merge all the configuration files in this group. 34 | * 35 | * $config->load($name); 36 | * 37 | * @param string $group Configuration group name 38 | * @return array 39 | * @uses Kohana::load 40 | */ 41 | public function load($group) 42 | { 43 | $config = []; 44 | 45 | if ($files = Kohana::find_file($this->_directory, $group, null, true)) { 46 | foreach ($files as $file) { 47 | // Merge each file to the configuration array 48 | $config = Arr::merge($config, Kohana::load($file)); 49 | } 50 | } 51 | 52 | return $config; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /system/classes/Kohana/Log/Syslog.php: -------------------------------------------------------------------------------- 1 | _ident = $ident; 31 | 32 | // Open the connection to syslog 33 | openlog($this->_ident, LOG_CONS, $facility); 34 | } 35 | 36 | /** 37 | * Writes each of the messages into the syslog. 38 | * 39 | * @param array $messages 40 | * @return void 41 | */ 42 | public function write(array $messages) 43 | { 44 | foreach ($messages as $message) { 45 | syslog($message['level'], $message['body']); 46 | 47 | if (isset($message['additional']['exception'])) { 48 | syslog(Log_Writer::$strace_level, $message['additional']['exception']->getTraceAsString()); 49 | } 50 | } 51 | } 52 | 53 | /** 54 | * Closes the syslog connection 55 | * 56 | * @return void 57 | */ 58 | public function __destruct() 59 | { 60 | // Close connection to syslog 61 | closelog(); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /modules/cache/tests/cache/WincacheTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('Wincache PHP Extension is not available'); 42 | } 43 | 44 | $this->cache(Cache::instance('wincache')); 45 | } 46 | 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /modules/minion/classes/Kohana/Minion/Exception.php: -------------------------------------------------------------------------------- 1 | format_for_cli(); 32 | } else { 33 | echo Kohana_Exception::text($e); 34 | } 35 | 36 | $exit_code = $e->getCode(); 37 | 38 | // Never exit "0" after an exception. 39 | if ($exit_code === 0) { 40 | $exit_code = 1; 41 | } 42 | 43 | exit($exit_code); 44 | } catch (Exception $e) { 45 | // Clean the output buffer if one exists 46 | ob_get_level() and ob_clean(); 47 | 48 | // Display the exception text 49 | echo Kohana_Exception::text($e), "\n"; 50 | 51 | // Exit with an error status 52 | exit(1); 53 | } 54 | } 55 | 56 | public function format_for_cli() 57 | { 58 | return Kohana_Exception::text($this); 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /modules/cache/tests/cache/SqliteTest.php: -------------------------------------------------------------------------------- 1 | markTestSkipped('SQLite PDO PHP Extension is not available'); 36 | } 37 | 38 | if (!Kohana::$config->load('cache.sqlite')) { 39 | Kohana::$config->load('cache') 40 | ->set('sqlite', [ 41 | 'driver' => 'sqlite', 42 | 'default_expire' => 3600, 43 | 'database' => 'memory', 44 | 'schema' => 'CREATE TABLE caches(id VARCHAR(127) PRIMARY KEY, tags VARCHAR(255), expiration INTEGER, cache TEXT)', 45 | ] 46 | ); 47 | } 48 | 49 | $this->cache(Cache::instance('sqlite')); 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /modules/database/classes/Kohana/Model/Database.php: -------------------------------------------------------------------------------- 1 | _db = $db; 50 | } elseif (!$this->_db) { 51 | // Use the default name 52 | $this->_db = Database::$default; 53 | } 54 | 55 | if (is_string($this->_db)) { 56 | // Load the database 57 | $this->_db = Database::instance($this->_db); 58 | } 59 | } 60 | 61 | } 62 | -------------------------------------------------------------------------------- /modules/userguide/vendor/markdown/License.text: -------------------------------------------------------------------------------- 1 | PHP Markdown & Extra 2 | Copyright (c) 2004-2008 Michel Fortin 3 | 4 | All rights reserved. 5 | 6 | Based on Markdown 7 | Copyright (c) 2003-2006 John Gruber 8 | 9 | All rights reserved. 10 | 11 | Redistribution and use in source and binary forms, with or without 12 | modification, are permitted provided that the following conditions are 13 | met: 14 | 15 | * Redistributions of source code must retain the above copyright notice, 16 | this list of conditions and the following disclaimer. 17 | 18 | * Redistributions in binary form must reproduce the above copyright 19 | notice, this list of conditions and the following disclaimer in the 20 | documentation and/or other materials provided with the distribution. 21 | 22 | * Neither the name "Markdown" nor the names of its contributors may 23 | be used to endorse or promote products derived from this software 24 | without specific prior written permission. 25 | 26 | This software is provided by the copyright holders and contributors "as 27 | is" and any express or implied warranties, including, but not limited 28 | to, the implied warranties of merchantability and fitness for a 29 | particular purpose are disclaimed. In no event shall the copyright owner 30 | or contributors be liable for any direct, indirect, incidental, special, 31 | exemplary, or consequential damages (including, but not limited to, 32 | procurement of substitute goods or services; loss of use, data, or 33 | profits; or business interruption) however caused and on any theory of 34 | liability, whether in contract, strict liability, or tort (including 35 | negligence or otherwise) arising in any way out of the use of this 36 | software, even if advised of the possibility of such damage. 37 | -------------------------------------------------------------------------------- /modules/orm/auth-schema-postgresql.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE roles 2 | ( 3 | id serial, 4 | "name" varchar(32) NOT NULL, 5 | description text NOT NULL, 6 | CONSTRAINT roles_id_pkey PRIMARY KEY (id), 7 | CONSTRAINT roles_name_key UNIQUE (name) 8 | ); 9 | 10 | CREATE TABLE roles_users 11 | ( 12 | user_id integer, 13 | role_id integer 14 | ); 15 | 16 | CREATE TABLE users 17 | ( 18 | id serial, 19 | email varchar(254) NOT NULL, 20 | username varchar(32) NOT NULL, 21 | "password" varchar(64) NOT NULL, 22 | logins integer NOT NULL DEFAULT 0, 23 | last_login integer, 24 | CONSTRAINT users_id_pkey PRIMARY KEY (id), 25 | CONSTRAINT users_username_key UNIQUE (username), 26 | CONSTRAINT users_email_key UNIQUE (email), 27 | CONSTRAINT users_logins_check CHECK (logins >= 0) 28 | ); 29 | 30 | CREATE TABLE user_tokens 31 | ( 32 | id serial, 33 | user_id integer NOT NULL, 34 | user_agent varchar(40) NOT NULL, 35 | token character varying(32) NOT NULL, 36 | created integer NOT NULL, 37 | expires integer NOT NULL, 38 | CONSTRAINT user_tokens_id_pkey PRIMARY KEY (id), 39 | CONSTRAINT user_tokens_token_key UNIQUE (token) 40 | ); 41 | 42 | CREATE INDEX user_id_idx ON roles_users (user_id); 43 | CREATE INDEX role_id_idx ON roles_users (role_id); 44 | 45 | ALTER TABLE roles_users 46 | ADD CONSTRAINT user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE, 47 | ADD CONSTRAINT role_id_fkey FOREIGN KEY (role_id) REFERENCES roles(id) ON DELETE CASCADE; 48 | 49 | ALTER TABLE user_tokens 50 | ADD CONSTRAINT user_id_fkey FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE; 51 | 52 | INSERT INTO roles (name, description) VALUES ('login', 'Login privileges, granted after account confirmation'); 53 | INSERT INTO roles (name, description) VALUES ('admin', 'Administrative user, has access to everything.'); 54 | -------------------------------------------------------------------------------- /system/classes/Kohana/HTTP/Request.php: -------------------------------------------------------------------------------- 1 | 10 | * @copyright (c) 2018 Kohana Group 11 | * @license https://kohana.top/license 12 | */ 13 | class Kohana_CacheArithmeticMemcachedTest extends Kohana_CacheArithmeticMethodsTest 14 | { 15 | /** 16 | * This method MUST be implemented by each driver to set up the `Cache` 17 | * instance for each test. 18 | * 19 | * This method should do the following tasks for each driver test: 20 | * 21 | * - Test the Cache instance driver is available, skip test otherwise 22 | * - Set up the Cache instance 23 | * - Call the parent setup method, `parent::setUp()` 24 | * 25 | * @return void 26 | * @throws Cache_Exception 27 | * @throws Kohana_Exception 28 | */ 29 | public function setUp() 30 | { 31 | parent::setUp(); 32 | 33 | if (!extension_loaded('memcached')) { 34 | $this->markTestSkipped('Memcached PHP Extension is not available'); 35 | } 36 | 37 | if (!Kohana::$config->load('cache.memcached')) { 38 | Kohana::$config->load('cache')->set('memcached', [ 39 | 'driver' => 'memcached', 40 | 'default_expire' => 3600, 41 | 'servers' => [ 42 | 'local' => [ 43 | 'host' => 'localhost', 44 | 'port' => 11211, 45 | 'weight' => 1, 46 | ], 47 | ] 48 | ]); 49 | Kohana::$config->load('cache.memcached'); 50 | } 51 | 52 | $this->cache(Cache::instance('memcached')); 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /modules/userguide/guide/userguide/works.md: -------------------------------------------------------------------------------- 1 | # How the Userguide works 2 | 3 | The userguide uses [Markdown](markdown) for the documentation. Both the userguide pages, and the in code comments for the API browser are written in markdown. 4 | 5 | ## Userguide pages 6 | 7 | Userguide pages are in the module they apply to, in `guide/`. For example, documentation for Kohana is in `system/guide/kohana` and documentation for orm is in `modules/orm/guide/orm`, database is in `modules/database/guide/database`, etc. 8 | 9 | Each module has an index page at `guide//index.md`. 10 | 11 | Each module's menu is at `guide//menu.md`. 12 | 13 | All other pages are in `guide/` and can be organized in subfolders and named however you want. 14 | 15 | For more info on how to make your module have userguide pages, see [Adding your module](adding). 16 | 17 | ### Images 18 | 19 | Any images used in the userguide pages must be in `media/guide//`. For example, if a page has `![Image Title](hello-world.jpg)` the image would be located at `media/guide//hello-world.jpg`. Images for the ORM module are in `modules/orm/media/guide/orm`, and images for the Kohana docs are in `system/media/guide/kohana`. 20 | 21 | ### API browser 22 | 23 | The API browser is generated from the actual source code. The descriptions for classes, constants, properties, and methods is extracted from the comments and parsed in Markdown. For example if you look in the comment for [Kohana_Core::init](https://github.com/kohana/core/blob/c443c44922ef13421f4a/classes/kohana/core.php#L5) you can see a Markdown list and table. These are parsed and show correctly in the API browser. `@param`, `@uses`, `@throws`, `@returns` and other tags are parsed as well. 24 | 25 | TODO: give more specific details on how to comment your classes, constants, methods, etc. including package and how it relates to the api module. 26 | -------------------------------------------------------------------------------- /system/guide/kohana/files/i18n.md: -------------------------------------------------------------------------------- 1 | # I18n 2 | 3 | Kohana has a fairly simple and easy-to-use i18n system. It is slightly modeled after gettext but is not as feature-rich. If you need the features of gettext, please use that :) 4 | 5 | ## __() 6 | 7 | Kohana has a __() function to do your translations for you. This function is only meant for small sections of text, not entire paragraphs or pages of translated text. 8 | 9 | To echo a translated string: 10 | 11 | 12 | 13 | This will echo 'Home' unless you've changed the defined language, which is explained below. 14 | 15 | ## Changing the displayed language 16 | 17 | Use the I18n::lang() method to change the displayed language: 18 | 19 | I18n::lang('fr'); 20 | 21 | This will change the language to 'es-es'. 22 | 23 | ## Defining language files 24 | 25 | To define the language file for the above language change, create a `i18n/fr.php` that contains: 26 | 27 | 'Bonjour, monde!', 31 | ]; 32 | 33 | Now when you do `__('Hello, world!')`, you will get `Bonjour, monde!` 34 | 35 | ## I18n variables 36 | 37 | You can define variables in your __() calls like so: 38 | 39 | echo __('Hello, :user', [':user' => $username]); 40 | 41 | Your i18n key in your translation file will need to be defined as: 42 | 43 | 'Bonjour, :user', 47 | ]; 48 | 49 | ## Defining your own __() function 50 | 51 | You can define your own __() function by simply defining your own i18n class: 52 | 53 | $pad_type, 49 | ]); 50 | } 51 | -------------------------------------------------------------------------------- /modules/minion/miniond: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # This script is similar to minion but will do a few additional things: 4 | # - PHP process is run in the background 5 | # - PHP process is monitored and restarted if it exits for any reason 6 | # - Added handlers for SUGHUP, SIGINT, and SIGTERM 7 | # 8 | # This is meant for long running minion tasks (like background workers). 9 | # Shutting down the minion tasks is done by sending a SIGINT or SIGTERM signal 10 | # to this miniond process. You can also restart the minion task by sending a 11 | # SUGHUP signal to this process. It's useful to restart all your workers when 12 | # deploying new code so that the workers reload their code as well. 13 | # You cannot use this script for tasks that require user input because of the 14 | # PHP process running in the background. 15 | # 16 | # Usage: ./miniond [task:name] [--option1=optval1 --option2=optval2] 17 | # 18 | # And so on. 19 | # 20 | 21 | # Define some functions 22 | function start_daemon() 23 | { 24 | echo "Starting" 25 | ./minion $ARGS & # This assumes miniond is sitting next to minion 26 | pid=$! # Store pid (globally) for later use.. 27 | } 28 | 29 | function stop_daemon() 30 | { 31 | kill -TERM $pid 32 | wait $pid # Wait for the task to exit and store the exit code 33 | ecode=$? # Store exit code (globally) for later use.. 34 | } 35 | 36 | function handle_SIGHUP() 37 | { 38 | echo "Restarting" 39 | stop_daemon 40 | start_daemon 41 | } 42 | 43 | function handle_SIGTERM_SIGINT() 44 | { 45 | echo "Shutting Down" 46 | stop_daemon 47 | exit $ecode 48 | } 49 | 50 | # Register signal handlers 51 | trap handle_SIGHUP SIGHUP 52 | trap handle_SIGTERM_SIGINT SIGTERM SIGINT 53 | 54 | ARGS=$@ 55 | 56 | start_daemon 57 | 58 | while : 59 | do 60 | # Pauses the script until $pid is dead 61 | wait $pid 62 | 63 | # Make sure someone didn't start it back up already (SIGHUP handler does this) 64 | if ! kill -0 $pid > /dev/null 2>&1 65 | then 66 | start_daemon 67 | fi 68 | done --------------------------------------------------------------------------------