├── app ├── Filters │ └── .gitkeep ├── Helpers │ └── .gitkeep ├── Language │ ├── .gitkeep │ └── en │ │ └── Validation.php ├── Libraries │ └── .gitkeep ├── Models │ └── .gitkeep ├── ThirdParty │ └── .gitkeep ├── Database │ ├── Seeds │ │ └── .gitkeep │ └── Migrations │ │ └── .gitkeep ├── .htaccess ├── Views │ └── errors │ │ ├── cli │ │ ├── error_404.php │ │ └── production.php │ │ └── html │ │ └── production.php ├── index.html ├── Controllers │ ├── Home.php │ └── BaseController.php ├── Config │ ├── ForeignCharacters.php │ ├── Images.php │ ├── Honeypot.php │ ├── Boot │ │ ├── production.php │ │ ├── testing.php │ │ └── development.php │ ├── Services.php │ ├── Validation.php │ ├── Pager.php │ ├── Filters.php │ ├── View.php │ ├── Exceptions.php │ ├── Modules.php │ ├── Events.php │ ├── Kint.php │ └── Migrations.php └── Common.php ├── writable ├── debugbar │ └── .gitkeep ├── .htaccess ├── cache │ └── index.html ├── logs │ └── index.html ├── session │ └── index.html └── uploads │ └── index.html ├── tests ├── _support │ ├── HTTP │ │ └── Files │ │ │ ├── tmp │ │ │ ├── fileA.txt │ │ │ ├── fileB.txt │ │ │ ├── fileC.csv │ │ │ ├── fileD.zip │ │ │ └── fileE.zip.rar │ │ │ └── CookiesHolder.txt │ ├── View │ │ ├── Views │ │ │ ├── simpler.php │ │ │ ├── simple.php │ │ │ └── simples.php │ │ ├── SampleClassWithInitController.php │ │ └── SampleClass.php │ ├── Helpers │ │ └── baguette_helper.php │ ├── Autoloader │ │ └── UnnamespacedClass.php │ ├── Widgets │ │ ├── NopeWidget.php │ │ ├── OtherWidget.php │ │ └── SomeWidget.php │ ├── Images │ │ ├── ci-logo.gif │ │ ├── ci-logo.jpeg │ │ ├── ci-logo.png │ │ ├── ci-logo.webp │ │ ├── Steveston_dusk.JPG │ │ └── EXIFsamples │ │ │ ├── landscape_0.jpg │ │ │ ├── landscape_1.jpg │ │ │ ├── landscape_2.jpg │ │ │ ├── landscape_3.jpg │ │ │ ├── landscape_4.jpg │ │ │ ├── landscape_5.jpg │ │ │ ├── landscape_6.jpg │ │ │ ├── landscape_7.jpg │ │ │ ├── landscape_8.jpg │ │ │ ├── portrait_0.jpg │ │ │ ├── portrait_1.jpg │ │ │ ├── portrait_2.jpg │ │ │ ├── portrait_3.jpg │ │ │ ├── portrait_4.jpg │ │ │ ├── portrait_5.jpg │ │ │ ├── portrait_6.jpg │ │ │ ├── portrait_7.jpg │ │ │ └── portrait_8.jpg │ ├── Validation │ │ ├── uploads │ │ │ └── phpUxc0ty │ │ └── TestRules.php │ ├── Language │ │ ├── ru │ │ │ └── Language.php │ │ ├── ab │ │ │ └── Allin.php │ │ ├── en │ │ │ ├── Nested.php │ │ │ ├── Allin.php │ │ │ ├── More.php │ │ │ ├── Foo.php │ │ │ ├── Language.php │ │ │ └── Core.php │ │ ├── en-ZZ │ │ │ └── More.php │ │ ├── ab-CD │ │ │ └── Allin.php │ │ └── SecondMockLanguage.php │ ├── Config │ │ ├── Filters.php │ │ ├── Routes.php │ │ ├── BadRegistrar.php │ │ ├── TestRegistrar.php │ │ └── Services.php │ ├── Controllers │ │ ├── Hello.php │ │ └── Popcorn.php │ ├── Files │ │ ├── able │ │ │ ├── apple.php │ │ │ ├── fig_3.php │ │ │ └── prune_ripe.php │ │ └── baker │ │ │ └── banana.php │ ├── SomeEntity.php │ ├── Models │ │ ├── StringifyPkeyModel.php │ │ ├── SimpleEntity.php │ │ ├── WithoutAutoIncrementModel.php │ │ ├── SecondaryModel.php │ │ ├── JobModel.php │ │ ├── EntityModel.php │ │ ├── UserModel.php │ │ ├── ValidErrorsModel.php │ │ ├── FabricatorModel.php │ │ └── ValidModel.php │ ├── RESTful │ │ ├── Worker.php │ │ └── Worker2.php │ ├── Commands │ │ ├── Foobar.php │ │ ├── AbstractInfo.php │ │ ├── ParamsReveal.php │ │ ├── InvalidCommand.php │ │ ├── AppInfo.php │ │ ├── LanguageCommand.php │ │ └── Unsuffixable.php │ ├── Database │ │ └── Seeds │ │ │ └── AnotherSeeder.php │ ├── MigrationTestMigrations │ │ └── Database │ │ │ └── Migrations │ │ │ ├── 2018-01-24-102301_Some_migration.php │ │ │ ├── 2018-01-24-102300_Another_migration.py │ │ │ └── 2018-01-24-102302_Another_migration.php │ ├── Filters │ │ └── Customfilter.php │ ├── Log │ │ └── Handlers │ │ │ └── TestHandler.php │ └── Services.php └── .htaccess ├── public ├── robots.txt ├── favicon.ico └── index.php ├── system ├── Validation │ ├── Views │ │ ├── single.php │ │ └── list.php │ └── Exceptions │ │ └── ValidationException.php ├── .htaccess ├── ThirdParty │ ├── PSR │ │ └── Log │ │ │ ├── InvalidArgumentException.php │ │ │ ├── LoggerAwareInterface.php │ │ │ ├── LogLevel.php │ │ │ ├── LoggerAwareTrait.php │ │ │ └── NullLogger.php │ ├── Kint │ │ ├── resources │ │ │ └── compiled │ │ │ │ ├── plain.css │ │ │ │ ├── plain.js │ │ │ │ ├── shared.js │ │ │ │ └── microtime.js │ │ ├── Renderer │ │ │ ├── Rich │ │ │ │ ├── PluginInterface.php │ │ │ │ ├── ObjectPluginInterface.php │ │ │ │ ├── TabPluginInterface.php │ │ │ │ ├── BlacklistPlugin.php │ │ │ │ ├── RecursionPlugin.php │ │ │ │ └── DepthLimitPlugin.php │ │ │ └── Text │ │ │ │ └── Plugin.php │ │ └── Object │ │ │ └── TraceObject.php │ └── Escaper │ │ └── Exception │ │ ├── ExceptionInterface.php │ │ ├── RuntimeException.php │ │ └── InvalidArgumentException.php ├── Commands │ ├── Generators │ │ └── Views │ │ │ ├── config.tpl.php │ │ │ ├── validation.tpl.php │ │ │ ├── seeder.tpl.php │ │ │ ├── entity.tpl.php │ │ │ ├── migration.tpl.php │ │ │ ├── filter.tpl.php │ │ │ ├── model.tpl.php │ │ │ └── command.tpl.php │ ├── Server │ │ └── rewrite.php │ └── Housekeeping │ │ └── ClearDebugbar.php ├── index.html ├── Debug │ └── Toolbar │ │ ├── Views │ │ ├── _files.tpl │ │ ├── _database.tpl │ │ ├── _events.tpl │ │ ├── _logs.tpl │ │ ├── _history.tpl │ │ ├── _config.tpl │ │ └── _routes.tpl │ │ └── Collectors │ │ └── Config.php ├── Language │ └── en │ │ ├── Log.php │ │ ├── RESTful.php │ │ ├── Files.php │ │ ├── Filters.php │ │ ├── Security.php │ │ ├── Fabricator.php │ │ ├── Router.php │ │ ├── Format.php │ │ ├── Cache.php │ │ ├── Number.php │ │ ├── Cast.php │ │ ├── Encryption.php │ │ ├── View.php │ │ ├── Pager.php │ │ ├── Core.php │ │ ├── Session.php │ │ ├── Cookie.php │ │ ├── Time.php │ │ └── Database.php ├── Test │ ├── Mock │ │ ├── MockQuery.php │ │ ├── MockCodeIgniter.php │ │ ├── MockSecurityConfig.php │ │ ├── MockSecurity.php │ │ ├── MockAutoload.php │ │ ├── MockBuilder.php │ │ ├── MockIncomingRequest.php │ │ ├── MockResourceController.php │ │ ├── MockTable.php │ │ ├── MockResourcePresenter.php │ │ ├── MockEvents.php │ │ ├── MockResponse.php │ │ ├── MockCommon.php │ │ ├── MockEmail.php │ │ ├── MockFileLogger.php │ │ ├── MockServices.php │ │ ├── MockCLIConfig.php │ │ ├── MockAppConfig.php │ │ └── MockCURLRequest.php │ ├── Filters │ │ └── CITestStreamFilter.php │ └── FeatureTestCase.php ├── Exceptions │ ├── EmergencyError.php │ ├── AlertError.php │ ├── CriticalError.php │ ├── ExceptionInterface.php │ ├── ConfigException.php │ ├── ModelException.php │ ├── DebugTraceableTrait.php │ ├── CastException.php │ ├── PageNotFoundException.php │ ├── DownloadException.php │ └── FrameworkException.php ├── Database │ ├── Exceptions │ │ ├── DatabaseException.php │ │ └── ExceptionInterface.php │ ├── SQLite3 │ │ └── Utils.php │ ├── SQLSRV │ │ └── Utils.php │ ├── MySQLi │ │ ├── Utils.php │ │ └── Builder.php │ ├── Postgre │ │ └── Utils.php │ └── ModelFactory.php ├── Router │ └── Exceptions │ │ ├── RedirectException.php │ │ └── RouterException.php ├── Cache │ ├── Exceptions │ │ ├── ExceptionInterface.php │ │ └── CacheException.php │ └── Handlers │ │ └── BaseHandler.php ├── Format │ ├── FormatterInterface.php │ └── JSONFormatter.php ├── Log │ ├── Exceptions │ │ └── LogException.php │ └── Handlers │ │ └── HandlerInterface.php ├── Pager │ ├── Views │ │ ├── default_simple.php │ │ ├── default_head.php │ │ └── default_full.php │ └── Exceptions │ │ └── PagerException.php ├── Files │ └── Exceptions │ │ ├── FileNotFoundException.php │ │ └── FileException.php ├── Security │ └── Exceptions │ │ └── SecurityException.php ├── CLI │ └── Exceptions │ │ └── CLIException.php ├── Honeypot │ └── Exceptions │ │ └── HoneypotException.php ├── Helpers │ ├── test_helper.php │ ├── xml_helper.php │ └── security_helper.php ├── Modules │ └── Modules.php ├── Config │ ├── Factory.php │ ├── Config.php │ └── Routes.php ├── Filters │ ├── Exceptions │ │ └── FilterException.php │ ├── Honeypot.php │ └── DebugToolbar.php ├── Encryption │ └── EncrypterInterface.php ├── View │ └── Exceptions │ │ └── ViewException.php ├── Session │ └── Exceptions │ │ └── SessionException.php └── Throttle │ └── ThrottlerInterface.php ├── LICENSE └── composer.json /app/Filters/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Language/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Libraries/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/ThirdParty/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Database/Seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /writable/debugbar/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Database/Migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileA.txt: -------------------------------------------------------------------------------- 1 | text -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/CookiesHolder.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileB.txt: -------------------------------------------------------------------------------- 1 | more text -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileC.csv: -------------------------------------------------------------------------------- 1 | separated;"text" -------------------------------------------------------------------------------- /tests/_support/View/Views/simpler.php: -------------------------------------------------------------------------------- 1 |

{testString}

-------------------------------------------------------------------------------- /tests/_support/View/Views/simple.php: -------------------------------------------------------------------------------- 1 |

-------------------------------------------------------------------------------- /tests/_support/Helpers/baguette_helper.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /system/Validation/Views/single.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/public/favicon.ico -------------------------------------------------------------------------------- /tests/_support/Autoloader/UnnamespacedClass.php: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /app/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /app/Language/en/Validation.php: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_0.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_1.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_2.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_3.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_4.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_5.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_6.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_7.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/landscape_8.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_0.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_1.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_2.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_3.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_4.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_5.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_6.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_7.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/natanfelles/CodeIgniter4/develop/tests/_support/Images/EXIFsamples/portrait_8.jpg -------------------------------------------------------------------------------- /app/Views/errors/cli/error_404.php: -------------------------------------------------------------------------------- 1 | 'Whatever this would be, translated', 5 | ]; 6 | -------------------------------------------------------------------------------- /writable/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /system/ThirdParty/PSR/Log/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | aliases['test-customfilter'] = \Tests\Support\Filters\Customfilter::class; 5 | -------------------------------------------------------------------------------- /tests/_support/Language/ab/Allin.php: -------------------------------------------------------------------------------- 1 | 'gluttony', 5 | 'tre' => 'greed', 6 | 'six' => 'envy', 7 | 'sev' => 'pride', 8 | ]; 9 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Nested.php: -------------------------------------------------------------------------------- 1 | [ 5 | 'b' => [ 6 | 'c' => [ 7 | 'd' => 'e', 8 | ], 9 | ], 10 | ], 11 | ]; 12 | -------------------------------------------------------------------------------- /app/Views/errors/cli/production.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /system/Commands/Generators/Views/config.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\Config\BaseConfig; 6 | 7 | class {class} extends BaseConfig 8 | { 9 | // 10 | } 11 | -------------------------------------------------------------------------------- /system/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/_support/Widgets/SomeWidget.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /writable/logs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /app/Controllers/Home.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /writable/uploads/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /system/Commands/Generators/Views/validation.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | class {class} 6 | { 7 | // public function custom_rule(): bool 8 | // { 9 | // return true; 10 | // } 11 | } 12 | -------------------------------------------------------------------------------- /app/Config/ForeignCharacters.php: -------------------------------------------------------------------------------- 1 | 'These are not the droids you are looking for', 4 | 'notaMoon' => "It's made of cheese", 5 | 'wisdom' => 'There is no try', 6 | ]; 7 | -------------------------------------------------------------------------------- /tests/_support/Controllers/Hello.php: -------------------------------------------------------------------------------- 1 | add('testing', 'TestController::index', ['as' => 'testing-index']); 6 | -------------------------------------------------------------------------------- /tests/_support/Files/able/apple.php: -------------------------------------------------------------------------------- 1 | 'four calling birds', 5 | 'fiv' => 'five golden rings', 6 | 'six' => 'six geese a laying', 7 | 'sev' => 'seven swans a swimming', 8 | ]; 9 | -------------------------------------------------------------------------------- /tests/_support/Files/able/prune_ripe.php: -------------------------------------------------------------------------------- 1 | null, 11 | 'bar' => null, 12 | ]; 13 | 14 | } 15 | -------------------------------------------------------------------------------- /tests/_support/Language/ab-CD/Allin.php: -------------------------------------------------------------------------------- 1 | 'Pyramid of Giza', 5 | 'tre' => 'Colossus of Rhodes', 6 | 'fiv' => 'Temple of Artemis', 7 | 'sev' => 'Hanging Gardens of Babylon', 8 | ]; 9 | -------------------------------------------------------------------------------- /tests/_support/Language/en/More.php: -------------------------------------------------------------------------------- 1 | 'These are not the droids you are looking for', 5 | 'notaMoon' => "That's no moon... it's a space station", 6 | 'cannotMove' => 'I have a very bad feeling about this', 7 | ]; 8 | -------------------------------------------------------------------------------- /tests/_support/Models/StringifyPkeyModel.php: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /tests/_support/RESTful/Worker.php: -------------------------------------------------------------------------------- 1 | 'The command will use this as foo.', 8 | 'bar' => 'The command will use this as bar.', 9 | 'baz' => 'The baz is here.', 10 | 'bas' => CLI::color('bas', 'green') . (new App())->baseURL, 11 | ]; 12 | -------------------------------------------------------------------------------- /tests/_support/Validation/TestRules.php: -------------------------------------------------------------------------------- 1 | 'Foo Bar Translated', 5 | 'bar.min_length1' => 'The {field} field is very short.', 6 | 'bar.min_length2' => 'Supplied value ({value}) for {field} must have at least {param} characters.', 7 | 'baz' => [ 8 | 'min_length3.short' => 'The {field} field is very short.', 9 | ], 10 | ]; 11 | -------------------------------------------------------------------------------- /system/ThirdParty/PSR/Log/LoggerAwareInterface.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | {userFiles} 4 | 5 | {name} 6 | {path} 7 | 8 | {/userFiles} 9 | {coreFiles} 10 | 11 | {name} 12 | {path} 13 | 14 | {/coreFiles} 15 | 16 | 17 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_database.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {queries} 10 | 11 | 12 | 13 | 14 | {/queries} 15 | 16 |
TimeQuery String
{duration}{! sql !}
17 | -------------------------------------------------------------------------------- /tests/_support/Models/WithoutAutoIncrementModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Log language settings 13 | return [ 14 | 'invalidLogLevel' => '{0} is an invalid log level.', 15 | ]; 16 | -------------------------------------------------------------------------------- /tests/_support/Database/Seeds/AnotherSeeder.php: -------------------------------------------------------------------------------- 1 | 'Jerome Lohan', 13 | 'email' => 'jlo@lohanenterprises.com', 14 | 'country' => 'UK', 15 | ]; 16 | 17 | $this->db->table('user')->insert($row); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /system/Language/en/RESTful.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // RESTful language settings 13 | return [ 14 | 'notImplemented' => '"{0}" action not implemented.', 15 | ]; 16 | -------------------------------------------------------------------------------- /system/Test/Mock/MockQuery.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Database\Query; 15 | 16 | class MockQuery extends Query 17 | { 18 | } 19 | -------------------------------------------------------------------------------- /tests/_support/Models/SecondaryModel.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Time 5 | Event Name 6 | Times Called 7 | 8 | 9 | 10 | {events} 11 | 12 | { duration } ms 13 | {event} 14 | {count} 15 | 16 | {/events} 17 | 18 | 19 | -------------------------------------------------------------------------------- /system/Language/en/Files.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Files language settings 13 | return [ 14 | 'fileNotFound' => 'File not found: {0}', 15 | 'cannotMove' => 'Could not move file {0} to {1} ({2})', 16 | ]; 17 | -------------------------------------------------------------------------------- /system/ThirdParty/PSR/Log/LoggerAwareTrait.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/_support/Commands/ParamsReveal.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Language system language settings 13 | return [ 14 | 'languageGetLineInvalidArgumentException' => 'Get line must be a string or array of strings.', 15 | ]; 16 | -------------------------------------------------------------------------------- /system/Exceptions/EmergencyError.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use Error; 15 | 16 | /** 17 | * Error: system is unusable 18 | */ 19 | class EmergencyError extends Error 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/Models/EntityModel.php: -------------------------------------------------------------------------------- 1 | [ 16 | 'first', 17 | 'second', 18 | ], 19 | 'format' => 'nice', 20 | 'fruit' => [ 21 | 'apple', 22 | 'banana', 23 | ], 24 | ]; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /system/Exceptions/AlertError.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use Error; 15 | 16 | /** 17 | * Error: Action must be taken immediately (system/db down, etc) 18 | */ 19 | class AlertError extends Error 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_logs.tpl: -------------------------------------------------------------------------------- 1 | { if $logs == [] } 2 |

Nothing was logged. If you were expecting logged items, ensure that LoggerConfig file has the correct threshold set.

3 | { else } 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | {logs} 13 | 14 | 15 | 16 | 17 | {/logs} 18 | 19 |
SeverityMessage
{level}{msg}
20 | { endif } 21 | -------------------------------------------------------------------------------- /system/Exceptions/CriticalError.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use Error; 15 | 16 | /** 17 | * Error: Critical conditions, like component unavailable, etc. 18 | */ 19 | class CriticalError extends Error 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/Models/UserModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Filters language settings 13 | return [ 14 | 'noFilter' => '{0} filter must have a matching alias defined.', 15 | 'incorrectInterface' => '{0} must implement CodeIgniter\Filters\FilterInterface.', 16 | ]; 17 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/resources/compiled/shared.js: -------------------------------------------------------------------------------- 1 | void 0===window.kintShared&&(window.kintShared=function(){"use strict";var e={dedupe:function(e,n){return[].forEach.call(document.querySelectorAll(e),function(e){n&&n.ownerDocument.contains(n)||(n=e),e!==n&&e.parentNode.removeChild(e)}),n},runOnce:function(e){"complete"===document.readyState?e():window.addEventListener("load",e)}};return window.addEventListener("click",function(e){if(e.target.classList.contains("kint-ide-link")){var n=new XMLHttpRequest;n.open("GET",e.target.href),n.send(null),e.preventDefault()}}),e}()); 2 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCodeIgniter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\CodeIgniter; 15 | 16 | class MockCodeIgniter extends CodeIgniter 17 | { 18 | protected function callExit($code) 19 | { 20 | // Do not call exit() in testing. 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /system/ThirdParty/Escaper/Exception/RuntimeException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Security language settings 13 | return [ 14 | 'disallowedAction' => 'The action you requested is not allowed.', 15 | 16 | // @deprecated 17 | 'invalidSameSite' => 'The SameSite value must be None, Lax, Strict, or a blank string. Given: {0}', 18 | ]; 19 | -------------------------------------------------------------------------------- /system/Test/Mock/MockSecurityConfig.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Whoops! 8 | 9 | 12 | 13 | 14 | 15 |
16 | 17 |

Whoops!

18 | 19 |

We seem to have hit a snag. Please try again later...

20 | 21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /system/Language/en/Fabricator.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Fabricator language settings 13 | return [ 14 | 'invalidModel' => 'Invalid model supplied for fabrication.', 15 | 'missingFormatters' => 'No valid formatters defined.', 16 | 'createFailed' => 'Fabricator failed to insert on table {0}: {1}.', 17 | ]; 18 | -------------------------------------------------------------------------------- /system/Language/en/Router.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Router language settings 13 | return [ 14 | 'invalidParameter' => 'A parameter does not match the expected type.', 15 | 'missingDefaultRoute' => 'Unable to determine what should be displayed. A default route has not been specified in the routing file.', 16 | ]; 17 | -------------------------------------------------------------------------------- /system/ThirdParty/Escaper/Exception/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\Exceptions; 13 | 14 | use Error; 15 | 16 | class DatabaseException extends Error implements ExceptionInterface 17 | { 18 | /** 19 | * Exit status code 20 | * 21 | * @var integer 22 | */ 23 | protected $code = 8; 24 | } 25 | -------------------------------------------------------------------------------- /tests/_support/Commands/InvalidCommand.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | /** 15 | * Provides a domain-level interface for broad capture 16 | * of all framework-related exceptions. 17 | * 18 | * catch (\CodeIgniter\Exceptions\ExceptionInterface) { ... } 19 | */ 20 | 21 | interface ExceptionInterface 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /system/Router/Exceptions/RedirectException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Router\Exceptions; 13 | 14 | use Exception; 15 | 16 | /** 17 | * RedirectException 18 | */ 19 | class RedirectException extends Exception 20 | { 21 | /** 22 | * Status code for redirects 23 | * 24 | * @var integer 25 | */ 26 | protected $code = 302; 27 | } 28 | -------------------------------------------------------------------------------- /system/Cache/Exceptions/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Cache\Exceptions; 13 | 14 | /** 15 | * Provides a domain-level interface for broad capture 16 | * of all framework-related exceptions. 17 | * 18 | * catch (\CodeIgniter\Cache\Exceptions\ExceptionInterface) { ... } 19 | */ 20 | interface ExceptionInterface 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /system/Format/FormatterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Format; 13 | 14 | /** 15 | * Formatter interface 16 | */ 17 | interface FormatterInterface 18 | { 19 | /** 20 | * Takes the given data and formats it. 21 | * 22 | * @param string|array $data 23 | * 24 | * @return mixed 25 | */ 26 | public function format($data); 27 | } 28 | -------------------------------------------------------------------------------- /system/Log/Exceptions/LogException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Log\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | class LogException extends FrameworkException 17 | { 18 | public static function forInvalidLogLevel(string $level) 19 | { 20 | return new static(lang('Log.invalidLogLevel', [$level])); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php: -------------------------------------------------------------------------------- 1 | forge->addField([ 8 | 'key' => [ 9 | 'type' => 'VARCHAR', 10 | 'constraint' => 255, 11 | ], 12 | ]); 13 | $this->forge->createTable('foo', true); 14 | 15 | $this->db->table('foo')->insert([ 16 | 'key' => 'foobar', 17 | ]); 18 | } 19 | 20 | public function down() 21 | { 22 | $this->forge->dropTable('foo', true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /tests/_support/Models/ValidErrorsModel.php: -------------------------------------------------------------------------------- 1 | [ 22 | 'required', 23 | 'min_length[10]', 24 | 'errors' => [ 25 | 'min_length' => 'Minimum Length Error', 26 | ] 27 | ], 28 | 'token' => 'in_list[{id}]', 29 | ]; 30 | } 31 | -------------------------------------------------------------------------------- /system/Test/Mock/MockSecurity.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\HTTP\RequestInterface; 15 | use CodeIgniter\Security\Security; 16 | 17 | class MockSecurity extends Security 18 | { 19 | public function sendCookie(RequestInterface $request) 20 | { 21 | $_COOKIE['csrf_cookie_name'] = $this->hash; 22 | 23 | return $this; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102300_Another_migration.py: -------------------------------------------------------------------------------- 1 | forge->addField([ 8 | 'key' => [ 9 | 'type' => 'VARCHAR', 10 | 'constraint' => 255, 11 | ], 12 | ]); 13 | $this->forge->createTable('foo', true); 14 | 15 | $this->db->table('foo')->insert([ 16 | 'key' => 'foobar', 17 | ]); 18 | } 19 | 20 | public function down() 21 | { 22 | $this->forge->dropTable('foo', true); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /system/Language/en/Format.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Format language settings 13 | return [ 14 | 'invalidFormatter' => '"{0}" is not a valid Formatter class.', 15 | 'invalidJSON' => 'Failed to parse json string, error: "{0}".', 16 | 'invalidMime' => 'No Formatter defined for mime type: "{0}".', 17 | 'missingExtension' => 'The SimpleXML extension is required to format XML.', 18 | ]; 19 | -------------------------------------------------------------------------------- /system/Test/Mock/MockAutoload.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use Config\Autoload; 15 | 16 | class MockAutoload extends Autoload 17 | { 18 | public $psr4 = []; 19 | 20 | public $classmap = []; 21 | 22 | public function __construct() 23 | { 24 | // Don't call the parent since we don't want the default mappings. 25 | // parent::__construct(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /system/Test/Mock/MockBuilder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Database\BaseBuilder; 15 | use CodeIgniter\Database\ConnectionInterface; 16 | 17 | class MockBuilder extends BaseBuilder 18 | { 19 | public function __construct($tableName, ConnectionInterface &$db, array $options = null) 20 | { 21 | parent::__construct($tableName, $db, $options); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /system/Language/en/Cache.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Cache language settings 13 | return [ 14 | 'unableToWrite' => 'Cache unable to write to {0}', 15 | 'invalidHandlers' => 'Cache config must have an array of $validHandlers.', 16 | 'noBackup' => 'Cache config must have a handler and backupHandler set.', 17 | 'handlerNotFound' => 'Cache config has an invalid handler or backup handler specified.', 18 | ]; 19 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Core.php: -------------------------------------------------------------------------------- 1 | '{0} extension could not be found.', 19 | 'bazillion' => 'billions and billions', // adds a new setting 20 | ]; 21 | -------------------------------------------------------------------------------- /system/Database/Exceptions/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\Exceptions; 13 | 14 | /** 15 | * Provides a domain-level interface for broad capture 16 | * of all database-related exceptions. 17 | * 18 | * catch (\CodeIgniter\Database\Exceptions\ExceptionInterface) { ... } 19 | */ 20 | interface ExceptionInterface extends \CodeIgniter\Exceptions\ExceptionInterface 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /tests/_support/Models/FabricatorModel.php: -------------------------------------------------------------------------------- 1 | $faker->ipv4, 28 | 'description' => $faker->words(10), 29 | ]; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /tests/_support/Filters/Customfilter.php: -------------------------------------------------------------------------------- 1 | url = 'http://hellowworld.com'; 15 | 16 | return $request; 17 | } 18 | 19 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) 20 | { 21 | 22 | } 23 | 24 | //-------------------------------------------------------------------- 25 | } -------------------------------------------------------------------------------- /tests/_support/View/SampleClassWithInitController.php: -------------------------------------------------------------------------------- 1 | response = $response; 19 | } 20 | 21 | public function index() 22 | { 23 | return get_class($this->response); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /system/Pager/Views/default_simple.php: -------------------------------------------------------------------------------- 1 | setSurroundCount(0); 9 | ?> 10 | 24 | -------------------------------------------------------------------------------- /tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'type' => 'VARCHAR', 10 | 'constraint' => 255, 11 | ], 12 | ]; 13 | $this->forge->addColumn('foo', $fields); 14 | 15 | $this->db->table('foo')->insert([ 16 | 'key' => 'foobar', 17 | 'value' => 'raboof', 18 | ]); 19 | } 20 | 21 | public function down() 22 | { 23 | if ($this->db->tableExists('foo')) 24 | { 25 | $this->forge->dropColumn('foo', 'value'); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Language/SecondMockLanguage.php: -------------------------------------------------------------------------------- 1 | load($file, $locale, $return); 15 | } 16 | 17 | //-------------------------------------------------------------------- 18 | 19 | /** 20 | * Expose the loaded language files 21 | */ 22 | public function loaded(string $locale = 'en') 23 | { 24 | return $this->loadedFiles[$locale]; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /system/Exceptions/ConfigException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | /** 15 | * Exception for automatic logging. 16 | */ 17 | class ConfigException extends CriticalError 18 | { 19 | use DebugTraceableTrait; 20 | 21 | /** 22 | * Error code 23 | * 24 | * @var integer 25 | */ 26 | protected $code = 3; 27 | 28 | public static function forDisabledMigrations() 29 | { 30 | return new static(lang('Migrations.disabled')); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /system/Test/Mock/MockIncomingRequest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\HTTP\IncomingRequest; 15 | 16 | class MockIncomingRequest extends IncomingRequest 17 | { 18 | // public function populateHeaders() 19 | // { 20 | // // Don't do anything... force the tester to manually set the headers they want. 21 | // } 22 | 23 | public function detectURI($protocol, $baseURL) 24 | { 25 | // Do nothing... 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /system/Test/Mock/MockResourceController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\RESTful\ResourceController; 15 | 16 | class MockResourceController extends ResourceController 17 | { 18 | public function getModel() 19 | { 20 | return $this->model; 21 | } 22 | 23 | public function getModelName() 24 | { 25 | return $this->modelName; 26 | } 27 | 28 | public function getFormat() 29 | { 30 | return $this->format; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /tests/_support/Models/ValidModel.php: -------------------------------------------------------------------------------- 1 | [ 22 | 'required', 23 | 'min_length[3]', 24 | ], 25 | 'token' => 'permit_empty|in_list[{id}]', 26 | ]; 27 | 28 | protected $validationMessages = [ 29 | 'name' => [ 30 | 'required' => 'You forgot to name the baby.', 31 | 'min_length' => 'Too short, man!', 32 | ], 33 | ]; 34 | } 35 | -------------------------------------------------------------------------------- /system/Language/en/Number.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Number language settings 13 | return [ 14 | 'terabyteAbbr' => 'TB', 15 | 'gigabyteAbbr' => 'GB', 16 | 'megabyteAbbr' => 'MB', 17 | 'kilobyteAbbr' => 'KB', 18 | 'bytes' => 'Bytes', 19 | 20 | // don't forget the space in front of these! 21 | 'thousand' => ' thousand', 22 | 'million' => ' million', 23 | 'billion' => ' billion', 24 | 'trillion' => ' trillion', 25 | 'quadrillion' => ' quadrillion', 26 | ]; 27 | -------------------------------------------------------------------------------- /system/Language/en/Cast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Cast language settings 13 | return [ 14 | 'jsonErrorDepth' => 'Maximum stack depth exceeded', 15 | 'jsonErrorStateMismatch' => 'Underflow or the modes mismatch', 16 | 'jsonErrorCtrlChar' => 'Unexpected control character found', 17 | 'jsonErrorSyntax' => 'Syntax error, malformed JSON', 18 | 'jsonErrorUtf8' => 'Malformed UTF-8 characters, possibly incorrectly encoded', 19 | 'jsonErrorUnknown' => 'Unknown error', 20 | ]; 21 | -------------------------------------------------------------------------------- /system/ThirdParty/PSR/Log/NullLogger.php: -------------------------------------------------------------------------------- 1 | logger) { }` 11 | * blocks. 12 | */ 13 | class NullLogger extends AbstractLogger 14 | { 15 | /** 16 | * Logs with an arbitrary level. 17 | * 18 | * @param mixed $level 19 | * @param string $message 20 | * @param array $context 21 | * @return null 22 | */ 23 | public function log($level, $message, array $context = []) 24 | { 25 | // noop 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /system/Exceptions/ModelException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | /** 15 | * Model Exceptions. 16 | */ 17 | 18 | class ModelException extends FrameworkException 19 | { 20 | public static function forNoPrimaryKey(string $modelName) 21 | { 22 | return new static(lang('Database.noPrimaryKey', [$modelName])); 23 | } 24 | 25 | public static function forNoDateFormat(string $modelName) 26 | { 27 | return new static(lang('Database.noDateFormat', [$modelName])); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /system/Files/Exceptions/FileNotFoundException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Files\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\DebugTraceableTrait; 15 | use CodeIgniter\Exceptions\ExceptionInterface; 16 | use RuntimeException; 17 | 18 | class FileNotFoundException extends RuntimeException implements ExceptionInterface 19 | { 20 | use DebugTraceableTrait; 21 | 22 | public static function forFileNotFound(string $path) 23 | { 24 | return new static(lang('Files.fileNotFound', [$path])); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Pager/Views/default_head.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use CodeIgniter\Pager\PagerRenderer; 13 | 14 | /** 15 | * @var PagerRenderer $pager 16 | */ 17 | $pager->setSurroundCount(0); 18 | 19 | if ($pager->hasPrevious()) 20 | { 21 | echo '' . PHP_EOL; 22 | } 23 | 24 | echo '' . PHP_EOL; 25 | 26 | if ($pager->hasNext()) 27 | { 28 | echo '' . PHP_EOL; 29 | } 30 | -------------------------------------------------------------------------------- /system/Language/en/Encryption.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Encryption language settings 13 | return [ 14 | 'noDriverRequested' => 'No driver requested; Miss Daisy will be so upset!', 15 | 'noHandlerAvailable' => 'Unable to find an available {0} encryption handler.', 16 | 'unKnownHandler' => '"{0}" cannot be configured.', 17 | 'starterKeyNeeded' => 'Encrypter needs a starter key.', 18 | 'authenticationFailed' => 'Decrypting: authentication failed.', 19 | 'encryptionFailed' => 'Encryption failed.', 20 | ]; 21 | -------------------------------------------------------------------------------- /system/Language/en/View.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // View language settings 13 | return [ 14 | 'invalidCellMethod' => '{class}::{method} is not a valid method.', 15 | 'missingCellParameters' => '{class}::{method} has no params.', 16 | 'invalidCellParameter' => '{0} is not a valid param name.', 17 | 'noCellClass' => 'No view cell class provided.', 18 | 'invalidCellClass' => 'Unable to locate view cell class: {0}.', 19 | 'tagSyntaxError' => 'You have a syntax error in your Parser tags: {0}', 20 | ]; 21 | -------------------------------------------------------------------------------- /system/Test/Mock/MockTable.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use BadMethodCallException; 15 | use CodeIgniter\View\Table; 16 | 17 | class MockTable extends Table 18 | { 19 | // Override inaccessible protected method 20 | public function __call($method, $params) 21 | { 22 | if (is_callable([$this, '_' . $method])) 23 | { 24 | return call_user_func_array([$this, '_' . $method], $params); 25 | } 26 | 27 | throw new BadMethodCallException('Method ' . $method . ' was not found'); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /system/Language/en/Pager.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Pager language settings 13 | return [ 14 | 'pageNavigation' => 'Page navigation', 15 | 'first' => 'First', 16 | 'previous' => 'Previous', 17 | 'next' => 'Next', 18 | 'last' => 'Last', 19 | 'older' => 'Older', 20 | 'newer' => 'Newer', 21 | 'invalidTemplate' => '{0} is not a valid Pager template.', 22 | 'invalidPaginationGroup' => '{0} is not a valid Pagination group.', 23 | ]; 24 | -------------------------------------------------------------------------------- /system/Test/Mock/MockResourcePresenter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\API\ResponseTrait; 15 | use CodeIgniter\RESTful\ResourcePresenter; 16 | 17 | class MockResourcePresenter extends ResourcePresenter 18 | { 19 | use ResponseTrait; 20 | 21 | public function getModel() 22 | { 23 | return $this->model; 24 | } 25 | 26 | public function getModelName() 27 | { 28 | return $this->modelName; 29 | } 30 | 31 | public function getFormat() 32 | { 33 | return $this->format; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /system/Pager/Exceptions/PagerException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Pager\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | class PagerException extends FrameworkException 17 | { 18 | public static function forInvalidTemplate(string $template = null) 19 | { 20 | return new static(lang('Pager.invalidTemplate', [$template])); 21 | } 22 | 23 | public static function forInvalidPaginationGroup(string $group = null) 24 | { 25 | return new static(lang('Pager.invalidPaginationGroup', [$group])); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/Config/Images.php: -------------------------------------------------------------------------------- 1 | 30 | */ 31 | public $handlers = [ 32 | 'gd' => GDHandler::class, 33 | 'imagick' => ImageMagickHandler::class, 34 | ]; 35 | } 36 | -------------------------------------------------------------------------------- /system/Files/Exceptions/FileException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Files\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\DebugTraceableTrait; 15 | use CodeIgniter\Exceptions\ExceptionInterface; 16 | use RuntimeException; 17 | 18 | class FileException extends RuntimeException implements ExceptionInterface 19 | { 20 | use DebugTraceableTrait; 21 | 22 | public static function forUnableToMove(string $from = null, string $to = null, string $error = null) 23 | { 24 | return new static(lang('Files.cannotMove', [$from, $to, $error])); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Test/Mock/MockEvents.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Events\Events; 15 | 16 | /** 17 | * Events 18 | */ 19 | class MockEvents extends Events 20 | { 21 | public function getListeners() 22 | { 23 | return self::$listeners; 24 | } 25 | 26 | public function getEventsFile() 27 | { 28 | return self::$files; 29 | } 30 | 31 | public function getSimulate() 32 | { 33 | return self::$simulate; 34 | } 35 | 36 | public function unInitialize() 37 | { 38 | static::$initialized = false; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/Config/Honeypot.php: -------------------------------------------------------------------------------- 1 | {label}'; 36 | 37 | /** 38 | * Honeypot container 39 | * 40 | * @var string 41 | */ 42 | public $container = '
{template}
'; 43 | } 44 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_history.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | {files} 15 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | {/files} 27 | 28 |
ActionDatetimeStatusMethodURLContent-TypeIs AJAX?
17 | 18 | {datetime}{status}{method}{url}{contentType}{isAJAX}
29 | -------------------------------------------------------------------------------- /system/Test/Mock/MockResponse.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\HTTP\Response; 15 | 16 | /** 17 | * Class MockResponse 18 | */ 19 | class MockResponse extends Response 20 | { 21 | /** 22 | * If true, will not write output. Useful during testing. 23 | * 24 | * @var boolean 25 | */ 26 | protected $pretend = true; 27 | 28 | // for testing 29 | public function getPretend() 30 | { 31 | return $this->pretend; 32 | } 33 | 34 | // artificial error for testing 35 | public function misbehave() 36 | { 37 | $this->statusCode = 0; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCommon.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | if (! function_exists('is_cli')) 13 | { 14 | /** 15 | * Is CLI? 16 | * 17 | * Test to see if a request was made from the command line. 18 | * You can set the return value for testing. 19 | * 20 | * @param boolean $newReturn return value to set 21 | * @return boolean 22 | */ 23 | function is_cli(bool $newReturn = null): bool 24 | { 25 | // PHPUnit always runs via CLI. 26 | static $returnValue = true; 27 | 28 | if ($newReturn !== null) 29 | { 30 | $returnValue = $newReturn; 31 | } 32 | 33 | return $returnValue; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/_support/Commands/AppInfo.php: -------------------------------------------------------------------------------- 1 | 'unused']; 14 | protected $description = 'Displays basic application information.'; 15 | 16 | public function run(array $params) 17 | { 18 | CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red')); 19 | } 20 | 21 | public function bomb() 22 | { 23 | try 24 | { 25 | CLI::color('test', 'white', 'Background'); 26 | } 27 | catch (\RuntimeException $oops) 28 | { 29 | $this->showError($oops); 30 | } 31 | } 32 | 33 | public function helpme() 34 | { 35 | $this->call('help'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /system/Language/en/Core.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Core language settings 13 | return [ 14 | 'copyError' => 'An error was encountered while attempting to replace the file ({0}). Please make sure your file directory is writable.', 15 | 'enabledZlibOutputCompression' => 'Your zlib.output_compression ini directive is turned on. This will not work well with output buffers.', 16 | 'invalidFile' => 'Invalid file: {0}', 17 | 'missingExtension' => 'The framework needs the following extension(s) installed and loaded: {0}.', 18 | 'noHandlers' => '{0} must provide at least one Handler.', 19 | ]; 20 | -------------------------------------------------------------------------------- /app/Config/Boot/production.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Security\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | class SecurityException extends FrameworkException 17 | { 18 | public static function forDisallowedAction() 19 | { 20 | return new static(lang('Security.disallowedAction'), 403); 21 | } 22 | 23 | /** 24 | * @deprecated Use `CookieException::forInvalidSameSite()` instead. 25 | * 26 | * @codeCoverageIgnore 27 | */ 28 | public static function forInvalidSameSite(string $samesite) 29 | { 30 | return new static(lang('Security.invalidSameSite', [$samesite])); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /system/Test/Mock/MockEmail.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Email\Email; 15 | use CodeIgniter\Events\Events; 16 | 17 | class MockEmail extends Email 18 | { 19 | /** 20 | * Value to return from mocked send(). 21 | * 22 | * @var boolean 23 | */ 24 | public $returnValue = true; 25 | 26 | public function send($autoClear = true) 27 | { 28 | if ($this->returnValue) 29 | { 30 | $this->setArchiveValues(); 31 | 32 | if ($autoClear) 33 | { 34 | $this->clear(); 35 | } 36 | 37 | Events::trigger('email', $this->archive); 38 | } 39 | 40 | return $this->returnValue; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /tests/_support/Config/Services.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\CLI\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\DebugTraceableTrait; 15 | use RuntimeException; 16 | 17 | /** 18 | * CLIException 19 | */ 20 | class CLIException extends RuntimeException 21 | { 22 | use DebugTraceableTrait; 23 | 24 | /** 25 | * Thrown when `$color` specified for `$type` is not within the 26 | * allowed list of colors. 27 | * 28 | * @param string $type 29 | * @param string $color 30 | * 31 | * @return CLIException 32 | */ 33 | public static function forInvalidColor(string $type, string $color) 34 | { 35 | return new static(lang('CLI.invalidColor', [$type, $color])); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/resources/compiled/microtime.js: -------------------------------------------------------------------------------- 1 | void 0===window.kintMicrotimeInitialized&&(window.kintMicrotimeInitialized=1,window.addEventListener("load",function(){"use strict";var c={},i=Array.prototype.slice.call(document.querySelectorAll("[data-kint-microtime-group]"),0);i.forEach(function(i){if(i.querySelector(".kint-microtime-lap")){var t=i.getAttribute("data-kint-microtime-group"),e=parseFloat(i.querySelector(".kint-microtime-lap").innerHTML),r=parseFloat(i.querySelector(".kint-microtime-avg").innerHTML);void 0===c[t]&&(c[t]={}),(void 0===c[t].min||c[t].min>e)&&(c[t].min=e),(void 0===c[t].max||c[t].max 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Log\Handlers\FileHandler; 15 | 16 | /** 17 | * Class MockFileLogger 18 | * 19 | * Extends FileHandler, exposing some inner workings 20 | */ 21 | class MockFileLogger extends FileHandler 22 | { 23 | /** 24 | * Where would the log be written? 25 | */ 26 | public $destination; 27 | 28 | //-------------------------------------------------------------------- 29 | 30 | public function __construct(array $config) 31 | { 32 | parent::__construct($config); 33 | $this->handles = $config['handles'] ?? []; 34 | $this->destination = $this->path . 'log-' . date('Y-m-d') . '.' . $this->fileExtension; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /system/Language/en/Session.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Session language settings 13 | return [ 14 | 'missingDatabaseTable' => '`sessionSavePath` must have the table name for the Database Session Handler to work.', 15 | 'invalidSavePath' => 'Session: Configured save path "{0}" is not a directory, does not exist or cannot be created.', 16 | 'writeProtectedSavePath' => 'Session: Configured save path "{0}" is not writable by the PHP process.', 17 | 'emptySavePath' => 'Session: No save path configured.', 18 | 'invalidSavePathFormat' => 'Session: Invalid Redis save path format: {0}', 19 | 20 | // @deprecated 21 | 'invalidSameSiteSetting' => 'Session: The SameSite setting must be None, Lax, Strict, or a blank string. Given: {0}', 22 | ]; 23 | -------------------------------------------------------------------------------- /app/Config/Services.php: -------------------------------------------------------------------------------- 1 | getTrace()[0]; 28 | 29 | if (isset($trace['class']) && $trace['class'] === static::class) 30 | { 31 | ['line' => $this->line, 'file' => $this->file] = $trace; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /system/Honeypot/Exceptions/HoneypotException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Honeypot\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\ConfigException; 15 | use CodeIgniter\Exceptions\ExceptionInterface; 16 | 17 | class HoneypotException extends ConfigException implements ExceptionInterface 18 | { 19 | public static function forNoTemplate() 20 | { 21 | return new static(lang('Honeypot.noTemplate')); 22 | } 23 | 24 | public static function forNoNameField() 25 | { 26 | return new static(lang('Honeypot.noNameField')); 27 | } 28 | 29 | public static function forNoHiddenValue() 30 | { 31 | return new static(lang('Honeypot.noHiddenValue')); 32 | } 33 | 34 | public static function isBot() 35 | { 36 | return new static(lang('Honeypot.theClientIsABot')); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /system/Test/Mock/MockServices.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use \CodeIgniter\Config\BaseService; 15 | use CodeIgniter\Autoloader\FileLocator; 16 | 17 | class MockServices extends BaseService 18 | { 19 | public $psr4 = [ 20 | 'Tests/Support' => TESTPATH . '_support/', 21 | ]; 22 | 23 | public $classmap = []; 24 | 25 | //-------------------------------------------------------------------- 26 | 27 | public function __construct() 28 | { 29 | // Don't call the parent since we don't want the default mappings. 30 | // parent::__construct(); 31 | } 32 | 33 | //-------------------------------------------------------------------- 34 | public static function locator(bool $getShared = true) 35 | { 36 | return new FileLocator(static::autoloader()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/_support/View/SampleClass.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Debug\Toolbar\Collectors; 13 | 14 | use CodeIgniter\CodeIgniter; 15 | use Config\App; 16 | use Config\Services; 17 | 18 | /** 19 | * Debug toolbar configuration 20 | */ 21 | class Config 22 | { 23 | /** 24 | * Return toolbar config values as an array. 25 | * 26 | * @return array 27 | */ 28 | public static function display(): array 29 | { 30 | $config = config(App::class); 31 | 32 | return [ 33 | 'ciVersion' => CodeIgniter::CI_VERSION, 34 | 'phpVersion' => phpversion(), 35 | 'phpSAPI' => php_sapi_name(), 36 | 'environment' => ENVIRONMENT, 37 | 'baseURL' => $config->baseURL, 38 | 'timezone' => app_timezone(), 39 | 'locale' => Services::request()->getLocale(), 40 | 'cspEnabled' => $config->CSPEnabled, 41 | ]; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /system/Cache/Handlers/BaseHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Cache\Handlers; 13 | 14 | use Closure; 15 | use CodeIgniter\Cache\CacheInterface; 16 | 17 | /** 18 | * Base class for cache handling 19 | */ 20 | abstract class BaseHandler implements CacheInterface 21 | { 22 | /** 23 | * Get an item from the cache, or execute the given Closure and store the result. 24 | * 25 | * @param string $key Cache item name 26 | * @param integer $ttl Time to live 27 | * @param Closure $callback Callback return value 28 | * 29 | * @return mixed 30 | */ 31 | public function remember(string $key, int $ttl, Closure $callback) 32 | { 33 | $value = $this->get($key); 34 | 35 | if (! is_null($value)) 36 | { 37 | return $value; 38 | } 39 | 40 | $this->save($key, $value = $callback(), $ttl); 41 | 42 | return $value; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/Config/Validation.php: -------------------------------------------------------------------------------- 1 | 34 | */ 35 | public $templates = [ 36 | 'list' => 'CodeIgniter\Validation\Views\list', 37 | 'single' => 'CodeIgniter\Validation\Views\single', 38 | ]; 39 | 40 | //-------------------------------------------------------------------- 41 | // Rules 42 | //-------------------------------------------------------------------- 43 | } 44 | -------------------------------------------------------------------------------- /system/Helpers/test_helper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use CodeIgniter\Test\Fabricator; 13 | 14 | /** 15 | * CodeIgniter Test Helpers 16 | */ 17 | //-------------------------------------------------------------------- 18 | 19 | if (! function_exists('fake')) 20 | { 21 | /** 22 | * Creates a single item using Fabricator. 23 | * 24 | * @param Model|object|string $model Instance or name of the model 25 | * @param array|null $overrides Overriding data to pass to Fabricator::setOverrides() 26 | * 27 | * @return object|array 28 | */ 29 | function fake($model, array $overrides = null) 30 | { 31 | // Get a model-appropriate Fabricator instance 32 | $fabricator = new Fabricator($model); 33 | 34 | // Set overriding data, if necessary 35 | if ($overrides) 36 | { 37 | $fabricator->setOverrides($overrides); 38 | } 39 | 40 | return $fabricator->create(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /system/Database/SQLite3/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\SQLite3; 13 | 14 | use CodeIgniter\Database\BaseUtils; 15 | use CodeIgniter\Database\Exceptions\DatabaseException; 16 | 17 | /** 18 | * Utils for SQLite3 19 | */ 20 | class Utils extends BaseUtils 21 | { 22 | /** 23 | * OPTIMIZE TABLE statement 24 | * 25 | * @var string 26 | */ 27 | protected $optimizeTable = 'REINDEX %s'; 28 | 29 | //-------------------------------------------------------------------- 30 | 31 | /** 32 | * Platform dependent version of the backup function. 33 | * 34 | * @param array|null $prefs 35 | * 36 | * @return mixed 37 | */ 38 | public function _backup(array $prefs = null) 39 | { 40 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 41 | } 42 | 43 | //-------------------------------------------------------------------- 44 | } 45 | -------------------------------------------------------------------------------- /system/Commands/Generators/Views/migration.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\Database\Migration; 6 | 7 | class {class} extends Migration 8 | { 9 | 10 | protected $DBGroup = ''; 11 | 12 | public function up() 13 | { 14 | $this->forge->addField([ 15 | 'id' => ['type' => 'VARCHAR', 'constraint' => 128, 'null' => false], 16 | 'ip_address' => ['type' => 'VARCHAR', 'constraint' => 45, 'null' => false], 17 | 'timestamp' => ['type' => 'INT', 'unsigned' => true, 'null' => false, 'default' => 0], 18 | 'data' => ['type' => 'TEXT', 'null' => false, 'default' => ''], 19 | ]); 20 | 21 | $this->forge->addKey(['id', 'ip_address'], true); 22 | 23 | $this->forge->addKey('id', true); 24 | 25 | $this->forge->addKey('timestamp'); 26 | $this->forge->createTable('', true); 27 | } 28 | 29 | public function down() 30 | { 31 | $this->forge->dropTable('', true); 32 | } 33 | 34 | public function up() 35 | { 36 | // 37 | } 38 | 39 | public function down() 40 | { 41 | // 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_config.tpl: -------------------------------------------------------------------------------- 1 |

2 | Read the CodeIgniter docs... 3 |

4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
CodeIgniter Version:{ ciVersion }
PHP Version:{ phpVersion }
PHP SAPI:{ phpSAPI }
Environment:{ environment }
Base URL: 26 | { if $baseURL == '' } 27 |
28 | The $baseURL should always be set manually to prevent possible URL personification from external parties. 29 |
30 | { else } 31 | { baseURL } 32 | { endif } 33 |
Timezone:{ timezone }
Locale:{ locale }
Content Security Policy Enabled:{ if $cspEnabled } Yes { else } No { endif }
49 | -------------------------------------------------------------------------------- /tests/_support/Commands/LanguageCommand.php: -------------------------------------------------------------------------------- 1 | 'The language folder to save the file.', 18 | '--sort' => 'Turn on/off the sortImports flag.', 19 | ]; 20 | 21 | public function run(array $params) 22 | { 23 | $this->setHasClassName(false); 24 | $params[0] = 'Foobar'; 25 | $params['lang'] = $params['lang'] ?? 'en'; 26 | 27 | $this->component = 'Language'; 28 | $this->directory = 'Language\\' . $params['lang']; 29 | 30 | $sort = (isset($params['sort']) && $params['sort'] === 'off') ? false : true; 31 | $this->setSortImports($sort); 32 | 33 | $this->execute($params); 34 | } 35 | 36 | protected function prepare(string $class): string 37 | { 38 | return file_get_contents(__DIR__ . '/Foobar.php') ?: ''; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 British Columbia Institute of Technology 4 | Copyright (c) 2019-2021 CodeIgniter Foundation 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /system/Modules/Modules.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Modules; 13 | 14 | /** 15 | * Modules Class 16 | * 17 | * @link https://codeigniter.com/user_guide/general/modules.html 18 | */ 19 | class Modules 20 | { 21 | /** 22 | * Auto-Discover 23 | * 24 | * @var boolean 25 | */ 26 | public $enabled = true; 27 | 28 | /** 29 | * Auto-Discovery Within Composer Packages 30 | * 31 | * @var boolean 32 | */ 33 | public $discoverInComposer = true; 34 | 35 | /** 36 | * Auto-Discover Rules Handler 37 | * 38 | * @var array 39 | */ 40 | public $aliases = []; 41 | 42 | /** 43 | * Should the application auto-discover the requested resource. 44 | * 45 | * @param string $alias 46 | * 47 | * @return boolean 48 | */ 49 | public function shouldDiscover(string $alias): bool 50 | { 51 | if (! $this->enabled) 52 | { 53 | return false; 54 | } 55 | 56 | return in_array(strtolower($alias), $this->aliases, true); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /system/Config/Factory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Config; 13 | 14 | /** 15 | * Factories Configuration file. 16 | * 17 | * Provides overriding directives for how 18 | * Factories should handle discovery and 19 | * instantiation of specific components. 20 | * Each property should correspond to the 21 | * lowercase, plural component name. 22 | */ 23 | class Factory extends BaseConfig 24 | { 25 | /** 26 | * Supplies a default set of options to merge for 27 | * all unspecified factory components. 28 | * 29 | * @var array 30 | */ 31 | public static $default = [ 32 | 'component' => null, 33 | 'path' => null, 34 | 'instanceOf' => null, 35 | 'getShared' => true, 36 | 'preferApp' => true, 37 | ]; 38 | 39 | /** 40 | * Specifies that Models should always favor child 41 | * classes to allow easy extension of module Models. 42 | * 43 | * @var array 44 | */ 45 | public $models = [ 46 | 'preferApp' => true, 47 | ]; 48 | } 49 | -------------------------------------------------------------------------------- /system/Exceptions/CastException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | /** 15 | * Cast Exceptions. 16 | */ 17 | class CastException extends CriticalError 18 | { 19 | use DebugTraceableTrait; 20 | 21 | /** 22 | * Error code 23 | * 24 | * @var integer 25 | */ 26 | protected $code = 3; 27 | 28 | public static function forInvalidJsonFormatException(int $error) 29 | { 30 | switch($error) 31 | { 32 | case JSON_ERROR_DEPTH: 33 | return new static(lang('Cast.jsonErrorDepth')); 34 | case JSON_ERROR_STATE_MISMATCH: 35 | return new static(lang('Cast.jsonErrorStateMismatch')); 36 | case JSON_ERROR_CTRL_CHAR: 37 | return new static(lang('Cast.jsonErrorCtrlChar')); 38 | case JSON_ERROR_SYNTAX: 39 | return new static(lang('Cast.jsonErrorSyntax')); 40 | case JSON_ERROR_UTF8: 41 | return new static(lang('Cast.jsonErrorUtf8')); 42 | default: 43 | return new static(lang('Cast.jsonErrorUnknown')); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /system/Exceptions/PageNotFoundException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use OutOfBoundsException; 15 | 16 | class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface 17 | { 18 | use DebugTraceableTrait; 19 | 20 | /** 21 | * Error code 22 | * 23 | * @var integer 24 | */ 25 | protected $code = 404; 26 | 27 | public static function forPageNotFound(string $message = null) 28 | { 29 | return new static($message ?? lang('HTTP.pageNotFound')); 30 | } 31 | 32 | public static function forEmptyController() 33 | { 34 | return new static(lang('HTTP.emptyController')); 35 | } 36 | 37 | public static function forControllerNotFound(string $controller, string $method) 38 | { 39 | return new static(lang('HTTP.controllerNotFound', [$controller, $method])); 40 | } 41 | 42 | public static function forMethodNotFound(string $method) 43 | { 44 | return new static(lang('HTTP.methodNotFound', [$method])); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /system/Filters/Exceptions/FilterException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Filters\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\ConfigException; 15 | use CodeIgniter\Exceptions\ExceptionInterface; 16 | 17 | /** 18 | * FilterException 19 | */ 20 | class FilterException extends ConfigException implements ExceptionInterface 21 | { 22 | /** 23 | * Thrown when the provided alias is not within 24 | * the list of configured filter aliases. 25 | * 26 | * @param string $alias 27 | * 28 | * @return static 29 | */ 30 | public static function forNoAlias(string $alias) 31 | { 32 | return new static(lang('Filters.noFilter', [$alias])); 33 | } 34 | 35 | /** 36 | * Thrown when the filter class does not implement FilterInterface. 37 | * 38 | * @param string $class 39 | * 40 | * @return static 41 | */ 42 | public static function forIncorrectInterface(string $class) 43 | { 44 | return new static(lang('Filters.incorrectInterface', [$class])); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /system/Validation/Exceptions/ValidationException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Validation\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | class ValidationException extends FrameworkException 17 | { 18 | public static function forRuleNotFound(string $rule = null) 19 | { 20 | return new static(lang('Validation.ruleNotFound', [$rule])); 21 | } 22 | 23 | public static function forGroupNotFound(string $group = null) 24 | { 25 | return new static(lang('Validation.groupNotFound', [$group])); 26 | } 27 | 28 | public static function forGroupNotArray(string $group = null) 29 | { 30 | return new static(lang('Validation.groupNotArray', [$group])); 31 | } 32 | 33 | public static function forInvalidTemplate(string $template = null) 34 | { 35 | return new static(lang('Validation.invalidTemplate', [$template])); 36 | } 37 | 38 | public static function forNoRuleSets() 39 | { 40 | return new static(lang('Validation.noRuleSets')); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_routes.tpl: -------------------------------------------------------------------------------- 1 |

Matched Route

2 | 3 | 4 | 5 | {matchedRoute} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | {params} 23 | 24 | 25 | 26 | 27 | {/params} 28 | {/matchedRoute} 29 | 30 |
Directory:{directory}
Controller:{controller}
Method:{method}
Params:{paramCount} / {truePCount}
{name}{value}
31 | 32 | 33 |

Defined Routes

34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | {routes} 45 | 46 | 47 | 48 | 49 | 50 | {/routes} 51 | 52 |
MethodRouteHandler
{method}{route}{handler}
53 | -------------------------------------------------------------------------------- /app/Config/Pager.php: -------------------------------------------------------------------------------- 1 | 22 | */ 23 | public $templates = [ 24 | 'default_full' => 'CodeIgniter\Pager\Views\default_full', 25 | 'default_simple' => 'CodeIgniter\Pager\Views\default_simple', 26 | 'default_head' => 'CodeIgniter\Pager\Views\default_head', 27 | ]; 28 | 29 | /** 30 | * -------------------------------------------------------------------------- 31 | * Items Per Page 32 | * -------------------------------------------------------------------------- 33 | * 34 | * The default number of results shown in a single page. 35 | * 36 | * @var integer 37 | */ 38 | public $perPage = 20; 39 | } 40 | -------------------------------------------------------------------------------- /system/Database/SQLSRV/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\SQLSRV; 13 | 14 | use CodeIgniter\Database\BaseUtils; 15 | use CodeIgniter\Database\Exceptions\DatabaseException; 16 | 17 | /** 18 | * Utils for SQLSRV 19 | */ 20 | class Utils extends BaseUtils 21 | { 22 | /** 23 | * List databases statement 24 | * 25 | * @var string 26 | */ 27 | protected $listDatabases = 'EXEC sp_helpdb'; // Can also be: EXEC sp_databases 28 | 29 | /** 30 | * OPTIMIZE TABLE statement 31 | * 32 | * @var string 33 | */ 34 | protected $optimizeTable = 'ALTER INDEX all ON %s REORGANIZE'; 35 | 36 | //-------------------------------------------------------------------- 37 | 38 | /** 39 | * Platform dependent version of the backup function. 40 | * 41 | * @param array|null $prefs 42 | * 43 | * @return mixed 44 | */ 45 | public function _backup(array $prefs = null) 46 | { 47 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /system/Exceptions/DownloadException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use RuntimeException; 15 | 16 | /** 17 | * Class DownloadException 18 | */ 19 | class DownloadException extends RuntimeException implements ExceptionInterface 20 | { 21 | use DebugTraceableTrait; 22 | 23 | public static function forCannotSetFilePath(string $path) 24 | { 25 | return new static(lang('HTTP.cannotSetFilepath', [$path])); 26 | } 27 | 28 | public static function forCannotSetBinary() 29 | { 30 | return new static(lang('HTTP.cannotSetBinary')); 31 | } 32 | 33 | public static function forNotFoundDownloadSource() 34 | { 35 | return new static(lang('HTTP.notFoundDownloadSource')); 36 | } 37 | 38 | public static function forCannotSetCache() 39 | { 40 | return new static(lang('HTTP.cannotSetCache')); 41 | } 42 | 43 | public static function forCannotSetStatusCode(int $code, string $reason) 44 | { 45 | return new static(lang('HTTP.cannotSetStatusCode', [$code, $reason])); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCLIConfig.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use Config\App; 15 | 16 | class MockCLIConfig extends App 17 | { 18 | public $baseURL = 'http://example.com/'; 19 | 20 | public $uriProtocol = 'REQUEST_URI'; 21 | 22 | public $cookiePrefix = ''; 23 | public $cookieDomain = ''; 24 | public $cookiePath = '/'; 25 | public $cookieSecure = false; 26 | public $cookieHTTPOnly = false; 27 | public $cookieSameSite = 'Lax'; 28 | 29 | public $proxyIPs = ''; 30 | 31 | public $CSRFProtection = false; 32 | public $CSRFTokenName = 'csrf_test_name'; 33 | public $CSRFCookieName = 'csrf_cookie_name'; 34 | public $CSRFExpire = 7200; 35 | public $CSRFRegenerate = true; 36 | public $CSRFExcludeURIs = ['http://example.com']; 37 | public $CSRFSameSite = 'Lax'; 38 | 39 | public $CSPEnabled = false; 40 | 41 | public $defaultLocale = 'en'; 42 | public $negotiateLocale = false; 43 | public $supportedLocales = [ 44 | 'en', 45 | 'es', 46 | ]; 47 | } 48 | -------------------------------------------------------------------------------- /system/Encryption/EncrypterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Encryption; 13 | 14 | use CodeIgniter\Encryption\Exceptions\EncryptionException; 15 | 16 | /** 17 | * CodeIgniter Encryption Handler 18 | * 19 | * Provides two-way keyed encryption 20 | */ 21 | interface EncrypterInterface 22 | { 23 | /** 24 | * Encrypt - convert plaintext into ciphertext 25 | * 26 | * @param string $data Input data 27 | * @param array|string|null $params Overridden parameters, specifically the key 28 | * 29 | * @throws EncryptionException 30 | * 31 | * @return string 32 | */ 33 | public function encrypt($data, $params = null); 34 | 35 | /** 36 | * Decrypt - convert ciphertext into plaintext 37 | * 38 | * @param string $data Encrypted data 39 | * @param array|string|null $params Overridden parameters, specifically the key 40 | * 41 | * @throws EncryptionException 42 | * 43 | * @return string 44 | */ 45 | public function decrypt($data, $params = null); 46 | } 47 | -------------------------------------------------------------------------------- /system/Database/MySQLi/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\MySQLi; 13 | 14 | use CodeIgniter\Database\BaseUtils; 15 | use CodeIgniter\Database\Exceptions\DatabaseException; 16 | 17 | /** 18 | * Utils for MySQLi 19 | */ 20 | class Utils extends BaseUtils 21 | { 22 | /** 23 | * List databases statement 24 | * 25 | * @var string 26 | */ 27 | protected $listDatabases = 'SHOW DATABASES'; 28 | 29 | /** 30 | * OPTIMIZE TABLE statement 31 | * 32 | * @var string 33 | */ 34 | protected $optimizeTable = 'OPTIMIZE TABLE %s'; 35 | 36 | //-------------------------------------------------------------------- 37 | 38 | /** 39 | * Platform dependent version of the backup function. 40 | * 41 | * @param array|null $prefs 42 | * 43 | * @return mixed 44 | */ 45 | public function _backup(array $prefs = null) 46 | { 47 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 48 | } 49 | 50 | //-------------------------------------------------------------------- 51 | } 52 | -------------------------------------------------------------------------------- /system/Config/Config.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Config; 13 | 14 | /** 15 | * Class Config 16 | * 17 | * @deprecated Use CodeIgniter\Config\Factories::config() 18 | */ 19 | class Config 20 | { 21 | /** 22 | * Create new configuration instances or return 23 | * a shared instance 24 | * 25 | * @param string $name Configuration name 26 | * @param boolean $getShared Use shared instance 27 | * 28 | * @return mixed|null 29 | */ 30 | public static function get(string $name, bool $getShared = true) 31 | { 32 | return Factories::config($name, ['getShared' => $getShared]); 33 | } 34 | 35 | /** 36 | * Helper method for injecting mock instances while testing. 37 | * 38 | * @param string $name 39 | * @param object $instance 40 | */ 41 | public static function injectMock(string $name, $instance) 42 | { 43 | Factories::injectMock('config', $name, $instance); 44 | } 45 | 46 | /** 47 | * Resets the static arrays 48 | */ 49 | public static function reset() 50 | { 51 | Factories::reset('config'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /system/Database/Postgre/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\Postgre; 13 | 14 | use CodeIgniter\Database\BaseUtils; 15 | use CodeIgniter\Database\Exceptions\DatabaseException; 16 | 17 | /** 18 | * Utils for Postgre 19 | */ 20 | class Utils extends BaseUtils 21 | { 22 | /** 23 | * List databases statement 24 | * 25 | * @var string 26 | */ 27 | protected $listDatabases = 'SELECT datname FROM pg_database'; 28 | 29 | /** 30 | * OPTIMIZE TABLE statement 31 | * 32 | * @var string 33 | */ 34 | protected $optimizeTable = 'REINDEX TABLE %s'; 35 | 36 | //-------------------------------------------------------------------- 37 | 38 | /** 39 | * Platform dependent version of the backup function. 40 | * 41 | * @param array|null $prefs 42 | * 43 | * @return mixed 44 | */ 45 | public function _backup(array $prefs = null) 46 | { 47 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 48 | } 49 | 50 | //-------------------------------------------------------------------- 51 | } 52 | -------------------------------------------------------------------------------- /tests/_support/Commands/Unsuffixable.php: -------------------------------------------------------------------------------- 1 | 'Class name', 47 | ]; 48 | 49 | /** 50 | * The Command's Options 51 | * 52 | * @var array 53 | */ 54 | protected $options = []; 55 | 56 | /** 57 | * Actually execute a command. 58 | * 59 | * @param array $params 60 | */ 61 | public function run(array $params) 62 | { 63 | $this->component = 'Command'; 64 | $this->directory = 'Commands'; 65 | $this->template = 'command.tpl.php'; 66 | 67 | $this->setEnabledSuffixing(false); 68 | $this->execute($params); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /app/Config/Boot/testing.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use Config\App; 15 | 16 | class MockAppConfig extends App 17 | { 18 | public $baseURL = 'http://example.com/'; 19 | 20 | public $uriProtocol = 'REQUEST_URI'; 21 | 22 | public $cookiePrefix = ''; 23 | public $cookieDomain = ''; 24 | public $cookiePath = '/'; 25 | public $cookieSecure = false; 26 | public $cookieHTTPOnly = false; 27 | public $cookieSameSite = 'Lax'; 28 | 29 | public $proxyIPs = ''; 30 | 31 | public $CSRFProtection = false; 32 | public $CSRFTokenName = 'csrf_test_name'; 33 | public $CSRFHeaderName = 'X-CSRF-TOKEN'; 34 | public $CSRFCookieName = 'csrf_cookie_name'; 35 | public $CSRFExpire = 7200; 36 | public $CSRFRegenerate = true; 37 | public $CSRFExcludeURIs = ['http://example.com']; 38 | public $CSRFRedirect = false; 39 | public $CSRFSameSite = 'Lax'; 40 | 41 | public $CSPEnabled = false; 42 | 43 | public $defaultLocale = 'en'; 44 | public $negotiateLocale = false; 45 | public $supportedLocales = [ 46 | 'en', 47 | 'es', 48 | ]; 49 | } 50 | -------------------------------------------------------------------------------- /app/Config/Filters.php: -------------------------------------------------------------------------------- 1 | CSRF::class, 20 | 'toolbar' => DebugToolbar::class, 21 | 'honeypot' => Honeypot::class, 22 | ]; 23 | 24 | /** 25 | * List of filter aliases that are always 26 | * applied before and after every request. 27 | * 28 | * @var array 29 | */ 30 | public $globals = [ 31 | 'before' => [ 32 | // 'honeypot', 33 | // 'csrf', 34 | ], 35 | 'after' => [ 36 | 'toolbar', 37 | // 'honeypot', 38 | ], 39 | ]; 40 | 41 | /** 42 | * List of filter aliases that works on a 43 | * particular HTTP method (GET, POST, etc.). 44 | * 45 | * Example: 46 | * 'post' => ['csrf', 'throttle'] 47 | * 48 | * @var array 49 | */ 50 | public $methods = []; 51 | 52 | /** 53 | * List of filter aliases that should run on any 54 | * before or after URI patterns. 55 | * 56 | * Example: 57 | * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']] 58 | * 59 | * @var array 60 | */ 61 | public $filters = []; 62 | } 63 | -------------------------------------------------------------------------------- /system/Database/MySQLi/Builder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\MySQLi; 13 | 14 | use CodeIgniter\Database\BaseBuilder; 15 | 16 | /** 17 | * Builder for MySQLi 18 | */ 19 | class Builder extends BaseBuilder 20 | { 21 | /** 22 | * Identifier escape character 23 | * 24 | * @var string 25 | */ 26 | protected $escapeChar = '`'; 27 | 28 | /** 29 | * Specifies which sql statements 30 | * support the ignore option. 31 | * 32 | * @var array 33 | */ 34 | protected $supportedIgnoreStatements = [ 35 | 'update' => 'IGNORE', 36 | 'insert' => 'IGNORE', 37 | 'delete' => 'IGNORE', 38 | ]; 39 | 40 | /** 41 | * FROM tables 42 | * 43 | * Groups tables in FROM clauses if needed, so there is no confusion 44 | * about operator precedence. 45 | * 46 | * Note: This is only used (and overridden) by MySQL. 47 | * 48 | * @return string 49 | */ 50 | protected function _fromTables(): string 51 | { 52 | if (! empty($this->QBJoin) && count($this->QBFrom) > 1) 53 | { 54 | return '(' . implode(', ', $this->QBFrom) . ')'; 55 | } 56 | 57 | return implode(', ', $this->QBFrom); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /system/Format/JSONFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Format; 13 | 14 | use CodeIgniter\Format\Exceptions\FormatException; 15 | use Config\Format; 16 | 17 | /** 18 | * JSON data formatter 19 | */ 20 | class JSONFormatter implements FormatterInterface 21 | { 22 | /** 23 | * Takes the given data and formats it. 24 | * 25 | * @param mixed $data 26 | * 27 | * @return string|boolean (JSON string | false) 28 | */ 29 | public function format($data) 30 | { 31 | $config = new Format(); 32 | 33 | $options = $config->formatterOptions['application/json'] ?? JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES; 34 | $options = $options | JSON_PARTIAL_OUTPUT_ON_ERROR; 35 | 36 | $options = ENVIRONMENT === 'production' ? $options : $options | JSON_PRETTY_PRINT; 37 | 38 | $result = json_encode($data, $options, 512); 39 | 40 | if (! in_array(json_last_error(), [JSON_ERROR_NONE, JSON_ERROR_RECURSION], true)) 41 | { 42 | throw FormatException::forInvalidJSON(json_last_error_msg()); 43 | } 44 | 45 | return $result; 46 | } 47 | 48 | //-------------------------------------------------------------------- 49 | } 50 | -------------------------------------------------------------------------------- /app/Config/Boot/development.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use CodeIgniter\Exceptions\PageNotFoundException; 13 | 14 | /** 15 | * System URI Routing 16 | * 17 | * This file contains any routing to system tools, such as command-line 18 | * tools for migrations, etc. 19 | * 20 | * It is called by Config\Routes, and has the $routes RouteCollection 21 | * already loaded up and ready for us to use. 22 | */ 23 | 24 | // Prevent access to BaseController 25 | $routes->add('BaseController(:any)', function () { 26 | throw PageNotFoundException::forPageNotFound(); 27 | }); 28 | 29 | // Prevent access to initController method 30 | $routes->add('(:any)/initController', function () { 31 | throw PageNotFoundException::forPageNotFound(); 32 | }); 33 | 34 | // Migrations 35 | $routes->cli('migrations/(:segment)/(:segment)', '\CodeIgniter\Commands\MigrationsCommand::$1/$2'); 36 | $routes->cli('migrations/(:segment)', '\CodeIgniter\Commands\MigrationsCommand::$1'); 37 | $routes->cli('migrations', '\CodeIgniter\Commands\MigrationsCommand::index'); 38 | 39 | // CLI Catchall - uses a _remap to call Commands 40 | $routes->cli('ci(:any)', '\CodeIgniter\CLI\CommandRunner::index/$1'); 41 | -------------------------------------------------------------------------------- /app/Config/View.php: -------------------------------------------------------------------------------- 1 | setSurroundCount(2); 9 | ?> 10 | 11 | 48 | -------------------------------------------------------------------------------- /system/Test/Filters/CITestStreamFilter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Filters; 13 | 14 | use php_user_filter; 15 | 16 | /** 17 | * Class to extract an output snapshot. 18 | * Used to capture output during unit testing, so that it can 19 | * be used in assertions. 20 | */ 21 | class CITestStreamFilter extends php_user_filter 22 | { 23 | /** 24 | * Buffer to capture stream content. 25 | * 26 | * @var string 27 | */ 28 | public static $buffer = ''; 29 | 30 | /** 31 | * Output filtering - catch it all. 32 | * 33 | * @param resource $in 34 | * @param resource $out 35 | * @param integer $consumed 36 | * @param boolean $closing 37 | * 38 | * @return integer 39 | */ 40 | public function filter($in, $out, &$consumed, $closing) 41 | { 42 | while ($bucket = stream_bucket_make_writeable($in)) 43 | { 44 | static::$buffer .= $bucket->data; 45 | 46 | $consumed += $bucket->datalen; 47 | } 48 | 49 | // @phpstan-ignore-next-line 50 | return PSFS_PASS_ON; 51 | } 52 | } 53 | 54 | // @codeCoverageIgnoreStart 55 | stream_filter_register('CITestStreamFilter', 'CodeIgniter\Test\Filters\CITestStreamFilter'); 56 | // @codeCoverageIgnoreEnd 57 | -------------------------------------------------------------------------------- /system/Language/en/Cookie.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Cookie language settings 13 | return [ 14 | 'invalidExpiresTime' => 'Invalid "{0}" type for "Expires" attribute. Expected: string, integer, DateTimeInterface object.', 15 | 'invalidExpiresValue' => 'The cookie expiration time is not valid.', 16 | 'invalidCookieName' => 'The cookie name "{0}" contains invalid characters.', 17 | 'emptyCookieName' => 'The cookie name cannot be empty.', 18 | 'invalidSecurePrefix' => 'Using the "__Secure-" prefix requires setting the "Secure" attribute.', 19 | 'invalidHostPrefix' => 'Using the "__Host-" prefix must be set with the "Secure" flag, must not have a "Domain" attribute, and the "Path" is set to "/".', 20 | 'invalidSameSite' => 'The SameSite value must be None, Lax, Strict or a blank string, {0} given.', 21 | 'invalidSameSiteNone' => 'Using the "SameSite=None" attribute requires setting the "Secure" attribute.', 22 | 'invalidCookieInstance' => '"{0}" class expected cookies array to be instances of "{1}" but got "{2}" at index {3}.', 23 | 'unknownCookieInstance' => 'Cookie object with name "{0}" and prefix "{1}" was not found in the collection.', 24 | ]; 25 | -------------------------------------------------------------------------------- /system/Commands/Generators/Views/filter.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\Filters\FilterInterface; 6 | use CodeIgniter\HTTP\RequestInterface; 7 | use CodeIgniter\HTTP\ResponseInterface; 8 | 9 | class {class} implements FilterInterface 10 | { 11 | /** 12 | * Do whatever processing this filter needs to do. 13 | * By default it should not return anything during 14 | * normal execution. However, when an abnormal state 15 | * is found, it should return an instance of 16 | * CodeIgniter\HTTP\Response. If it does, script 17 | * execution will end and that Response will be 18 | * sent back to the client, allowing for error pages, 19 | * redirects, etc. 20 | * 21 | * @param RequestInterface $request 22 | * @param array|null $arguments 23 | * 24 | * @return mixed 25 | */ 26 | public function before(RequestInterface $request, $arguments = null) 27 | { 28 | // 29 | } 30 | 31 | /** 32 | * Allows After filters to inspect and modify the response 33 | * object as needed. This method does not allow any way 34 | * to stop execution of other after filters, short of 35 | * throwing an Exception or Error. 36 | * 37 | * @param RequestInterface $request 38 | * @param ResponseInterface $response 39 | * @param array|null $arguments 40 | * 41 | * @return mixed 42 | */ 43 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) 44 | { 45 | // 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /system/Commands/Generators/Views/model.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\Model; 6 | 7 | class {class} extends Model 8 | { 9 | protected $DBGroup = '{DBGroup}'; 10 | protected $table = '{table}'; 11 | protected $primaryKey = 'id'; 12 | protected $useAutoIncrement = true; 13 | protected $insertID = 0; 14 | protected $returnType = '{return}'; 15 | protected $useSoftDelete = false; 16 | protected $protectFields = true; 17 | protected $allowedFields = []; 18 | 19 | // Dates 20 | protected $useTimestamps = false; 21 | protected $dateFormat = 'datetime'; 22 | protected $createdField = 'created_at'; 23 | protected $updatedField = 'updated_at'; 24 | protected $deletedField = 'deleted_at'; 25 | 26 | // Validation 27 | protected $validationRules = []; 28 | protected $validationMessages = []; 29 | protected $skipValidation = false; 30 | protected $cleanValidationRules = true; 31 | 32 | // Callbacks 33 | protected $allowCallbacks = true; 34 | protected $beforeInsert = []; 35 | protected $afterInsert = []; 36 | protected $beforeUpdate = []; 37 | protected $afterUpdate = []; 38 | protected $beforeFind = []; 39 | protected $afterFind = []; 40 | protected $beforeDelete = []; 41 | protected $afterDelete = []; 42 | } 43 | -------------------------------------------------------------------------------- /system/View/Exceptions/ViewException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\View\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | class ViewException extends FrameworkException 17 | { 18 | public static function forInvalidCellMethod(string $class, string $method) 19 | { 20 | return new static(lang('View.invalidCellMethod', ['class' => $class, 'method' => $method])); 21 | } 22 | 23 | public static function forMissingCellParameters(string $class, string $method) 24 | { 25 | return new static(lang('View.missingCellParameters', ['class' => $class, 'method' => $method])); 26 | } 27 | 28 | public static function forInvalidCellParameter(string $key) 29 | { 30 | return new static(lang('View.invalidCellParameter', [$key])); 31 | } 32 | 33 | public static function forNoCellClass() 34 | { 35 | return new static(lang('View.noCellClass')); 36 | } 37 | 38 | public static function forInvalidCellClass(string $class = null) 39 | { 40 | return new static(lang('View.invalidCellClass', [$class])); 41 | } 42 | 43 | public static function forTagSyntaxError(string $output) 44 | { 45 | return new static(lang('View.tagSyntaxError', [$output])); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /system/Commands/Server/rewrite.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /* 13 | * CodeIgniter PHP-Development Server Rewrite Rules 14 | * 15 | * This script works with the CLI serve command to help run a seamless 16 | * development server based around PHP's built-in development 17 | * server. This file simply tries to mimic Apache's mod_rewrite 18 | * functionality so the site will operate as normal. 19 | */ 20 | 21 | // @codeCoverageIgnoreStart 22 | // Avoid this file run when listing commands 23 | if (PHP_SAPI === 'cli') 24 | { 25 | return; 26 | } 27 | 28 | $uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); 29 | 30 | // Front Controller path - expected to be in the default folder 31 | $fcpath = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR; 32 | 33 | // Full path 34 | $path = $fcpath . ltrim($uri, '/'); 35 | 36 | // If $path is an existing file or folder within the public folder 37 | // then let the request handle it like normal. 38 | if ($uri !== '/' && (is_file($path) || is_dir($path))) 39 | { 40 | return false; 41 | } 42 | 43 | // Otherwise, we'll load the index file and let 44 | // the framework handle the request from here. 45 | require_once $fcpath . 'index.php'; 46 | // @codeCoverageIgnoreEnd 47 | -------------------------------------------------------------------------------- /system/Session/Exceptions/SessionException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Session\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | class SessionException extends FrameworkException 17 | { 18 | public static function forMissingDatabaseTable() 19 | { 20 | return new static(lang('Session.missingDatabaseTable')); 21 | } 22 | 23 | public static function forInvalidSavePath(string $path = null) 24 | { 25 | return new static(lang('Session.invalidSavePath', [$path])); 26 | } 27 | 28 | public static function forWriteProtectedSavePath(string $path = null) 29 | { 30 | return new static(lang('Session.writeProtectedSavePath', [$path])); 31 | } 32 | 33 | public static function forEmptySavepath() 34 | { 35 | return new static(lang('Session.emptySavePath')); 36 | } 37 | 38 | public static function forInvalidSavePathFormat(string $path) 39 | { 40 | return new static(lang('Session.invalidSavePathFormat', [$path])); 41 | } 42 | 43 | /** 44 | * @deprecated 45 | * 46 | * @codeCoverageIgnore 47 | */ 48 | public static function forInvalidSameSiteSetting(string $samesite) 49 | { 50 | return new static(lang('Session.invalidSameSiteSetting', [$samesite])); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/Config/Exceptions.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Throttle; 13 | 14 | /** 15 | * Expected behavior of a Throttler 16 | */ 17 | interface ThrottlerInterface 18 | { 19 | /** 20 | * Restricts the number of requests made by a single key within 21 | * a set number of seconds. 22 | * 23 | * Example: 24 | * 25 | * if (! $throttler->checkIPAddress($request->ipAddress(), 60, MINUTE)) 26 | * { 27 | * die('You submitted over 60 requests within a minute.'); 28 | * } 29 | * 30 | * @param string $key The name to use as the "bucket" name. 31 | * @param integer $capacity The number of requests the "bucket" can hold 32 | * @param integer $seconds The time it takes the "bucket" to completely refill 33 | * @param integer $cost The number of tokens this action uses. 34 | * 35 | * @return boolean 36 | */ 37 | public function check(string $key, int $capacity, int $seconds, int $cost); 38 | 39 | //-------------------------------------------------------------------- 40 | 41 | /** 42 | * Returns the number of seconds until the next available token will 43 | * be released for usage. 44 | * 45 | * @return integer 46 | */ 47 | public function getTokenTime(): int; 48 | } 49 | -------------------------------------------------------------------------------- /system/Language/en/Time.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Time language settings 13 | return [ 14 | 'invalidFormat' => '"{0}" is not a valid datetime format', 15 | 'invalidMonth' => 'Months must be between 1 and 12. Given: {0}', 16 | 'invalidDay' => 'Days must be between 1 and 31. Given: {0}', 17 | 'invalidOverDay' => 'Days must be between 1 and {0}. Given: {1}', 18 | 'invalidHours' => 'Hours must be between 0 and 23. Given: {0}', 19 | 'invalidMinutes' => 'Minutes must be between 0 and 59. Given: {0}', 20 | 'invalidSeconds' => 'Seconds must be between 0 and 59. Given: {0}', 21 | 'years' => '{0, plural, =1{# year} other{# years}}', 22 | 'months' => '{0, plural, =1{# month} other{# months}}', 23 | 'weeks' => '{0, plural, =1{# week} other{# weeks}}', 24 | 'days' => '{0, plural, =1{# day} other{# days}}', 25 | 'hours' => '{0, plural, =1{# hour} other{# hours}}', 26 | 'minutes' => '{0, plural, =1{# minute} other{# minutes}}', 27 | 'seconds' => '{0, plural, =1{# second} other{# seconds}}', 28 | 'ago' => '{0} ago', 29 | 'inFuture' => 'in {0}', 30 | 'yesterday' => 'Yesterday', 31 | 'tomorrow' => 'Tomorrow', 32 | 'now' => 'Just now', 33 | ]; 34 | -------------------------------------------------------------------------------- /system/Commands/Generators/Views/command.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\CLI\BaseCommand; 6 | use CodeIgniter\CLI\CLI; 7 | 8 | use CodeIgniter\CLI\GeneratorTrait; 9 | 10 | 11 | class {class} extends BaseCommand 12 | { 13 | 14 | use GeneratorTrait; 15 | 16 | 17 | /** 18 | * The Command's Group 19 | * 20 | * @var string 21 | */ 22 | protected $group = '{group}'; 23 | 24 | /** 25 | * The Command's Name 26 | * 27 | * @var string 28 | */ 29 | protected $name = '{command}'; 30 | 31 | /** 32 | * The Command's Description 33 | * 34 | * @var string 35 | */ 36 | protected $description = ''; 37 | 38 | /** 39 | * The Command's Usage 40 | * 41 | * @var string 42 | */ 43 | protected $usage = '{command} [arguments] [options]'; 44 | 45 | /** 46 | * The Command's Arguments 47 | * 48 | * @var array 49 | */ 50 | protected $arguments = []; 51 | 52 | /** 53 | * The Command's Options 54 | * 55 | * @var array 56 | */ 57 | protected $options = []; 58 | 59 | /** 60 | * Actually execute a command. 61 | * 62 | * @param array $params 63 | */ 64 | public function run(array $params) 65 | { 66 | 67 | $this->component = 'Command'; 68 | $this->directory = 'Commands'; 69 | $this->template = 'command.tpl.php'; 70 | 71 | $this->execute($params); 72 | 73 | // 74 | 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/Renderer/Rich/PluginInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Log\Handlers; 13 | 14 | /** 15 | * Expected behavior for a Log handler 16 | */ 17 | interface HandlerInterface 18 | { 19 | /** 20 | * Handles logging the message. 21 | * If the handler returns false, then execution of handlers 22 | * will stop. Any handlers that have not run, yet, will not 23 | * be run. 24 | * 25 | * @param string $level 26 | * @param string $message 27 | * 28 | * @return boolean 29 | */ 30 | public function handle($level, $message): bool; 31 | 32 | //-------------------------------------------------------------------- 33 | 34 | /** 35 | * Checks whether the Handler will handle logging items of this 36 | * log Level. 37 | * 38 | * @param string $level 39 | * 40 | * @return boolean 41 | */ 42 | public function canHandle(string $level): bool; 43 | 44 | //-------------------------------------------------------------------- 45 | 46 | /** 47 | * Sets the preferred date format to use when logging. 48 | * 49 | * @param string $format 50 | * 51 | * @return HandlerInterface 52 | */ 53 | public function setDateFormat(string $format); 54 | 55 | //-------------------------------------------------------------------- 56 | } 57 | -------------------------------------------------------------------------------- /system/Database/ModelFactory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database; 13 | 14 | use CodeIgniter\Config\Factories; 15 | 16 | /** 17 | * Returns new or shared Model instances 18 | * 19 | * @deprecated Use CodeIgniter\Config\Factories::models() 20 | */ 21 | class ModelFactory 22 | { 23 | /** 24 | * Creates new Model instances or returns a shared instance 25 | * 26 | * @param string $name Model name, namespace optional 27 | * @param boolean $getShared Use shared instance 28 | * @param ConnectionInterface $connection 29 | * 30 | * @return mixed|null 31 | */ 32 | public static function get(string $name, bool $getShared = true, ConnectionInterface $connection = null) 33 | { 34 | return Factories::models($name, ['getShared' => $getShared], $connection); 35 | } 36 | 37 | /** 38 | * Helper method for injecting mock instances while testing. 39 | * 40 | * @param string $name 41 | * @param object $instance 42 | */ 43 | public static function injectMock(string $name, $instance) 44 | { 45 | Factories::injectMock('models', $name, $instance); 46 | } 47 | 48 | /** 49 | * Resets the static arrays 50 | */ 51 | public static function reset() 52 | { 53 | Factories::reset('models'); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCURLRequest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\HTTP\CURLRequest; 15 | 16 | /** 17 | * Class MockCURLRequest 18 | * 19 | * Simply allows us to not actually call cURL during the 20 | * test runs. Instead, we can set the desired output 21 | * and get back the set options. 22 | */ 23 | class MockCURLRequest extends CURLRequest 24 | { 25 | public $curl_options; 26 | 27 | protected $output = ''; 28 | 29 | //-------------------------------------------------------------------- 30 | 31 | public function setOutput($output) 32 | { 33 | $this->output = $output; 34 | 35 | return $this; 36 | } 37 | 38 | //-------------------------------------------------------------------- 39 | 40 | protected function sendRequest(array $curlOptions = []): string 41 | { 42 | // Save so we can access later. 43 | $this->curl_options = $curlOptions; 44 | 45 | return $this->output; 46 | } 47 | 48 | //-------------------------------------------------------------------- 49 | // for testing purposes only 50 | public function getBaseURI() 51 | { 52 | return $this->baseURI; 53 | } 54 | 55 | // for testing purposes only 56 | public function getDelay() 57 | { 58 | return $this->delay; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/Renderer/Rich/ObjectPluginInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Filters; 13 | 14 | use CodeIgniter\Honeypot\Exceptions\HoneypotException; 15 | use CodeIgniter\HTTP\RequestInterface; 16 | use CodeIgniter\HTTP\ResponseInterface; 17 | use Config\Services; 18 | 19 | /** 20 | * Honeypot filter 21 | */ 22 | class Honeypot implements FilterInterface 23 | { 24 | /** 25 | * Checks if Honeypot field is empty; if not 26 | * then the requester is a bot 27 | * 28 | * @param RequestInterface $request 29 | * @param array|null $arguments 30 | * 31 | * @return void 32 | */ 33 | public function before(RequestInterface $request, $arguments = null) 34 | { 35 | $honeypot = Services::honeypot(new \Config\Honeypot()); 36 | if ($honeypot->hasContent($request)) 37 | { 38 | throw HoneypotException::isBot(); 39 | } 40 | } 41 | 42 | /** 43 | * Attach a honeypot to the current response. 44 | * 45 | * @param RequestInterface $request 46 | * @param ResponseInterface $response 47 | * @param array|null $arguments 48 | * 49 | * @return void 50 | */ 51 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) 52 | { 53 | $honeypot = Services::honeypot(new \Config\Honeypot()); 54 | $honeypot->attachHoneypot($response); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /system/Helpers/xml_helper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | /** 13 | * CodeIgniter XML Helpers 14 | */ 15 | 16 | if (! function_exists('xml_convert')) 17 | { 18 | /** 19 | * Convert Reserved XML characters to Entities 20 | * 21 | * @param string $str 22 | * @param boolean $protectAll 23 | * @return string 24 | */ 25 | function xml_convert(string $str, bool $protectAll = false): string 26 | { 27 | $temp = '__TEMP_AMPERSANDS__'; 28 | 29 | // Replace entities to temporary markers so that 30 | // ampersands won't get messed up 31 | $str = preg_replace('/&#(\d+);/', $temp . '\\1;', $str); 32 | 33 | if ($protectAll === true) 34 | { 35 | $str = preg_replace('/&(\w+);/', $temp . '\\1;', $str); 36 | } 37 | 38 | $original = [ 39 | '&', 40 | '<', 41 | '>', 42 | '"', 43 | "'", 44 | '-', 45 | ]; 46 | 47 | $replacement = [ 48 | '&', 49 | '<', 50 | '>', 51 | '"', 52 | ''', 53 | '-', 54 | ]; 55 | 56 | $str = str_replace($original, $replacement, $str); 57 | 58 | // Decode the temp markers back to entities 59 | $str = preg_replace('/' . $temp . '(\d+);/', '&#\\1;', $str); 60 | 61 | if ($protectAll === true) 62 | { 63 | return preg_replace('/' . $temp . '(\w+);/', '&\\1;', $str); 64 | } 65 | 66 | return $str; 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /system/Exceptions/FrameworkException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use RuntimeException; 15 | 16 | /** 17 | * Class FrameworkException 18 | * 19 | * A collection of exceptions thrown by the framework 20 | * that can only be determined at run time. 21 | */ 22 | class FrameworkException extends RuntimeException implements ExceptionInterface 23 | { 24 | use DebugTraceableTrait; 25 | 26 | public static function forEnabledZlibOutputCompression() 27 | { 28 | return new static(lang('Core.enabledZlibOutputCompression')); 29 | } 30 | 31 | public static function forInvalidFile(string $path) 32 | { 33 | return new static(lang('Core.invalidFile', [$path])); 34 | } 35 | 36 | public static function forCopyError(string $path) 37 | { 38 | return new static(lang('Core.copyError', [$path])); 39 | } 40 | 41 | public static function forMissingExtension(string $extension) 42 | { 43 | return new static(lang('Core.missingExtension', [$extension])); 44 | } 45 | 46 | public static function forNoHandlers(string $class) 47 | { 48 | return new static(lang('Core.noHandlers', [$class])); 49 | } 50 | 51 | public static function forFabricatorCreateFailed(string $table, string $reason) 52 | { 53 | return new static(lang('Fabricator.createFailed', [$table, $reason])); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /system/Test/FeatureTestCase.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test; 13 | 14 | use CodeIgniter\Router\RouteCollection; 15 | 16 | /** 17 | * Class FeatureTestCase 18 | * 19 | * Provides a base class with the trait for doing full HTTP testing 20 | * against your application. 21 | */ 22 | class FeatureTestCase extends CIDatabaseTestCase 23 | { 24 | use FeatureTestTrait; 25 | 26 | /** 27 | * If present, will override application 28 | * routes when using call(). 29 | * 30 | * @var RouteCollection 31 | */ 32 | protected $routes; 33 | 34 | /** 35 | * Values to be set in the SESSION global 36 | * before running the test. 37 | * 38 | * @var array 39 | */ 40 | protected $session = []; 41 | 42 | /** 43 | * Enabled auto clean op buffer after request call 44 | * 45 | * @var boolean 46 | */ 47 | protected $clean = true; 48 | 49 | /** 50 | * Custom request's headers 51 | * 52 | * @var array 53 | */ 54 | protected $headers = []; 55 | 56 | /** 57 | * Allows for formatting the request body to what 58 | * the controller is going to expect 59 | * 60 | * @var string 61 | */ 62 | protected $bodyFormat = ''; 63 | 64 | /** 65 | * Allows for directly setting the body to what 66 | * it needs to be. 67 | * 68 | * @var mixed 69 | */ 70 | protected $requestBody = ''; 71 | } 72 | -------------------------------------------------------------------------------- /app/Controllers/BaseController.php: -------------------------------------------------------------------------------- 1 | session = \Config\Services::session(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /system/Cache/Exceptions/CacheException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Cache\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\DebugTraceableTrait; 15 | use RuntimeException; 16 | 17 | /** 18 | * CacheException 19 | */ 20 | class CacheException extends RuntimeException implements ExceptionInterface 21 | { 22 | use DebugTraceableTrait; 23 | 24 | /** 25 | * Thrown when handler has no permission to write cache. 26 | * 27 | * @param string $path 28 | * 29 | * @return CacheException 30 | */ 31 | public static function forUnableToWrite(string $path) 32 | { 33 | return new static(lang('Cache.unableToWrite', [$path])); 34 | } 35 | 36 | /** 37 | * Thrown when an unrecognized handler is used. 38 | * 39 | * @return CacheException 40 | */ 41 | public static function forInvalidHandlers() 42 | { 43 | return new static(lang('Cache.invalidHandlers')); 44 | } 45 | 46 | /** 47 | * Thrown when no backup handler is setup in config. 48 | * 49 | * @return CacheException 50 | */ 51 | public static function forNoBackup() 52 | { 53 | return new static(lang('Cache.noBackup')); 54 | } 55 | 56 | /** 57 | * Thrown when specified handler was not found. 58 | * 59 | * @return CacheException 60 | */ 61 | public static function forHandlerNotFound() 62 | { 63 | return new static(lang('Cache.handlerNotFound')); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /tests/_support/Controllers/Popcorn.php: -------------------------------------------------------------------------------- 1 | respond('Oops', 567, 'Surprise'); 24 | } 25 | 26 | public function popper() 27 | { 28 | throw new \RuntimeException('Surprise', 500); 29 | } 30 | 31 | public function weasel() 32 | { 33 | $this->respond('', 200); 34 | } 35 | 36 | public function oops() 37 | { 38 | $this->failUnauthorized(); 39 | } 40 | 41 | public function goaway() 42 | { 43 | return redirect()->to('/'); 44 | } 45 | 46 | // @see https://github.com/codeigniter4/CodeIgniter4/issues/1834 47 | public function index3() 48 | { 49 | return $this->response->setJSON(['lang' => $this->request->getLocale()]); 50 | } 51 | 52 | public function canyon() 53 | { 54 | echo 'Hello-o-o ' . $this->request->getGet('foo'); 55 | } 56 | 57 | public function cat() 58 | { 59 | } 60 | 61 | public function json() 62 | { 63 | $this->respond(['answer' => 42]); 64 | } 65 | 66 | public function xml() 67 | { 68 | $this->respond('cat'); 69 | } 70 | 71 | public function toindex() 72 | { 73 | return redirect()->route('testing-index'); 74 | } 75 | 76 | public function echoJson() 77 | { 78 | return $this->response->setJSON($this->request->getJSON()); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /system/Commands/Housekeeping/ClearDebugbar.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Commands\Housekeeping; 13 | 14 | use CodeIgniter\CLI\BaseCommand; 15 | use CodeIgniter\CLI\CLI; 16 | 17 | /** 18 | * ClearDebugbar Command 19 | */ 20 | class ClearDebugbar extends BaseCommand 21 | { 22 | /** 23 | * The group the command is lumped under 24 | * when listing commands. 25 | * 26 | * @var string 27 | */ 28 | protected $group = 'Housekeeping'; 29 | 30 | /** 31 | * The Command's name 32 | * 33 | * @var string 34 | */ 35 | protected $name = 'debugbar:clear'; 36 | 37 | /** 38 | * The Command's usage 39 | * 40 | * @var string 41 | */ 42 | protected $usage = 'debugbar:clear'; 43 | 44 | /** 45 | * The Command's short description. 46 | * 47 | * @var string 48 | */ 49 | protected $description = 'Clears all debugbar JSON files.'; 50 | 51 | /** 52 | * Actually runs the command. 53 | * 54 | * @param array $params 55 | * 56 | * @return void 57 | */ 58 | public function run(array $params) 59 | { 60 | helper('filesystem'); 61 | 62 | if (! delete_files(WRITEPATH . 'debugbar')) 63 | { 64 | // @codeCoverageIgnoreStart 65 | CLI::error('Error deleting the debugbar JSON files.'); 66 | CLI::newLine(); 67 | return; 68 | // @codeCoverageIgnoreEnd 69 | } 70 | 71 | CLI::write('Debugbar cleared.', 'green'); 72 | CLI::newLine(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /system/Filters/DebugToolbar.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Filters; 13 | 14 | use CodeIgniter\HTTP\IncomingRequest; 15 | use CodeIgniter\HTTP\RequestInterface; 16 | use CodeIgniter\HTTP\Response; 17 | use CodeIgniter\HTTP\ResponseInterface; 18 | use Config\Services; 19 | 20 | /** 21 | * Debug toolbar filter 22 | */ 23 | class DebugToolbar implements FilterInterface 24 | { 25 | /** 26 | * We don't need to do anything here. 27 | * 28 | * @param RequestInterface|IncomingRequest $request 29 | * @param array|null $arguments 30 | * 31 | * @return void 32 | */ 33 | public function before(RequestInterface $request, $arguments = null) 34 | { 35 | } 36 | 37 | //-------------------------------------------------------------------- 38 | 39 | /** 40 | * If the debug flag is set (CI_DEBUG) then collect performance 41 | * and debug information and display it in a toolbar. 42 | * 43 | * @param RequestInterface|IncomingRequest $request 44 | * @param ResponseInterface|Response $response 45 | * @param array|null $arguments 46 | * 47 | * @return void 48 | */ 49 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) 50 | { 51 | Services::toolbar()->prepare($request, $response); 52 | } 53 | 54 | //-------------------------------------------------------------------- 55 | } 56 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/Renderer/Rich/BlacklistPlugin.php: -------------------------------------------------------------------------------- 1 | '.$this->renderLockedHeader($o, 'Blacklisted').''; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/Renderer/Rich/RecursionPlugin.php: -------------------------------------------------------------------------------- 1 | '.$this->renderLockedHeader($o, 'Recursion').''; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/Renderer/Rich/DepthLimitPlugin.php: -------------------------------------------------------------------------------- 1 | '.$this->renderLockedHeader($o, 'Depth Limit').''; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /app/Config/Modules.php: -------------------------------------------------------------------------------- 1 | renderer = $r; 38 | } 39 | 40 | abstract public function render(BasicObject $o); 41 | } 42 | -------------------------------------------------------------------------------- /tests/_support/Log/Handlers/TestHandler.php: -------------------------------------------------------------------------------- 1 | handles = $config['handles'] ?? []; 29 | $this->destination = $this->path . 'log-' . date('Y-m-d') . '.' . $this->fileExtension; 30 | 31 | self::$logs = []; 32 | } 33 | 34 | //-------------------------------------------------------------------- 35 | 36 | /** 37 | * Handles logging the message. 38 | * If the handler returns false, then execution of handlers 39 | * will stop. Any handlers that have not run, yet, will not 40 | * be run. 41 | * 42 | * @param $level 43 | * @param $message 44 | * 45 | * @return boolean 46 | */ 47 | public function handle($level, $message): bool 48 | { 49 | $date = date($this->dateFormat); 50 | 51 | self::$logs[] = strtoupper($level) . ' - ' . $date . ' --> ' . $message; 52 | 53 | return true; 54 | } 55 | 56 | //-------------------------------------------------------------------- 57 | 58 | public static function getLogs() 59 | { 60 | return self::$logs; 61 | } 62 | 63 | //-------------------------------------------------------------------- 64 | } 65 | -------------------------------------------------------------------------------- /app/Config/Events.php: -------------------------------------------------------------------------------- 1 | 0) 34 | { 35 | ob_end_flush(); 36 | } 37 | 38 | ob_start(function ($buffer) { 39 | return $buffer; 40 | }); 41 | } 42 | 43 | /* 44 | * -------------------------------------------------------------------- 45 | * Debug Toolbar Listeners. 46 | * -------------------------------------------------------------------- 47 | * If you delete, they will no longer be collected. 48 | */ 49 | if (CI_DEBUG) 50 | { 51 | Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); 52 | Services::toolbar()->respond(); 53 | } 54 | }); 55 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codeigniter4/codeigniter4", 3 | "type": "project", 4 | "description": "The CodeIgniter framework v4", 5 | "homepage": "https://codeigniter.com", 6 | "license": "MIT", 7 | "require": { 8 | "php": "^7.3||^8.0", 9 | "ext-curl": "*", 10 | "ext-intl": "*", 11 | "ext-json": "*", 12 | "ext-mbstring": "*", 13 | "kint-php/kint": "^3.3", 14 | "laminas/laminas-escaper": "^2.6", 15 | "psr/log": "^1.1" 16 | }, 17 | "require-dev": { 18 | "codeigniter4/codeigniter4-standard": "^1.0", 19 | "fakerphp/faker": "^1.9", 20 | "mikey179/vfsstream": "^1.6", 21 | "nette/utils": "^3.2", 22 | "phpstan/phpstan": "0.12.75", 23 | "phpunit/phpunit": "^9.1", 24 | "predis/predis": "^1.1", 25 | "rector/rector-prefixed": "^0.9", 26 | "squizlabs/php_codesniffer": "^3.3" 27 | }, 28 | "suggest": { 29 | "ext-fileinfo": "Improves mime type detection for files" 30 | }, 31 | "config": { 32 | "optimize-autoloader": true, 33 | "preferred-install": "dist", 34 | "sort-packages": true 35 | }, 36 | "autoload": { 37 | "psr-4": { 38 | "CodeIgniter\\": "system/" 39 | }, 40 | "exclude-from-classmap": [ 41 | "**/Database/Migrations/**" 42 | ] 43 | }, 44 | "autoload-dev": { 45 | "psr-4": { 46 | "CodeIgniter\\": "tests/system/", 47 | "Utils\\": "utils/" 48 | } 49 | }, 50 | "scripts": { 51 | "post-update-cmd": [ 52 | "CodeIgniter\\ComposerScripts::postUpdate", 53 | "bash admin/setup.sh" 54 | ], 55 | "analyze": "phpstan analyze", 56 | "test": "phpunit" 57 | }, 58 | "support": { 59 | "forum": "http://forum.codeigniter.com/", 60 | "source": "https://github.com/codeigniter4/CodeIgniter4", 61 | "slack": "https://codeigniterchat.slack.com" 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /tests/_support/Services.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Router\Exceptions; 13 | 14 | use CodeIgniter\Exceptions\FrameworkException; 15 | 16 | /** 17 | * RouterException 18 | */ 19 | class RouterException extends FrameworkException 20 | { 21 | /** 22 | * Thrown when the actual parameter type does not match 23 | * the expected types. 24 | * 25 | * @return RouterException 26 | */ 27 | public static function forInvalidParameterType() 28 | { 29 | return new static(lang('Router.invalidParameterType')); 30 | } 31 | 32 | /** 33 | * Thrown when a default route is not set. 34 | * 35 | * @return RouterException 36 | */ 37 | public static function forMissingDefaultRoute() 38 | { 39 | return new static(lang('Router.missingDefaultRoute')); 40 | } 41 | 42 | /** 43 | * Throw when controller or its method is not found. 44 | * 45 | * @param string $controller 46 | * @param string $method 47 | * 48 | * @return RouterException 49 | */ 50 | public static function forControllerNotFound(string $controller, string $method) 51 | { 52 | return new static(lang('HTTP.controllerNotFound', [$controller, $method])); 53 | } 54 | 55 | /** 56 | * Throw when route is not valid. 57 | * 58 | * @param string $route 59 | * 60 | * @return RouterException 61 | */ 62 | public static function forInvalidRoute(string $route) 63 | { 64 | return new static(lang('HTTP.invalidRoute', [$route])); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /app/Config/Kint.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | use Config\Services; 13 | 14 | /** 15 | * CodeIgniter Security Helpers 16 | */ 17 | 18 | if (! function_exists('sanitize_filename')) 19 | { 20 | /** 21 | * Sanitize a filename to use in a URI. 22 | * 23 | * @param string $filename 24 | * 25 | * @return string 26 | */ 27 | function sanitize_filename(string $filename): string 28 | { 29 | return Services::security()->sanitizeFilename($filename); 30 | } 31 | } 32 | 33 | //-------------------------------------------------------------------- 34 | 35 | if (! function_exists('strip_image_tags')) 36 | { 37 | /** 38 | * Strip Image Tags 39 | * 40 | * @param string $str 41 | * 42 | * @return string 43 | */ 44 | function strip_image_tags(string $str): string 45 | { 46 | return preg_replace([ 47 | '##i', 48 | '#`]+)).*?\>#i', 49 | ], '\\2', $str 50 | ); 51 | } 52 | } 53 | 54 | //-------------------------------------------------------------------- 55 | 56 | if (! function_exists('encode_php_tags')) 57 | { 58 | /** 59 | * Convert PHP tags to entities 60 | * 61 | * @param string $str 62 | * 63 | * @return string 64 | */ 65 | function encode_php_tags(string $str): string 66 | { 67 | return str_replace([''], ['<?', '?>'], $str); 68 | } 69 | } 70 | 71 | //-------------------------------------------------------------------- 72 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; 35 | $app = require realpath($bootstrap) ?: $bootstrap; 36 | 37 | /* 38 | *--------------------------------------------------------------- 39 | * LAUNCH THE APPLICATION 40 | *--------------------------------------------------------------- 41 | * Now that everything is setup, it's time to actually fire 42 | * up the engines and make this app do its thang. 43 | */ 44 | $app->run(); 45 | -------------------------------------------------------------------------------- /system/ThirdParty/Kint/Object/TraceObject.php: -------------------------------------------------------------------------------- 1 | size) { 40 | return 'empty'; 41 | } 42 | 43 | return parent::getSize(); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /system/Language/en/Database.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | // Database language settings 13 | return [ 14 | 'invalidEvent' => '{0} is not a valid Model Event callback.', 15 | 'invalidArgument' => 'You must provide a valid {0}.', 16 | 'invalidAllowedFields' => 'Allowed fields must be specified for model: {0}', 17 | 'emptyDataset' => 'There is no data to {0}.', 18 | 'emptyPrimaryKey' => 'There is no primary key defined when trying to make {0}.', 19 | 'failGetFieldData' => 'Failed to get field data from database.', 20 | 'failGetIndexData' => 'Failed to get index data from database.', 21 | 'failGetForeignKeyData' => 'Failed to get foreign key data from database.', 22 | 'parseStringFail' => 'Parsing key string failed.', 23 | 'featureUnavailable' => 'This feature is not available for the database you are using.', 24 | 'tableNotFound' => 'Table `{0}` was not found in the current database.', 25 | 'noPrimaryKey' => '`{0}` model class does not specify a Primary Key.', 26 | 'noDateFormat' => '`{0}` model class does not have a valid dateFormat.', 27 | 'fieldNotExists' => 'Field `{0}` not found.', 28 | 'forEmptyInputGiven' => 'Empty statement is given for the field `{0}`', 29 | 'forFindColumnHaveMultipleColumns' => 'Only single column allowed in Column name.', 30 | ]; 31 | -------------------------------------------------------------------------------- /app/Config/Migrations.php: -------------------------------------------------------------------------------- 1 | php spark migrate:create 46 | * 47 | * Typical formats: 48 | * - YmdHis_ 49 | * - Y-m-d-His_ 50 | * - Y_m_d_His_ 51 | * 52 | * @var string 53 | */ 54 | public $timestampFormat = 'Y-m-d-His_'; 55 | } 56 | --------------------------------------------------------------------------------