├── CHANGELOG.md ├── LICENSE ├── README.md ├── SECURITY.md ├── app ├── .htaccess ├── Common.php ├── Config │ ├── App.php │ ├── Autoload.php │ ├── Boot │ │ ├── development.php │ │ ├── production.php │ │ └── testing.php │ ├── CURLRequest.php │ ├── Cache.php │ ├── Constants.php │ ├── ContentSecurityPolicy.php │ ├── Cookie.php │ ├── Database.php │ ├── DocTypes.php │ ├── Email.php │ ├── Encryption.php │ ├── Events.php │ ├── Exceptions.php │ ├── Feature.php │ ├── Filters.php │ ├── ForeignCharacters.php │ ├── Format.php │ ├── Generators.php │ ├── Honeypot.php │ ├── Images.php │ ├── Kint.php │ ├── Logger.php │ ├── Migrations.php │ ├── Mimes.php │ ├── Modules.php │ ├── Pager.php │ ├── Paths.php │ ├── Publisher.php │ ├── Routes.php │ ├── Security.php │ ├── Services.php │ ├── Toolbar.php │ ├── UserAgents.php │ ├── Validation.php │ └── View.php ├── Controllers │ ├── BaseController.php │ └── Home.php ├── Database │ ├── Migrations │ │ └── .gitkeep │ └── Seeds │ │ └── .gitkeep ├── Filters │ └── .gitkeep ├── Helpers │ └── .gitkeep ├── Language │ ├── .gitkeep │ └── en │ │ └── Validation.php ├── Libraries │ └── .gitkeep ├── Models │ └── .gitkeep ├── ThirdParty │ └── .gitkeep ├── Views │ ├── errors │ │ ├── cli │ │ │ ├── error_404.php │ │ │ ├── error_exception.php │ │ │ └── production.php │ │ └── html │ │ │ ├── debug.css │ │ │ ├── debug.js │ │ │ ├── error_404.php │ │ │ ├── error_exception.php │ │ │ └── production.php │ └── welcome_message.php └── index.html ├── composer.json ├── env ├── public ├── .htaccess ├── favicon.ico ├── index.php └── robots.txt ├── spark ├── system ├── .htaccess ├── API │ └── ResponseTrait.php ├── Autoloader │ ├── Autoloader.php │ └── FileLocator.php ├── BaseModel.php ├── CLI │ ├── BaseCommand.php │ ├── CLI.php │ ├── CommandRunner.php │ ├── Commands.php │ ├── Console.php │ ├── Exceptions │ │ └── CLIException.php │ └── GeneratorTrait.php ├── Cache │ ├── CacheFactory.php │ ├── CacheInterface.php │ ├── Exceptions │ │ ├── CacheException.php │ │ └── ExceptionInterface.php │ └── Handlers │ │ ├── BaseHandler.php │ │ ├── DummyHandler.php │ │ ├── FileHandler.php │ │ ├── MemcachedHandler.php │ │ ├── PredisHandler.php │ │ ├── RedisHandler.php │ │ └── WincacheHandler.php ├── CodeIgniter.php ├── Commands │ ├── Cache │ │ ├── ClearCache.php │ │ └── InfoCache.php │ ├── Database │ │ ├── CreateDatabase.php │ │ ├── Migrate.php │ │ ├── MigrateRefresh.php │ │ ├── MigrateRollback.php │ │ ├── MigrateStatus.php │ │ ├── Seed.php │ │ └── ShowTableInfo.php │ ├── Encryption │ │ └── GenerateKey.php │ ├── Generators │ │ ├── CommandGenerator.php │ │ ├── ConfigGenerator.php │ │ ├── ControllerGenerator.php │ │ ├── EntityGenerator.php │ │ ├── FilterGenerator.php │ │ ├── MigrateCreate.php │ │ ├── MigrationGenerator.php │ │ ├── ModelGenerator.php │ │ ├── ScaffoldGenerator.php │ │ ├── SeederGenerator.php │ │ ├── SessionMigrationGenerator.php │ │ ├── ValidationGenerator.php │ │ └── Views │ │ │ ├── command.tpl.php │ │ │ ├── config.tpl.php │ │ │ ├── controller.tpl.php │ │ │ ├── entity.tpl.php │ │ │ ├── filter.tpl.php │ │ │ ├── migration.tpl.php │ │ │ ├── model.tpl.php │ │ │ ├── seeder.tpl.php │ │ │ └── validation.tpl.php │ ├── Help.php │ ├── Housekeeping │ │ ├── ClearDebugbar.php │ │ └── ClearLogs.php │ ├── ListCommands.php │ ├── Server │ │ ├── Serve.php │ │ └── rewrite.php │ └── Utilities │ │ ├── Environment.php │ │ ├── Namespaces.php │ │ ├── Publish.php │ │ ├── Routes.php │ │ └── Routes │ │ ├── AutoRouteCollector.php │ │ ├── AutoRouterImproved │ │ ├── AutoRouteCollector.php │ │ └── ControllerMethodReader.php │ │ ├── ControllerFinder.php │ │ ├── ControllerMethodReader.php │ │ ├── FilterCollector.php │ │ ├── FilterFinder.php │ │ └── SampleURIGenerator.php ├── Common.php ├── ComposerScripts.php ├── Config │ ├── AutoloadConfig.php │ ├── BaseConfig.php │ ├── BaseService.php │ ├── Config.php │ ├── DotEnv.php │ ├── Factories.php │ ├── Factory.php │ ├── ForeignCharacters.php │ ├── Publisher.php │ ├── Routes.php │ ├── Services.php │ └── View.php ├── Controller.php ├── Cookie │ ├── CloneableCookieInterface.php │ ├── Cookie.php │ ├── CookieInterface.php │ ├── CookieStore.php │ └── Exceptions │ │ └── CookieException.php ├── Database │ ├── BaseBuilder.php │ ├── BaseConnection.php │ ├── BasePreparedQuery.php │ ├── BaseResult.php │ ├── BaseUtils.php │ ├── Config.php │ ├── ConnectionInterface.php │ ├── Database.php │ ├── Exceptions │ │ ├── DataException.php │ │ ├── DatabaseException.php │ │ └── ExceptionInterface.php │ ├── Forge.php │ ├── Migration.php │ ├── MigrationRunner.php │ ├── ModelFactory.php │ ├── MySQLi │ │ ├── Builder.php │ │ ├── Connection.php │ │ ├── Forge.php │ │ ├── PreparedQuery.php │ │ ├── Result.php │ │ └── Utils.php │ ├── OCI8 │ │ ├── Builder.php │ │ ├── Connection.php │ │ ├── Forge.php │ │ ├── PreparedQuery.php │ │ ├── Result.php │ │ └── Utils.php │ ├── Postgre │ │ ├── Builder.php │ │ ├── Connection.php │ │ ├── Forge.php │ │ ├── PreparedQuery.php │ │ ├── Result.php │ │ └── Utils.php │ ├── PreparedQueryInterface.php │ ├── Query.php │ ├── QueryInterface.php │ ├── RawSql.php │ ├── ResultInterface.php │ ├── SQLSRV │ │ ├── Builder.php │ │ ├── Connection.php │ │ ├── Forge.php │ │ ├── PreparedQuery.php │ │ ├── Result.php │ │ └── Utils.php │ ├── SQLite3 │ │ ├── Builder.php │ │ ├── Connection.php │ │ ├── Forge.php │ │ ├── PreparedQuery.php │ │ ├── Result.php │ │ ├── Table.php │ │ └── Utils.php │ └── Seeder.php ├── Debug │ ├── Exceptions.php │ ├── Iterator.php │ ├── Timer.php │ ├── Toolbar.php │ └── Toolbar │ │ ├── Collectors │ │ ├── BaseCollector.php │ │ ├── Config.php │ │ ├── Database.php │ │ ├── Events.php │ │ ├── Files.php │ │ ├── History.php │ │ ├── Logs.php │ │ ├── Routes.php │ │ ├── Timers.php │ │ └── Views.php │ │ └── Views │ │ ├── _config.tpl │ │ ├── _database.tpl │ │ ├── _events.tpl │ │ ├── _files.tpl │ │ ├── _history.tpl │ │ ├── _logs.tpl │ │ ├── _routes.tpl │ │ ├── toolbar.css │ │ ├── toolbar.js │ │ ├── toolbar.tpl.php │ │ └── toolbarloader.js ├── Email │ └── Email.php ├── Encryption │ ├── EncrypterInterface.php │ ├── Encryption.php │ ├── Exceptions │ │ └── EncryptionException.php │ └── Handlers │ │ ├── BaseHandler.php │ │ ├── OpenSSLHandler.php │ │ └── SodiumHandler.php ├── Entity.php ├── Entity │ ├── Cast │ │ ├── ArrayCast.php │ │ ├── BaseCast.php │ │ ├── BooleanCast.php │ │ ├── CSVCast.php │ │ ├── CastInterface.php │ │ ├── DatetimeCast.php │ │ ├── FloatCast.php │ │ ├── IntegerCast.php │ │ ├── JsonCast.php │ │ ├── ObjectCast.php │ │ ├── StringCast.php │ │ ├── TimestampCast.php │ │ └── URICast.php │ ├── Entity.php │ └── Exceptions │ │ └── CastException.php ├── Events │ └── Events.php ├── Exceptions │ ├── AlertError.php │ ├── CastException.php │ ├── ConfigException.php │ ├── CriticalError.php │ ├── DebugTraceableTrait.php │ ├── DownloadException.php │ ├── EmergencyError.php │ ├── ExceptionInterface.php │ ├── FrameworkException.php │ ├── ModelException.php │ ├── PageNotFoundException.php │ └── TestException.php ├── Files │ ├── Exceptions │ │ ├── FileException.php │ │ └── FileNotFoundException.php │ ├── File.php │ └── FileCollection.php ├── Filters │ ├── CSRF.php │ ├── DebugToolbar.php │ ├── Exceptions │ │ └── FilterException.php │ ├── FilterInterface.php │ ├── Filters.php │ ├── Honeypot.php │ ├── InvalidChars.php │ └── SecureHeaders.php ├── Format │ ├── Exceptions │ │ └── FormatException.php │ ├── Format.php │ ├── FormatterInterface.php │ ├── JSONFormatter.php │ └── XMLFormatter.php ├── HTTP │ ├── CLIRequest.php │ ├── CURLRequest.php │ ├── ContentSecurityPolicy.php │ ├── DownloadResponse.php │ ├── Exceptions │ │ └── HTTPException.php │ ├── Files │ │ ├── FileCollection.php │ │ ├── UploadedFile.php │ │ └── UploadedFileInterface.php │ ├── Header.php │ ├── IncomingRequest.php │ ├── Message.php │ ├── MessageInterface.php │ ├── MessageTrait.php │ ├── Negotiate.php │ ├── RedirectResponse.php │ ├── Request.php │ ├── RequestInterface.php │ ├── RequestTrait.php │ ├── Response.php │ ├── ResponseInterface.php │ ├── ResponseTrait.php │ ├── URI.php │ └── UserAgent.php ├── Helpers │ ├── array_helper.php │ ├── cookie_helper.php │ ├── date_helper.php │ ├── filesystem_helper.php │ ├── form_helper.php │ ├── html_helper.php │ ├── inflector_helper.php │ ├── number_helper.php │ ├── security_helper.php │ ├── test_helper.php │ ├── text_helper.php │ ├── url_helper.php │ └── xml_helper.php ├── Honeypot │ ├── Exceptions │ │ └── HoneypotException.php │ └── Honeypot.php ├── I18n │ ├── Exceptions │ │ └── I18nException.php │ ├── Time.php │ └── TimeDifference.php ├── Images │ ├── Exceptions │ │ └── ImageException.php │ ├── Handlers │ │ ├── BaseHandler.php │ │ ├── GDHandler.php │ │ └── ImageMagickHandler.php │ ├── Image.php │ └── ImageHandlerInterface.php ├── Language │ ├── Language.php │ └── en │ │ ├── CLI.php │ │ ├── Cache.php │ │ ├── Cast.php │ │ ├── Cookie.php │ │ ├── Core.php │ │ ├── Database.php │ │ ├── Email.php │ │ ├── Encryption.php │ │ ├── Fabricator.php │ │ ├── Files.php │ │ ├── Filters.php │ │ ├── Format.php │ │ ├── HTTP.php │ │ ├── Images.php │ │ ├── Log.php │ │ ├── Migrations.php │ │ ├── Number.php │ │ ├── Pager.php │ │ ├── Publisher.php │ │ ├── RESTful.php │ │ ├── Router.php │ │ ├── Security.php │ │ ├── Session.php │ │ ├── Test.php │ │ ├── Time.php │ │ ├── Validation.php │ │ └── View.php ├── Log │ ├── Exceptions │ │ └── LogException.php │ ├── Handlers │ │ ├── BaseHandler.php │ │ ├── ChromeLoggerHandler.php │ │ ├── ErrorlogHandler.php │ │ ├── FileHandler.php │ │ └── HandlerInterface.php │ └── Logger.php ├── Model.php ├── Modules │ └── Modules.php ├── Pager │ ├── Exceptions │ │ └── PagerException.php │ ├── Pager.php │ ├── PagerInterface.php │ ├── PagerRenderer.php │ └── Views │ │ ├── default_full.php │ │ ├── default_head.php │ │ └── default_simple.php ├── Publisher │ ├── Exceptions │ │ └── PublisherException.php │ └── Publisher.php ├── RESTful │ ├── BaseResource.php │ ├── ResourceController.php │ └── ResourcePresenter.php ├── Router │ ├── AutoRouter.php │ ├── AutoRouterImproved.php │ ├── AutoRouterInterface.php │ ├── Exceptions │ │ ├── RedirectException.php │ │ └── RouterException.php │ ├── RouteCollection.php │ ├── RouteCollectionInterface.php │ ├── Router.php │ └── RouterInterface.php ├── Security │ ├── Exceptions │ │ └── SecurityException.php │ ├── Security.php │ └── SecurityInterface.php ├── Session │ ├── Exceptions │ │ └── SessionException.php │ ├── Handlers │ │ ├── ArrayHandler.php │ │ ├── BaseHandler.php │ │ ├── Database │ │ │ ├── MySQLiHandler.php │ │ │ └── PostgreHandler.php │ │ ├── DatabaseHandler.php │ │ ├── FileHandler.php │ │ ├── MemcachedHandler.php │ │ └── RedisHandler.php │ ├── Session.php │ └── SessionInterface.php ├── Test │ ├── CIDatabaseTestCase.php │ ├── CIUnitTestCase.php │ ├── ConfigFromArrayTrait.php │ ├── Constraints │ │ └── SeeInDatabase.php │ ├── ControllerResponse.php │ ├── ControllerTestTrait.php │ ├── ControllerTester.php │ ├── DOMParser.php │ ├── DatabaseTestTrait.php │ ├── Fabricator.php │ ├── FeatureResponse.php │ ├── FeatureTestCase.php │ ├── FeatureTestTrait.php │ ├── FilterTestTrait.php │ ├── Filters │ │ └── CITestStreamFilter.php │ ├── Interfaces │ │ └── FabricatorModel.php │ ├── Mock │ │ ├── MockAppConfig.php │ │ ├── MockAutoload.php │ │ ├── MockBuilder.php │ │ ├── MockCLIConfig.php │ │ ├── MockCURLRequest.php │ │ ├── MockCache.php │ │ ├── MockCodeIgniter.php │ │ ├── MockCommon.php │ │ ├── MockConnection.php │ │ ├── MockEmail.php │ │ ├── MockEvents.php │ │ ├── MockFileLogger.php │ │ ├── MockIncomingRequest.php │ │ ├── MockLanguage.php │ │ ├── MockLogger.php │ │ ├── MockQuery.php │ │ ├── MockResourceController.php │ │ ├── MockResourcePresenter.php │ │ ├── MockResponse.php │ │ ├── MockResult.php │ │ ├── MockSecurity.php │ │ ├── MockSecurityConfig.php │ │ ├── MockServices.php │ │ ├── MockSession.php │ │ └── MockTable.php │ ├── ReflectionHelper.php │ ├── TestLogger.php │ ├── TestResponse.php │ └── bootstrap.php ├── ThirdParty │ ├── Escaper │ │ ├── Escaper.php │ │ ├── Exception │ │ │ ├── ExceptionInterface.php │ │ │ ├── InvalidArgumentException.php │ │ │ └── RuntimeException.php │ │ └── LICENSE.md │ ├── Kint │ │ ├── CallFinder.php │ │ ├── Kint.php │ │ ├── LICENSE │ │ ├── Parser │ │ │ ├── ArrayLimitPlugin.php │ │ │ ├── ArrayObjectPlugin.php │ │ │ ├── Base64Plugin.php │ │ │ ├── BinaryPlugin.php │ │ │ ├── BlacklistPlugin.php │ │ │ ├── ClassMethodsPlugin.php │ │ │ ├── ClassStaticsPlugin.php │ │ │ ├── ClosurePlugin.php │ │ │ ├── ColorPlugin.php │ │ │ ├── DOMDocumentPlugin.php │ │ │ ├── DateTimePlugin.php │ │ │ ├── EnumPlugin.php │ │ │ ├── FsPathPlugin.php │ │ │ ├── IteratorPlugin.php │ │ │ ├── JsonPlugin.php │ │ │ ├── MicrotimePlugin.php │ │ │ ├── MysqliPlugin.php │ │ │ ├── Parser.php │ │ │ ├── Plugin.php │ │ │ ├── ProxyPlugin.php │ │ │ ├── SerializePlugin.php │ │ │ ├── SimpleXMLElementPlugin.php │ │ │ ├── SplFileInfoPlugin.php │ │ │ ├── SplObjectStoragePlugin.php │ │ │ ├── StreamPlugin.php │ │ │ ├── TablePlugin.php │ │ │ ├── ThrowablePlugin.php │ │ │ ├── TimestampPlugin.php │ │ │ ├── ToStringPlugin.php │ │ │ ├── TracePlugin.php │ │ │ └── XmlPlugin.php │ │ ├── Renderer │ │ │ ├── CliRenderer.php │ │ │ ├── PlainRenderer.php │ │ │ ├── Renderer.php │ │ │ ├── Rich │ │ │ │ ├── ArrayLimitPlugin.php │ │ │ │ ├── BinaryPlugin.php │ │ │ │ ├── BlacklistPlugin.php │ │ │ │ ├── CallablePlugin.php │ │ │ │ ├── ClosurePlugin.php │ │ │ │ ├── ColorPlugin.php │ │ │ │ ├── DepthLimitPlugin.php │ │ │ │ ├── DocstringPlugin.php │ │ │ │ ├── MicrotimePlugin.php │ │ │ │ ├── Plugin.php │ │ │ │ ├── PluginInterface.php │ │ │ │ ├── RecursionPlugin.php │ │ │ │ ├── SimpleXMLElementPlugin.php │ │ │ │ ├── SourcePlugin.php │ │ │ │ ├── TabPluginInterface.php │ │ │ │ ├── TablePlugin.php │ │ │ │ ├── TimestampPlugin.php │ │ │ │ ├── TraceFramePlugin.php │ │ │ │ └── ValuePluginInterface.php │ │ │ ├── RichRenderer.php │ │ │ ├── Text │ │ │ │ ├── ArrayLimitPlugin.php │ │ │ │ ├── BlacklistPlugin.php │ │ │ │ ├── DepthLimitPlugin.php │ │ │ │ ├── EnumPlugin.php │ │ │ │ ├── MicrotimePlugin.php │ │ │ │ ├── Plugin.php │ │ │ │ ├── RecursionPlugin.php │ │ │ │ └── TracePlugin.php │ │ │ └── TextRenderer.php │ │ ├── Utils.php │ │ ├── Zval │ │ │ ├── BlobValue.php │ │ │ ├── ClosureValue.php │ │ │ ├── DateTimeValue.php │ │ │ ├── EnumValue.php │ │ │ ├── InstanceValue.php │ │ │ ├── MethodValue.php │ │ │ ├── ParameterValue.php │ │ │ ├── Representation │ │ │ │ ├── ColorRepresentation.php │ │ │ │ ├── DocstringRepresentation.php │ │ │ │ ├── MicrotimeRepresentation.php │ │ │ │ ├── Representation.php │ │ │ │ ├── SourceRepresentation.php │ │ │ │ └── SplFileInfoRepresentation.php │ │ │ ├── ResourceValue.php │ │ │ ├── SimpleXMLElementValue.php │ │ │ ├── StreamValue.php │ │ │ ├── ThrowableValue.php │ │ │ ├── TraceFrameValue.php │ │ │ ├── TraceValue.php │ │ │ └── Value.php │ │ ├── init.php │ │ ├── init_helpers.php │ │ └── resources │ │ │ └── compiled │ │ │ ├── aante-light.css │ │ │ ├── microtime.js │ │ │ ├── original.css │ │ │ ├── plain.css │ │ │ ├── plain.js │ │ │ ├── rich.js │ │ │ ├── shared.js │ │ │ ├── solarized-dark.css │ │ │ └── solarized.css │ └── PSR │ │ └── Log │ │ ├── AbstractLogger.php │ │ ├── InvalidArgumentException.php │ │ ├── LICENSE │ │ ├── LogLevel.php │ │ ├── LoggerAwareInterface.php │ │ ├── LoggerAwareTrait.php │ │ ├── LoggerInterface.php │ │ ├── LoggerTrait.php │ │ └── NullLogger.php ├── Throttle │ ├── Throttler.php │ └── ThrottlerInterface.php ├── Typography │ └── Typography.php ├── Validation │ ├── CreditCardRules.php │ ├── Exceptions │ │ └── ValidationException.php │ ├── FileRules.php │ ├── FormatRules.php │ ├── Rules.php │ ├── StrictRules │ │ ├── CreditCardRules.php │ │ ├── FileRules.php │ │ ├── FormatRules.php │ │ └── Rules.php │ ├── Validation.php │ ├── ValidationInterface.php │ └── Views │ │ ├── list.php │ │ └── single.php ├── View │ ├── Cell.php │ ├── Exceptions │ │ └── ViewException.php │ ├── Filters.php │ ├── Parser.php │ ├── Plugins.php │ ├── RendererInterface.php │ ├── Table.php │ ├── View.php │ ├── ViewDecoratorInterface.php │ └── ViewDecoratorTrait.php ├── bootstrap.php └── index.html ├── tests ├── .htaccess ├── README.md └── _support │ ├── Autoloader │ ├── FatalLocator.php │ ├── UnnamespacedClass.php │ └── functions.php │ ├── Cache │ └── RestrictiveHandler.php │ ├── Commands │ ├── AbstractInfo.php │ ├── AppInfo.php │ ├── Foobar.php │ ├── InvalidCommand.php │ ├── LanguageCommand.php │ ├── ParamsReveal.php │ └── Unsuffixable.php │ ├── Config │ ├── BadRegistrar.php │ ├── Filters.php │ ├── Registrar.php │ ├── Routes.php │ ├── Services.php │ └── TestRegistrar.php │ ├── Controllers │ ├── Hello.php │ ├── Newautorouting.php │ ├── Popcorn.php │ └── Remap.php │ ├── Database │ ├── Migrations │ │ └── 20160428212500_Create_test_tables.php │ └── Seeds │ │ ├── AnotherSeeder.php │ │ └── CITestSeeder.php │ ├── Entity │ ├── Cast │ │ ├── CastBase64.php │ │ ├── CastPassParameters.php │ │ └── NotExtendsBaseCast.php │ └── User.php │ ├── Files │ ├── able │ │ ├── apple.php │ │ ├── fig_3.php │ │ └── prune_ripe.php │ └── baker │ │ └── banana.php │ ├── Filters │ └── Customfilter.php │ ├── HTTP │ └── Files │ │ ├── CookiesHolder.txt │ │ └── tmp │ │ ├── fileA.txt │ │ ├── fileB.txt │ │ ├── fileC.csv │ │ ├── fileD.zip │ │ └── fileE.zip.rar │ ├── Helpers │ └── baguette_helper.php │ ├── Images │ ├── 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 │ ├── Steveston_dusk.JPG │ ├── ci-logo.gif │ ├── ci-logo.jpeg │ ├── ci-logo.png │ └── ci-logo.webp │ ├── Language │ ├── SecondMockLanguage.php │ ├── ab-CD │ │ └── Allin.php │ ├── ab │ │ └── Allin.php │ ├── en-ZZ │ │ └── More.php │ ├── en │ │ ├── Allin.php │ │ ├── Core.php │ │ ├── Foo.php │ │ ├── Language.php │ │ ├── More.php │ │ └── Nested.php │ └── ru │ │ └── Language.php │ ├── Log │ └── Handlers │ │ └── TestHandler.php │ ├── MigrationTestMigrations │ └── Database │ │ └── Migrations │ │ ├── 2018-01-24-102300_Another_migration.py │ │ ├── 2018-01-24-102301_Some_migration.php │ │ └── 2018-01-24-102302_Another_migration.php │ ├── Models │ ├── EntityModel.php │ ├── EventModel.php │ ├── FabricatorModel.php │ ├── GetCompiledModelTest.php │ ├── JobModel.php │ ├── SecondaryModel.php │ ├── SimpleEntity.php │ ├── StringifyPkeyModel.php │ ├── UserModel.php │ ├── UserObjModel.php │ ├── ValidErrorsModel.php │ ├── ValidModel.php │ └── WithoutAutoIncrementModel.php │ ├── Publishers │ └── TestPublisher.php │ ├── RESTful │ ├── Worker.php │ └── Worker2.php │ ├── SomeEntity.php │ ├── Validation │ ├── TestRules.php │ └── uploads │ │ ├── abc77tz │ │ └── phpUxc0ty │ ├── View │ ├── BadDecorator.php │ ├── SampleClass.php │ ├── SampleClassWithInitController.php │ ├── Views │ │ ├── simple.php │ │ ├── simpler.php │ │ └── simples.php │ └── WorldDecorator.php │ └── Widgets │ ├── NopeWidget.php │ ├── OtherWidget.php │ └── SomeWidget.php └── writable ├── .htaccess ├── cache └── index.html ├── debugbar └── .gitkeep ├── logs └── index.html ├── session └── index.html └── uploads └── index.html /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014-2019 British Columbia Institute of Technology 4 | Copyright (c) 2019-2022 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 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | The development team and community take all security issues seriously. **Please do not make public any uncovered flaws.** 4 | 5 | ## Reporting a Vulnerability 6 | 7 | Thank you for improving the security of our code! Any assistance in removing security flaws will be acknowledged. 8 | 9 | **Please report security flaws by emailing the development team directly: security@codeigniter.com**. 10 | 11 | The lead maintainer will acknowledge your email within 48 hours, and will send a more detailed response within 48 hours indicating 12 | the next steps in handling your report. After the initial reply to your report, the security team will endeavor to keep you informed of the 13 | progress towards a fix and full announcement, and may ask for additional information or guidance. 14 | 15 | ## Disclosure Policy 16 | 17 | When the security team receives a security bug report, they will assign it to a primary handler. 18 | This person will coordinate the fix and release process, involving the following steps: 19 | 20 | - Confirm the problem and determine the affected versions. 21 | - Audit code to find any potential similar problems. 22 | - Prepare fixes for all releases still under maintenance. These fixes will be released as fast as possible. 23 | - Publish security advisories at https://github.com/codeigniter4/CodeIgniter4/security/advisories 24 | 25 | ## Comments on this Policy 26 | 27 | If you have suggestions on how this process could be improved please submit a Pull Request. 28 | -------------------------------------------------------------------------------- /app/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /app/Common.php: -------------------------------------------------------------------------------- 1 | {label}'; 36 | 37 | /** 38 | * Honeypot container 39 | * 40 | * @var string 41 | */ 42 | public $container = '
{template}
'; 43 | } 44 | -------------------------------------------------------------------------------- /app/Config/Images.php: -------------------------------------------------------------------------------- 1 | 30 | */ 31 | public $handlers = [ 32 | 'gd' => GDHandler::class, 33 | 'imagick' => ImageMagickHandler::class, 34 | ]; 35 | } 36 | -------------------------------------------------------------------------------- /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 int 37 | */ 38 | public $perPage = 20; 39 | } 40 | -------------------------------------------------------------------------------- /app/Config/Publisher.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public $restrictions = [ 25 | ROOTPATH => '*', 26 | FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i', 27 | ]; 28 | } 29 | -------------------------------------------------------------------------------- /app/Config/Services.php: -------------------------------------------------------------------------------- 1 | 35 | */ 36 | public $templates = [ 37 | 'list' => 'CodeIgniter\Validation\Views\list', 38 | 'single' => 'CodeIgniter\Validation\Views\single', 39 | ]; 40 | 41 | // -------------------------------------------------------------------- 42 | // Rules 43 | // -------------------------------------------------------------------- 44 | } 45 | -------------------------------------------------------------------------------- /app/Controllers/Home.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 | -------------------------------------------------------------------------------- /app/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /system/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /system/CLI/Exceptions/CLIException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * @return CLIException 29 | */ 30 | public static function forInvalidColor(string $type, string $color) 31 | { 32 | return new static(lang('CLI.invalidColor', [$type, $color])); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /system/Cache/Exceptions/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * @deprecated 4.1.2 21 | */ 22 | interface ExceptionInterface 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /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/Commands/Generators/Views/entity.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\Entity\Entity; 6 | 7 | class {class} extends Entity 8 | { 9 | protected $datamap = []; 10 | protected $dates = ['created_at', 'updated_at', 'deleted_at']; 11 | protected $casts = []; 12 | } 13 | -------------------------------------------------------------------------------- /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 | 17 | 'ip_address' => ['type' => 'VARCHAR', 'constraint' => 45, 'null' => false], 18 | 'timestamp timestamp DEFAULT CURRENT_TIMESTAMP NOT NULL', 19 | 'data' => ['type' => 'BLOB', 'null' => false], 20 | 21 | 'ip_address inet NOT NULL', 22 | 'timestamp timestamptz DEFAULT CURRENT_TIMESTAMP NOT NULL', 23 | "data bytea DEFAULT '' NOT NULL", 24 | 25 | ]); 26 | 27 | $this->forge->addKey(['id', 'ip_address'], true); 28 | 29 | $this->forge->addKey('id', true); 30 | 31 | $this->forge->addKey('timestamp'); 32 | $this->forge->createTable('', true); 33 | } 34 | 35 | public function down() 36 | { 37 | $this->forge->dropTable('', true); 38 | } 39 | 40 | public function up() 41 | { 42 | // 43 | } 44 | 45 | public function down() 46 | { 47 | // 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /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 $useSoftDeletes = 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/Commands/Generators/Views/seeder.tpl.php: -------------------------------------------------------------------------------- 1 | <@php 2 | 3 | namespace {namespace}; 4 | 5 | use CodeIgniter\Database\Seeder; 6 | 7 | class {class} extends Seeder 8 | { 9 | public function run() 10 | { 11 | // 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /system/Commands/Server/rewrite.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | return; 25 | } 26 | 27 | $uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH)); 28 | 29 | // Front Controller path - expected to be in the default folder 30 | $fcpath = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR; 31 | 32 | // Full path 33 | $path = $fcpath . ltrim($uri, '/'); 34 | 35 | // If $path is an existing file or folder within the public folder 36 | // then let the request handle it like normal. 37 | if ($uri !== '/' && (is_file($path) || is_dir($path))) { 38 | return false; 39 | } 40 | 41 | // Otherwise, we'll load the index file and let 42 | // the framework handle the request from here. 43 | require_once $fcpath . 'index.php'; 44 | // @codeCoverageIgnoreEnd 45 | -------------------------------------------------------------------------------- /system/Config/Config.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Config; 13 | 14 | /** 15 | * @deprecated Use CodeIgniter\Config\Factories::config() 16 | */ 17 | class Config 18 | { 19 | /** 20 | * Create new configuration instances or return 21 | * a shared instance 22 | * 23 | * @param string $name Configuration name 24 | * @param bool $getShared Use shared instance 25 | * 26 | * @return mixed|null 27 | */ 28 | public static function get(string $name, bool $getShared = true) 29 | { 30 | return Factories::config($name, ['getShared' => $getShared]); 31 | } 32 | 33 | /** 34 | * Helper method for injecting mock instances while testing. 35 | * 36 | * @param object $instance 37 | */ 38 | public static function injectMock(string $name, $instance) 39 | { 40 | Factories::injectMock('config', $name, $instance); 41 | } 42 | 43 | /** 44 | * Resets the static arrays 45 | */ 46 | public static function reset() 47 | { 48 | Factories::reset('config'); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /system/Config/Factory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Config/Publisher.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Config; 13 | 14 | /** 15 | * Publisher Configuration 16 | * 17 | * Defines basic security restrictions for the Publisher class 18 | * to prevent abuse by injecting malicious files into a project. 19 | */ 20 | class Publisher extends BaseConfig 21 | { 22 | /** 23 | * A list of allowed destinations with a (pseudo-)regex 24 | * of allowed files for each destination. 25 | * Attempts to publish to directories not in this list will 26 | * result in a PublisherException. Files that do no fit the 27 | * pattern will cause copy/merge to fail. 28 | * 29 | * @var array 30 | */ 31 | public $restrictions = [ 32 | ROOTPATH => '*', 33 | FCPATH => '#\.(?css|js|map|htm?|xml|json|webmanifest|tff|eot|woff?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i', 34 | ]; 35 | 36 | /** 37 | * Disables Registrars to prevent modules from altering the restrictions. 38 | */ 39 | final protected function registerProperties() 40 | { 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /system/Config/Routes.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | /* 13 | * System URI Routing 14 | * 15 | * This file contains any routing to system tools, such as command-line 16 | * tools for migrations, etc. 17 | * 18 | * It is called by Config\Routes, and has the $routes RouteCollection 19 | * already loaded up and ready for us to use. 20 | */ 21 | 22 | // CLI Catchall - uses a _remap to call Commands 23 | $routes->cli('ci(:any)', '\CodeIgniter\CLI\CommandRunner::index/$1'); 24 | -------------------------------------------------------------------------------- /system/Database/Exceptions/DatabaseException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 int 22 | */ 23 | protected $code = EXIT_DATABASE; 24 | } 25 | -------------------------------------------------------------------------------- /system/Database/Exceptions/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Database/ModelFactory.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * @codeCoverageIgnore 22 | */ 23 | class ModelFactory 24 | { 25 | /** 26 | * Creates new Model instances or returns a shared instance 27 | * 28 | * @return mixed 29 | */ 30 | public static function get(string $name, bool $getShared = true, ?ConnectionInterface $connection = null) 31 | { 32 | return Factories::models($name, ['getShared' => $getShared], $connection); 33 | } 34 | 35 | /** 36 | * Helper method for injecting mock instances while testing. 37 | * 38 | * @param object $instance 39 | */ 40 | public static function injectMock(string $name, $instance) 41 | { 42 | Factories::injectMock('models', $name, $instance); 43 | } 44 | 45 | /** 46 | * Resets the static arrays 47 | */ 48 | public static function reset() 49 | { 50 | Factories::reset('models'); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /system/Database/MySQLi/Builder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | protected function _fromTables(): string 49 | { 50 | if (! empty($this->QBJoin) && count($this->QBFrom) > 1) { 51 | return '(' . implode(', ', $this->QBFrom) . ')'; 52 | } 53 | 54 | return implode(', ', $this->QBFrom); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /system/Database/MySQLi/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * Platform dependent version of the backup function. 38 | * 39 | * @return mixed 40 | */ 41 | public function _backup(?array $prefs = null) 42 | { 43 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /system/Database/OCI8/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database\OCI8; 13 | 14 | use CodeIgniter\Database\BaseUtils; 15 | use CodeIgniter\Database\Exceptions\DatabaseException; 16 | 17 | /** 18 | * Utils for OCI8 19 | */ 20 | class Utils extends BaseUtils 21 | { 22 | /** 23 | * List databases statement 24 | * 25 | * @var string 26 | */ 27 | protected $listDatabases = 'SELECT TABLESPACE_NAME FROM USER_TABLESPACES'; 28 | 29 | /** 30 | * Platform dependent version of the backup function. 31 | * 32 | * @return mixed 33 | */ 34 | public function _backup(?array $prefs = null) 35 | { 36 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /system/Database/Postgre/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * Platform dependent version of the backup function. 38 | * 39 | * @return mixed 40 | */ 41 | public function _backup(?array $prefs = null) 42 | { 43 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /system/Database/PreparedQueryInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database; 13 | 14 | /** 15 | * Prepared query interface 16 | */ 17 | interface PreparedQueryInterface 18 | { 19 | /** 20 | * Takes a new set of data and runs it against the currently 21 | * prepared query. Upon success, will return a Results object. 22 | * 23 | * @return ResultInterface 24 | */ 25 | public function execute(...$data); 26 | 27 | /** 28 | * Prepares the query against the database, and saves the connection 29 | * info necessary to execute the query later. 30 | * 31 | * @return mixed 32 | */ 33 | public function prepare(string $sql, array $options = []); 34 | 35 | /** 36 | * Explicity closes the statement. 37 | */ 38 | public function close(); 39 | 40 | /** 41 | * Returns the SQL that has been prepared. 42 | */ 43 | public function getQueryString(): string; 44 | 45 | /** 46 | * Returns the error code created while executing this statement. 47 | */ 48 | public function getErrorCode(): int; 49 | 50 | /** 51 | * Returns the error message created while executing this statement. 52 | */ 53 | public function getErrorMessage(): string; 54 | } 55 | -------------------------------------------------------------------------------- /system/Database/RawSql.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Database; 13 | 14 | class RawSql 15 | { 16 | /** 17 | * @var string Raw SQL string 18 | */ 19 | private string $string; 20 | 21 | public function __construct(string $sqlString) 22 | { 23 | $this->string = $sqlString; 24 | } 25 | 26 | public function __toString(): string 27 | { 28 | return $this->string; 29 | } 30 | 31 | /** 32 | * Create new instance with new SQL string 33 | */ 34 | public function with(string $newSqlString): self 35 | { 36 | $new = clone $this; 37 | $new->string = $newSqlString; 38 | 39 | return $new; 40 | } 41 | 42 | /** 43 | * Returns unique id for binding key 44 | */ 45 | public function getBindingKey(): string 46 | { 47 | return 'RawSql' . spl_object_id($this); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /system/Database/SQLSRV/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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\ConnectionInterface; 16 | use CodeIgniter\Database\Exceptions\DatabaseException; 17 | 18 | /** 19 | * Utils for SQLSRV 20 | */ 21 | class Utils extends BaseUtils 22 | { 23 | /** 24 | * List databases statement 25 | * 26 | * @var string 27 | */ 28 | protected $listDatabases = 'EXEC sp_helpdb'; // Can also be: EXEC sp_databases 29 | 30 | /** 31 | * OPTIMIZE TABLE statement 32 | * 33 | * @var string 34 | */ 35 | protected $optimizeTable = 'ALTER INDEX all ON %s REORGANIZE'; 36 | 37 | public function __construct(ConnectionInterface $db) 38 | { 39 | parent::__construct($db); 40 | 41 | $this->optimizeTable = 'ALTER INDEX all ON ' . $this->db->schema . '.%s REORGANIZE'; 42 | } 43 | 44 | /** 45 | * Platform dependent version of the backup function. 46 | * 47 | * @return mixed 48 | */ 49 | public function _backup(?array $prefs = null) 50 | { 51 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /system/Database/SQLite3/Utils.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * Platform dependent version of the backup function. 31 | * 32 | * @return mixed 33 | */ 34 | public function _backup(?array $prefs = null) 35 | { 36 | throw new DatabaseException('Unsupported feature of the database platform you are using.'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Collectors/Config.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public static function display(): array 27 | { 28 | $config = config(App::class); 29 | 30 | return [ 31 | 'ciVersion' => CodeIgniter::CI_VERSION, 32 | 'phpVersion' => PHP_VERSION, 33 | 'phpSAPI' => PHP_SAPI, 34 | 'environment' => ENVIRONMENT, 35 | 'baseURL' => $config->baseURL, 36 | 'timezone' => app_timezone(), 37 | 'locale' => Services::request()->getLocale(), 38 | 'cspEnabled' => $config->CSPEnabled, 39 | ]; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_database.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | {queries} 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 23 | 24 | {/queries} 25 | 26 |
TimeQuery String
{duration}{! sql !}{trace-file}
27 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_events.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | {events} 11 | 12 | 13 | 14 | 15 | 16 | {/events} 17 | 18 |
TimeEvent NameTimes Called
{ duration } ms{event}{count}
19 | -------------------------------------------------------------------------------- /system/Debug/Toolbar/Views/_files.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | {userFiles} 4 | 5 | 6 | 7 | 8 | {/userFiles} 9 | {coreFiles} 10 | 11 | 12 | 13 | 14 | {/coreFiles} 15 | 16 |
{name}{path}
{name}{path}
17 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /system/Encryption/EncrypterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Entity.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter; 13 | 14 | use CodeIgniter\Entity\Entity as CoreEntity; 15 | 16 | /** 17 | * Entity encapsulation, for use with CodeIgniter\Model 18 | * 19 | * @deprecated use CodeIgniter\Entity\Entity class instead 20 | */ 21 | class Entity extends CoreEntity 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /system/Entity/Cast/ArrayCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class ArrayCast 16 | */ 17 | class ArrayCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): array 23 | { 24 | if (is_string($value) && (strpos($value, 'a:') === 0 || strpos($value, 's:') === 0)) { 25 | $value = unserialize($value); 26 | } 27 | 28 | return (array) $value; 29 | } 30 | 31 | /** 32 | * {@inheritDoc} 33 | */ 34 | public static function set($value, array $params = []): string 35 | { 36 | return serialize($value); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /system/Entity/Cast/BaseCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class BaseCast 16 | */ 17 | abstract class BaseCast implements CastInterface 18 | { 19 | /** 20 | * Get 21 | * 22 | * @param array|bool|float|int|object|string|null $value Data 23 | * @param array $params Additional param 24 | * 25 | * @return array|bool|float|int|object|string|null 26 | */ 27 | public static function get($value, array $params = []) 28 | { 29 | return $value; 30 | } 31 | 32 | /** 33 | * Set 34 | * 35 | * @param array|bool|float|int|object|string|null $value Data 36 | * @param array $params Additional param 37 | * 38 | * @return array|bool|float|int|object|string|null 39 | */ 40 | public static function set($value, array $params = []) 41 | { 42 | return $value; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /system/Entity/Cast/BooleanCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class BooleanCast 16 | */ 17 | class BooleanCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): bool 23 | { 24 | return (bool) $value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Entity/Cast/CSVCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class CSVCast 16 | */ 17 | class CSVCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): array 23 | { 24 | return explode(',', $value); 25 | } 26 | 27 | /** 28 | * {@inheritDoc} 29 | */ 30 | public static function set($value, array $params = []): string 31 | { 32 | return implode(',', $value); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /system/Entity/Cast/CastInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Interface CastInterface 16 | */ 17 | interface CastInterface 18 | { 19 | /** 20 | * Get 21 | * 22 | * @param array|bool|float|int|object|string|null $value Data 23 | * @param array $params Additional param 24 | * 25 | * @return array|bool|float|int|object|string|null 26 | */ 27 | public static function get($value, array $params = []); 28 | 29 | /** 30 | * Set 31 | * 32 | * @param array|bool|float|int|object|string|null $value Data 33 | * @param array $params Additional param 34 | * 35 | * @return array|bool|float|int|object|string|null 36 | */ 37 | public static function set($value, array $params = []); 38 | } 39 | -------------------------------------------------------------------------------- /system/Entity/Cast/DatetimeCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | use CodeIgniter\I18n\Time; 15 | use DateTime; 16 | use Exception; 17 | 18 | /** 19 | * Class DatetimeCast 20 | */ 21 | class DatetimeCast extends BaseCast 22 | { 23 | /** 24 | * {@inheritDoc} 25 | * 26 | * @throws Exception 27 | * 28 | * @return Time 29 | */ 30 | public static function get($value, array $params = []) 31 | { 32 | if ($value instanceof Time) { 33 | return $value; 34 | } 35 | 36 | if ($value instanceof DateTime) { 37 | return Time::createFromInstance($value); 38 | } 39 | 40 | if (is_numeric($value)) { 41 | return Time::createFromTimestamp($value); 42 | } 43 | 44 | if (is_string($value)) { 45 | return Time::parse($value); 46 | } 47 | 48 | return $value; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /system/Entity/Cast/FloatCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class FloatCast 16 | */ 17 | class FloatCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): float 23 | { 24 | return (float) $value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Entity/Cast/IntegerCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class IntegerCast 16 | */ 17 | class IntegerCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): int 23 | { 24 | return (int) $value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Entity/Cast/ObjectCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class ObjectCast 16 | */ 17 | class ObjectCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): object 23 | { 24 | return (object) $value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Entity/Cast/StringCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | /** 15 | * Class StringCast 16 | */ 17 | class StringCast extends BaseCast 18 | { 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | public static function get($value, array $params = []): string 23 | { 24 | return (string) $value; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Entity/Cast/TimestampCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | use CodeIgniter\Entity\Exceptions\CastException; 15 | 16 | /** 17 | * Class TimestampCast 18 | */ 19 | class TimestampCast extends BaseCast 20 | { 21 | /** 22 | * {@inheritDoc} 23 | */ 24 | public static function get($value, array $params = []) 25 | { 26 | $value = strtotime($value); 27 | 28 | if ($value === false) { 29 | throw CastException::forInvalidTimestamp(); 30 | } 31 | 32 | return $value; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /system/Entity/Cast/URICast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Entity\Cast; 13 | 14 | use CodeIgniter\HTTP\URI; 15 | 16 | /** 17 | * Class URICast 18 | */ 19 | class URICast extends BaseCast 20 | { 21 | /** 22 | * {@inheritDoc} 23 | */ 24 | public static function get($value, array $params = []): URI 25 | { 26 | return $value instanceof URI ? $value : new URI($value); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /system/Exceptions/AlertError.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Exceptions/ConfigException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * Exit status code 23 | * 24 | * @var int 25 | */ 26 | protected $code = EXIT_CONFIG; 27 | 28 | public static function forDisabledMigrations() 29 | { 30 | return new static(lang('Migrations.disabled')); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /system/Exceptions/CriticalError.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Exceptions/DebugTraceableTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | use Throwable; 15 | 16 | /** 17 | * This trait provides framework exceptions the ability to pinpoint 18 | * accurately where the exception was raised rather than instantiated. 19 | * 20 | * This is used primarily for factory-instantiated exceptions. 21 | */ 22 | trait DebugTraceableTrait 23 | { 24 | /** 25 | * Tweaks the exception's constructor to assign the file/line to where 26 | * it is actually raised rather than were it is instantiated. 27 | */ 28 | final public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null) 29 | { 30 | parent::__construct($message, $code, $previous); 31 | 32 | $trace = $this->getTrace()[0]; 33 | 34 | if (isset($trace['class']) && $trace['class'] === static::class) { 35 | [ 36 | 'line' => $this->line, 37 | 'file' => $this->file, 38 | ] = $trace; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /system/Exceptions/DownloadException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Exceptions/EmergencyError.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Exceptions/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | interface ExceptionInterface 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /system/Exceptions/ModelException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | /** 15 | * Model Exceptions. 16 | */ 17 | class ModelException extends FrameworkException 18 | { 19 | public static function forNoPrimaryKey(string $modelName) 20 | { 21 | return new static(lang('Database.noPrimaryKey', [$modelName])); 22 | } 23 | 24 | public static function forNoDateFormat(string $modelName) 25 | { 26 | return new static(lang('Database.noDateFormat', [$modelName])); 27 | } 28 | 29 | public static function forMethodNotAvailable(string $modelName, string $methodName) 30 | { 31 | return new static(lang('Database.methodNotAvailable', [$modelName, $methodName])); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /system/Exceptions/TestException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Exceptions; 13 | 14 | /** 15 | * Exception for automatic logging. 16 | */ 17 | class TestException extends CriticalError 18 | { 19 | use DebugTraceableTrait; 20 | 21 | public static function forInvalidMockClass(string $name) 22 | { 23 | return new static(lang('Test.invalidMockClass', [$name])); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /system/Files/Exceptions/FileNotFoundException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Filters/DebugToolbar.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Filters; 13 | 14 | use CodeIgniter\HTTP\RequestInterface; 15 | use CodeIgniter\HTTP\ResponseInterface; 16 | use Config\Services; 17 | 18 | /** 19 | * Debug toolbar filter 20 | */ 21 | class DebugToolbar implements FilterInterface 22 | { 23 | /** 24 | * We don't need to do anything here. 25 | * 26 | * @param array|null $arguments 27 | */ 28 | public function before(RequestInterface $request, $arguments = null) 29 | { 30 | } 31 | 32 | /** 33 | * If the debug flag is set (CI_DEBUG) then collect performance 34 | * and debug information and display it in a toolbar. 35 | * 36 | * @param array|null $arguments 37 | */ 38 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) 39 | { 40 | Services::toolbar()->prepare($request, $response); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /system/Filters/Exceptions/FilterException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * @return static 27 | */ 28 | public static function forNoAlias(string $alias) 29 | { 30 | return new static(lang('Filters.noFilter', [$alias])); 31 | } 32 | 33 | /** 34 | * Thrown when the filter class does not implement FilterInterface. 35 | * 36 | * @return static 37 | */ 38 | public static function forIncorrectInterface(string $class) 39 | { 40 | return new static(lang('Filters.incorrectInterface', [$class])); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /system/Format/FormatterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 array|string $data 23 | * 24 | * @return bool|string 25 | */ 26 | public function format($data); 27 | } 28 | -------------------------------------------------------------------------------- /system/Format/JSONFormatter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 false|string (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 | throw FormatException::forInvalidJSON(json_last_error_msg()); 42 | } 43 | 44 | return $result; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /system/Helpers/security_helper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | use Config\Services; 13 | 14 | // CodeIgniter Security Helpers 15 | 16 | if (! function_exists('sanitize_filename')) { 17 | /** 18 | * Sanitize a filename to use in a URI. 19 | */ 20 | function sanitize_filename(string $filename): string 21 | { 22 | return Services::security()->sanitizeFilename($filename); 23 | } 24 | } 25 | 26 | if (! function_exists('strip_image_tags')) { 27 | /** 28 | * Strip Image Tags 29 | */ 30 | function strip_image_tags(string $str): string 31 | { 32 | return preg_replace( 33 | [ 34 | '##i', 35 | '#`]+)).*?\>#i', 36 | ], 37 | '\\2', 38 | $str 39 | ); 40 | } 41 | } 42 | 43 | if (! function_exists('encode_php_tags')) { 44 | /** 45 | * Convert PHP tags to entities 46 | */ 47 | function encode_php_tags(string $str): string 48 | { 49 | return str_replace([''], ['<?', '?>'], $str); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /system/Honeypot/Exceptions/HoneypotException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Cache.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Language/en/Cast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | // Cast language settings 13 | return [ 14 | 'baseCastMissing' => 'The "{0}" class must inherit the "CodeIgniter\Entity\Cast\BaseCast" class.', 15 | 'invalidCastMethod' => 'The "{0}" is invalid cast method, valid methods are: ["get", "set"].', 16 | 'invalidTimestamp' => 'Type casting "timestamp" expects a correct timestamp.', 17 | 'jsonErrorCtrlChar' => 'Unexpected control character found.', 18 | 'jsonErrorDepth' => 'Maximum stack depth exceeded.', 19 | 'jsonErrorStateMismatch' => 'Underflow or the modes mismatch.', 20 | 'jsonErrorSyntax' => 'Syntax error, malformed JSON.', 21 | 'jsonErrorUnknown' => 'Unknown error.', 22 | 'jsonErrorUtf8' => 'Malformed UTF-8 characters, possibly incorrectly encoded.', 23 | ]; 24 | -------------------------------------------------------------------------------- /system/Language/en/Cookie.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Core.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | 'invalidPhpVersion' => 'Your PHP version must be {0} or higher to run CodeIgniter. Current version: {1}', 18 | 'missingExtension' => 'The framework needs the following extension(s) installed and loaded: {0}.', 19 | 'noHandlers' => '{0} must provide at least one Handler.', 20 | ]; 21 | -------------------------------------------------------------------------------- /system/Language/en/Encryption.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Fabricator.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Files.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | 'expectedDirectory' => '{0} expects a valid directory.', 17 | 'expectedFile' => '{0} expects a valid file.', 18 | ]; 19 | -------------------------------------------------------------------------------- /system/Language/en/Filters.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Format.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Log.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | 'invalidMessageType' => 'The given message type "{0}" is not supported.', 16 | ]; 17 | -------------------------------------------------------------------------------- /system/Language/en/Number.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Pager.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Publisher.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | // Publisher language settings 13 | return [ 14 | 'collision' => 'Publisher encountered an unexpected {0} while copying {1} to {2}.', 15 | 'destinationNotAllowed' => 'Destination is not on the allowed list of Publisher directories: {0}', 16 | 'fileNotAllowed' => '{0} fails the following restriction for {1}: {2}', 17 | 18 | // Publish Command 19 | 'publishMissing' => 'No Publisher classes detected in {0} across all namespaces.', 20 | 'publishSuccess' => '{0} published {1} file(s) to {2}.', 21 | 'publishFailure' => '{0} failed to publish to {1}!', 22 | ]; 23 | -------------------------------------------------------------------------------- /system/Language/en/RESTful.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Router.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | 'invalidDynamicController' => 'A dynamic controller is not allowed for security reasons. Route handler: {0}', 17 | 'invalidControllerName' => 'The namespace delimiter is a backslash (\), not a slash (/). Route handler: {0}', 18 | ]; 19 | -------------------------------------------------------------------------------- /system/Language/en/Security.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Language/en/Session.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Language/en/Test.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | // Testing language settings 13 | return [ 14 | 'invalidMockClass' => '{0} is not a valid Mock class', 15 | ]; 16 | -------------------------------------------------------------------------------- /system/Language/en/View.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | 'invalidDecoratorClass' => '{0} is not a valid View Decorator.', 21 | ]; 22 | -------------------------------------------------------------------------------- /system/Log/Exceptions/LogException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public static function forInvalidMessageType(string $messageType) 24 | { 25 | return new static(lang('Log.invalidMessageType', [$messageType])); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /system/Log/Handlers/BaseHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Log\Handlers; 13 | 14 | /** 15 | * Base class for logging 16 | */ 17 | abstract class BaseHandler implements HandlerInterface 18 | { 19 | /** 20 | * Handles 21 | * 22 | * @var array 23 | */ 24 | protected $handles; 25 | 26 | /** 27 | * Date format for logging 28 | * 29 | * @var string 30 | */ 31 | protected $dateFormat = 'Y-m-d H:i:s'; 32 | 33 | /** 34 | * Constructor 35 | */ 36 | public function __construct(array $config) 37 | { 38 | $this->handles = $config['handles'] ?? []; 39 | } 40 | 41 | /** 42 | * Checks whether the Handler will handle logging items of this 43 | * log Level. 44 | */ 45 | public function canHandle(string $level): bool 46 | { 47 | return in_array($level, $this->handles, true); 48 | } 49 | 50 | /** 51 | * Stores the date format to use while logging messages. 52 | */ 53 | public function setDateFormat(string $format): HandlerInterface 54 | { 55 | $this->dateFormat = $format; 56 | 57 | return $this; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /system/Log/Handlers/HandlerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public function handle($level, $message): bool; 29 | 30 | /** 31 | * Checks whether the Handler will handle logging items of this 32 | * log Level. 33 | */ 34 | public function canHandle(string $level): bool; 35 | 36 | /** 37 | * Sets the preferred date format to use when logging. 38 | * 39 | * @return HandlerInterface 40 | */ 41 | public function setDateFormat(string $format); 42 | } 43 | -------------------------------------------------------------------------------- /system/Modules/Modules.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Modules; 13 | 14 | /** 15 | * Modules Class 16 | * 17 | * @see https://codeigniter.com/user_guide/general/modules.html 18 | */ 19 | class Modules 20 | { 21 | /** 22 | * Auto-Discover 23 | * 24 | * @var bool 25 | */ 26 | public $enabled = true; 27 | 28 | /** 29 | * Auto-Discovery Within Composer Packages 30 | * 31 | * @var bool 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 | public function shouldDiscover(string $alias): bool 46 | { 47 | if (! $this->enabled) { 48 | return false; 49 | } 50 | 51 | return in_array(strtolower($alias), $this->aliases, true); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /system/Pager/Exceptions/PagerException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Pager/Views/default_full.php: -------------------------------------------------------------------------------- 1 | setSurroundCount(2); 9 | ?> 10 | 11 | 48 | -------------------------------------------------------------------------------- /system/Pager/Views/default_head.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | echo '' . PHP_EOL; 21 | } 22 | 23 | echo '' . PHP_EOL; 24 | 25 | if ($pager->hasNext()) { 26 | echo '' . PHP_EOL; 27 | } 28 | -------------------------------------------------------------------------------- /system/Pager/Views/default_simple.php: -------------------------------------------------------------------------------- 1 | setSurroundCount(0); 9 | ?> 10 | 24 | -------------------------------------------------------------------------------- /system/Router/AutoRouterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Router; 13 | 14 | /** 15 | * Expected behavior of a AutoRouter. 16 | */ 17 | interface AutoRouterInterface 18 | { 19 | /** 20 | * Returns controller, method and params from the URI. 21 | * 22 | * @return array [directory_name, controller_name, controller_method, params] 23 | */ 24 | public function getRoute(string $uri): array; 25 | } 26 | -------------------------------------------------------------------------------- /system/Router/Exceptions/RedirectException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | * HTTP status code for redirects 23 | * 24 | * @var int 25 | */ 26 | protected $code = 302; 27 | } 28 | -------------------------------------------------------------------------------- /system/Security/Exceptions/SecurityException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public static function forInvalidUTF8Chars(string $source, string $string) 24 | { 25 | return new static( 26 | 'Invalid UTF-8 characters in ' . $source . ': ' . $string, 27 | 400 28 | ); 29 | } 30 | 31 | public static function forInvalidControlChars(string $source, string $string) 32 | { 33 | return new static( 34 | 'Invalid Control characters in ' . $source . ': ' . $string, 35 | 400 36 | ); 37 | } 38 | 39 | /** 40 | * @deprecated Use `CookieException::forInvalidSameSite()` instead. 41 | * 42 | * @codeCoverageIgnore 43 | */ 44 | public static function forInvalidSameSite(string $samesite) 45 | { 46 | return new static(lang('Security.invalidSameSite', [$samesite])); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /system/Session/Handlers/Database/MySQLiHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Session\Handlers\Database; 13 | 14 | use CodeIgniter\Session\Handlers\DatabaseHandler; 15 | 16 | /** 17 | * Session handler for MySQLi 18 | */ 19 | class MySQLiHandler extends DatabaseHandler 20 | { 21 | /** 22 | * Lock the session. 23 | */ 24 | protected function lockSession(string $sessionID): bool 25 | { 26 | $arg = md5($sessionID . ($this->matchIP ? '_' . $this->ipAddress : '')); 27 | if ($this->db->query("SELECT GET_LOCK('{$arg}', 300) AS ci_session_lock")->getRow()->ci_session_lock) { 28 | $this->lock = $arg; 29 | 30 | return true; 31 | } 32 | 33 | return $this->fail(); 34 | } 35 | 36 | /** 37 | * Releases the lock, if any. 38 | */ 39 | protected function releaseLock(): bool 40 | { 41 | if (! $this->lock) { 42 | return true; 43 | } 44 | 45 | if ($this->db->query("SELECT RELEASE_LOCK('{$this->lock}') AS ci_session_lock")->getRow()->ci_session_lock) { 46 | $this->lock = false; 47 | 48 | return true; 49 | } 50 | 51 | return $this->fail(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /system/Test/CIDatabaseTestCase.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test; 13 | 14 | /** 15 | * CIDatabaseTestCase 16 | * 17 | * Use DatabaseTestTrait instead. 18 | * 19 | * @deprecated 4.1.2 20 | */ 21 | abstract class CIDatabaseTestCase extends CIUnitTestCase 22 | { 23 | use DatabaseTestTrait; 24 | } 25 | -------------------------------------------------------------------------------- /system/Test/ConfigFromArrayTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test; 13 | 14 | use LogicException; 15 | 16 | trait ConfigFromArrayTrait 17 | { 18 | /** 19 | * Creates a Config instance from an array. 20 | * 21 | * @template T of \CodeIgniter\Config\BaseConfig 22 | * 23 | * @param class-string $classname Config classname 24 | * @param array $config 25 | * 26 | * @return T 27 | */ 28 | private function createConfigFromArray(string $classname, array $config) 29 | { 30 | $configObj = new $classname(); 31 | 32 | foreach ($config as $key => $value) { 33 | if (property_exists($configObj, $key)) { 34 | $configObj->{$key} = $value; 35 | 36 | continue; 37 | } 38 | 39 | throw new LogicException( 40 | 'No such property: ' . $classname . '::$' . $key 41 | ); 42 | } 43 | 44 | return $configObj; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /system/Test/FeatureResponse.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test; 13 | 14 | /** 15 | * Assertions for a response 16 | * 17 | * @deprecated Use TestResponse directly 18 | */ 19 | class FeatureResponse extends TestResponse 20 | { 21 | /** 22 | * @deprecated Will be protected in a future release, use response() instead 23 | */ 24 | public $response; 25 | } 26 | -------------------------------------------------------------------------------- /system/Test/Filters/CITestStreamFilter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Filters; 13 | 14 | use php_user_filter; 15 | 16 | /** 17 | * Used to capture output during unit testing, so that it can 18 | * be used in assertions. 19 | */ 20 | class CITestStreamFilter extends php_user_filter 21 | { 22 | /** 23 | * Buffer to capture stream content. 24 | * 25 | * @var string 26 | */ 27 | public static $buffer = ''; 28 | 29 | /** 30 | * This method is called whenever data is read from or written to the 31 | * attached stream (such as with fread() or fwrite()). 32 | * 33 | * @param resource $in 34 | * @param resource $out 35 | * @param int $consumed 36 | * @param bool $closing 37 | */ 38 | public function filter($in, $out, &$consumed, $closing): int 39 | { 40 | while ($bucket = stream_bucket_make_writeable($in)) { 41 | static::$buffer .= $bucket->data; 42 | 43 | $consumed += $bucket->datalen; 44 | } 45 | 46 | return PSFS_PASS_ON; 47 | } 48 | } 49 | 50 | stream_filter_register('CITestStreamFilter', CITestStreamFilter::class); // @codeCoverageIgnore 51 | -------------------------------------------------------------------------------- /system/Test/Mock/MockAppConfig.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public $uriProtocol = 'REQUEST_URI'; 20 | public $cookiePrefix = ''; 21 | public $cookieDomain = ''; 22 | public $cookiePath = '/'; 23 | public $cookieSecure = false; 24 | public $cookieHTTPOnly = false; 25 | public $cookieSameSite = 'Lax'; 26 | public $proxyIPs = ''; 27 | public $CSRFTokenName = 'csrf_test_name'; 28 | public $CSRFHeaderName = 'X-CSRF-TOKEN'; 29 | public $CSRFCookieName = 'csrf_cookie_name'; 30 | public $CSRFExpire = 7200; 31 | public $CSRFRegenerate = true; 32 | public $CSRFExcludeURIs = ['http://example.com']; 33 | public $CSRFRedirect = false; 34 | public $CSRFSameSite = 'Lax'; 35 | public $CSPEnabled = false; 36 | public $defaultLocale = 'en'; 37 | public $negotiateLocale = false; 38 | public $supportedLocales = [ 39 | 'en', 40 | 'es', 41 | ]; 42 | } 43 | -------------------------------------------------------------------------------- /system/Test/Mock/MockAutoload.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public $classmap = []; 20 | 21 | public function __construct() 22 | { 23 | // Don't call the parent since we don't want the default mappings. 24 | // parent::__construct(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /system/Test/Mock/MockBuilder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Database\BaseBuilder; 15 | 16 | class MockBuilder extends BaseBuilder 17 | { 18 | protected $supportedIgnoreStatements = [ 19 | 'update' => 'IGNORE', 20 | 'insert' => 'IGNORE', 21 | 'delete' => 'IGNORE', 22 | ]; 23 | } 24 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCLIConfig.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public $uriProtocol = 'REQUEST_URI'; 20 | public $cookiePrefix = ''; 21 | public $cookieDomain = ''; 22 | public $cookiePath = '/'; 23 | public $cookieSecure = false; 24 | public $cookieHTTPOnly = false; 25 | public $cookieSameSite = 'Lax'; 26 | public $proxyIPs = ''; 27 | public $CSRFTokenName = 'csrf_test_name'; 28 | public $CSRFCookieName = 'csrf_cookie_name'; 29 | public $CSRFExpire = 7200; 30 | public $CSRFRegenerate = true; 31 | public $CSRFExcludeURIs = ['http://example.com']; 32 | public $CSRFSameSite = 'Lax'; 33 | public $CSPEnabled = false; 34 | public $defaultLocale = 'en'; 35 | public $negotiateLocale = false; 36 | public $supportedLocales = [ 37 | 'en', 38 | 'es', 39 | ]; 40 | } 41 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCURLRequest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | protected $output = ''; 27 | 28 | public function setOutput($output) 29 | { 30 | $this->output = $output; 31 | 32 | return $this; 33 | } 34 | 35 | protected function sendRequest(array $curlOptions = []): string 36 | { 37 | // Save so we can access later. 38 | $this->curl_options = $curlOptions; 39 | 40 | return $this->output; 41 | } 42 | 43 | // for testing purposes only 44 | public function getBaseURI() 45 | { 46 | return $this->baseURI; 47 | } 48 | 49 | // for testing purposes only 50 | public function getDelay() 51 | { 52 | return $this->delay; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCodeIgniter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 ?string $context = 'web'; 19 | 20 | protected function callExit($code) 21 | { 22 | // Do not call exit() in testing. 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /system/Test/Mock/MockCommon.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | if (! function_exists('is_cli')) { 13 | /** 14 | * Is CLI? 15 | * 16 | * Test to see if a request was made from the command line. 17 | * You can set the return value for testing. 18 | * 19 | * @param bool $newReturn return value to set 20 | */ 21 | function is_cli(?bool $newReturn = null): bool 22 | { 23 | // PHPUnit always runs via CLI. 24 | static $returnValue = true; 25 | 26 | if ($newReturn !== null) { 27 | $returnValue = $newReturn; 28 | } 29 | 30 | return $returnValue; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /system/Test/Mock/MockEmail.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 bool 23 | */ 24 | public $returnValue = true; 25 | 26 | public function send($autoClear = true) 27 | { 28 | if ($this->returnValue) { 29 | $this->setArchiveValues(); 30 | 31 | if ($autoClear) { 32 | $this->clear(); 33 | } 34 | 35 | Events::trigger('email', $this->archive); 36 | } 37 | 38 | return $this->returnValue; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /system/Test/Mock/MockEvents.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Test/Mock/MockFileLogger.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | public function __construct(array $config) 29 | { 30 | parent::__construct($config); 31 | $this->handles = $config['handles'] ?? []; 32 | $this->destination = $this->path . 'log-' . date('Y-m-d') . '.' . $this->fileExtension; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /system/Test/Mock/MockIncomingRequest.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | protected function detectURI($protocol, $baseURL) 19 | { 20 | // Do nothing... 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /system/Test/Mock/MockLanguage.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Language\Language; 15 | 16 | class MockLanguage extends Language 17 | { 18 | /** 19 | * Stores the data that should be 20 | * returned by the 'requireFile()' method. 21 | * 22 | * @var mixed 23 | */ 24 | protected $data; 25 | 26 | /** 27 | * Sets the data that should be returned by the 28 | * 'requireFile()' method to allow easy overrides 29 | * during testing. 30 | * 31 | * @return $this 32 | */ 33 | public function setData(string $file, array $data, ?string $locale = null) 34 | { 35 | $this->language[$locale ?? $this->locale][$file] = $data; 36 | 37 | return $this; 38 | } 39 | 40 | /** 41 | * Provides an override that allows us to set custom 42 | * data to be returned easily during testing. 43 | */ 44 | protected function requireFile(string $path): array 45 | { 46 | return $this->data ?? []; 47 | } 48 | 49 | /** 50 | * Arbitrarily turnoff internationalization support for testing 51 | */ 52 | public function disableIntlSupport() 53 | { 54 | $this->intlSupport = false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /system/Test/Mock/MockQuery.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Test/Mock/MockResourceController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /system/Test/Mock/MockResourcePresenter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Test/Mock/MockResponse.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 bool 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/MockSecurity.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Security\Security; 15 | 16 | class MockSecurity extends Security 17 | { 18 | protected function doSendCookie(): void 19 | { 20 | $_COOKIE['csrf_cookie_name'] = $this->hash; 21 | } 22 | 23 | protected function randomize(string $hash): string 24 | { 25 | $keyBinary = hex2bin('005513c290126d34d41bf41c5265e0f1'); 26 | $hashBinary = hex2bin($hash); 27 | 28 | return bin2hex(($hashBinary ^ $keyBinary) . $keyBinary); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /system/Test/Mock/MockSecurityConfig.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use Config\Security; 15 | 16 | /** 17 | * @deprecated 18 | * 19 | * @codeCoverageIgnore 20 | */ 21 | class MockSecurityConfig extends Security 22 | { 23 | public $tokenName = 'csrf_test_name'; 24 | public $headerName = 'X-CSRF-TOKEN'; 25 | public $cookieName = 'csrf_cookie_name'; 26 | public $expires = 7200; 27 | public $regenerate = true; 28 | public $redirect = false; 29 | public $samesite = 'Lax'; 30 | public $excludeURIs = ['http://example.com']; 31 | } 32 | -------------------------------------------------------------------------------- /system/Test/Mock/MockServices.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\Test\Mock; 13 | 14 | use CodeIgniter\Autoloader\FileLocator; 15 | use CodeIgniter\Config\BaseService; 16 | 17 | class MockServices extends BaseService 18 | { 19 | public $psr4 = [ 20 | 'Tests/Support' => TESTPATH . '_support/', 21 | ]; 22 | public $classmap = []; 23 | 24 | public function __construct() 25 | { 26 | // Don't call the parent since we don't want the default mappings. 27 | // parent::__construct(); 28 | } 29 | 30 | public static function locator(bool $getShared = true) 31 | { 32 | return new FileLocator(static::autoloader()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /system/Test/Mock/MockTable.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | return call_user_func_array([$this, '_' . $method], $params); 24 | } 25 | 26 | throw new BadMethodCallException('Method ' . $method . ' was not found'); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /system/ThirdParty/Escaper/Exception/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | e)&&(a[i].min=e),(void 0===a[i].max||a[i].maxlogger = $logger; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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 | * 22 | * @return void 23 | * 24 | * @throws \Psr\Log\InvalidArgumentException 25 | */ 26 | public function log($level, $message, array $context = array()) 27 | { 28 | // noop 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /system/Throttle/ThrottlerInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 int $capacity The number of requests the "bucket" can hold 32 | * @param int $seconds The time it takes the "bucket" to completely refill 33 | * @param int $cost The number of tokens this action uses. 34 | * 35 | * @return bool 36 | */ 37 | public function check(string $key, int $capacity, int $seconds, int $cost); 38 | 39 | /** 40 | * Returns the number of seconds until the next available token will 41 | * be released for usage. 42 | */ 43 | public function getTokenTime(): int; 44 | } 45 | -------------------------------------------------------------------------------- /system/Validation/Exceptions/ValidationException.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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/Validation/StrictRules/FileRules.php: -------------------------------------------------------------------------------- 1 | 9 | * 10 | * For the full copyright and license information, please view 11 | * the LICENSE file that was distributed with this source code. 12 | */ 13 | 14 | namespace CodeIgniter\Validation\StrictRules; 15 | 16 | use CodeIgniter\Validation\FileRules as NonStrictFileRules; 17 | 18 | /** 19 | * File validation rules 20 | */ 21 | class FileRules extends NonStrictFileRules 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /system/Validation/Views/list.php: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | -------------------------------------------------------------------------------- /system/Validation/Views/single.php: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /system/View/ViewDecoratorInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\View; 13 | 14 | /** 15 | * View Decorators are simple classes that are given the 16 | * chance to modify the output from the view() calls 17 | * prior to it being cached. 18 | */ 19 | interface ViewDecoratorInterface 20 | { 21 | /** 22 | * Takes $html and has a chance to alter it. 23 | * MUST return the modified HTML. 24 | */ 25 | public static function decorate(string $html): string; 26 | } 27 | -------------------------------------------------------------------------------- /system/View/ViewDecoratorTrait.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace CodeIgniter\View; 13 | 14 | use CodeIgniter\View\Exceptions\ViewException; 15 | 16 | trait ViewDecoratorTrait 17 | { 18 | /** 19 | * Runs the generated output through any declared 20 | * view decorators. 21 | */ 22 | protected function decorateOutput(string $html): string 23 | { 24 | $decorators = \config('View')->decorators; 25 | 26 | foreach ($decorators as $decorator) { 27 | if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) { 28 | throw ViewException::forInvalidDecorator($decorator); 29 | } 30 | 31 | $html = $decorator::decorate($html); 32 | } 33 | 34 | return $html; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /system/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /tests/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /tests/_support/Autoloader/UnnamespacedClass.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | class UnnamespacedClass 13 | { 14 | } 15 | -------------------------------------------------------------------------------- /tests/_support/Autoloader/functions.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | if (! function_exists('autoload_foo')) { 13 | function autoload_foo(): string 14 | { 15 | return 'I am autoloaded by Autoloader through $files!'; 16 | } 17 | } 18 | 19 | if (! defined('AUTOLOAD_CONSTANT')) { 20 | define('AUTOLOAD_CONSTANT', 'foo'); 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/Cache/RestrictiveHandler.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Cache; 13 | 14 | use CodeIgniter\Cache\Handlers\DummyHandler; 15 | 16 | /** 17 | * Handler with unnecessarily restrictive 18 | * key limit for testing validateKey. 19 | */ 20 | class RestrictiveHandler extends DummyHandler 21 | { 22 | /** 23 | * Maximum key length. 24 | */ 25 | public const MAX_KEY_LENGTH = 10; 26 | } 27 | -------------------------------------------------------------------------------- /tests/_support/Commands/AbstractInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Commands; 13 | 14 | use CodeIgniter\CLI\BaseCommand; 15 | 16 | abstract class AbstractInfo extends BaseCommand 17 | { 18 | protected $group = 'demo'; 19 | protected $name = 'app:pablo'; 20 | protected $description = 'Displays basic application information.'; 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/Commands/AppInfo.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Commands; 13 | 14 | use CodeIgniter\CLI\BaseCommand; 15 | use CodeIgniter\CLI\CLI; 16 | use CodeIgniter\CodeIgniter; 17 | use RuntimeException; 18 | 19 | class AppInfo extends BaseCommand 20 | { 21 | protected $group = 'demo'; 22 | protected $name = 'app:info'; 23 | protected $arguments = ['draft' => 'unused']; 24 | protected $description = 'Displays basic application information.'; 25 | 26 | public function run(array $params) 27 | { 28 | CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red')); 29 | } 30 | 31 | public function bomb() 32 | { 33 | try { 34 | CLI::color('test', 'white', 'Background'); 35 | } catch (RuntimeException $oops) { 36 | $this->showError($oops); 37 | } 38 | } 39 | 40 | public function helpme() 41 | { 42 | $this->call('help'); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /tests/_support/Commands/Foobar.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/Commands/InvalidCommand.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Commands; 13 | 14 | use CodeIgniter\CLI\BaseCommand; 15 | use CodeIgniter\CLI\CLI; 16 | use CodeIgniter\CodeIgniter; 17 | use ReflectionException; 18 | 19 | class InvalidCommand extends BaseCommand 20 | { 21 | protected $group = 'demo'; 22 | protected $name = 'app:invalid'; 23 | protected $description = ''; 24 | 25 | public function __construct() 26 | { 27 | throw new ReflectionException(); 28 | } 29 | 30 | public function run(array $params) 31 | { 32 | CLI::write('CI Version: ' . CLI::color(CodeIgniter::CI_VERSION, 'red')); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /tests/_support/Commands/ParamsReveal.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Commands; 13 | 14 | use CodeIgniter\CLI\BaseCommand; 15 | 16 | class ParamsReveal extends BaseCommand 17 | { 18 | protected $group = 'demo'; 19 | protected $name = 'reveal'; 20 | protected $usage = 'reveal [options] [arguments]'; 21 | protected $description = 'Reveal params'; 22 | public static $args; 23 | 24 | public function run(array $params) 25 | { 26 | static::$args = $params; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Config/BadRegistrar.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Config; 13 | 14 | /** 15 | * Class BadRegistrar 16 | * 17 | * Doesn't provides a basic registrar class for testing BaseConfig registration functions, 18 | * because it doesn't return an associative array 19 | */ 20 | class BadRegistrar 21 | { 22 | public static function RegistrarConfig() 23 | { 24 | return 'I am not worthy'; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/_support/Config/Filters.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Config\Filters; 13 | 14 | $filters->aliases['test-customfilter'] = \Tests\Support\Filters\Customfilter::class; 15 | -------------------------------------------------------------------------------- /tests/_support/Config/Routes.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Config; 13 | 14 | // This is a simple file to include for testing the RouteCollection class. 15 | $routes->add('testing', 'TestController::index', ['as' => 'testing-index']); 16 | $routes->get('closure', static fn () => 'closure test'); 17 | -------------------------------------------------------------------------------- /tests/_support/Config/Services.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Config; 13 | 14 | use CodeIgniter\HTTP\URI; 15 | use Config\Services as BaseServices; 16 | use RuntimeException; 17 | 18 | /** 19 | * Services Class 20 | * 21 | * Provides a replacement uri Service 22 | * to demonstrate overriding core services. 23 | */ 24 | class Services extends BaseServices 25 | { 26 | /** 27 | * The URI class provides a way to model and manipulate URIs. 28 | * 29 | * @param string $uri 30 | * 31 | * @return URI 32 | */ 33 | public static function uri(?string $uri = null, bool $getShared = true) 34 | { 35 | // Intercept our test case 36 | if ($uri === 'testCanReplaceFrameworkServices') { 37 | throw new RuntimeException('Service originated from ' . static::class); 38 | } 39 | 40 | if ($getShared) { 41 | return static::getSharedInstance('uri', $uri); 42 | } 43 | 44 | return new URI($uri); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /tests/_support/Config/TestRegistrar.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Config; 13 | 14 | /** 15 | * Class Registrar 16 | * 17 | * Provides a basic registrar class for testing BaseConfig registration functions. 18 | */ 19 | class TestRegistrar 20 | { 21 | public static function RegistrarConfig() 22 | { 23 | return [ 24 | 'bar' => [ 25 | 'first', 26 | 'second', 27 | ], 28 | 'format' => 'nice', 29 | 'fruit' => [ 30 | 'apple', 31 | 'banana', 32 | ], 33 | ]; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/_support/Controllers/Hello.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Controllers; 13 | 14 | use CodeIgniter\Controller; 15 | 16 | class Hello extends Controller 17 | { 18 | public function index() 19 | { 20 | return 'Hello'; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/_support/Controllers/Newautorouting.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Controllers; 13 | 14 | use CodeIgniter\Controller; 15 | 16 | class Newautorouting extends Controller 17 | { 18 | public function getIndex() 19 | { 20 | return 'Hello'; 21 | } 22 | 23 | public function postSave(int $a, string $b, $c = null) 24 | { 25 | return 'Saved'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tests/_support/Controllers/Remap.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Controllers; 13 | 14 | use CodeIgniter\Controller; 15 | 16 | class Remap extends Controller 17 | { 18 | public function _remap($method, ...$params) 19 | { 20 | if ($method === 'xyz') { 21 | return $this->abc(); 22 | } 23 | 24 | return $this->index(); 25 | } 26 | 27 | public function index() 28 | { 29 | return 'index'; 30 | } 31 | 32 | public function abc() 33 | { 34 | return 'abc'; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /tests/_support/Database/Seeds/AnotherSeeder.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Database\Seeds; 13 | 14 | use CodeIgniter\Database\Seeder; 15 | 16 | class AnotherSeeder extends Seeder 17 | { 18 | public function run() 19 | { 20 | $row = [ 21 | 'name' => 'Jerome Lohan', 22 | 'email' => 'jlo@lohanenterprises.com', 23 | 'country' => 'UK', 24 | ]; 25 | 26 | $this->db->table('user')->insert($row); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Entity/Cast/CastBase64.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Entity\Cast; 13 | 14 | use CodeIgniter\Entity\Cast\BaseCast; 15 | 16 | class CastBase64 extends BaseCast 17 | { 18 | /** 19 | * Get 20 | * 21 | * @param mixed $value Data 22 | * @param array $params Additional param 23 | * 24 | * @return mixed 25 | */ 26 | public static function get($value, array $params = []): string 27 | { 28 | return base64_decode($value, true); 29 | } 30 | 31 | /** 32 | * Set 33 | * 34 | * @param mixed $value Data 35 | * @param array $params Additional param 36 | * 37 | * @return mixed 38 | */ 39 | public static function set($value, array $params = []): string 40 | { 41 | return base64_encode($value); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /tests/_support/Entity/Cast/CastPassParameters.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Entity\Cast; 13 | 14 | use CodeIgniter\Entity\Cast\BaseCast; 15 | 16 | class CastPassParameters extends BaseCast 17 | { 18 | /** 19 | * Set 20 | * 21 | * @param mixed $value Data 22 | * @param array $params Additional param 23 | * 24 | * @return mixed 25 | */ 26 | public static function set($value, array $params = []) 27 | { 28 | return $value . ':' . json_encode($params); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /tests/_support/Entity/Cast/NotExtendsBaseCast.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Entity\Cast; 13 | 14 | class NotExtendsBaseCast 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /tests/_support/Entity/User.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Entity; 13 | 14 | use CodeIgniter\Entity\Entity; 15 | 16 | class User extends Entity 17 | { 18 | protected $attributes = [ 19 | 'country' => 'India', 20 | ]; 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/Files/able/apple.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | -------------------------------------------------------------------------------- /tests/_support/Files/able/fig_3.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | -------------------------------------------------------------------------------- /tests/_support/Files/able/prune_ripe.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | -------------------------------------------------------------------------------- /tests/_support/Files/baker/banana.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | -------------------------------------------------------------------------------- /tests/_support/Filters/Customfilter.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Filters; 13 | 14 | use CodeIgniter\HTTP\RequestInterface; 15 | use CodeIgniter\HTTP\ResponseInterface; 16 | 17 | class Customfilter implements \CodeIgniter\Filters\FilterInterface 18 | { 19 | public function before(RequestInterface $request, $arguments = null) 20 | { 21 | $request->appendBody('http://hellowworld.com'); 22 | 23 | return $request; 24 | } 25 | 26 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null) 27 | { 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/CookiesHolder.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileA.txt: -------------------------------------------------------------------------------- 1 | text -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileB.txt: -------------------------------------------------------------------------------- 1 | more text -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileC.csv: -------------------------------------------------------------------------------- 1 | separated;"text" -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileD.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/HTTP/Files/tmp/fileD.zip -------------------------------------------------------------------------------- /tests/_support/HTTP/Files/tmp/fileE.zip.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/HTTP/Files/tmp/fileE.zip.rar -------------------------------------------------------------------------------- /tests/_support/Helpers/baguette_helper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_0.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_1.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_2.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_3.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_4.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_5.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_6.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_7.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/landscape_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/landscape_8.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_0.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_1.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_2.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_3.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_4.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_5.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_6.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_7.jpg -------------------------------------------------------------------------------- /tests/_support/Images/EXIFsamples/portrait_8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/EXIFsamples/portrait_8.jpg -------------------------------------------------------------------------------- /tests/_support/Images/Steveston_dusk.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/Steveston_dusk.JPG -------------------------------------------------------------------------------- /tests/_support/Images/ci-logo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/ci-logo.gif -------------------------------------------------------------------------------- /tests/_support/Images/ci-logo.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/ci-logo.jpeg -------------------------------------------------------------------------------- /tests/_support/Images/ci-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/ci-logo.png -------------------------------------------------------------------------------- /tests/_support/Images/ci-logo.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Images/ci-logo.webp -------------------------------------------------------------------------------- /tests/_support/Language/SecondMockLanguage.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Language; 13 | 14 | use CodeIgniter\Language\Language; 15 | 16 | class SecondMockLanguage extends Language 17 | { 18 | /** 19 | * Expose the protected *load* method 20 | */ 21 | public function loadem(string $file, string $locale = 'en', bool $return = false) 22 | { 23 | return $this->load($file, $locale, $return); 24 | } 25 | 26 | /** 27 | * Expose the loaded language files 28 | */ 29 | public function loaded(string $locale = 'en') 30 | { 31 | return $this->loadedFiles[$locale]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /tests/_support/Language/ab-CD/Allin.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'one' => 'Pyramid of Giza', 14 | 'tre' => 'Colossus of Rhodes', 15 | 'fiv' => 'Temple of Artemis', 16 | 'sev' => 'Hanging Gardens of Babylon', 17 | ]; 18 | -------------------------------------------------------------------------------- /tests/_support/Language/ab/Allin.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'two' => 'gluttony', 14 | 'tre' => 'greed', 15 | 'six' => 'envy', 16 | 'sev' => 'pride', 17 | ]; 18 | -------------------------------------------------------------------------------- /tests/_support/Language/en-ZZ/More.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'strongForce' => 'These are not the droids you are looking for', 14 | 'notaMoon' => "It's made of cheese", 15 | 'wisdom' => 'There is no try', 16 | ]; 17 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Allin.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'for' => 'four calling birds', 14 | 'fiv' => 'five golden rings', 15 | 'six' => 'six geese a laying', 16 | 'sev' => 'seven swans a swimming', 17 | ]; 18 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Core.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'missingExtension' => '{0} extension could not be found.', 14 | 'bazillion' => 'billions and billions', // adds a new setting 15 | ]; 16 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Foo.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'bar' => 'Foo Bar Translated', 14 | 'bar.min_length1' => 'The {field} field is very short.', 15 | 'bar.min_length2' => 'Supplied value ({value}) for {field} must have at least {param} characters.', 16 | 'baz' => [ 17 | 'min_length3.short' => 'The {field} field is very short.', 18 | ], 19 | ]; 20 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Language.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE 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 | -------------------------------------------------------------------------------- /tests/_support/Language/en/More.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'strongForce' => 'These are not the droids you are looking for', 14 | 'notaMoon' => "That's no moon... it's a space station", 15 | 'cannotMove' => 'I have a very bad feeling about this', 16 | ]; 17 | -------------------------------------------------------------------------------- /tests/_support/Language/en/Nested.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'a' => [ 14 | 'b' => [ 15 | 'c' => [ 16 | 'd' => 'e', 17 | ], 18 | ], 19 | ], 20 | ]; 21 | -------------------------------------------------------------------------------- /tests/_support/Language/ru/Language.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | return [ 13 | 'languageGetLineInvalidArgumentException' => 'Whatever this would be, translated', 14 | ]; 15 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102301_Some_migration.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\MigrationTestMigrations\Database\Migrations; 13 | 14 | class Migration_some_migration extends \CodeIgniter\Database\Migration 15 | { 16 | public function up() 17 | { 18 | $this->forge->addField([ 19 | 'key' => [ 20 | 'type' => 'VARCHAR', 21 | 'constraint' => 255, 22 | ], 23 | ]); 24 | $this->forge->createTable('foo', true); 25 | 26 | $this->db->table('foo')->insert([ 27 | 'key' => 'foobar', 28 | ]); 29 | } 30 | 31 | public function down() 32 | { 33 | $this->forge->dropTable('foo', true); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/_support/MigrationTestMigrations/Database/Migrations/2018-01-24-102302_Another_migration.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\MigrationTestMigrations\Database\Migrations; 13 | 14 | class Migration_another_migration extends \CodeIgniter\Database\Migration 15 | { 16 | public function up() 17 | { 18 | $fields = [ 19 | 'value' => [ 20 | 'type' => 'VARCHAR', 21 | 'constraint' => 255, 22 | ], 23 | ]; 24 | $this->forge->addColumn('foo', $fields); 25 | 26 | $this->db->table('foo')->insert([ 27 | 'key' => 'foobar', 28 | 'value' => 'raboof', 29 | ]); 30 | } 31 | 32 | public function down() 33 | { 34 | if ($this->db->tableExists('foo')) { 35 | $this->forge->dropColumn('foo', 'value'); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /tests/_support/Models/EntityModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class EntityModel extends Model 17 | { 18 | protected $table = 'job'; 19 | protected $returnType = '\Tests\Support\Models\SimpleEntity'; 20 | protected $useSoftDeletes = false; 21 | protected $dateFormat = 'int'; 22 | protected $deletedField = 'deleted_at'; 23 | protected $allowedFields = [ 24 | 'name', 25 | 'description', 26 | 'created_at', 27 | ]; 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Models/FabricatorModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | use Faker\Generator; 16 | 17 | class FabricatorModel extends Model 18 | { 19 | protected $table = 'job'; 20 | protected $returnType = 'object'; 21 | protected $useSoftDeletes = true; 22 | protected $useTimestamps = true; 23 | protected $dateFormat = 'int'; 24 | protected $allowedFields = [ 25 | 'name', 26 | 'description', 27 | ]; 28 | 29 | // Return a faked entity 30 | public function fake(Generator &$faker) 31 | { 32 | return (object) [ 33 | 'name' => $faker->ipv4, 34 | 'description' => $faker->words(10), 35 | ]; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /tests/_support/Models/JobModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class JobModel extends Model 17 | { 18 | protected $table = 'job'; 19 | protected $returnType = 'object'; 20 | protected $useSoftDeletes = false; 21 | protected $dateFormat = 'int'; 22 | protected $allowedFields = [ 23 | 'name', 24 | 'description', 25 | ]; 26 | public $name = ''; 27 | public $description = ''; 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Models/SecondaryModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class SecondaryModel extends Model 17 | { 18 | protected $table = 'secondary'; 19 | protected $primaryKey = 'id'; 20 | protected $returnType = 'object'; 21 | protected $useSoftDeletes = false; 22 | protected $dateFormat = 'int'; 23 | protected $allowedFields = [ 24 | 'key', 25 | 'value', 26 | ]; 27 | } 28 | -------------------------------------------------------------------------------- /tests/_support/Models/SimpleEntity.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Entity\Entity; 15 | 16 | /** 17 | * Class SimpleEntity 18 | * 19 | * Simple Entity-type class for testing creating and saving entities 20 | * in the model so we can support Entity/Repository type patterns. 21 | */ 22 | class SimpleEntity extends Entity 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /tests/_support/Models/StringifyPkeyModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class StringifyPkeyModel extends Model 17 | { 18 | protected $table = 'stringifypkey'; 19 | protected $returnType = 'object'; 20 | } 21 | -------------------------------------------------------------------------------- /tests/_support/Models/UserModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class UserModel extends Model 17 | { 18 | protected $table = 'user'; 19 | protected $allowedFields = [ 20 | 'name', 21 | 'email', 22 | 'country', 23 | 'deleted_at', 24 | ]; 25 | protected $returnType = 'object'; 26 | protected $useSoftDeletes = true; 27 | protected $dateFormat = 'datetime'; 28 | public $name = ''; 29 | public $email = ''; 30 | public $country = ''; 31 | } 32 | -------------------------------------------------------------------------------- /tests/_support/Models/UserObjModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class UserObjModel extends Model 17 | { 18 | protected $table = 'user'; 19 | protected $allowedFields = [ 20 | 'name', 21 | 'email', 22 | 'country', 23 | 'deleted_at', 24 | ]; 25 | protected $returnType = \Tests\Support\Entity\User::class; 26 | protected $useSoftDeletes = true; 27 | protected $dateFormat = 'datetime'; 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Models/ValidErrorsModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class ValidErrorsModel extends Model 17 | { 18 | protected $table = 'job'; 19 | protected $returnType = 'object'; 20 | protected $useSoftDeletes = false; 21 | protected $dateFormat = 'int'; 22 | protected $allowedFields = [ 23 | 'name', 24 | 'description', 25 | ]; 26 | protected $validationRules = [ 27 | 'name' => [ 28 | 'required', 29 | 'min_length[10]', 30 | 'errors' => [ 31 | 'min_length' => 'Minimum Length Error', 32 | ], 33 | ], 34 | 'token' => 'in_list[{id}]', 35 | ]; 36 | } 37 | -------------------------------------------------------------------------------- /tests/_support/Models/ValidModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class ValidModel extends Model 17 | { 18 | protected $table = 'job'; 19 | protected $returnType = 'object'; 20 | protected $useSoftDeletes = false; 21 | protected $dateFormat = 'int'; 22 | protected $allowedFields = [ 23 | 'name', 24 | 'description', 25 | ]; 26 | protected $validationRules = [ 27 | 'name' => [ 28 | 'required', 29 | 'min_length[3]', 30 | ], 31 | 'token' => 'permit_empty|in_list[{id}]', 32 | ]; 33 | protected $validationMessages = [ 34 | 'name' => [ 35 | 'required' => 'You forgot to name the baby.', 36 | 'min_length' => 'Too short, man!', 37 | ], 38 | ]; 39 | } 40 | -------------------------------------------------------------------------------- /tests/_support/Models/WithoutAutoIncrementModel.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Models; 13 | 14 | use CodeIgniter\Model; 15 | 16 | class WithoutAutoIncrementModel extends Model 17 | { 18 | protected $table = 'without_auto_increment'; 19 | protected $primaryKey = 'key'; 20 | protected $allowedFields = [ 21 | 'key', 22 | 'value', 23 | ]; 24 | protected $useAutoIncrement = false; 25 | } 26 | -------------------------------------------------------------------------------- /tests/_support/Publishers/TestPublisher.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Publishers; 13 | 14 | use CodeIgniter\Publisher\Publisher; 15 | 16 | final class TestPublisher extends Publisher 17 | { 18 | /** 19 | * Return value for publish() 20 | * 21 | * @var bool 22 | */ 23 | private static $result = true; 24 | 25 | /** 26 | * Base path to use for the source. 27 | * 28 | * @var string 29 | */ 30 | protected $source = SUPPORTPATH . 'Files'; 31 | 32 | /** 33 | * Base path to use for the destination. 34 | * 35 | * @var string 36 | */ 37 | protected $destination = WRITEPATH; 38 | 39 | /** 40 | * Fakes an error on the given file. 41 | */ 42 | public static function setResult(bool $result) 43 | { 44 | self::$result = $result; 45 | } 46 | 47 | /** 48 | * Fakes a publish event so no files are actually copied. 49 | */ 50 | public function publish(): bool 51 | { 52 | $this->addPath(''); 53 | 54 | return self::$result; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /tests/_support/RESTful/Worker.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\RESTful; 13 | 14 | use CodeIgniter\RESTful\ResourceController; 15 | 16 | /** 17 | * An extendable controller to provide a RESTful API for a resource. 18 | */ 19 | class Worker extends ResourceController 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/RESTful/Worker2.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\RESTful; 13 | 14 | use CodeIgniter\RESTful\ResourcePresenter; 15 | 16 | /** 17 | * An extendable controller to provide a RESTful API for a resource. 18 | */ 19 | class Worker2 extends ResourcePresenter 20 | { 21 | } 22 | -------------------------------------------------------------------------------- /tests/_support/SomeEntity.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support; 13 | 14 | use CodeIgniter\Entity\Entity; 15 | 16 | class SomeEntity extends Entity 17 | { 18 | protected $attributes = [ 19 | 'foo' => null, 20 | 'bar' => null, 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /tests/_support/Validation/TestRules.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Validation; 13 | 14 | class TestRules 15 | { 16 | public function customError(string $str, ?string &$error = null) 17 | { 18 | $error = 'My lovely error'; 19 | 20 | return false; 21 | } 22 | 23 | public function check_object_rule(object $value, ?string $fields, array $data = []) 24 | { 25 | $find = false; 26 | 27 | foreach ($value as $key => $val) { 28 | if ($key === 'first') { 29 | $find = true; 30 | } 31 | } 32 | 33 | return $find; 34 | } 35 | 36 | public function array_count($value, $count): bool 37 | { 38 | return is_array($value) && count($value) === (int) $count; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /tests/_support/Validation/uploads/abc77tz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Validation/uploads/abc77tz -------------------------------------------------------------------------------- /tests/_support/Validation/uploads/phpUxc0ty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/tests/_support/Validation/uploads/phpUxc0ty -------------------------------------------------------------------------------- /tests/_support/View/BadDecorator.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\View; 13 | 14 | /** 15 | * Class BadDecorator 16 | * 17 | * This class is only used to provide a reference point 18 | * during tests to make sure that things work as expected. 19 | */ 20 | class BadDecorator 21 | { 22 | public static function decorate(string $html): string 23 | { 24 | return $html; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /tests/_support/View/SampleClass.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\View; 13 | 14 | /** 15 | * Class SampleClass 16 | * 17 | * This class is only used to provide a reference point 18 | * during tests to make sure that things work as expected. 19 | */ 20 | class SampleClass 21 | { 22 | public function index() 23 | { 24 | return 'Hello World'; 25 | } 26 | 27 | public function hello() 28 | { 29 | return 'Hello'; 30 | } 31 | 32 | public function echobox($params) 33 | { 34 | if (is_array($params)) { 35 | $params = implode(',', $params); 36 | } 37 | 38 | return $params; 39 | } 40 | 41 | public static function staticEcho($params) 42 | { 43 | if (is_array($params)) { 44 | $params = implode(',', $params); 45 | } 46 | 47 | return $params; 48 | } 49 | 50 | public function work($p1, $p2, $p4) 51 | { 52 | return 'Right on'; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /tests/_support/View/SampleClassWithInitController.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\View; 13 | 14 | use CodeIgniter\HTTP\RequestInterface; 15 | use CodeIgniter\HTTP\ResponseInterface; 16 | use Psr\Log\LoggerInterface; 17 | 18 | /** 19 | * Class SampleClassWithInitController 20 | * 21 | * This class is only used to provide a reference point 22 | * during tests to make sure that things work as expected. 23 | */ 24 | class SampleClassWithInitController 25 | { 26 | public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) 27 | { 28 | $this->response = $response; 29 | } 30 | 31 | public function index() 32 | { 33 | return get_class($this->response); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /tests/_support/View/Views/simple.php: -------------------------------------------------------------------------------- 1 |

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

{testString}

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

-------------------------------------------------------------------------------- /tests/_support/View/WorldDecorator.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\View; 13 | 14 | use CodeIgniter\View\ViewDecoratorInterface; 15 | 16 | /** 17 | * Class WorldDecorator 18 | * 19 | * This class is only used to provide a reference point 20 | * during tests to make sure that things work as expected. 21 | */ 22 | class WorldDecorator implements ViewDecoratorInterface 23 | { 24 | public static function decorate(string $html): string 25 | { 26 | return str_ireplace('World', 'Galaxy', $html); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /tests/_support/Widgets/NopeWidget.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | $class = 'nope'; 13 | -------------------------------------------------------------------------------- /tests/_support/Widgets/OtherWidget.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Widgets; 13 | 14 | class OtherWidget 15 | { 16 | } 17 | -------------------------------------------------------------------------------- /tests/_support/Widgets/SomeWidget.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view 9 | * the LICENSE file that was distributed with this source code. 10 | */ 11 | 12 | namespace Tests\Support\Widgets; 13 | 14 | use stdClass; 15 | 16 | // Extends a trivial class to test the instanceOf directive 17 | class SomeWidget extends stdClass 18 | { 19 | } 20 | -------------------------------------------------------------------------------- /writable/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /writable/cache/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /writable/debugbar/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/CodeIgniter-Chinese/CodeIgniter4/f635c0f6ff0afc94142e9b4cd26552692681c511/writable/debugbar/.gitkeep -------------------------------------------------------------------------------- /writable/logs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /writable/session/index.html: -------------------------------------------------------------------------------- 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 | --------------------------------------------------------------------------------