├── .gitignore
├── LICENSE
├── README.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
│ ├── Routing.php
│ ├── Security.php
│ ├── Services.php
│ ├── Session.php
│ ├── Toolbar.php
│ ├── UserAgents.php
│ ├── Validation.php
│ └── View.php
├── Controllers
│ ├── BaseController.php
│ ├── Caja.php
│ ├── Configuracion.php
│ ├── Inicio.php
│ ├── Login.php
│ ├── Productos.php
│ ├── Reportes.php
│ └── Ventas.php
├── Database
│ ├── Migrations
│ │ ├── .gitkeep
│ │ ├── 2024-01-30-144522_Usuarios.php
│ │ ├── 2024-01-30-152739_Productos.php
│ │ ├── 2024-02-01-193447_Configuracion.php
│ │ ├── 2024-02-04-083335_TemporalCaja.php
│ │ ├── 2024-02-06-204639_Ventas.php
│ │ ├── 2024-02-06-210226_DetalleVenta.php
│ │ └── 2024-02-08-094405_VistaVentas.php
│ └── Seeds
│ │ ├── .gitkeep
│ │ ├── CargaSeeder.php
│ │ ├── ConfiguracionSeeder.php
│ │ └── UsuariosSeeder.php
├── Filters
│ ├── .gitkeep
│ └── AuthFilter.php
├── Helpers
│ └── .gitkeep
├── Language
│ ├── .gitkeep
│ ├── en
│ │ └── Validation.php
│ └── es
│ │ └── Validation.php
├── Libraries
│ └── .gitkeep
├── Models
│ ├── .gitkeep
│ ├── ConfiguracionModel.php
│ ├── DetalleVentasModel.php
│ ├── ProductosModel.php
│ ├── TemporalCajaModel.php
│ ├── UsuariosModel.php
│ └── VentasModel.php
├── ThirdParty
│ ├── .gitkeep
│ ├── Fpdf
│ │ ├── Fpdf.php
│ │ ├── PlantillaProductos.php
│ │ ├── PlantillaVentas.php
│ │ ├── font
│ │ │ ├── courier.php
│ │ │ ├── courierb.php
│ │ │ ├── courierbi.php
│ │ │ ├── courieri.php
│ │ │ ├── helvetica.php
│ │ │ ├── helveticab.php
│ │ │ ├── helveticabi.php
│ │ │ ├── helveticai.php
│ │ │ ├── symbol.php
│ │ │ ├── times.php
│ │ │ ├── timesb.php
│ │ │ ├── timesbi.php
│ │ │ ├── timesi.php
│ │ │ └── zapfdingbats.php
│ │ ├── license.txt
│ │ └── makefont
│ │ │ ├── cp1250.map
│ │ │ ├── cp1251.map
│ │ │ ├── cp1252.map
│ │ │ ├── cp1253.map
│ │ │ ├── cp1254.map
│ │ │ ├── cp1255.map
│ │ │ ├── cp1257.map
│ │ │ ├── cp1258.map
│ │ │ ├── cp874.map
│ │ │ ├── iso-8859-1.map
│ │ │ ├── iso-8859-11.map
│ │ │ ├── iso-8859-15.map
│ │ │ ├── iso-8859-16.map
│ │ │ ├── iso-8859-2.map
│ │ │ ├── iso-8859-4.map
│ │ │ ├── iso-8859-5.map
│ │ │ ├── iso-8859-7.map
│ │ │ ├── iso-8859-9.map
│ │ │ ├── koi8-r.map
│ │ │ ├── koi8-u.map
│ │ │ ├── makefont.php
│ │ │ └── ttfparser.php
│ └── NumerosALetras.php
├── Views
│ ├── cambia_password.php
│ ├── configuracion
│ │ └── datos.php
│ ├── errors
│ │ ├── cli
│ │ │ ├── error_404.php
│ │ │ ├── error_exception.php
│ │ │ └── production.php
│ │ └── html
│ │ │ ├── debug.css
│ │ │ ├── debug.js
│ │ │ ├── error_404.php
│ │ │ ├── error_exception.php
│ │ │ └── production.php
│ ├── inicio.php
│ ├── login.php
│ ├── plantilla
│ │ ├── layout.php
│ │ └── menu.php
│ ├── premium.php
│ ├── productos
│ │ ├── edit.php
│ │ ├── eliminados.php
│ │ ├── index.php
│ │ └── new.php
│ ├── reportes
│ │ ├── crea_ventas.php
│ │ ├── ver_reporte_productos.php
│ │ └── ver_reporte_ventas.php
│ └── ventas
│ │ ├── caja.php
│ │ ├── eliminados.php
│ │ ├── index.php
│ │ ├── mensaje.php
│ │ └── ticket.php
└── index.html
├── builds
├── composer.json
├── env
├── phpunit.xml.dist
├── preload.php
├── public
├── .htaccess
├── assets
│ ├── datatables
│ │ ├── datatables.min.css
│ │ └── datatables.min.js
│ └── jquery-ui
│ │ ├── LICENSE.txt
│ │ ├── images
│ │ ├── ui-icons_444444_256x240.png
│ │ ├── ui-icons_555555_256x240.png
│ │ ├── ui-icons_777620_256x240.png
│ │ ├── ui-icons_777777_256x240.png
│ │ ├── ui-icons_cc0000_256x240.png
│ │ └── ui-icons_ffffff_256x240.png
│ │ ├── jquery-ui.min.css
│ │ ├── jquery-ui.min.js
│ │ └── package.json
├── css
│ ├── all.min.css
│ └── styles.css
├── favicon.ico
├── images
│ ├── background_pos.jpg
│ ├── capturas
│ │ ├── 1-Login.png
│ │ ├── 2-Dasdboard.png
│ │ ├── 3-Caja.png
│ │ ├── 4-Ticket.png
│ │ ├── 5-Productos.png
│ │ └── 6-Reporte.png
│ └── logotipo.png
├── index.php
├── js
│ ├── DatatablesSpanish.json
│ ├── bootstrap.bundle.min.js
│ ├── bootstrap.bundle.min.js.map
│ ├── jquery.min.js
│ └── scripts.js
├── robots.txt
└── webfonts
│ ├── fa-brands-400.ttf
│ ├── fa-brands-400.woff2
│ ├── fa-regular-400.ttf
│ ├── fa-regular-400.woff2
│ ├── fa-solid-900.ttf
│ ├── fa-solid-900.woff2
│ ├── fa-v4compatibility.ttf
│ └── fa-v4compatibility.woff2
├── spark
├── system
├── .htaccess
├── API
│ └── ResponseTrait.php
├── Autoloader
│ ├── Autoloader.php
│ └── FileLocator.php
├── BaseModel.php
├── CLI
│ ├── BaseCommand.php
│ ├── CLI.php
│ ├── Commands.php
│ ├── Console.php
│ ├── Exceptions
│ │ └── CLIException.php
│ └── GeneratorTrait.php
├── Cache
│ ├── CacheFactory.php
│ ├── CacheInterface.php
│ ├── Exceptions
│ │ ├── CacheException.php
│ │ └── ExceptionInterface.php
│ ├── FactoriesCache.php
│ ├── FactoriesCache
│ │ └── FileVarExportHandler.php
│ ├── Handlers
│ │ ├── BaseHandler.php
│ │ ├── DummyHandler.php
│ │ ├── FileHandler.php
│ │ ├── MemcachedHandler.php
│ │ ├── PredisHandler.php
│ │ ├── RedisHandler.php
│ │ └── WincacheHandler.php
│ └── ResponseCache.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
│ │ ├── CellGenerator.php
│ │ ├── 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
│ │ │ ├── cell.tpl.php
│ │ │ ├── cell_view.tpl.php
│ │ │ ├── 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
│ │ ├── FilterCheck.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
│ ├── Routing.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
│ ├── BaseExceptionHandler.php
│ ├── ExceptionHandler.php
│ ├── ExceptionHandlerInterface.php
│ ├── 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
│ │ ├── IntBoolCast.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
│ ├── HTTPExceptionInterface.php
│ ├── HasExitCodeInterface.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
│ │ ├── BadRequestException.php
│ │ ├── HTTPException.php
│ │ └── RedirectException.php
│ ├── Files
│ │ ├── FileCollection.php
│ │ ├── UploadedFile.php
│ │ └── UploadedFileInterface.php
│ ├── Header.php
│ ├── IncomingRequest.php
│ ├── Message.php
│ ├── MessageInterface.php
│ ├── MessageTrait.php
│ ├── Negotiate.php
│ ├── OutgoingRequest.php
│ ├── OutgoingRequestInterface.php
│ ├── RedirectResponse.php
│ ├── Request.php
│ ├── RequestInterface.php
│ ├── RequestTrait.php
│ ├── ResponsableInterface.php
│ ├── Response.php
│ ├── ResponseInterface.php
│ ├── ResponseTrait.php
│ ├── SiteURI.php
│ ├── SiteURIFactory.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
│ ├── kint_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
├── HotReloader
│ ├── DirectoryHasher.php
│ ├── HotReloader.php
│ └── IteratorFilter.php
├── I18n
│ ├── Exceptions
│ │ └── I18nException.php
│ ├── Time.php
│ ├── TimeDifference.php
│ ├── TimeLegacy.php
│ └── TimeTrait.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
│ │ ├── Errors.php
│ │ ├── Fabricator.php
│ │ ├── Files.php
│ │ ├── Filters.php
│ │ ├── Format.php
│ │ ├── HTTP.php
│ │ ├── Images.php
│ │ ├── Language.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
│ ├── ContentReplacer.php
│ ├── Exceptions
│ │ └── PublisherException.php
│ └── Publisher.php
├── RESTful
│ ├── BaseResource.php
│ ├── ResourceController.php
│ └── ResourcePresenter.php
├── Router
│ ├── AutoRouter.php
│ ├── AutoRouterImproved.php
│ ├── AutoRouterInterface.php
│ ├── DefinedRouteCollector.php
│ ├── Exceptions
│ │ ├── MethodNotFoundException.php
│ │ ├── 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
├── Superglobals.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
│ ├── IniTestTrait.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
│ ├── PhpStreamWrapper.php
│ ├── ReflectionHelper.php
│ ├── StreamFilterTrait.php
│ ├── TestLogger.php
│ ├── TestResponse.php
│ └── bootstrap.php
├── ThirdParty
│ ├── Escaper
│ │ ├── Escaper.php
│ │ ├── Exception
│ │ │ ├── ExceptionInterface.php
│ │ │ ├── InvalidArgumentException.php
│ │ │ └── RuntimeException.php
│ │ └── LICENSE.md
│ ├── Kint
│ │ ├── CallFinder.php
│ │ ├── FacadeInterface.php
│ │ ├── Kint.php
│ │ ├── LICENSE
│ │ ├── Parser
│ │ │ ├── AbstractPlugin.php
│ │ │ ├── ArrayLimitPlugin.php
│ │ │ ├── ArrayObjectPlugin.php
│ │ │ ├── Base64Plugin.php
│ │ │ ├── BinaryPlugin.php
│ │ │ ├── BlacklistPlugin.php
│ │ │ ├── ClassMethodsPlugin.php
│ │ │ ├── ClassStaticsPlugin.php
│ │ │ ├── ClosurePlugin.php
│ │ │ ├── ColorPlugin.php
│ │ │ ├── ConstructablePluginInterface.php
│ │ │ ├── DOMDocumentPlugin.php
│ │ │ ├── DateTimePlugin.php
│ │ │ ├── EnumPlugin.php
│ │ │ ├── FsPathPlugin.php
│ │ │ ├── IteratorPlugin.php
│ │ │ ├── JsonPlugin.php
│ │ │ ├── MicrotimePlugin.php
│ │ │ ├── MysqliPlugin.php
│ │ │ ├── Parser.php
│ │ │ ├── PluginInterface.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
│ │ │ ├── AbstractRenderer.php
│ │ │ ├── CliRenderer.php
│ │ │ ├── PlainRenderer.php
│ │ │ ├── RendererInterface.php
│ │ │ ├── Rich
│ │ │ │ ├── AbstractPlugin.php
│ │ │ │ ├── ArrayLimitPlugin.php
│ │ │ │ ├── BinaryPlugin.php
│ │ │ │ ├── BlacklistPlugin.php
│ │ │ │ ├── CallablePlugin.php
│ │ │ │ ├── ClosurePlugin.php
│ │ │ │ ├── ColorPlugin.php
│ │ │ │ ├── DepthLimitPlugin.php
│ │ │ │ ├── MethodDefinitionPlugin.php
│ │ │ │ ├── MicrotimePlugin.php
│ │ │ │ ├── PluginInterface.php
│ │ │ │ ├── RecursionPlugin.php
│ │ │ │ ├── SimpleXMLElementPlugin.php
│ │ │ │ ├── SourcePlugin.php
│ │ │ │ ├── TabPluginInterface.php
│ │ │ │ ├── TablePlugin.php
│ │ │ │ ├── TimestampPlugin.php
│ │ │ │ ├── TraceFramePlugin.php
│ │ │ │ └── ValuePluginInterface.php
│ │ │ ├── RichRenderer.php
│ │ │ ├── Text
│ │ │ │ ├── AbstractPlugin.php
│ │ │ │ ├── ArrayLimitPlugin.php
│ │ │ │ ├── BlacklistPlugin.php
│ │ │ │ ├── DepthLimitPlugin.php
│ │ │ │ ├── EnumPlugin.php
│ │ │ │ ├── MicrotimePlugin.php
│ │ │ │ ├── PluginInterface.php
│ │ │ │ ├── RecursionPlugin.php
│ │ │ │ └── TracePlugin.php
│ │ │ └── TextRenderer.php
│ │ ├── Utils.php
│ │ ├── Zval
│ │ │ ├── BlobValue.php
│ │ │ ├── ClosureValue.php
│ │ │ ├── DateTimeValue.php
│ │ │ ├── EnumValue.php
│ │ │ ├── InstanceValue.php
│ │ │ ├── MethodValue.php
│ │ │ ├── ParameterHoldingTrait.php
│ │ │ ├── ParameterValue.php
│ │ │ ├── Representation
│ │ │ │ ├── ColorRepresentation.php
│ │ │ │ ├── MethodDefinitionRepresentation.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-dark.css
│ │ │ ├── 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
├── Traits
│ ├── ConditionalTrait.php
│ └── PropertiesTrait.php
├── Typography
│ └── Typography.php
├── Validation
│ ├── CreditCardRules.php
│ ├── DotArrayFilter.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
│ ├── Cells
│ │ └── 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
├── README.md
├── _support
│ ├── Database
│ │ ├── Migrations
│ │ │ └── 2020-02-22-222222_example_migration.php
│ │ └── Seeds
│ │ │ └── ExampleSeeder.php
│ ├── Libraries
│ │ └── ConfigReader.php
│ └── Models
│ │ └── ExampleModel.php
├── database
│ └── ExampleDatabaseTest.php
├── session
│ └── ExampleSessionTest.php
└── unit
│ └── HealthTest.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-2024 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 |
--------------------------------------------------------------------------------
/app/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Require all denied
3 |
4 |
5 | Deny from all
6 |
7 |
--------------------------------------------------------------------------------
/app/Common.php:
--------------------------------------------------------------------------------
1 | {label}';
28 |
29 | /**
30 | * Honeypot container
31 | *
32 | * If you enabled CSP, you can remove `style="display:none"`.
33 | */
34 | public string $container = '
{template}
';
35 |
36 | /**
37 | * The id attribute for Honeypot container tag
38 | *
39 | * Used when CSP is enabled.
40 | */
41 | public string $containerId = 'hpc';
42 | }
43 |
--------------------------------------------------------------------------------
/app/Config/Images.php:
--------------------------------------------------------------------------------
1 |
26 | */
27 | public array $handlers = [
28 | 'gd' => GDHandler::class,
29 | 'imagick' => ImageMagickHandler::class,
30 | ];
31 | }
32 |
--------------------------------------------------------------------------------
/app/Config/Pager.php:
--------------------------------------------------------------------------------
1 |
22 | */
23 | public array $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 | public int $perPage = 20;
37 | }
38 |
--------------------------------------------------------------------------------
/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 |
22 | */
23 | public array $ruleSets = [
24 | Rules::class,
25 | FormatRules::class,
26 | FileRules::class,
27 | CreditCardRules::class,
28 | ];
29 |
30 | /**
31 | * Specifies the views that are used to display the
32 | * errors.
33 | *
34 | * @var array
35 | */
36 | public array $templates = [
37 | 'list' => 'CodeIgniter\Validation\Views\list',
38 | 'single' => 'CodeIgniter\Validation\Views\single',
39 | ];
40 |
41 | // --------------------------------------------------------------------
42 | // Rules
43 | // --------------------------------------------------------------------
44 | }
45 |
--------------------------------------------------------------------------------
/app/Controllers/Inicio.php:
--------------------------------------------------------------------------------
1 | where('activo', 1)->countAllResults();
26 | $hoy = date('Y-m-d');
27 | $totalVentas = $ventasModel->totalVentasDia($hoy);
28 |
29 | return view('inicio', ['totalProductos' => $totalProductos, 'totalVentas' => $totalVentas]);
30 | }
31 |
32 | public function premium()
33 | {
34 | return view('premium');
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/app/Database/Migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/app/Database/Migrations/.gitkeep
--------------------------------------------------------------------------------
/app/Database/Migrations/2024-01-30-144522_Usuarios.php:
--------------------------------------------------------------------------------
1 | forge->addField([
12 | 'id' => [
13 | 'type' => 'SMALLINT',
14 | 'unsigned' => true,
15 | 'auto_increment' => true,
16 | ],
17 | 'usuario' => [
18 | 'type' => 'VARCHAR',
19 | 'constraint' => '30',
20 | 'unique' => true
21 | ],
22 | 'password' => [
23 | 'type' => 'VARCHAR',
24 | 'constraint' => '130',
25 | ],
26 | 'nombre' => [
27 | 'type' => 'VARCHAR',
28 | 'constraint' => '100',
29 | ],
30 | 'activo' => [
31 | 'type' => 'TINYINT',
32 | ],
33 | 'fecha_alta' => [
34 | 'type' => 'DATETIME',
35 | ],
36 | 'fecha_modifica' => [
37 | 'type' => 'DATETIME',
38 | ],
39 | ]);
40 |
41 | $this->forge->addKey('id', true);
42 | $this->forge->createTable('usuarios');
43 | }
44 |
45 | public function down()
46 | {
47 | $this->forge->dropTable('usuarios');
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/app/Database/Migrations/2024-02-01-193447_Configuracion.php:
--------------------------------------------------------------------------------
1 | forge->addField([
12 | 'id' => [
13 | 'type' => 'SMALLINT',
14 | 'unsigned' => true,
15 | 'auto_increment' => true,
16 | ],
17 | 'nombre' => [
18 | 'type' => 'VARCHAR',
19 | 'constraint' => '50'
20 | ],
21 | 'valor' => [
22 | 'type' => 'VARCHAR',
23 | 'constraint' => '100',
24 | ]
25 | ]);
26 |
27 | $this->forge->addKey('id', true);
28 | $this->forge->createTable('configuracion');
29 | }
30 |
31 | public function down()
32 | {
33 | $this->forge->dropTable('configuracion');
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/app/Database/Migrations/2024-02-06-204639_Ventas.php:
--------------------------------------------------------------------------------
1 | forge->addField([
12 | 'id' => [
13 | 'type' => 'INT',
14 | 'unsigned' => true,
15 | 'auto_increment' => true,
16 | ],
17 | 'folio' => [
18 | 'type' => 'VARCHAR',
19 | 'constraint' => '10',
20 | ],
21 | 'total' => [
22 | 'type' => 'DECIMAL',
23 | 'constraint' => '10,2',
24 | ],
25 | 'fecha' => [
26 | 'type' => 'DATETIME',
27 | ],
28 | 'usuario_id' => [
29 | 'type' => 'SMALLINT',
30 | 'unsigned' => true,
31 | ],
32 | 'activo' => [
33 | 'type' => 'TINYINT',
34 | ],
35 | 'fecha_alta' => [
36 | 'type' => 'DATETIME',
37 | ],
38 | 'fecha_modifica' => [
39 | 'type' => 'DATETIME',
40 | ]
41 | ]);
42 |
43 | $this->forge->addKey('id', true);
44 | $this->forge->addForeignKey('usuario_id', 'usuarios', 'id');
45 | $this->forge->createTable('ventas');
46 | }
47 |
48 | public function down()
49 | {
50 | $this->forge->dropTable('ventas');
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/app/Database/Migrations/2024-02-06-210226_DetalleVenta.php:
--------------------------------------------------------------------------------
1 | forge->addField([
12 | 'id' => [
13 | 'type' => 'INT',
14 | 'unsigned' => true,
15 | 'auto_increment' => true,
16 | ],
17 | 'venta_id' => [
18 | 'type' => 'INT',
19 | 'unsigned' => true,
20 | ],
21 | 'producto_id' => [
22 | 'type' => 'SMALLINT',
23 | 'unsigned' => true,
24 | ],
25 | 'nombre' => [
26 | 'type' => 'VARCHAR',
27 | 'constraint' => '200',
28 | ],
29 | 'cantidad' => [
30 | 'type' => 'SMALLINT',
31 | ],
32 | 'precio' => [
33 | 'type' => 'DECIMAL',
34 | 'constraint' => '10,2',
35 | ],
36 | ]);
37 |
38 | $this->forge->addKey('id', true);
39 | $this->forge->addForeignKey('venta_id', 'ventas', 'id');
40 | $this->forge->createTable('detalle_ventas');
41 | }
42 |
43 | public function down()
44 | {
45 | $this->forge->dropTable('detalle_ventas');
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/app/Database/Migrations/2024-02-08-094405_VistaVentas.php:
--------------------------------------------------------------------------------
1 | db->query("CREATE VIEW v_ventas AS
12 | SELECT v.id, v.folio, v.total, v.fecha, v.activo, u.nombre AS usuario
13 | FROM ventas AS v
14 | INNER JOIN usuarios AS u ON v.usuario_id = u.id;");
15 |
16 | }
17 |
18 | public function down()
19 | {
20 | $this->db->query("DROP VIEW IF EXISTS v_ventas;");
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/app/Database/Seeds/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/app/Database/Seeds/.gitkeep
--------------------------------------------------------------------------------
/app/Database/Seeds/CargaSeeder.php:
--------------------------------------------------------------------------------
1 | call('ConfiguracionSeeder');
12 | $this->call('UsuariosSeeder');
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/app/Database/Seeds/ConfiguracionSeeder.php:
--------------------------------------------------------------------------------
1 | 'tienda_nombre', 'valor' => 'Tienda CDP'],
13 | ['nombre' => 'tienda_telefono', 'valor' => '5512345678'],
14 | ['nombre' => 'tienda_direccion', 'valor' => 'Calle Benito Juarez #5 Colonia Miguel Hidalgo, CDMX'],
15 | ['nombre' => 'ticket_leyenda', 'valor' => 'Gracias por su compra'],
16 | ['nombre' => 'ventas_folio', 'valor' => '0000000001']
17 | ];
18 |
19 | $this->db->table('configuracion')->insertBatch($data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Database/Seeds/UsuariosSeeder.php:
--------------------------------------------------------------------------------
1 | 'admin',
13 | 'password' => password_hash('admin', PASSWORD_DEFAULT),
14 | 'nombre' => 'Administrador',
15 | 'activo' => 1
16 | ];
17 |
18 | // Using Query Builder
19 | $this->db->query('INSERT INTO usuarios (usuario, password, nombre, activo) VALUES(:usuario:, :password:, :nombre:, :activo:)', $data);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/app/Filters/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/app/Filters/.gitkeep
--------------------------------------------------------------------------------
/app/Filters/AuthFilter.php:
--------------------------------------------------------------------------------
1 | get('usuarioLogin')) {
16 | return redirect()->to(base_url('login'));
17 | }
18 | }
19 |
20 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
21 | {
22 | // Do something here
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/app/Helpers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/app/Helpers/.gitkeep
--------------------------------------------------------------------------------
/app/Language/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/app/Language/.gitkeep
--------------------------------------------------------------------------------
/app/Language/en/Validation.php:
--------------------------------------------------------------------------------
1 | where('nombre', $nombre)
35 | ->set(['valor' => $valor])
36 | ->update();
37 | }
38 |
39 | // Consulta ultimo folio
40 | public function ultimoFolio()
41 | {
42 | $resultado = $this->select('valor')
43 | ->where('nombre', 'ventas_folio')
44 | ->get();
45 |
46 | if ($resultado->getNumRows() > 0) {
47 | return $resultado->getRowArray()['valor'];
48 | } else {
49 | return 1;
50 | }
51 | }
52 |
53 | // Actualiza siguiente folio
54 | public function siguienteFolio()
55 | {
56 | $this->where('nombre', 'ventas_folio')
57 | ->set('valor', "LPAD(valor+1,10,'0')", false)
58 | ->update();
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/app/Models/DetalleVentasModel.php:
--------------------------------------------------------------------------------
1 | $usuario, 'activo' => 1];
38 |
39 | $sql = $this->where($condicion);
40 | $usuarioData = $sql->get()->getRowArray();
41 |
42 | if ($usuarioData && password_verify($password, $usuarioData['password'])) {
43 | return $usuarioData;
44 | }
45 |
46 | return null;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/app/ThirdParty/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/app/ThirdParty/.gitkeep
--------------------------------------------------------------------------------
/app/ThirdParty/Fpdf/font/courier.php:
--------------------------------------------------------------------------------
1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10 | ?>
11 |
--------------------------------------------------------------------------------
/app/ThirdParty/Fpdf/font/courierb.php:
--------------------------------------------------------------------------------
1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10 | ?>
11 |
--------------------------------------------------------------------------------
/app/ThirdParty/Fpdf/font/courierbi.php:
--------------------------------------------------------------------------------
1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10 | ?>
11 |
--------------------------------------------------------------------------------
/app/ThirdParty/Fpdf/font/courieri.php:
--------------------------------------------------------------------------------
1 | array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
10 | ?>
11 |
--------------------------------------------------------------------------------
/app/ThirdParty/Fpdf/license.txt:
--------------------------------------------------------------------------------
1 | Permission is hereby granted, free of charge, to any person obtaining a copy
2 | of this software to use, copy, modify, distribute, sublicense, and/or sell
3 | copies of the software, and to permit persons to whom the software is furnished
4 | to do so.
5 |
6 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
--------------------------------------------------------------------------------
/app/Views/errors/cli/error_404.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | = lang('Errors.whoops') ?>
8 |
9 |
12 |
13 |
14 |
15 |
16 |
17 |
= lang('Errors.whoops') ?>
18 |
19 |
= lang('Errors.weHitASnag') ?>
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/Views/inicio.php:
--------------------------------------------------------------------------------
1 | extend('plantilla/layout');
4 | $this->section('contentido');
5 |
6 | ?>
7 |
8 |
9 |
10 |
11 |
Total de productos
12 |
18 |
19 |
20 |
21 |
22 |
23 |
Ventas del día
24 |
30 |
31 |
32 |
33 |
34 | endSection(); ?>
--------------------------------------------------------------------------------
/app/Views/reportes/ver_reporte_productos.php:
--------------------------------------------------------------------------------
1 | extend('plantilla/layout');
13 | $this->section('contentido');
14 |
15 | ?>
16 |
17 |
24 |
25 | endSection(); ?>
--------------------------------------------------------------------------------
/app/Views/reportes/ver_reporte_ventas.php:
--------------------------------------------------------------------------------
1 | extend('plantilla/layout');
13 | $this->section('contentido');
14 |
15 | ?>
16 |
17 |
24 |
25 | endSection(); ?>
--------------------------------------------------------------------------------
/app/Views/ventas/mensaje.php:
--------------------------------------------------------------------------------
1 | extend('plantilla/layout');
13 | $this->section('contentido');
14 |
15 | ?>
16 |
17 |
18 |
19 |
= $mensaje; ?>
20 |
21 |
22 |
23 | endSection(); ?>
--------------------------------------------------------------------------------
/app/Views/ventas/ticket.php:
--------------------------------------------------------------------------------
1 | extend('plantilla/layout');
15 | $this->section('contentido');
16 |
17 | ?>
18 |
19 |
26 |
27 | endSection(); ?>
--------------------------------------------------------------------------------
/app/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "mroblesdev/pos-cdp-lite",
3 | "description": "Sistema Punto de Venta CDP Lite usando CodeIgniter 4",
4 | "license": "MIT",
5 | "type": "project",
6 | "homepage": "https://codigosdeprogramacion.com",
7 | "authors": [
8 | {
9 | "name": "Marco Robles",
10 | "role": "Developer",
11 | "homepage": "https://github.com/mroblesdev"
12 | }
13 | ],
14 | "support": {
15 | "source": "https://github.com/mroblesdev/pos-cdp-lite"
16 | },
17 | "require": {
18 | "php": "^7.4 || ^8.0",
19 | "ext-intl": "*",
20 | "ext-json": "*",
21 | "ext-mbstring": "*"
22 | },
23 | "autoload": {
24 | "psr-4": {
25 | "CodeIgniter\\": "system/"
26 | },
27 | "exclude-from-classmap": [
28 | "**/Database/Migrations/**"
29 | ]
30 | },
31 | "config": {
32 | "optimize-autoloader": true,
33 | "preferred-install": "dist",
34 | "sort-packages": true
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/public/assets/jquery-ui/images/ui-icons_444444_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/assets/jquery-ui/images/ui-icons_444444_256x240.png
--------------------------------------------------------------------------------
/public/assets/jquery-ui/images/ui-icons_555555_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/assets/jquery-ui/images/ui-icons_555555_256x240.png
--------------------------------------------------------------------------------
/public/assets/jquery-ui/images/ui-icons_777620_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/assets/jquery-ui/images/ui-icons_777620_256x240.png
--------------------------------------------------------------------------------
/public/assets/jquery-ui/images/ui-icons_777777_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/assets/jquery-ui/images/ui-icons_777777_256x240.png
--------------------------------------------------------------------------------
/public/assets/jquery-ui/images/ui-icons_cc0000_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/assets/jquery-ui/images/ui-icons_cc0000_256x240.png
--------------------------------------------------------------------------------
/public/assets/jquery-ui/images/ui-icons_ffffff_256x240.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/assets/jquery-ui/images/ui-icons_ffffff_256x240.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/favicon.ico
--------------------------------------------------------------------------------
/public/images/background_pos.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/background_pos.jpg
--------------------------------------------------------------------------------
/public/images/capturas/1-Login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/capturas/1-Login.png
--------------------------------------------------------------------------------
/public/images/capturas/2-Dasdboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/capturas/2-Dasdboard.png
--------------------------------------------------------------------------------
/public/images/capturas/3-Caja.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/capturas/3-Caja.png
--------------------------------------------------------------------------------
/public/images/capturas/4-Ticket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/capturas/4-Ticket.png
--------------------------------------------------------------------------------
/public/images/capturas/5-Productos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/capturas/5-Productos.png
--------------------------------------------------------------------------------
/public/images/capturas/6-Reporte.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/capturas/6-Reporte.png
--------------------------------------------------------------------------------
/public/images/logotipo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/images/logotipo.png
--------------------------------------------------------------------------------
/public/js/DatatablesSpanish.json:
--------------------------------------------------------------------------------
1 | {
2 | "sProcessing": "Procesando...",
3 | "sLengthMenu": "Mostrar _MENU_ registros",
4 | "sZeroRecords": "No se encontraron resultados",
5 | "sEmptyTable": "Ningún dato disponible en esta tabla",
6 | "sInfo": "Mostrando _START_ a _END_ de _TOTAL_ registros",
7 | "sInfoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
8 | "sInfoFiltered": "(filtrado de un total de _MAX_ registros)",
9 | "sSearch": "Buscar:",
10 | "sInfoThousands": ",",
11 | "sLoadingRecords": "Cargando...",
12 | "oPaginate": {
13 | "sFirst": "Primero",
14 | "sLast": "Último",
15 | "sNext": "Siguiente",
16 | "sPrevious": "Anterior"
17 | },
18 | "oAria": {
19 | "sSortAscending": ": Activar para ordenar la columna de manera ascendente",
20 | "sSortDescending": ": Activar para ordenar la columna de manera descendente"
21 | },
22 | "buttons": {
23 | "copy": "Copiar",
24 | "colvis": "Visibilidad"
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/public/js/scripts.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * Start Bootstrap - SB Admin v7.0.7 (https://startbootstrap.com/template/sb-admin)
3 | * Copyright 2013-2023 Start Bootstrap
4 | * Licensed under MIT (https://github.com/StartBootstrap/startbootstrap-sb-admin/blob/master/LICENSE)
5 | */
6 | //
7 | // Scripts
8 | //
9 |
10 | window.addEventListener('DOMContentLoaded', event => {
11 |
12 | // Toggle the side navigation
13 | const sidebarToggle = document.body.querySelector('#sidebarToggle');
14 | if (sidebarToggle) {
15 | // Uncomment Below to persist sidebar toggle between refreshes
16 | // if (localStorage.getItem('sb|sidebar-toggle') === 'true') {
17 | // document.body.classList.toggle('sb-sidenav-toggled');
18 | // }
19 | sidebarToggle.addEventListener('click', event => {
20 | event.preventDefault();
21 | document.body.classList.toggle('sb-sidenav-toggled');
22 | localStorage.setItem('sb|sidebar-toggle', document.body.classList.contains('sb-sidenav-toggled'));
23 | });
24 | }
25 | });
26 |
27 | $(document).ready(function() {
28 | $("body").tooltip({
29 | selector: '[rel=tooltip]'
30 | });
31 | });
32 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/public/webfonts/fa-brands-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-brands-400.ttf
--------------------------------------------------------------------------------
/public/webfonts/fa-brands-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-brands-400.woff2
--------------------------------------------------------------------------------
/public/webfonts/fa-regular-400.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-regular-400.ttf
--------------------------------------------------------------------------------
/public/webfonts/fa-regular-400.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-regular-400.woff2
--------------------------------------------------------------------------------
/public/webfonts/fa-solid-900.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-solid-900.ttf
--------------------------------------------------------------------------------
/public/webfonts/fa-solid-900.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-solid-900.woff2
--------------------------------------------------------------------------------
/public/webfonts/fa-v4compatibility.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-v4compatibility.ttf
--------------------------------------------------------------------------------
/public/webfonts/fa-v4compatibility.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/public/webfonts/fa-v4compatibility.woff2
--------------------------------------------------------------------------------
/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/Cache/FactoriesCache/FileVarExportHandler.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\FactoriesCache;
13 |
14 | final class FileVarExportHandler
15 | {
16 | private string $path = WRITEPATH . 'cache';
17 |
18 | /**
19 | * @param array|bool|float|int|object|string|null $val
20 | */
21 | public function save(string $key, $val): void
22 | {
23 | $val = var_export($val, true);
24 |
25 | // Write to temp file first to ensure atomicity
26 | $tmp = $this->path . "/{$key}." . uniqid('', true) . '.tmp';
27 | file_put_contents($tmp, 'path . "/{$key}");
30 | }
31 |
32 | public function delete(string $key): void
33 | {
34 | @unlink($this->path . "/{$key}");
35 | }
36 |
37 | /**
38 | * @return array|bool|float|int|object|string|null
39 | */
40 | public function get(string $key)
41 | {
42 | return @include $this->path . "/{$key}";
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/cell.tpl.php:
--------------------------------------------------------------------------------
1 | <@php
2 |
3 | namespace {namespace};
4 |
5 | use CodeIgniter\View\Cells\Cell;
6 |
7 | class {class} extends Cell
8 | {
9 | //
10 | }
11 |
--------------------------------------------------------------------------------
/system/Commands/Generators/Views/cell_view.tpl.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/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 = '= $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('= $table ?>', true);
33 | }
34 |
35 | public function down()
36 | {
37 | $this->forge->dropTable('= $table ?>', 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 |
10 | protected $DBGroup = '{dbGroup}';
11 |
12 | protected $table = '{table}';
13 | protected $primaryKey = 'id';
14 | protected $useAutoIncrement = true;
15 | protected $returnType = {return};
16 | protected $useSoftDeletes = false;
17 | protected $protectFields = true;
18 | protected $allowedFields = [];
19 |
20 | protected bool $allowEmptyInserts = false;
21 |
22 | // Dates
23 | protected $useTimestamps = false;
24 | protected $dateFormat = 'datetime';
25 | protected $createdField = 'created_at';
26 | protected $updatedField = 'updated_at';
27 | protected $deletedField = 'deleted_at';
28 |
29 | // Validation
30 | protected $validationRules = [];
31 | protected $validationMessages = [];
32 | protected $skipValidation = false;
33 | protected $cleanValidationRules = true;
34 |
35 | // Callbacks
36 | protected $allowCallbacks = true;
37 | protected $beforeInsert = [];
38 | protected $afterInsert = [];
39 | protected $beforeUpdate = [];
40 | protected $afterUpdate = [];
41 | protected $beforeFind = [];
42 | protected $afterFind = [];
43 | protected $beforeDelete = [];
44 | protected $afterDelete = [];
45 | }
46 |
--------------------------------------------------------------------------------
/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(
28 | parse_url('https://codeigniter.com' . $_SERVER['REQUEST_URI'], PHP_URL_PATH) ?? ''
29 | );
30 |
31 | // All request handle by index.php file.
32 | $_SERVER['SCRIPT_NAME'] = '/index.php';
33 |
34 | // Full path
35 | $path = $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . ltrim($uri, '/');
36 |
37 | // If $path is an existing file or folder within the public folder
38 | // then let the request handle it like normal.
39 | if ($uri !== '/' && (is_file($path) || is_dir($path))) {
40 | return false;
41 | }
42 |
43 | unset($uri, $path);
44 |
45 | // Otherwise, we'll load the index file and let
46 | // the framework handle the request from here.
47 | require_once $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR . 'index.php';
48 | // @codeCoverageIgnoreEnd
49 |
--------------------------------------------------------------------------------
/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 | * @see \CodeIgniter\Config\ConfigTest
17 | */
18 | class Config
19 | {
20 | /**
21 | * Create new configuration instances or return
22 | * a shared instance
23 | *
24 | * @param string $name Configuration name
25 | * @param bool $getShared Use shared instance
26 | *
27 | * @return object|null
28 | */
29 | public static function get(string $name, bool $getShared = true)
30 | {
31 | return Factories::config($name, ['getShared' => $getShared]);
32 | }
33 |
34 | /**
35 | * Helper method for injecting mock instances while testing.
36 | *
37 | * @param object $instance
38 | *
39 | * @return void
40 | */
41 | public static function injectMock(string $name, $instance)
42 | {
43 | Factories::injectMock('config', $name, $instance);
44 | }
45 |
46 | /**
47 | * Resets the static arrays
48 | *
49 | * @return void
50 | */
51 | public static function reset()
52 | {
53 | Factories::reset('config');
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/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(): void
40 | {
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/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 CodeIgniter\Exceptions\HasExitCodeInterface;
15 | use Error;
16 |
17 | class DatabaseException extends Error implements ExceptionInterface, HasExitCodeInterface
18 | {
19 | public function getExitCode(): int
20 | {
21 | return EXIT_DATABASE;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/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 | * @see \CodeIgniter\Database\ModelFactoryTest
23 | */
24 | class ModelFactory
25 | {
26 | /**
27 | * Creates new Model instances or returns a shared instance
28 | *
29 | * @return mixed
30 | */
31 | public static function get(string $name, bool $getShared = true, ?ConnectionInterface $connection = null)
32 | {
33 | return Factories::models($name, ['getShared' => $getShared], $connection);
34 | }
35 |
36 | /**
37 | * Helper method for injecting mock instances while testing.
38 | *
39 | * @param object $instance
40 | */
41 | public static function injectMock(string $name, $instance)
42 | {
43 | Factories::injectMock('models', $name, $instance);
44 | }
45 |
46 | /**
47 | * Resets the static arrays
48 | */
49 | public static function reset()
50 | {
51 | Factories::reset('models');
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/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 never
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 never
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 never
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/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 | /**
15 | * @see \CodeIgniter\Database\RawSqlTest
16 | */
17 | class RawSql
18 | {
19 | /**
20 | * @var string Raw SQL string
21 | */
22 | private string $string;
23 |
24 | public function __construct(string $sqlString)
25 | {
26 | $this->string = $sqlString;
27 | }
28 |
29 | public function __toString(): string
30 | {
31 | return $this->string;
32 | }
33 |
34 | /**
35 | * Create new instance with new SQL string
36 | */
37 | public function with(string $newSqlString): self
38 | {
39 | $new = clone $this;
40 | $new->string = $newSqlString;
41 |
42 | return $new;
43 | }
44 |
45 | /**
46 | * Returns unique id for binding key
47 | */
48 | public function getBindingKey(): string
49 | {
50 | return 'RawSql' . spl_object_id($this);
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/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 never
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 never
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/ExceptionHandlerInterface.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;
13 |
14 | use CodeIgniter\HTTP\RequestInterface;
15 | use CodeIgniter\HTTP\ResponseInterface;
16 | use Throwable;
17 |
18 | interface ExceptionHandlerInterface
19 | {
20 | /**
21 | * Determines the correct way to display the error.
22 | */
23 | public function handle(
24 | Throwable $exception,
25 | RequestInterface $request,
26 | ResponseInterface $response,
27 | int $statusCode,
28 | int $exitCode
29 | ): void;
30 | }
31 |
--------------------------------------------------------------------------------
/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/_config.tpl:
--------------------------------------------------------------------------------
1 |
2 | Read the CodeIgniter docs...
3 |
4 |
5 |
6 |
7 |
8 | CodeIgniter Version: |
9 | { ciVersion } |
10 |
11 |
12 | PHP Version: |
13 | { phpVersion } |
14 |
15 |
16 | PHP SAPI: |
17 | { phpSAPI } |
18 |
19 |
20 | Environment: |
21 | { environment } |
22 |
23 |
24 | Base URL: |
25 |
26 | { if $baseURL == '' }
27 |
28 | The $baseURL should always be set manually to prevent possible URL personification from external parties.
29 |
30 | { else }
31 | { baseURL }
32 | { endif }
33 | |
34 |
35 |
36 | Timezone: |
37 | { timezone } |
38 |
39 |
40 | Locale: |
41 | { locale } |
42 |
43 |
44 | Content Security Policy Enabled: |
45 | { if $cspEnabled } Yes { else } No { endif } |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_database.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Time |
5 | Query String |
6 |
7 |
8 |
9 | {queries}
10 |
11 | {duration} |
12 | {! sql !} |
13 | {trace-file} |
14 |
15 |
16 | |
17 |
18 | {trace}
19 | {index}{file}
20 | {function}
21 | {/trace}
22 | |
23 |
24 | {/queries}
25 |
26 |
27 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_events.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Time |
5 | Event Name |
6 | Times Called |
7 |
8 |
9 |
10 | {events}
11 |
12 | { duration } ms |
13 | {event} |
14 | {count} |
15 |
16 | {/events}
17 |
18 |
19 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_files.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 | {userFiles}
4 |
5 | {name} |
6 | {path} |
7 |
8 | {/userFiles}
9 | {coreFiles}
10 |
11 | {name} |
12 | {path} |
13 |
14 | {/coreFiles}
15 |
16 |
17 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_history.tpl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Action |
5 | Datetime |
6 | Status |
7 | Method |
8 | URL |
9 | Content-Type |
10 | Is AJAX? |
11 |
12 |
13 |
14 | {files}
15 |
16 |
17 |
18 | |
19 | {datetime} |
20 | {status} |
21 | {method} |
22 | {url} |
23 | {contentType} |
24 | {isAJAX} |
25 |
26 | {/files}
27 |
28 |
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 | Severity |
8 | Message |
9 |
10 |
11 |
12 | {logs}
13 |
14 | {level} |
15 | {msg} |
16 |
17 | {/logs}
18 |
19 |
20 | { endif }
21 |
--------------------------------------------------------------------------------
/system/Debug/Toolbar/Views/_routes.tpl:
--------------------------------------------------------------------------------
1 | Matched Route
2 |
3 |
4 |
5 | {matchedRoute}
6 |
7 | Directory: |
8 | {directory} |
9 |
10 |
11 | Controller: |
12 | {controller} |
13 |
14 |
15 | Method: |
16 | {method} |
17 |
18 |
19 | Params: |
20 | {paramCount} / {truePCount} |
21 |
22 | {params}
23 |
24 | {name} |
25 | {value} |
26 |
27 | {/params}
28 | {/matchedRoute}
29 |
30 |
31 |
32 |
33 | Defined Routes
34 |
35 |
36 |
37 |
38 | Method |
39 | Route |
40 | Handler |
41 |
42 |
43 |
44 | {routes}
45 |
46 | {method} |
47 | {route} |
48 | {handler} |
49 |
50 | {/routes}
51 |
52 |
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 | * @return string
30 | *
31 | * @throws EncryptionException
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 | * @return string
42 | *
43 | * @throws EncryptionException
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 | * @return Time
27 | *
28 | * @throws Exception
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/IntBoolCast.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 | * Int Bool Cast
16 | *
17 | * DB column: int (0/1) <--> Class property: bool
18 | */
19 | final class IntBoolCast extends BaseCast
20 | {
21 | /**
22 | * @param int $value
23 | */
24 | public static function get($value, array $params = []): bool
25 | {
26 | return (bool) $value;
27 | }
28 |
29 | /**
30 | * @param bool|int|string $value
31 | */
32 | public static function set($value, array $params = []): int
33 | {
34 | return (int) $value;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/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/CastException.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 | * Cast Exceptions.
16 | *
17 | * @deprecated use CodeIgniter\Entity\Exceptions\CastException instead.
18 | *
19 | * @codeCoverageIgnore
20 | */
21 | class CastException extends CriticalError implements HasExitCodeInterface
22 | {
23 | use DebugTraceableTrait;
24 |
25 | public function getExitCode(): int
26 | {
27 | return EXIT_CONFIG;
28 | }
29 |
30 | /**
31 | * @return static
32 | */
33 | public static function forInvalidJsonFormatException(int $error)
34 | {
35 | switch ($error) {
36 | case JSON_ERROR_DEPTH:
37 | return new static(lang('Cast.jsonErrorDepth'));
38 |
39 | case JSON_ERROR_STATE_MISMATCH:
40 | return new static(lang('Cast.jsonErrorStateMismatch'));
41 |
42 | case JSON_ERROR_CTRL_CHAR:
43 | return new static(lang('Cast.jsonErrorCtrlChar'));
44 |
45 | case JSON_ERROR_SYNTAX:
46 | return new static(lang('Cast.jsonErrorSyntax'));
47 |
48 | case JSON_ERROR_UTF8:
49 | return new static(lang('Cast.jsonErrorUtf8'));
50 |
51 | default:
52 | return new static(lang('Cast.jsonErrorUnknown'));
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/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 implements HasExitCodeInterface
18 | {
19 | use DebugTraceableTrait;
20 |
21 | public function getExitCode(): int
22 | {
23 | return EXIT_CONFIG;
24 | }
25 |
26 | /**
27 | * @return static
28 | */
29 | public static function forDisabledMigrations()
30 | {
31 | return new static(lang('Migrations.disabled'));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/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 | /**
24 | * @return static
25 | */
26 | public static function forCannotSetFilePath(string $path)
27 | {
28 | return new static(lang('HTTP.cannotSetFilepath', [$path]));
29 | }
30 |
31 | /**
32 | * @return static
33 | */
34 | public static function forCannotSetBinary()
35 | {
36 | return new static(lang('HTTP.cannotSetBinary'));
37 | }
38 |
39 | /**
40 | * @return static
41 | */
42 | public static function forNotFoundDownloadSource()
43 | {
44 | return new static(lang('HTTP.notFoundDownloadSource'));
45 | }
46 |
47 | /**
48 | * @return static
49 | */
50 | public static function forCannotSetCache()
51 | {
52 | return new static(lang('HTTP.cannotSetCache'));
53 | }
54 |
55 | /**
56 | * @return static
57 | */
58 | public static function forCannotSetStatusCode(int $code, string $reason)
59 | {
60 | return new static(lang('HTTP.cannotSetStatusCode', [$code, $reason]));
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/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/HTTPExceptionInterface.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 | * Interface for Exceptions that has exception code as HTTP status code.
16 | */
17 | interface HTTPExceptionInterface
18 | {
19 | }
20 |
--------------------------------------------------------------------------------
/system/Exceptions/HasExitCodeInterface.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 | * Interface for Exceptions that has exception code as exit code.
16 | */
17 | interface HasExitCodeInterface
18 | {
19 | /**
20 | * Returns exit status code.
21 | */
22 | public function getExitCode(): int;
23 | }
24 |
--------------------------------------------------------------------------------
/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 | /**
20 | * @return static
21 | */
22 | public static function forNoPrimaryKey(string $modelName)
23 | {
24 | return new static(lang('Database.noPrimaryKey', [$modelName]));
25 | }
26 |
27 | /**
28 | * @return static
29 | */
30 | public static function forNoDateFormat(string $modelName)
31 | {
32 | return new static(lang('Database.noDateFormat', [$modelName]));
33 | }
34 |
35 | /**
36 | * @return static
37 | */
38 | public static function forMethodNotAvailable(string $modelName, string $methodName)
39 | {
40 | return new static(lang('Database.methodNotAvailable', [$modelName, $methodName]));
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/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 | /**
22 | * @return static
23 | */
24 | public static function forInvalidMockClass(string $name)
25 | {
26 | return new static(lang('Test.invalidMockClass', [$name]));
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/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 | /**
23 | * @return static
24 | */
25 | public static function forFileNotFound(string $path)
26 | {
27 | return new static(lang('Files.fileNotFound', [$path]));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/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 | * @see \CodeIgniter\Filters\DebugToolbarTest
22 | */
23 | class DebugToolbar implements FilterInterface
24 | {
25 | /**
26 | * We don't need to do anything here.
27 | *
28 | * @param list|null $arguments
29 | */
30 | public function before(RequestInterface $request, $arguments = null)
31 | {
32 | }
33 |
34 | /**
35 | * If the debug flag is set (CI_DEBUG) then collect performance
36 | * and debug information and display it in a toolbar.
37 | *
38 | * @param list|null $arguments
39 | */
40 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
41 | {
42 | Services::toolbar()->prepare($request, $response);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/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/Filters/Honeypot.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\Honeypot\Exceptions\HoneypotException;
15 | use CodeIgniter\HTTP\IncomingRequest;
16 | use CodeIgniter\HTTP\RequestInterface;
17 | use CodeIgniter\HTTP\ResponseInterface;
18 | use Config\Services;
19 |
20 | /**
21 | * Honeypot filter
22 | *
23 | * @see \CodeIgniter\Filters\HoneypotTest
24 | */
25 | class Honeypot implements FilterInterface
26 | {
27 | /**
28 | * Checks if Honeypot field is empty, if not then the
29 | * requester is a bot
30 | *
31 | * @param list|null $arguments
32 | *
33 | * @throws HoneypotException
34 | */
35 | public function before(RequestInterface $request, $arguments = null)
36 | {
37 | if (! $request instanceof IncomingRequest) {
38 | return;
39 | }
40 |
41 | if (Services::honeypot()->hasContent($request)) {
42 | throw HoneypotException::isBot();
43 | }
44 | }
45 |
46 | /**
47 | * Attach a honeypot to the current response.
48 | *
49 | * @param list|null $arguments
50 | */
51 | public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
52 | {
53 | Services::honeypot()->attachHoneypot($response);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/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|object|string $data
23 | *
24 | * @return false|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 | * @see \CodeIgniter\Format\JSONFormatterTest
21 | */
22 | class JSONFormatter implements FormatterInterface
23 | {
24 | /**
25 | * Takes the given data and formats it.
26 | *
27 | * @param array|bool|float|int|object|string|null $data
28 | *
29 | * @return false|string (JSON string | false)
30 | */
31 | public function format($data)
32 | {
33 | $config = new Format();
34 |
35 | $options = $config->formatterOptions['application/json'] ?? JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES;
36 | $options |= JSON_PARTIAL_OUTPUT_ON_ERROR;
37 |
38 | $options = ENVIRONMENT === 'production' ? $options : $options | JSON_PRETTY_PRINT;
39 |
40 | $result = json_encode($data, $options, 512);
41 |
42 | if (! in_array(json_last_error(), [JSON_ERROR_NONE, JSON_ERROR_RECURSION], true)) {
43 | throw FormatException::forInvalidJSON(json_last_error_msg());
44 | }
45 |
46 | return $result;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/system/HTTP/Exceptions/BadRequestException.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\HTTP\Exceptions;
13 |
14 | use CodeIgniter\Exceptions\HTTPExceptionInterface;
15 | use RuntimeException;
16 |
17 | /**
18 | * 400 Bad Request
19 | */
20 | class BadRequestException extends RuntimeException implements HTTPExceptionInterface
21 | {
22 | /**
23 | * HTTP status code for Bad Request
24 | *
25 | * @var int
26 | */
27 | protected $code = 400; // @phpstan-ignore-line
28 | }
29 |
--------------------------------------------------------------------------------
/system/HTTP/RequestInterface.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\HTTP;
13 |
14 | /**
15 | * Representation of an incoming, server-side HTTP request.
16 | *
17 | * Corresponds to Psr7\ServerRequestInterface.
18 | */
19 | interface RequestInterface extends OutgoingRequestInterface
20 | {
21 | /**
22 | * Gets the user's IP address.
23 | * Supplied by RequestTrait.
24 | *
25 | * @return string IP address
26 | */
27 | public function getIPAddress(): string;
28 |
29 | /**
30 | * Validate an IP address
31 | *
32 | * @param string $ip IP Address
33 | * @param string $which IP protocol: 'ipv4' or 'ipv6'
34 | *
35 | * @deprecated Use Validation instead
36 | */
37 | public function isValidIP(string $ip, ?string $which = null): bool;
38 |
39 | /**
40 | * Fetch an item from the $_SERVER array.
41 | * Supplied by RequestTrait.
42 | *
43 | * @param array|string|null $index Index for item to be fetched from $_SERVER
44 | * @param int|null $filter A filter name to be applied
45 | *
46 | * @return mixed
47 | */
48 | public function getServer($index = null, $filter = null);
49 | }
50 |
--------------------------------------------------------------------------------
/system/HTTP/ResponsableInterface.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\HTTP;
13 |
14 | interface ResponsableInterface
15 | {
16 | public function getResponse(): ResponseInterface;
17 | }
18 |
--------------------------------------------------------------------------------
/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 | /**
20 | * Thrown when the template value of config is empty.
21 | *
22 | * @return static
23 | */
24 | public static function forNoTemplate()
25 | {
26 | return new static(lang('Honeypot.noTemplate'));
27 | }
28 |
29 | /**
30 | * Thrown when the name value of config is empty.
31 | *
32 | * @return static
33 | */
34 | public static function forNoNameField()
35 | {
36 | return new static(lang('Honeypot.noNameField'));
37 | }
38 |
39 | /**
40 | * Thrown when the hidden value of config is false.
41 | *
42 | * @return static
43 | */
44 | public static function forNoHiddenValue()
45 | {
46 | return new static(lang('Honeypot.noHiddenValue'));
47 | }
48 |
49 | /**
50 | * Thrown when there are no data in the request of honeypot field.
51 | *
52 | * @return static
53 | */
54 | public static function isBot()
55 | {
56 | return new static(lang('Honeypot.theClientIsABot'));
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/system/HotReloader/IteratorFilter.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\HotReloader;
13 |
14 | use Config\Toolbar;
15 | use RecursiveFilterIterator;
16 | use RecursiveIterator;
17 |
18 | /**
19 | * @internal
20 | *
21 | * @psalm-suppress MissingTemplateParam
22 | */
23 | final class IteratorFilter extends RecursiveFilterIterator implements RecursiveIterator
24 | {
25 | private array $watchedExtensions = [];
26 |
27 | public function __construct(RecursiveIterator $iterator)
28 | {
29 | parent::__construct($iterator);
30 |
31 | $this->watchedExtensions = config(Toolbar::class)->watchedExtensions;
32 | }
33 |
34 | /**
35 | * Apply filters to the files in the iterator.
36 | */
37 | public function accept(): bool
38 | {
39 | if (! $this->current()->isFile()) {
40 | return true;
41 | }
42 |
43 | $filename = $this->current()->getFilename();
44 |
45 | // Skip hidden files and directories.
46 | if ($filename[0] === '.') {
47 | return false;
48 | }
49 |
50 | // Only consume files of interest.
51 | $ext = trim(strtolower($this->current()->getExtension()), '. ');
52 |
53 | return in_array($ext, $this->watchedExtensions, true);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/system/I18n/Time.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\I18n;
13 |
14 | use DateTimeImmutable;
15 |
16 | /**
17 | * A localized date/time package inspired
18 | * by Nesbot/Carbon and CakePHP/Chronos.
19 | *
20 | * Requires the intl PHP extension.
21 | *
22 | * @property int $age read-only
23 | * @property string $day read-only
24 | * @property string $dayOfWeek read-only
25 | * @property string $dayOfYear read-only
26 | * @property bool $dst read-only
27 | * @property string $hour read-only
28 | * @property bool $local read-only
29 | * @property string $minute read-only
30 | * @property string $month read-only
31 | * @property string $quarter read-only
32 | * @property string $second read-only
33 | * @property int $timestamp read-only
34 | * @property bool $utc read-only
35 | * @property string $weekOfMonth read-only
36 | * @property string $weekOfYear read-only
37 | * @property string $year read-only
38 | *
39 | * @see \CodeIgniter\I18n\TimeTest
40 | */
41 | class Time extends DateTimeImmutable
42 | {
43 | use TimeTrait;
44 | }
45 |
--------------------------------------------------------------------------------
/system/I18n/TimeLegacy.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\I18n;
13 |
14 | use DateTime;
15 |
16 | /**
17 | * Legacy Time class.
18 | *
19 | * This class is only for backward compatibility. Do not use.
20 | * This is not immutable! Some methods are immutable,
21 | * but some methods can alter the state.
22 | *
23 | * @property int $age read-only
24 | * @property string $day read-only
25 | * @property string $dayOfWeek read-only
26 | * @property string $dayOfYear read-only
27 | * @property bool $dst read-only
28 | * @property string $hour read-only
29 | * @property bool $local read-only
30 | * @property string $minute read-only
31 | * @property string $month read-only
32 | * @property string $quarter read-only
33 | * @property string $second read-only
34 | * @property int $timestamp read-only
35 | * @property bool $utc read-only
36 | * @property string $weekOfMonth read-only
37 | * @property string $weekOfYear read-only
38 | * @property string $year read-only
39 | *
40 | * @deprecated Use Time instead.
41 | * @see \CodeIgniter\I18n\TimeLegacyTest
42 | */
43 | class TimeLegacy extends DateTime
44 | {
45 | use TimeTrait;
46 | }
47 |
--------------------------------------------------------------------------------
/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 | 'invalidDirectory' => 'Directory does not exist: "{0}"',
18 | 'invalidPhpVersion' => 'Your PHP version must be {0} or higher to run CodeIgniter. Current version: {1}',
19 | 'missingExtension' => 'The framework needs the following extension(s) installed and loaded: "{0}".',
20 | 'noHandlers' => '"{0}" must provide at least one Handler.',
21 | ];
22 |
--------------------------------------------------------------------------------
/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/Errors.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 | // Errors language settings
13 | return [
14 | 'pageNotFound' => '404 - Page Not Found',
15 | 'sorryCannotFind' => 'Sorry! Cannot seem to find the page you were looking for.',
16 | 'whoops' => 'Whoops!',
17 | 'weHitASnag' => 'We seem to have hit a snag. Please try again later...',
18 | ];
19 |
--------------------------------------------------------------------------------
/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}". Reason: {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/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" language settings
13 | return [
14 | 'invalidMessageFormat' => 'Invalid message format: "{0}", args: "{1}"',
15 | ];
16 |
--------------------------------------------------------------------------------
/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/Time.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 | // Time language settings
13 | return [
14 | 'invalidFormat' => '"{0}" is not a valid datetime format',
15 | 'invalidMonth' => 'Months must be between 1 and 12. Given: {0}',
16 | 'invalidDay' => 'Days must be between 1 and 31. Given: {0}',
17 | 'invalidOverDay' => 'Days must be between 1 and {0}. Given: {1}',
18 | 'invalidHours' => 'Hours must be between 0 and 23. Given: {0}',
19 | 'invalidMinutes' => 'Minutes must be between 0 and 59. Given: {0}',
20 | 'invalidSeconds' => 'Seconds must be between 0 and 59. Given: {0}',
21 | 'years' => '{0, plural, =1{# year} other{# years}}',
22 | 'months' => '{0, plural, =1{# month} other{# months}}',
23 | 'weeks' => '{0, plural, =1{# week} other{# weeks}}',
24 | 'days' => '{0, plural, =1{# day} other{# days}}',
25 | 'hours' => '{0, plural, =1{# hour} other{# hours}}',
26 | 'minutes' => '{0, plural, =1{# minute} other{# minutes}}',
27 | 'seconds' => '{0, plural, =1{# second} other{# seconds}}',
28 | 'ago' => '{0} ago',
29 | 'inFuture' => 'in {0}',
30 | 'yesterday' => 'Yesterday',
31 | 'tomorrow' => 'Tomorrow',
32 | 'now' => 'Just now',
33 | ];
34 |
--------------------------------------------------------------------------------
/system/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 | /**
19 | * @return static
20 | */
21 | public static function forInvalidLogLevel(string $level)
22 | {
23 | return new static(lang('Log.invalidLogLevel', [$level]));
24 | }
25 |
26 | /**
27 | * @return static
28 | */
29 | public static function forInvalidMessageType(string $messageType)
30 | {
31 | return new static(lang('Log.invalidMessageType', [$messageType]));
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/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/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 | /**
19 | * Throws when the template is invalid.
20 | *
21 | * @return static
22 | */
23 | public static function forInvalidTemplate(?string $template = null)
24 | {
25 | return new static(lang('Pager.invalidTemplate', [$template]));
26 | }
27 |
28 | /**
29 | * Throws when the group is invalid.
30 | *
31 | * @return static
32 | */
33 | public static function forInvalidPaginationGroup(?string $group = null)
34 | {
35 | return new static(lang('Pager.invalidPaginationGroup', [$group]));
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/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, string $httpVerb): array;
25 | }
26 |
--------------------------------------------------------------------------------
/system/Router/Exceptions/MethodNotFoundException.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 RuntimeException;
15 |
16 | /**
17 | * @internal
18 | */
19 | final class MethodNotFoundException extends RuntimeException
20 | {
21 | }
22 |
--------------------------------------------------------------------------------
/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 CodeIgniter\Exceptions\HTTPExceptionInterface;
15 | use Exception;
16 |
17 | /**
18 | * RedirectException
19 | *
20 | * @deprecated Use \CodeIgniter\HTTP\Exceptions\RedirectException instead
21 | */
22 | class RedirectException extends Exception implements HTTPExceptionInterface
23 | {
24 | /**
25 | * HTTP status code for redirects
26 | *
27 | * @var int
28 | */
29 | protected $code = 302;
30 | }
31 |
--------------------------------------------------------------------------------
/system/Session/Exceptions/SessionException.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\Exceptions;
13 |
14 | use CodeIgniter\Exceptions\FrameworkException;
15 |
16 | class SessionException extends FrameworkException
17 | {
18 | public static function forMissingDatabaseTable()
19 | {
20 | return new static(lang('Session.missingDatabaseTable'));
21 | }
22 |
23 | public static function forInvalidSavePath(?string $path = null)
24 | {
25 | return new static(lang('Session.invalidSavePath', [$path]));
26 | }
27 |
28 | public static function forWriteProtectedSavePath(?string $path = null)
29 | {
30 | return new static(lang('Session.writeProtectedSavePath', [$path]));
31 | }
32 |
33 | public static function forEmptySavepath()
34 | {
35 | return new static(lang('Session.emptySavePath'));
36 | }
37 |
38 | public static function forInvalidSavePathFormat(string $path)
39 | {
40 | return new static(lang('Session.invalidSavePathFormat', [$path]));
41 | }
42 |
43 | /**
44 | * @deprecated
45 | *
46 | * @codeCoverageIgnore
47 | */
48 | public static function forInvalidSameSiteSetting(string $samesite)
49 | {
50 | return new static(lang('Session.invalidSameSiteSetting', [$samesite]));
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/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 | * @see \CodeIgniter\Session\Handlers\Database\MySQLiHandlerTest
20 | */
21 | class MySQLiHandler extends DatabaseHandler
22 | {
23 | /**
24 | * Lock the session.
25 | */
26 | protected function lockSession(string $sessionID): bool
27 | {
28 | $arg = md5($sessionID . ($this->matchIP ? '_' . $this->ipAddress : ''));
29 | if ($this->db->query("SELECT GET_LOCK('{$arg}', 300) AS ci_session_lock")->getRow()->ci_session_lock) {
30 | $this->lock = $arg;
31 |
32 | return true;
33 | }
34 |
35 | return $this->fail();
36 | }
37 |
38 | /**
39 | * Releases the lock, if any.
40 | */
41 | protected function releaseLock(): bool
42 | {
43 | if (! $this->lock) {
44 | return true;
45 | }
46 |
47 | if ($this->db->query("SELECT RELEASE_LOCK('{$this->lock}') AS ci_session_lock")->getRow()->ci_session_lock) {
48 | $this->lock = false;
49 |
50 | return true;
51 | }
52 |
53 | return $this->fail();
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/system/Superglobals.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 | /**
15 | * Superglobals manipulation.
16 | *
17 | * @internal
18 | * @see \CodeIgniter\SuperglobalsTest
19 | */
20 | final class Superglobals
21 | {
22 | private array $server;
23 | private array $get;
24 |
25 | public function __construct(?array $server = null, ?array $get = null)
26 | {
27 | $this->server = $server ?? $_SERVER;
28 | $this->get = $get ?? $_GET;
29 | }
30 |
31 | public function server(string $key): ?string
32 | {
33 | return $this->server[$key] ?? null;
34 | }
35 |
36 | public function setServer(string $key, string $value): void
37 | {
38 | $this->server[$key] = $value;
39 | $_SERVER[$key] = $value;
40 | }
41 |
42 | /**
43 | * @return array|string|null
44 | */
45 | public function get(string $key)
46 | {
47 | return $this->get[$key] ?? null;
48 | }
49 |
50 | public function setGet(string $key, string $value): void
51 | {
52 | $this->get[$key] = $value;
53 | $_GET[$key] = $value;
54 | }
55 |
56 | public function setGetArray(array $array): void
57 | {
58 | $this->get = $array;
59 | $_GET = $array;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/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/IniTestTrait.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 | trait IniTestTrait
15 | {
16 | private array $iniSettings = [];
17 |
18 | private function backupIniValues(array $keys): void
19 | {
20 | foreach ($keys as $key) {
21 | $this->iniSettings[$key] = ini_get($key);
22 | }
23 | }
24 |
25 | private function restoreIniValues(): void
26 | {
27 | foreach ($this->iniSettings as $key => $value) {
28 | ini_set($key, $value);
29 | }
30 |
31 | $this->iniSettings = [];
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/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 string $baseURL = 'http://example.com/';
19 | public string $uriProtocol = 'REQUEST_URI';
20 | public array $proxyIPs = [];
21 | public bool $CSPEnabled = false;
22 | public string $defaultLocale = 'en';
23 | public bool $negotiateLocale = false;
24 | public array $supportedLocales = [
25 | 'en',
26 | 'es',
27 | ];
28 | }
29 |
--------------------------------------------------------------------------------
/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 string $baseURL = 'http://example.com/';
19 | public string $uriProtocol = 'REQUEST_URI';
20 | public array $proxyIPs = [];
21 | public string $CSRFTokenName = 'csrf_test_name';
22 | public string $CSRFCookieName = 'csrf_cookie_name';
23 | public int $CSRFExpire = 7200;
24 | public bool $CSRFRegenerate = true;
25 | public $CSRFExcludeURIs = ['http://example.com'];
26 | public string $CSRFSameSite = 'Lax';
27 | public bool $CSPEnabled = false;
28 | public string $defaultLocale = 'en';
29 | public bool $negotiateLocale = false;
30 | public array $supportedLocales = [
31 | 'en',
32 | 'es',
33 | ];
34 | }
35 |
--------------------------------------------------------------------------------
/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 | $this->response = clone $this->responseOrig;
38 |
39 | // Save so we can access later.
40 | $this->curl_options = $curlOptions;
41 |
42 | return $this->output;
43 | }
44 |
45 | // for testing purposes only
46 | public function getBaseURI()
47 | {
48 | return $this->baseURI;
49 | }
50 |
51 | // for testing purposes only
52 | public function getDelay()
53 | {
54 | return $this->delay;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/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 | /**
21 | * @param int $code
22 | *
23 | * @deprecated 4.4.0 No longer Used. Moved to index.php.
24 | */
25 | protected function callExit($code)
26 | {
27 | // Do not call exit() in testing.
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/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 | }
19 |
--------------------------------------------------------------------------------
/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 string $tokenName = 'csrf_test_name';
24 | public string $headerName = 'X-CSRF-TOKEN';
25 | public string $cookieName = 'csrf_cookie_name';
26 | public int $expires = 7200;
27 | public bool $regenerate = true;
28 | public bool $redirect = false;
29 | public string $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/Test/StreamFilterTrait.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 CodeIgniter\Test\Filters\CITestStreamFilter;
15 |
16 | trait StreamFilterTrait
17 | {
18 | protected function setUpStreamFilterTrait(): void
19 | {
20 | CITestStreamFilter::registration();
21 | CITestStreamFilter::addOutputFilter();
22 | CITestStreamFilter::addErrorFilter();
23 | }
24 |
25 | protected function tearDownStreamFilterTrait(): void
26 | {
27 | CITestStreamFilter::removeOutputFilter();
28 | CITestStreamFilter::removeErrorFilter();
29 | }
30 |
31 | protected function getStreamFilterBuffer(): string
32 | {
33 | return CITestStreamFilter::$buffer;
34 | }
35 |
36 | protected function resetStreamFilterBuffer(): void
37 | {
38 | CITestStreamFilter::$buffer = '';
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/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/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 | * @see \CodeIgniter\Validation\StrictRules\FileRulesTest
22 | */
23 | class FileRules extends NonStrictFileRules
24 | {
25 | }
26 |
--------------------------------------------------------------------------------
/system/Validation/Views/list.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - = esc($error) ?>
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/system/Validation/Views/single.php:
--------------------------------------------------------------------------------
1 | = esc($error) ?>
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 | use Config\View as ViewConfig;
16 |
17 | trait ViewDecoratorTrait
18 | {
19 | /**
20 | * Runs the generated output through any declared
21 | * view decorators.
22 | */
23 | protected function decorateOutput(string $html): string
24 | {
25 | $decorators = $this->config->decorators ?? config(ViewConfig::class)->decorators;
26 |
27 | foreach ($decorators as $decorator) {
28 | if (! is_subclass_of($decorator, ViewDecoratorInterface::class)) {
29 | throw ViewException::forInvalidDecorator($decorator);
30 | }
31 |
32 | $html = $decorator::decorate($html);
33 | }
34 |
35 | return $html;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/system/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 403 Forbidden
5 |
6 |
7 |
8 | Directory access is forbidden.
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php:
--------------------------------------------------------------------------------
1 | forge->addField('id');
14 | $this->forge->addField([
15 | 'name' => ['type' => 'varchar', 'constraint' => 31],
16 | 'uid' => ['type' => 'varchar', 'constraint' => 31],
17 | 'class' => ['type' => 'varchar', 'constraint' => 63],
18 | 'icon' => ['type' => 'varchar', 'constraint' => 31],
19 | 'summary' => ['type' => 'varchar', 'constraint' => 255],
20 | 'created_at' => ['type' => 'datetime', 'null' => true],
21 | 'updated_at' => ['type' => 'datetime', 'null' => true],
22 | 'deleted_at' => ['type' => 'datetime', 'null' => true],
23 | ]);
24 |
25 | $this->forge->addKey('name');
26 | $this->forge->addKey('uid');
27 | $this->forge->addKey(['deleted_at', 'id']);
28 | $this->forge->addKey('created_at');
29 |
30 | $this->forge->createTable('factories');
31 | }
32 |
33 | public function down()
34 | {
35 | $this->forge->dropTable('factories');
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tests/_support/Database/Seeds/ExampleSeeder.php:
--------------------------------------------------------------------------------
1 | 'Test Factory',
14 | 'uid' => 'test001',
15 | 'class' => 'Factories\Tests\NewFactory',
16 | 'icon' => 'fas fa-puzzle-piece',
17 | 'summary' => 'Longer sample text for testing',
18 | ],
19 | [
20 | 'name' => 'Widget Factory',
21 | 'uid' => 'widget',
22 | 'class' => 'Factories\Tests\WidgetPlant',
23 | 'icon' => 'fas fa-puzzle-piece',
24 | 'summary' => 'Create widgets in your factory',
25 | ],
26 | [
27 | 'name' => 'Evil Factory',
28 | 'uid' => 'evil-maker',
29 | 'class' => 'Factories\Evil\MyFactory',
30 | 'icon' => 'fas fa-book-dead',
31 | 'summary' => 'Abandon all hope, ye who enter here',
32 | ],
33 | ];
34 |
35 | $builder = $this->db->table('factories');
36 |
37 | foreach ($factories as $factory) {
38 | $builder->insert($factory);
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/tests/_support/Libraries/ConfigReader.php:
--------------------------------------------------------------------------------
1 | findAll();
23 |
24 | // Make sure the count is as expected
25 | $this->assertCount(3, $objects);
26 | }
27 |
28 | public function testSoftDeleteLeavesRow()
29 | {
30 | $model = new ExampleModel();
31 | $this->setPrivateProperty($model, 'useSoftDeletes', true);
32 | $this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
33 |
34 | /** @var stdClass $object */
35 | $object = $model->first();
36 | $model->delete($object->id);
37 |
38 | // The model should no longer find it
39 | $this->assertNull($model->find($object->id));
40 |
41 | // ... but it should still be in the database
42 | $result = $model->builder()->where('id', $object->id)->get()->getResult();
43 |
44 | $this->assertCount(1, $result);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/tests/session/ExampleSessionTest.php:
--------------------------------------------------------------------------------
1 | set('logged_in', 123);
16 | $this->assertSame(123, $session->get('logged_in'));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/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/mroblesdev/pos-cdp-lite/8c8fbcf0734af1cea462dd9ba0ec46824997c027/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 |
--------------------------------------------------------------------------------