From 7e9668a55246b75f6422a0719cfa9706c5e4f974 Mon Sep 17 00:00:00 2001 From: Naden Date: Sat, 25 Apr 2026 04:41:23 +0700 Subject: [PATCH] init --- .env | 148 ++ .gitignore | 121 + LICENSE | 22 + README.md | 171 ++ app/.htaccess | 6 + app/Commands/CleanupPelanggaran.php | 33 + app/Commands/DhivaCommand.php | 454 ++++ app/Common.php | 15 + app/Config/App.php | 178 ++ app/Config/Autoload.php | 116 + app/Config/Boot/development.php | 32 + app/Config/Boot/production.php | 21 + app/Config/Boot/testing.php | 32 + app/Config/CURLRequest.php | 20 + app/Config/Cache.php | 172 ++ app/Config/Constants.php | 392 +++ app/Config/ContentSecurityPolicy.php | 176 ++ app/Config/Cookie.php | 107 + app/Config/DocTypes.php | 46 + app/Config/Email.php | 19 + app/Config/Encryption.php | 92 + app/Config/Events.php | 55 + app/Config/Exceptions.php | 104 + app/Config/Feature.php | 30 + app/Config/Filters.php | 72 + app/Config/ForeignCharacters.php | 12 + app/Config/Format.php | 77 + app/Config/Generators.php | 42 + app/Config/Honeypot.php | 42 + app/Config/Images.php | 31 + app/Config/Keys.php | 18 + app/Config/Kint.php | 63 + app/Config/Logger.php | 148 ++ app/Config/Migrations.php | 52 + app/Config/Mimes.php | 534 ++++ app/Config/Modules.php | 84 + app/Config/Pager.php | 37 + app/Config/Paths.php | 75 + app/Config/Publisher.php | 28 + app/Config/Routes.php | 31 + app/Config/Routing.php | 113 + app/Config/Security.php | 101 + app/Config/Services.php | 32 + app/Config/Session.php | 102 + app/Config/Toolbar.php | 118 + app/Config/UserAgents.php | 252 ++ app/Config/Validation.php | 44 + app/Config/View.php | 56 + app/Controllers/BaseController.php | 2250 +++++++++++++++++ app/Controllers/DevController.php | 25 + app/Controllers/PersonelController.php | 141 ++ app/Controllers/SuperUserController.php | 182 ++ app/Database/Migrations/.gitkeep | 0 .../2023-10-19-182027_SuperUser.php | 84 + .../2023-10-19-185755_SuperGroup.php | 55 + .../Migrations/2023-10-19-211659_Endpoint.php | 69 + ...2-11-180000_CreateIperaAgreementTables.php | 222 ++ app/Database/Seeds/.gitkeep | 0 app/Database/Seeds/EndpointSeeder.php | 42 + app/Database/Seeds/SuperGroupSeeder.php | 25 + app/Database/Seeds/SuperUserSeeder.php | 34 + app/Filters/.gitkeep | 0 app/Filters/Cors.php | 54 + app/Helpers/.gitkeep | 0 app/Helpers/device_helper.php | 335 +++ app/Language/.gitkeep | 0 app/Language/en/Validation.php | 4 + app/Libraries/.gitkeep | 0 app/Libraries/ArelAyudhi/src/Broadcast.php | 50 + app/Libraries/ArelAyudhi/src/Group.php | 70 + app/Libraries/ArelAyudhi/src/ListMessage.php | 108 + app/Libraries/ArelAyudhi/src/Multiple.php | 25 + .../ArelAyudhi/src/ProdevMessages.php | 84 + .../ArelAyudhi/src/ProdevMessagesAbstract.php | 122 + app/Libraries/ArelAyudhi/src/ProdevXendit.php | 79 + .../ArelAyudhi/src/ProdevXenditAbstract.php | 121 + app/Libraries/ArelAyudhi/src/QrPayment.php | 37 + app/Libraries/ArelAyudhi/src/UserList.php | 161 ++ .../ArelAyudhi/src/VirtualAccount.php | 37 + app/Libraries/ArelAyudhi/src/composer.json | 11 + app/Libraries/DhivaAES.php | 111 + app/Libraries/DhivaComponent/Controller.txt | 13 + .../DhivaComponent/DatabaseClient.txt | 85 + app/Libraries/DhivaComponent/Model.txt | 9 + app/Libraries/DhivaComponent/Routes.txt | 1 + app/Libraries/DhivaComponent/env.txt | 143 ++ app/Libraries/DhivaRoutes.php | 45 + app/Libraries/DistribusiService.php | 15 + app/Libraries/EmailService.php | 423 ++++ app/Libraries/MekariWhatsAppService.php | 461 ++++ app/Libraries/MongoLib.php | 1002 ++++++++ app/Libraries/Notification.php | 39 + app/Libraries/Tenancy.php | 126 + app/Libraries/WablasService.php | 157 ++ app/Libraries/Zoom/.gitignore | 3 + app/Libraries/Zoom/Endpoint/Meetings.php | 146 ++ app/Libraries/Zoom/Endpoint/Recordings.php | 96 + app/Libraries/Zoom/Endpoint/Reports.php | 36 + app/Libraries/Zoom/Endpoint/Users.php | 76 + app/Libraries/Zoom/Endpoint/Webinars.php | 143 ++ app/Libraries/Zoom/Interfaces/Request.php | 199 ++ app/Libraries/Zoom/LICENSE | 21 + app/Libraries/Zoom/README.md | 7 + app/Libraries/Zoom/ZoomAPI.php | 119 + app/Libraries/Zoom/composer.json | 13 + app/Libraries/Zoom/index.php | 8 + app/Models/MongoModel/BaseMongoNoSql.php | 187 ++ app/Models/PersonelModel.php | 52 + app/Models/SqlModel/BaseModelSql.php | 254 ++ app/Models/SqlModel/EndpointModelSql.php | 14 + app/Models/SqlModel/SuperUserModelSql.php | 69 + app/ThirdParty/.gitkeep | 0 app/Views/errors/cli/error_404.php | 7 + app/Views/errors/cli/error_exception.php | 65 + app/Views/errors/cli/production.php | 5 + app/Views/errors/html/debug.css | 197 ++ app/Views/errors/html/debug.js | 116 + app/Views/errors/html/error_404.php | 84 + app/Views/errors/html/error_exception.php | 392 +++ app/Views/errors/html/production.php | 25 + app/Views/welcome_message.php | 325 +++ app/index.html | 11 + builds | 125 + composer.json | 43 + dbsamples.png | Bin 0 -> 82673 bytes env | 144 ++ package-lock.json | 6 + phpunit.xml.dist | 57 + preload.php | 113 + public/.htaccess | 49 + public/dataWargaDummy.json | 183 ++ public/favicon.ico | Bin 0 -> 5430 bytes public/index.php | 56 + public/robots.txt | 2 + schema.sql | 178 ++ spark | 84 + tests/README.md | 122 + .../2020-02-22-222222_example_migration.php | 37 + .../_support/Database/Seeds/ExampleSeeder.php | 41 + tests/_support/Libraries/ConfigReader.php | 17 + tests/_support/Models/ExampleModel.php | 24 + tests/database/ExampleDatabaseTest.php | 46 + tests/session/ExampleSessionTest.php | 18 + tests/unit/HealthTest.php | 50 + writable copy/.htaccess | 6 + writable copy/cache/index.html | 11 + writable copy/debugbar/.gitkeep | 0 .../debugbar/debugbar_1731033133.195989.json | 1 + .../debugbar/debugbar_1731033422.525809.json | 1 + .../debugbar/debugbar_1731033422.788773.json | 1 + .../debugbar/debugbar_1731033422.929684.json | 1 + .../debugbar/debugbar_1731033524.826791.json | 1 + .../debugbar/debugbar_1731033556.047855.json | 1 + .../debugbar/debugbar_1731033556.202196.json | 1 + .../debugbar/debugbar_1731033556.332496.json | 1 + .../debugbar/debugbar_1731033579.274203.json | 1 + .../debugbar/debugbar_1731033579.384264.json | 1 + .../debugbar/debugbar_1731033579.548890.json | 1 + .../debugbar/debugbar_1731049547.712078.json | 1 + .../debugbar/debugbar_1731049577.560615.json | 1 + .../debugbar/debugbar_1731132150.904391.json | 1 + .../debugbar/debugbar_1731132177.984999.json | 1 + .../debugbar/debugbar_1731132178.179148.json | 1 + .../debugbar/debugbar_1731132178.401760.json | 1 + .../debugbar/debugbar_1731132279.085550.json | 1 + .../debugbar/debugbar_1731132279.188896.json | 1 + .../debugbar/debugbar_1731132279.365748.json | 1 + .../debugbar/debugbar_1731132350.455601.json | 1 + .../debugbar/debugbar_1731132350.567570.json | 1 + .../debugbar/debugbar_1731132350.689691.json | 1 + .../debugbar/debugbar_1731132399.468431.json | 1 + .../debugbar/debugbar_1731132399.594444.json | 1 + .../debugbar/debugbar_1731132399.791274.json | 1 + .../debugbar/debugbar_1731132436.204978.json | 1 + .../debugbar/debugbar_1731132541.365417.json | 1 + .../debugbar/debugbar_1731132541.462429.json | 1 + .../debugbar/debugbar_1731132541.748043.json | 1 + .../debugbar/debugbar_1731224368.334265.json | 1 + .../debugbar/debugbar_1731224401.231849.json | 1 + .../debugbar/debugbar_1731261752.622431.json | 1 + .../debugbar/debugbar_1731261836.519335.json | 1 + .../debugbar/debugbar_1731380633.571232.json | 1 + .../debugbar/debugbar_1759844673.058493.json | 1 + writable copy/logs/index.html | 11 + writable copy/logs/log-2024-11-02.log | 687 +++++ writable copy/logs/log-2024-11-03.log | 586 +++++ writable copy/logs/log-2024-11-08.log | 96 + writable copy/logs/log-2024-11-10.log | 972 +++++++ writable copy/logs/log-2024-11-11.log | 324 +++ writable copy/logs/log-2024-11-12.log | 1267 ++++++++++ writable copy/logs/log-2024-11-13.log | 262 ++ writable copy/logs/log-2024-11-14.log | 54 + writable copy/logs/log-2025-10-07.log | 72 + writable copy/session/index.html | 11 + writable copy/uploads/index.html | 11 + 195 files changed, 20254 insertions(+) create mode 100644 .env create mode 100644 .gitignore create mode 100644 LICENSE create mode 100644 README.md create mode 100644 app/.htaccess create mode 100644 app/Commands/CleanupPelanggaran.php create mode 100644 app/Commands/DhivaCommand.php create mode 100644 app/Common.php create mode 100644 app/Config/App.php create mode 100644 app/Config/Autoload.php create mode 100644 app/Config/Boot/development.php create mode 100644 app/Config/Boot/production.php create mode 100644 app/Config/Boot/testing.php create mode 100644 app/Config/CURLRequest.php create mode 100644 app/Config/Cache.php create mode 100644 app/Config/Constants.php create mode 100644 app/Config/ContentSecurityPolicy.php create mode 100644 app/Config/Cookie.php create mode 100644 app/Config/DocTypes.php create mode 100644 app/Config/Email.php create mode 100644 app/Config/Encryption.php create mode 100644 app/Config/Events.php create mode 100644 app/Config/Exceptions.php create mode 100644 app/Config/Feature.php create mode 100644 app/Config/Filters.php create mode 100644 app/Config/ForeignCharacters.php create mode 100644 app/Config/Format.php create mode 100644 app/Config/Generators.php create mode 100644 app/Config/Honeypot.php create mode 100644 app/Config/Images.php create mode 100644 app/Config/Keys.php create mode 100644 app/Config/Kint.php create mode 100644 app/Config/Logger.php create mode 100644 app/Config/Migrations.php create mode 100644 app/Config/Mimes.php create mode 100644 app/Config/Modules.php create mode 100644 app/Config/Pager.php create mode 100644 app/Config/Paths.php create mode 100644 app/Config/Publisher.php create mode 100644 app/Config/Routes.php create mode 100644 app/Config/Routing.php create mode 100644 app/Config/Security.php create mode 100644 app/Config/Services.php create mode 100644 app/Config/Session.php create mode 100644 app/Config/Toolbar.php create mode 100644 app/Config/UserAgents.php create mode 100644 app/Config/Validation.php create mode 100644 app/Config/View.php create mode 100644 app/Controllers/BaseController.php create mode 100644 app/Controllers/DevController.php create mode 100644 app/Controllers/PersonelController.php create mode 100644 app/Controllers/SuperUserController.php create mode 100644 app/Database/Migrations/.gitkeep create mode 100644 app/Database/Migrations/2023-10-19-182027_SuperUser.php create mode 100644 app/Database/Migrations/2023-10-19-185755_SuperGroup.php create mode 100644 app/Database/Migrations/2023-10-19-211659_Endpoint.php create mode 100644 app/Database/Migrations/2026-02-11-180000_CreateIperaAgreementTables.php create mode 100644 app/Database/Seeds/.gitkeep create mode 100644 app/Database/Seeds/EndpointSeeder.php create mode 100644 app/Database/Seeds/SuperGroupSeeder.php create mode 100644 app/Database/Seeds/SuperUserSeeder.php create mode 100644 app/Filters/.gitkeep create mode 100644 app/Filters/Cors.php create mode 100644 app/Helpers/.gitkeep create mode 100644 app/Helpers/device_helper.php create mode 100644 app/Language/.gitkeep create mode 100644 app/Language/en/Validation.php create mode 100644 app/Libraries/.gitkeep create mode 100644 app/Libraries/ArelAyudhi/src/Broadcast.php create mode 100644 app/Libraries/ArelAyudhi/src/Group.php create mode 100644 app/Libraries/ArelAyudhi/src/ListMessage.php create mode 100644 app/Libraries/ArelAyudhi/src/Multiple.php create mode 100644 app/Libraries/ArelAyudhi/src/ProdevMessages.php create mode 100644 app/Libraries/ArelAyudhi/src/ProdevMessagesAbstract.php create mode 100644 app/Libraries/ArelAyudhi/src/ProdevXendit.php create mode 100644 app/Libraries/ArelAyudhi/src/ProdevXenditAbstract.php create mode 100644 app/Libraries/ArelAyudhi/src/QrPayment.php create mode 100644 app/Libraries/ArelAyudhi/src/UserList.php create mode 100644 app/Libraries/ArelAyudhi/src/VirtualAccount.php create mode 100644 app/Libraries/ArelAyudhi/src/composer.json create mode 100644 app/Libraries/DhivaAES.php create mode 100644 app/Libraries/DhivaComponent/Controller.txt create mode 100644 app/Libraries/DhivaComponent/DatabaseClient.txt create mode 100644 app/Libraries/DhivaComponent/Model.txt create mode 100644 app/Libraries/DhivaComponent/Routes.txt create mode 100644 app/Libraries/DhivaComponent/env.txt create mode 100644 app/Libraries/DhivaRoutes.php create mode 100644 app/Libraries/DistribusiService.php create mode 100644 app/Libraries/EmailService.php create mode 100644 app/Libraries/MekariWhatsAppService.php create mode 100644 app/Libraries/MongoLib.php create mode 100644 app/Libraries/Notification.php create mode 100644 app/Libraries/Tenancy.php create mode 100644 app/Libraries/WablasService.php create mode 100644 app/Libraries/Zoom/.gitignore create mode 100644 app/Libraries/Zoom/Endpoint/Meetings.php create mode 100644 app/Libraries/Zoom/Endpoint/Recordings.php create mode 100644 app/Libraries/Zoom/Endpoint/Reports.php create mode 100644 app/Libraries/Zoom/Endpoint/Users.php create mode 100644 app/Libraries/Zoom/Endpoint/Webinars.php create mode 100644 app/Libraries/Zoom/Interfaces/Request.php create mode 100644 app/Libraries/Zoom/LICENSE create mode 100644 app/Libraries/Zoom/README.md create mode 100644 app/Libraries/Zoom/ZoomAPI.php create mode 100644 app/Libraries/Zoom/composer.json create mode 100644 app/Libraries/Zoom/index.php create mode 100644 app/Models/MongoModel/BaseMongoNoSql.php create mode 100644 app/Models/PersonelModel.php create mode 100644 app/Models/SqlModel/BaseModelSql.php create mode 100644 app/Models/SqlModel/EndpointModelSql.php create mode 100644 app/Models/SqlModel/SuperUserModelSql.php create mode 100644 app/ThirdParty/.gitkeep create mode 100644 app/Views/errors/cli/error_404.php create mode 100644 app/Views/errors/cli/error_exception.php create mode 100644 app/Views/errors/cli/production.php create mode 100644 app/Views/errors/html/debug.css create mode 100644 app/Views/errors/html/debug.js create mode 100644 app/Views/errors/html/error_404.php create mode 100644 app/Views/errors/html/error_exception.php create mode 100644 app/Views/errors/html/production.php create mode 100644 app/Views/welcome_message.php create mode 100644 app/index.html create mode 100644 builds create mode 100644 composer.json create mode 100644 dbsamples.png create mode 100644 env create mode 100644 package-lock.json create mode 100644 phpunit.xml.dist create mode 100644 preload.php create mode 100644 public/.htaccess create mode 100644 public/dataWargaDummy.json create mode 100644 public/favicon.ico create mode 100644 public/index.php create mode 100644 public/robots.txt create mode 100644 schema.sql create mode 100644 spark create mode 100644 tests/README.md create mode 100644 tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php create mode 100644 tests/_support/Database/Seeds/ExampleSeeder.php create mode 100644 tests/_support/Libraries/ConfigReader.php create mode 100644 tests/_support/Models/ExampleModel.php create mode 100644 tests/database/ExampleDatabaseTest.php create mode 100644 tests/session/ExampleSessionTest.php create mode 100644 tests/unit/HealthTest.php create mode 100644 writable copy/.htaccess create mode 100644 writable copy/cache/index.html create mode 100644 writable copy/debugbar/.gitkeep create mode 100644 writable copy/debugbar/debugbar_1731033133.195989.json create mode 100644 writable copy/debugbar/debugbar_1731033422.525809.json create mode 100644 writable copy/debugbar/debugbar_1731033422.788773.json create mode 100644 writable copy/debugbar/debugbar_1731033422.929684.json create mode 100644 writable copy/debugbar/debugbar_1731033524.826791.json create mode 100644 writable copy/debugbar/debugbar_1731033556.047855.json create mode 100644 writable copy/debugbar/debugbar_1731033556.202196.json create mode 100644 writable copy/debugbar/debugbar_1731033556.332496.json create mode 100644 writable copy/debugbar/debugbar_1731033579.274203.json create mode 100644 writable copy/debugbar/debugbar_1731033579.384264.json create mode 100644 writable copy/debugbar/debugbar_1731033579.548890.json create mode 100644 writable copy/debugbar/debugbar_1731049547.712078.json create mode 100644 writable copy/debugbar/debugbar_1731049577.560615.json create mode 100644 writable copy/debugbar/debugbar_1731132150.904391.json create mode 100644 writable copy/debugbar/debugbar_1731132177.984999.json create mode 100644 writable copy/debugbar/debugbar_1731132178.179148.json create mode 100644 writable copy/debugbar/debugbar_1731132178.401760.json create mode 100644 writable copy/debugbar/debugbar_1731132279.085550.json create mode 100644 writable copy/debugbar/debugbar_1731132279.188896.json create mode 100644 writable copy/debugbar/debugbar_1731132279.365748.json create mode 100644 writable copy/debugbar/debugbar_1731132350.455601.json create mode 100644 writable copy/debugbar/debugbar_1731132350.567570.json create mode 100644 writable copy/debugbar/debugbar_1731132350.689691.json create mode 100644 writable copy/debugbar/debugbar_1731132399.468431.json create mode 100644 writable copy/debugbar/debugbar_1731132399.594444.json create mode 100644 writable copy/debugbar/debugbar_1731132399.791274.json create mode 100644 writable copy/debugbar/debugbar_1731132436.204978.json create mode 100644 writable copy/debugbar/debugbar_1731132541.365417.json create mode 100644 writable copy/debugbar/debugbar_1731132541.462429.json create mode 100644 writable copy/debugbar/debugbar_1731132541.748043.json create mode 100644 writable copy/debugbar/debugbar_1731224368.334265.json create mode 100644 writable copy/debugbar/debugbar_1731224401.231849.json create mode 100644 writable copy/debugbar/debugbar_1731261752.622431.json create mode 100644 writable copy/debugbar/debugbar_1731261836.519335.json create mode 100644 writable copy/debugbar/debugbar_1731380633.571232.json create mode 100644 writable copy/debugbar/debugbar_1759844673.058493.json create mode 100644 writable copy/logs/index.html create mode 100644 writable copy/logs/log-2024-11-02.log create mode 100644 writable copy/logs/log-2024-11-03.log create mode 100644 writable copy/logs/log-2024-11-08.log create mode 100644 writable copy/logs/log-2024-11-10.log create mode 100644 writable copy/logs/log-2024-11-11.log create mode 100644 writable copy/logs/log-2024-11-12.log create mode 100644 writable copy/logs/log-2024-11-13.log create mode 100644 writable copy/logs/log-2024-11-14.log create mode 100644 writable copy/logs/log-2025-10-07.log create mode 100644 writable copy/session/index.html create mode 100644 writable copy/uploads/index.html diff --git a/.env b/.env new file mode 100644 index 0000000..db7f9d7 --- /dev/null +++ b/.env @@ -0,0 +1,148 @@ +#-------------------------------------------------------------------- +# Example Environment Configuration file +# +# This file can be used as a starting point for your own +# custom .env files, and contains most of the possible settings +# available in a default install. +# +# By default, all of the settings are commented out. If you want +# to override the setting, you must un-comment it by removing the '#' +# at the beginning of the line. +#-------------------------------------------------------------------- + +#-------------------------------------------------------------------- +# ENVIRONMENT +#-------------------------------------------------------------------- + +# CI_ENVIRONMENT = production +CI_ENVIRONMENT = development + +#-------------------------------------------------------------------- +# APP +#-------------------------------------------------------------------- + +app.baseURL = 'https://project.adhivasindo.co.id/api_tambang_ntb/' +# Base URL khusus aset publik (image/pdf decode). +app.assetBaseURL = 'https://project.adhivasindo.co.id/api_tambang_ntb/' +# If you have trouble with `.`, you could also use `_`. +# app_baseURL = '' +# app.forceGlobalSecureRequests = false +# app.CSPEnabled = false + +#-------------------------------------------------------------------- +# DATABASE +#-------------------------------------------------------------------- + +database.default.hostname = localhost +database.default.database = stock_map +database.default.username = postgres +database.default.password = yoga21 +database.default.DBDriver = Postgre +database.default.DBPrefix = +database.default.port = 5432 + +# database.tests.hostname = localhost +# database.tests.database = ci4_test +# database.tests.username = root +# database.tests.password = root +# database.tests.DBDriver = MySQLi +# database.tests.DBPrefix = +# database.tests.port = 3306 + +#-------------------------------------------------------------------- +# CONTENT SECURITY POLICY +#-------------------------------------------------------------------- + +# contentsecuritypolicy.reportOnly = false +# contentsecuritypolicy.defaultSrc = 'none' +# contentsecuritypolicy.scriptSrc = 'self' +# contentsecuritypolicy.styleSrc = 'self' +# contentsecuritypolicy.imageSrc = 'self' +# contentsecuritypolicy.baseURI = null +# contentsecuritypolicy.childSrc = null +# contentsecuritypolicy.connectSrc = 'self' +# contentsecuritypolicy.fontSrc = null +# contentsecuritypolicy.formAction = null +# contentsecuritypolicy.frameAncestors = null +# contentsecuritypolicy.frameSrc = null +# contentsecuritypolicy.mediaSrc = null +# contentsecuritypolicy.objectSrc = null +# contentsecuritypolicy.pluginTypes = null +# contentsecuritypolicy.reportURI = null +# contentsecuritypolicy.sandbox = false +# contentsecuritypolicy.upgradeInsecureRequests = false +# contentsecuritypolicy.styleNonceTag = '{csp-style-nonce}' +# contentsecuritypolicy.scriptNonceTag = '{csp-script-nonce}' +# contentsecuritypolicy.autoNonce = true + +#-------------------------------------------------------------------- +# COOKIE +#-------------------------------------------------------------------- + +# cookie.prefix = '' +# cookie.expires = 0 +# cookie.path = '/' +# cookie.domain = '' +# cookie.secure = false +# cookie.httponly = false +# cookie.samesite = 'Lax' +# cookie.raw = false + +#-------------------------------------------------------------------- +# ENCRYPTION +#-------------------------------------------------------------------- + +# encryption.key = +# encryption.driver = OpenSSL +# encryption.blockSize = 16 +# encryption.digest = SHA512 + +#-------------------------------------------------------------------- +# HONEYPOT +#-------------------------------------------------------------------- + +# honeypot.hidden = 'true' +# honeypot.label = 'Fill This Field' +# honeypot.name = 'honeypot' +# honeypot.template = '' +# honeypot.container = '
{template}
' + +#-------------------------------------------------------------------- +# SECURITY +#-------------------------------------------------------------------- + +# security.csrfProtection = 'cookie' +# security.tokenRandomize = false +# security.tokenName = 'csrf_token_name' +# security.headerName = 'X-CSRF-TOKEN' +# security.cookieName = 'csrf_cookie_name' +# security.expires = 7200 +# security.regenerate = true +# security.redirect = false +# security.samesite = 'Lax' + +#-------------------------------------------------------------------- +# SESSION +#-------------------------------------------------------------------- + +# session.driver = 'CodeIgniter\Session\Handlers\FileHandler' +# session.cookieName = 'ci_session' +# session.expiration = 7200 +# session.savePath = null +# session.matchIP = false +# session.timeToUpdate = 300 +# session.regenerateDestroy = false + +#-------------------------------------------------------------------- +# LOGGER +#-------------------------------------------------------------------- + +# logger.threshold = 4 + +#-------------------------------------------------------------------- +# CURLRequest +#-------------------------------------------------------------------- + +# curlrequest.shareOptions = true + +LINK_FORGOT_PASSWORD = 'http://project.adhivasindo.co.id/ntb/e-teguran-humanis/' diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6b4f69f --- /dev/null +++ b/.gitignore @@ -0,0 +1,121 @@ +#------------------------- +# Operating Specific Junk Files +#------------------------- + +# Dhiva Poject +app/Config/Database.php +app/Config/ExternalApi.php +app/Config/MongoConfig.php +writable/ +composer.lock + +# OS X +.DS_Store +.AppleDouble +.LSOverride + +# OS X Thumbnails +._* + +# Windows image file caches +Thumbs.db +ehthumbs.db +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# Linux +*~ + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +#------------------------- +# Environment Files +#------------------------- +# These should never be under version control, +# as it poses a security risk. +# .env +.vagrant +Vagrantfile + +#------------------------- +# Temporary Files +#------------------------- + + +php_errors.log + +#------------------------- +# User Guide Temp Files +#------------------------- +user_guide_src/build/* +user_guide_src/cilexer/build/* +user_guide_src/cilexer/dist/* +user_guide_src/cilexer/pycilexer.egg-info/* + +#------------------------- +# Test Files +#------------------------- +tests/coverage* + +# Don't save phpunit under version control. +phpunit + +#------------------------- +# Composer +#------------------------- +vendor/ + +#------------------------- +# IDE / Development Files +#------------------------- + +# Modules Testing +_modules/* + +# phpenv local config +.php-version + +# Jetbrains editors (PHPStorm, etc) +.idea/ +*.iml + +# Netbeans +nbproject/ +build/ +nbbuild/ +dist/ +nbdist/ +nbactions.xml +nb-configuration.xml +.nb-gradle/ + +# Sublime Text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache +*.sublime-workspace +*.sublime-project +.phpintel +/api/ + +# Visual Studio Code +.vscode/ + +/results/ +/phpunit*.xml +/.phpunit.*.cache \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0119e5f --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014-2019 British Columbia Institute of Technology +Copyright (c) 2019-2023 CodeIgniter Foundation + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..3dba22b --- /dev/null +++ b/README.md @@ -0,0 +1,171 @@ +# Codeigniter 4 Dhiva + +Custom APP Codeigniter 4 + +## Requitment + +PHP Versi : + + PHP 7.4 keatas + +php.ini extension : + + extension=intl + extension=php_gmp + extension=php_pgsql + extension=php_pdo_pgsql + extension=php_sockets + extension=gd + extension=zip + +## Features + +- Pembuatan Controller dan Model secara otomatis +- CMD environment +- APP ID Generate +- Coffee Maker + +## Setup Database + +- Buat terlebih dahulu database untuk project yang ingin dibangun +- Jika menggunakan `Postgre` +Tentukan `Username`, `Password`,`Database`, dan `Schema` +- Jika menggunakan `Mysql` +Tentukan `Username`, `Password`, dan `Database` + +## Run Locally + +Kloning project + +```bash + git clone git@bitbucket.org:adhivasindo-prodev/base-ci4.git +``` + +Pindah ke Folder + +```bash + cd base-ci4 +``` + +Update dependensi + +```bash + composer update +``` +


+### Inisialisasi Core +(Berlaku di sisi server dan developer) + +![App Screenshot](dbsamples.png) + +Jalankan perintah ini di CMD +```bash + php spark sebat kuy +``` + +Disini perlu menentukan database yang ingin di gunakan +``` +Database Driver + [0] MySQLi + [1] Postgre +``` + +Jika memilih tipe `Postgre` maka akan keluar tampilan seperti ini + +``` +Username Database : +Password Database : +Nama Database: +Schema Database : +``` + +Untuk contohnya pengisiannya seperti di bawah ini: +``` +Username Database : postgres +Password Database : admin +Nama Database: my_db +Schema Database : testt +``` +


+#### Buatkan CRUD + +Untuk membuat CRUD otomatis ketik `2` lalu akan muncul tampilan seperti ini + +``` +Nama Component : +Nama Routing : +Tabel Database : +``` + +List Perintah +------------ + +Jalankan perintah `php spark sebat` maka akan keluar tampilan seperti ini: + +``` +Perintahmu ya Baginda? + [0] Ubah environment ke production + [1] Buatkan APP ID + [2] Buatkan CRUD + [3] Buatkan Kopi + [4] Belum kepikiran ntar dulu +``` + +#### Ubah environment ke production + +Jika ingin merubah environment dari development ke production atau sebaliknya ketik `0` maka akan keluar tampilan seperti ini + +```bash +Berhasil dirubah ke development ya baginda +``` + +#### Buatkan APP ID +`APP ID` berfungsi untuk enkripsi data `Authorization` untuk menjadikan `ClientSecret` yang bertujuan untuk mencegah manipulasi `JWT Token` yang di simpan di sisi client + +Untuk membuat `APP ID` ketik `1` lalu akan muncul seperti ini + +``` +Berhasil ditambahkan APP ID ya baginda +``` +Jika APP ID sudah tersedia maka akan muncul tampilan seperti ini + +``` +APP ID Sudah ada ya banginda, tidak perlu di generate lagi +``` + +#### Buatkan CRUD + +Untuk membuat CRUD otomatis ketik `2` lalu akan muncul tampilan seperti ini + +``` +Nama Component : +Nama Routing : +Tabel Database : +``` + +##### Nama Component +Berfungsi untuk membuat file Controller dan Model, Misal untuk membuat Controller `EndpointController` dan Model `EndpointModelSql` hanya dibutuhkan input `endpoint` saja. + +Contoh : + +``` +Nama Component : endpoint +``` + +##### Nama Routing +Berfungsi untuk membuat Routing URI dengan fitur CRUD secara otomatis + +Contoh : + +``` +Nama Routing : endpoint +``` + +##### Tabel Database +Berfungsi untuk menentukan table yang ingin di CRUD kan + +Contoh : + +``` +Tabel Database : endpoint +``` diff --git a/app/.htaccess b/app/.htaccess new file mode 100644 index 0000000..f24db0a --- /dev/null +++ b/app/.htaccess @@ -0,0 +1,6 @@ + + Require all denied + + + Deny from all + diff --git a/app/Commands/CleanupPelanggaran.php b/app/Commands/CleanupPelanggaran.php new file mode 100644 index 0000000..7b0c0fb --- /dev/null +++ b/app/Commands/CleanupPelanggaran.php @@ -0,0 +1,33 @@ +table('e_teguran_humanis.pelanggaran'); + + $delete = $builder->where('is_deleted', true) + ->where('deleted_at <', date('Y-m-d H:i:s', strtotime('-7 days'))) + ->get()->getResult(); + + if (!empty($delete)) { + $db->table('e_teguran_humanis.pelanggaran')->where('is_deleted', true)->where('deleted_at <', date('Y-m-d H:i:s', strtotime('-7 days')))->delete(); + foreach ($delete as $key => $value) { + CLI::write('✅ Berhasil menghapus data pelanggaran dengan id ' . $value->pelanggaran_id, 'green'); + } + } else { + CLI::write('Gagal menghapus data pelanggaran lebih dari 7 hari', 'red'); + } + } +} \ No newline at end of file diff --git a/app/Commands/DhivaCommand.php b/app/Commands/DhivaCommand.php new file mode 100644 index 0000000..1716228 --- /dev/null +++ b/app/Commands/DhivaCommand.php @@ -0,0 +1,454 @@ +initDb()) { + $db = \Config\Database::connect(); + CLI::write('Init ' . $db->getPlatform()); + if ($db->getPlatform() == 'Postgre') { + $this->initTbPostgre(); + echo command('db:seed superuserseeder'); + echo command('db:seed supergroupseeder'); + echo command('db:seed endpointseeder'); + } else { + CLI::write('Versi MySql belum ada'); + } + + CLI::write("Installasi core berhasil ya baginda", 'green'); + } + } else { + CLI::write("Sudah di config wahai yang mulia baginda", 'green'); + } + } else { + CLI::write('Buah duku di pohon kaktus' . PHP_EOL . 'Tidak bisa diambil karena berduri' . PHP_EOL . 'Pinjamkanlah dulu aku sembilan ratus' . PHP_EOL . 'Biar aku bisa wara-wiri' . PHP_EOL); + $command = CLI::promptByKey( + 'Perintahmu ya Baginda?', + [ + 'Ubah environment ke ' . $this->checkEnv(), + 'Buatkan APP ID', + 'Buatkan CRUD', + 'Ubah durasi JWT Token', + 'Buatkan Kopi', + 'Belum kepikiran ntar dulu' + ] + ); + switch ($command) { + case 0: + $this->changeEnv(); + break; + case 1: + $this->createAppId(); + break; + case 2: + $this->createComponent(); + break; + case 3: + $this->changeJWTtimeout(); + break; + case 4: + CLI::write("Silahkan bikin sendiri wahai banginda"); + break; + case 5: + CLI::write("Mikir mulu!"); + break; + default: + CLI::write("Perintahnya tidak ada wahai baginda"); + } + } + } + private function changeJWTtimeout() + { + if (JWT_BY == 'JAM') { + CLI::write("Durasi Sekarang : " . JWT_TIMEOUT / HOUR . " " . JWT_BY); + } elseif (JWT_BY == 'HARI') { + CLI::write("Durasi Sekarang : " . JWT_TIMEOUT / DAY . " " . JWT_BY); + } + CLI::newLine(1); + $pd = CLI::promptByKey('Pilih Durasi ', ['JAM', 'HARI']); + if ($pd == 0) { + $dr = CLI::prompt("Berapa jam?", null, ['required']); + if (preg_match("/^\\d+$/", $dr)) { + $str = file_get_contents(APPPATH . '/Config/Constants.php'); + $new = HOUR * $dr; + $str = str_replace(['define("JWT_TIMEOUT", ' . JWT_TIMEOUT . ');', 'define("JWT_BY", "' . JWT_BY . '");'], ['define("JWT_TIMEOUT", ' . $new . ');', 'define("JWT_BY", "JAM");'], $str); + file_put_contents(APPPATH . '/Config/Constants.php', $str); + CLI::write("Durasi Sekarang : " . $dr . " Jam"); + } + } elseif ($pd == 1) { + $dr = CLI::prompt("Berapa hari?", null, ['required']); + if (preg_match("/^\\d+$/", $dr)) { + $str = file_get_contents(APPPATH . '/Config/Constants.php'); + $new = DAY * $dr; + $str = str_replace(['define("JWT_TIMEOUT", ' . JWT_TIMEOUT . ');', 'define("JWT_BY", "' . JWT_BY . '");'], ['define("JWT_TIMEOUT", ' . $new . ');', 'define("JWT_BY", "HARI");'], $str); + } + file_put_contents(APPPATH . '/Config/Constants.php', $str); + CLI::write("Durasi Sekarang : " . $dr . " Hari"); + } + } + private function initDb() + { + $schema = ''; + $DBDriver = CLI::promptByKey('Database Driver ', ['MySQLi', 'Postgre']); + $username = CLI::prompt("Username Database", null, ['required']); + $password = CLI::prompt("Password Database", null, ['required']); + $tabel = CLI::prompt("Nama Database", null, ['required']); + if ($DBDriver == 0) { + $DBDriver = 'MySQLi'; + } else if ($DBDriver == 1) { + $DBDriver = 'Postgre'; + $schema = CLI::prompt("Schema Database", null, ['required']); + if ($this->checkConnectionDB($DBDriver, $username, $password, $tabel, $schema)) { + $str = file_get_contents(APPPATH . '/Libraries/DhivaComponent/DatabaseClient.txt'); + $str = str_replace(['{{DBDriver}}', '{{username}}', '{{password}}', '{{tabel}}', '{{schema}}'], [$DBDriver, $username, $password, $tabel, $schema], $str); + file_put_contents(APPPATH . '/Config/Database.php', $str); + return true; + } else { + CLI::write("Koneksi ke database gagal!", 'red'); + return false; + } + } + } + private function checkConnectionDB($DBDriver, $username, $password, $tabel, $schema) + { + $dbSelect = [ + 'DSN' => '', + 'hostname' => 'localhost', + 'username' => $username, + 'password' => $password, + 'database' => $tabel, + 'schema' => $schema, + 'DBDriver' => $DBDriver, + 'DBPrefix' => '', + 'pConnect' => true, + 'DBDebug' => true, + 'charset' => 'utf8', + 'DBCollat' => 'utf8_bin', + 'swapPre' => '', + 'encrypt' => false, + 'compress' => false, + 'strictOn' => false, + 'failover' => [], + 'numberNative' => false, + ]; + + try { + $db = Database::connect($dbSelect, false); + $db->error(); + CLI::write(json_encode($db->error()['message'])); + } catch (\Throwable $e) { + CLI::write('Username atau Password DB salah'); + } + if (!$db->simpleQuery('CREATE TABLE testtable();')) { + return false; + } else { + $db->query('DROP TABLE testtable;'); + return true; + } + } + private function createComponent() + { + $component = CLI::prompt("Nama Component", null, ['required']); + $routes = CLI::prompt("Nama Routing", null, ['required']); + $tabel = CLI::prompt("Tabel Database", null, ['required']); + $str1 = file_get_contents(APPPATH . '/Libraries/DhivaComponent/Controller.txt'); + $str1 = str_replace(['{{controller}}', '{{model}}', '{{tabel}}'], [ucfirst($component), ucfirst($component), $tabel], $str1); + file_put_contents(APPPATH . "/Controllers/" . ucfirst($component) . 'Controller.php', $str1); + + $str2 = file_get_contents(APPPATH . '/Libraries/DhivaComponent/Model.txt'); + $str2 = str_replace(['{{model}}', '{{tabel}}'], [ucfirst($component), $tabel], $str2); + file_put_contents(APPPATH . "/Models/SqlModel/" . ucfirst($component) . 'ModelSql.php', $str2); + + $str3 = file_get_contents(APPPATH . '/Libraries/DhivaComponent/Routes.txt'); + $str3 = str_replace(['{{routes}}', '{{controller}}'], [$routes, ucfirst($component)], $str3); + file_put_contents(APPPATH . "/Config/Routes.php", $str3, FILE_APPEND); + + $str4 = file_get_contents(APPPATH . '/Models/SqlModel/BaseModelSql.php'); + $s = explode('];', explode('protected $providers = [', $str4)[1]); + $r = $s[0] . ' "' . $tabel . '" => ' . ucfirst($component) . 'ModelSql::class,' . PHP_EOL; + $done = str_replace($s[0], $r, $str4); + file_put_contents(APPPATH . '/Models/SqlModel/BaseModelSql.php', $done); + $this->createComponentDb($tabel); + CLI::write("Component berhasil ditambahkan ya baginda", 'green'); + } + /** + * Masih ada bug buat primary key di Postgre + * jadi belum bisa dipake + * @link https://codeigniter4.github.io/userguide/dbmgmt/forge.html#forge-addprimarykey + */ + private function createComponentDb($tabel, $buat = false) + { + if ($buat) { + + $forge = Database::forge(); + $forge->addField([ + $tabel . '_id' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'primary' => true + ], + $tabel . '_unique' => [ + 'type' => 'INT', + 'constraint' => 255, + 'auto_increment' => true, + 'unique' => true, + ], + 'created_at timestamp without time zone NULL DEFAULT CURRENT_TIMESTAMP' + ]); + $forge->createTable($tabel); + $db = \Config\Database::connect(); + $db->query('ALTER TABLE ' . $tabel . ' ADD CONSTRAINT ' . $tabel . '_pk PRIMARY KEY (' . $tabel . '_id)'); + } else { + $forge = \Config\Database::forge(); + $forge->addField([ + $tabel . '_id' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + ], + $tabel . '_unique' => [ + 'type' => 'INT', + 'constraint' => 255, + 'auto_increment' => true, + 'unique' => true, + ], + 'created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP' + ]); + $forge->addKey($tabel . '_id', true); + $forge->createTable($tabel); + } + } + private function checkEnv() + { + return (ENVIRONMENT != 'development') ? 'development' : 'production'; + } + private function createAppId() + { + $str = file_get_contents(APPPATH . '/Config/Constants.php'); + if (!str_contains($str, 'SSL_KEY')) { + // Jangan di dirapihin/format document!, memang kek gini rule nya + $text = + 'define("SSL_KEY", array( + "password" => "' . DhivaAES::randomStr(16) . '", + "salt" => "' . DhivaAES::randomStr(16) . '", + "iv" => "' . DhivaAES::randomStr(16) . '", + "iterations" => 2, + "keyLength" => 2, + "route" => "' . DhivaAES::randomStr(16) . '" + )); +define("JWT_KEY", "' . DhivaAES::randomStr(20) . '"); +'; + file_put_contents(APPPATH . '/Config/Constants.php', $text, FILE_APPEND); + CLI::write('Berhasil ditambahkan APP ID ya baginda', 'green'); + } else { + CLI::write('APP ID Sudah ada ya banginda, tidak perlu di generate lagi', 'green'); + } + } + private function changeEnv() + { + if (!file_exists(ROOTPATH . ".env")) { + if (!file_exists(ROOTPATH . "env")) { + $str = file_get_contents(APPPATH . '/Libraries/DhivaComponent/env.txt'); + file_put_contents(ROOTPATH . ".env", $str); + } else { + copy(ROOTPATH . "env", ROOTPATH . ".env"); + } + } + $str = file_get_contents(ROOTPATH . ".env"); + if (str_contains($str, '# CI_ENVIRONMENT')) { + $search = '# CI_ENVIRONMENT'; + } else { + $search = 'CI_ENVIRONMENT'; + } + if (ENVIRONMENT == 'development') { + $str = str_replace($search . ' = development', $search . ' = production', $str); + $rr = 'production'; + } else { + $str = str_replace($search . ' = production', $search . ' = development', $str); + $rr = 'development'; + } + file_put_contents(ROOTPATH . ".env", $str); + CLI::write('Berhasil dirubah ke ' . $rr . ' ya baginda', 'green'); + } + private function initTbPostgre() + { + $db = \Config\Database::connect(); + $forge = \Config\Database::forge(); + $forge->addField([ + 'super_user_id' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + ], + 'super_user_unique' => [ + 'type' => 'INT', + 'constraint' => 255, + 'auto_increment' => true, + 'unique' => true, + ], + 'super_group_id' => [ + 'type' => 'INT', + 'constraint' => 5, + ], + 'domain_id' => [ + 'type' => 'INT', + 'constraint' => 5, + ], + 'name' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + ], + 'email' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'null' => true, + ], + 'username' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + ], + 'password' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + ], + 'avatar' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'null' => true, + ], + 'status' => [ + 'type' => 'INT', + 'constraint' => 1, + 'null' => true, + ], + 'token' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'null' => true, + ], + 'created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP', + 'login_date TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP', + 'access_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP' + ]); + $forge->createTable('super_user'); + $db->query('ALTER TABLE ' . 'super_user ADD CONSTRAINT super_user_pk PRIMARY KEY (super_user_id)'); + $forge->addField([ + 'super_group_id' => [ + 'type' => 'INT', + 'constraint' => 255, + 'auto_increment' => true, + ], + 'super_group_unique' => [ + 'type' => 'INT', + 'constraint' => 255, + 'auto_increment' => true, + 'unique' => true, + ], + 'domain_id' => [ + 'type' => 'INT', + 'constraint' => 255, + ], + 'group_name' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'null' => true, + ], + 'status' => [ + 'type' => 'INT', + 'constraint' => 1, + 'null' => true, + ], + 'created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP', + ]); + $forge->createTable('super_group'); + $db->query("CREATE TYPE endpoint_type" . " AS enum ('frontend', 'backend')"); + $db->query("CREATE TYPE endpoint_method" . " AS enum ('POST', 'GET', 'PUT', 'DELETE')"); + $db->query("CREATE TYPE endpoint_bypass" . " AS enum ('0', '1')"); + + $forge->addField([ + 'endpoint_id' => [ + 'type' => 'INT', + 'constraint' => 255, + 'auto_increment' => true, + ], + 'value' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + ], + 'description' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'null' => true, + ], + 'created_by' => [ + 'type' => 'VARCHAR', + 'constraint' => 200, + 'null' => true, + ], + 'created_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP', + ]); + $forge->createTable('endpoint'); + $db->query('ALTER TABLE endpoint ADD CONSTRAINT endpoint_id_pk PRIMARY KEY (endpoint_id)'); + $db->query("ALTER TABLE endpoint ADD method endpoint_method NOT NULL;"); + $db->query("ALTER TABLE endpoint ADD type endpoint_type NOT NULL;"); + $db->query("ALTER TABLE endpoint ADD bypass endpoint_bypass NOT NULL;"); + } +} +class Database extends Config +{ +} diff --git a/app/Common.php b/app/Common.php new file mode 100644 index 0000000..95f5544 --- /dev/null +++ b/app/Common.php @@ -0,0 +1,15 @@ + + */ + public array $allowedHostnames = []; + + /** + * -------------------------------------------------------------------------- + * Index File + * -------------------------------------------------------------------------- + * + * Typically this will be your index.php file, unless you've renamed it to + * something else. If you are using mod_rewrite to remove the page set this + * variable so that it is blank. + */ + public string $indexPage = 'index.php'; + + /** + * -------------------------------------------------------------------------- + * URI PROTOCOL + * -------------------------------------------------------------------------- + * + * This item determines which server global should be used to retrieve the + * URI string. The default setting of 'REQUEST_URI' works for most servers. + * If your links do not seem to work, try one of the other delicious flavors: + * + * 'REQUEST_URI' Uses $_SERVER['REQUEST_URI'] + * 'QUERY_STRING' Uses $_SERVER['QUERY_STRING'] + * 'PATH_INFO' Uses $_SERVER['PATH_INFO'] + * + * WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded! + */ + public string $uriProtocol = 'REQUEST_URI'; + + /** + * -------------------------------------------------------------------------- + * Default Locale + * -------------------------------------------------------------------------- + * + * The Locale roughly represents the language and location that your visitor + * is viewing the site from. It affects the language strings and other + * strings (like currency markers, numbers, etc), that your program + * should run under for this request. + */ + public string $defaultLocale = 'en'; + + /** + * -------------------------------------------------------------------------- + * Negotiate Locale + * -------------------------------------------------------------------------- + * + * If true, the current Request object will automatically determine the + * language to use based on the value of the Accept-Language header. + * + * If false, no automatic detection will be performed. + */ + public bool $negotiateLocale = false; + + /** + * -------------------------------------------------------------------------- + * Supported Locales + * -------------------------------------------------------------------------- + * + * If $negotiateLocale is true, this array lists the locales supported + * by the application in descending order of priority. If no match is + * found, the first locale will be used. + * + * IncomingRequest::setLocale() also uses this list. + * + * @var string[] + */ + public array $supportedLocales = ['en']; + + /** + * -------------------------------------------------------------------------- + * Application Timezone + * -------------------------------------------------------------------------- + * + * The default timezone that will be used in your application to display + * dates with the date helper, and can be retrieved through app_timezone() + * + * @see https://www.php.net/manual/en/timezones.php for list of timezones supported by PHP. + */ + public string $appTimezone = 'Asia/Makassar'; + + /** + * -------------------------------------------------------------------------- + * Default Character Set + * -------------------------------------------------------------------------- + * + * This determines which character set is used by default in various methods + * that require a character set to be provided. + * + * @see http://php.net/htmlspecialchars for a list of supported charsets. + */ + public string $charset = 'UTF-8'; + + /** + * -------------------------------------------------------------------------- + * Force Global Secure Requests + * -------------------------------------------------------------------------- + * + * If true, this will force every request made to this application to be + * made via a secure connection (HTTPS). If the incoming request is not + * secure, the user will be redirected to a secure version of the page + * and the HTTP Strict Transport Security header will be set. + */ + public bool $forceGlobalSecureRequests = false; + + /** + * -------------------------------------------------------------------------- + * Reverse Proxy IPs + * -------------------------------------------------------------------------- + * + * If your server is behind a reverse proxy, you must whitelist the proxy + * IP addresses from which CodeIgniter should trust headers such as + * X-Forwarded-For or Client-IP in order to properly identify + * the visitor's IP address. + * + * You need to set a proxy IP address or IP address with subnets and + * the HTTP header for the client IP address. + * + * Here are some examples: + * [ + * '10.0.1.200' => 'X-Forwarded-For', + * '192.168.5.0/24' => 'X-Real-IP', + * ] + * + * @var array + */ + public array $proxyIPs = []; + + /** + * -------------------------------------------------------------------------- + * Content Security Policy + * -------------------------------------------------------------------------- + * + * Enables the Response's Content Secure Policy to restrict the sources that + * can be used for images, scripts, CSS files, audio, video, etc. If enabled, + * the Response object will populate default values for the policy from the + * `ContentSecurityPolicy.php` file. Controllers can always add to those + * restrictions at run time. + * + * For a better understanding of CSP, see these documents: + * + * @see http://www.html5rocks.com/en/tutorials/security/content-security-policy/ + * @see http://www.w3.org/TR/CSP/ + */ + public bool $CSPEnabled = false; +} \ No newline at end of file diff --git a/app/Config/Autoload.php b/app/Config/Autoload.php new file mode 100644 index 0000000..c175338 --- /dev/null +++ b/app/Config/Autoload.php @@ -0,0 +1,116 @@ + SYSTEMPATH, + * 'App' => APPPATH + * ]; + * + * @var array|string> + * @phpstan-var array> + */ + public $psr4 = [ + APP_NAMESPACE => APPPATH, // For custom app namespace + 'Config' => APPPATH . 'Config', + 'Dhiva/Core' => APPPATH . 'Libraries', + ]; + + /** + * ------------------------------------------------------------------- + * Class Map + * ------------------------------------------------------------------- + * The class map provides a map of class names and their exact + * location on the drive. Classes loaded in this manner will have + * slightly faster performance because they will not have to be + * searched for within one or more directories as they would if they + * were being autoloaded through a namespace. + * + * Prototype: + * $classmap = [ + * 'MyClass' => '/path/to/class/file.php' + * ]; + * + * @var array + */ + public $classmap = + [ + 'Dhiva\Core\DhivaRoutes' => APPPATH . 'Libraries/DhivaRoutes.php', + 'Dhiva\Core\DhivaAES' => APPPATH . 'Libraries/DhivaAES.php', + 'Dhiva\Core\Notification' => APPPATH . 'Libraries/Notification.php', + 'ArelAyudhi\DhivaProdevWa\ProdevMessages' => APPPATH . 'Libraries/ArelAyudhi/src/ProdevMessages.php', + 'ArelAyudhi\DhivaProdevWa\ProdevMessagesAbstract' => APPPATH . 'Libraries/ArelAyudhi/src/ProdevMessagesAbstract.php', + 'ArelAyudhi\DhivaProdevWa\Multiple' => APPPATH . 'Libraries/ArelAyudhi/src/Multiple.php', + 'ArelAyudhi\DhivaProdevWa\Group' => APPPATH . 'Libraries/ArelAyudhi/src/Group.php', + 'ArelAyudhi\DhivaProdevWa\ListMessage' => APPPATH . 'Libraries/ArelAyudhi/src/ListMessage.php', + 'ArelAyudhi\DhivaProdevWa\Broadcast' => APPPATH . 'Libraries/ArelAyudhi/src/Broadcast.php', + 'ArelAyudhi\DhivaProdevWa\UserList' => APPPATH . 'Libraries/ArelAyudhi/src/UserList.php', + 'Dhiva\Core\Notification' => APPPATH . 'Libraries/Notification.php' + ]; + + /** + * ------------------------------------------------------------------- + * Files + * ------------------------------------------------------------------- + * The files array provides a list of paths to __non-class__ files + * that will be autoloaded. This can be useful for bootstrap operations + * or for loading functions. + * + * Prototype: + * $files = [ + * '/path/to/my/file.php', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $files = []; + + /** + * ------------------------------------------------------------------- + * Helpers + * ------------------------------------------------------------------- + * Prototype: + * $helpers = [ + * 'form', + * ]; + * + * @var string[] + * @phpstan-var list + */ + public $helpers = ['device']; +} diff --git a/app/Config/Boot/development.php b/app/Config/Boot/development.php new file mode 100644 index 0000000..05a8612 --- /dev/null +++ b/app/Config/Boot/development.php @@ -0,0 +1,32 @@ + + */ + public array $file = [ + 'storePath' => WRITEPATH . 'cache/', + 'mode' => 0640, + ]; + + /** + * ------------------------------------------------------------------------- + * Memcached settings + * ------------------------------------------------------------------------- + * Your Memcached servers can be specified below, if you are using + * the Memcached drivers. + * + * @see https://codeigniter.com/user_guide/libraries/caching.html#memcached + * + * @var array + */ + public array $memcached = [ + 'host' => '127.0.0.1', + 'port' => 11211, + 'weight' => 1, + 'raw' => false, + ]; + + /** + * ------------------------------------------------------------------------- + * Redis settings + * ------------------------------------------------------------------------- + * Your Redis server can be specified below, if you are using + * the Redis or Predis drivers. + * + * @var array + */ + public array $redis = [ + 'host' => '127.0.0.1', + 'password' => null, + 'port' => 6379, + 'timeout' => 0, + 'database' => 0, + ]; + + /** + * -------------------------------------------------------------------------- + * Available Cache Handlers + * -------------------------------------------------------------------------- + * + * This is an array of cache engine alias' and class names. Only engines + * that are listed here are allowed to be used. + * + * @var array + * @phpstan-var array> + */ + public array $validHandlers = [ + 'dummy' => DummyHandler::class, + 'file' => FileHandler::class, + 'memcached' => MemcachedHandler::class, + 'predis' => PredisHandler::class, + 'redis' => RedisHandler::class, + 'wincache' => WincacheHandler::class, + ]; +} diff --git a/app/Config/Constants.php b/app/Config/Constants.php new file mode 100644 index 0000000..5033389 --- /dev/null +++ b/app/Config/Constants.php @@ -0,0 +1,392 @@ + $b) { + $string = preg_match("/^[a-zA-Z0-9]+$/", $_POST[$a]); + if (!$string) { + $response = [ + "success" => false, + "code" => 9001, + "message" => "Query Not Allowed", + ]; + header("Content-Type: application/json"); + echo json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); + die; + } + } + } + return $_POST; + } +} +// JANGAN DI GANTI ATAU DI FORMAT +define("SSL_KEY", array( + "password" => "8QAuvaF5qzNlGlgi", + "salt" => "aww9Rq9PRsy3QYrq", + "iv" => "LDSzHPcej5CKXqvT", + "iterations" => 2, + "keyLength" => 2, + "Payload_Key" => "U4a97fVRoQ", + "Payload_IV" => "Ae0Rf13j8e", + "route" => "pkAddGs9DB3VeEGL" +)); +define("JWT_KEY", "9QY3tGDFzS5aiI3Pz8Uf"); +// YG INI JANGAN DI HAPUS diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php new file mode 100644 index 0000000..7799c47 --- /dev/null +++ b/app/Config/ContentSecurityPolicy.php @@ -0,0 +1,176 @@ +` element. + * + * Will default to self if not overridden + * + * @var string|string[]|null + */ + public $baseURI; + + /** + * Lists the URLs for workers and embedded frame contents + * + * @var string|string[] + */ + public $childSrc = 'self'; + + /** + * Limits the origins that you can connect to (via XHR, + * WebSockets, and EventSource). + * + * @var string|string[] + */ + public $connectSrc = 'self'; + + /** + * Specifies the origins that can serve web fonts. + * + * @var string|string[] + */ + public $fontSrc; + + /** + * Lists valid endpoints for submission from `
` tags. + * + * @var string|string[] + */ + public $formAction = 'self'; + + /** + * Specifies the sources that can embed the current page. + * This directive applies to ``, `