├── app ├── Filters │ └── .gitkeep ├── Helpers │ └── .gitkeep ├── Language │ ├── .gitkeep │ └── en │ │ └── Validation.php ├── Libraries │ └── .gitkeep ├── Models │ ├── .gitkeep │ └── UserModel.php ├── ThirdParty │ └── .gitkeep ├── Database │ ├── Seeds │ │ └── .gitkeep │ └── Migrations │ │ └── .gitkeep ├── Views │ ├── about.php │ ├── errors │ │ ├── cli │ │ │ ├── error_404.php │ │ │ ├── production.php │ │ │ └── error_exception.php │ │ └── html │ │ │ ├── production.php │ │ │ ├── error_404.php │ │ │ ├── debug.js │ │ │ ├── debug.css │ │ │ └── error_exception.php │ ├── home.php │ ├── dashboard │ │ └── index.php │ ├── form │ │ ├── register.php │ │ └── login.php │ └── templates │ │ ├── header.php │ │ └── footer.php ├── .htaccess ├── index.html ├── Config │ ├── ForeignCharacters.php │ ├── CURLRequest.php │ ├── Images.php │ ├── Boot │ │ ├── production.php │ │ ├── testing.php │ │ └── development.php │ ├── Publisher.php │ ├── Honeypot.php │ ├── Services.php │ ├── Feature.php │ ├── Pager.php │ ├── Validation.php │ ├── Events.php │ ├── Kint.php │ ├── Filters.php │ ├── Migrations.php │ ├── View.php │ ├── Generators.php │ ├── Routes.php │ ├── Modules.php │ ├── Database.php │ ├── Email.php │ ├── Format.php │ ├── Encryption.php │ ├── Paths.php │ ├── DocTypes.php │ ├── Exceptions.php │ ├── Autoload.php │ ├── Toolbar.php │ ├── Security.php │ ├── Cookie.php │ ├── Session.php │ ├── Constants.php │ ├── ContentSecurityPolicy.php │ ├── Logger.php │ ├── Cache.php │ ├── UserAgents.php │ └── Mimes.php ├── Common.php └── Controllers │ ├── Home.php │ ├── Dashboard.php │ ├── BaseController.php │ └── User.php ├── public ├── robots.txt ├── favicon.ico ├── .htaccess └── index.php ├── writable ├── .htaccess ├── cache │ └── index.html ├── logs │ └── index.html ├── session │ └── index.html └── uploads │ └── index.html ├── tests ├── _support │ ├── Libraries │ │ └── ConfigReader.php │ ├── Models │ │ └── ExampleModel.php │ └── Database │ │ ├── Migrations │ │ └── 2020-02-22-222222_example_migration.php │ │ └── Seeds │ │ └── ExampleSeeder.php ├── session │ └── ExampleSessionTest.php ├── database │ └── ExampleDatabaseTest.php ├── unit │ └── HealthTest.php └── README.md ├── composer.json ├── LICENSE ├── README.md ├── phpunit.xml.dist ├── spark ├── preload.php └── env /app/Filters/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Helpers/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Language/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Libraries/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Models/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/ThirdParty/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Database/Seeds/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/Database/Migrations/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /app/Views/about.php: -------------------------------------------------------------------------------- 1 |
2 |

ABOUT PAGE

3 |
-------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deaafrizal/deaci4dev-boilerplate/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /app/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /app/Language/en/Validation.php: -------------------------------------------------------------------------------- 1 | 2 | Require all denied 3 | 4 | 5 | Deny from all 6 | 7 | -------------------------------------------------------------------------------- /app/Views/errors/cli/production.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 403 Forbidden 5 | 6 | 7 | 8 |

Directory access is forbidden.

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

Directory access is forbidden.

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

Directory access is forbidden.

9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Config/ForeignCharacters.php: -------------------------------------------------------------------------------- 1 | 2 |

HOMEPAGE

3 |

4 | getFlashdata('message'))) { 6 | echo $session->getFlashdata('message'); 7 | } 8 | ?> 9 |

10 | -------------------------------------------------------------------------------- /app/Models/UserModel.php: -------------------------------------------------------------------------------- 1 | DASHBOARD 2 |

3 | 8 |

9 | 10 |

your email: 11 | 12 |

13 |

your api token: 14 | 15 |

16 |

islogin: 17 | 18 |

-------------------------------------------------------------------------------- /tests/_support/Libraries/ConfigReader.php: -------------------------------------------------------------------------------- 1 | set('logged_in', 123); 16 | $this->assertSame(123, $session->get('logged_in')); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/Common.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | <?= lang('Errors.whoops') ?> 8 | 9 | 12 | 13 | 14 | 15 |
16 | 17 |

18 | 19 |

20 | 21 |
22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/Config/CURLRequest.php: -------------------------------------------------------------------------------- 1 | title . "HOME"; 11 | $data['session'] = \Config\Services::session(); 12 | 13 | return view('templates/header', $data) . view('home') . view('templates/footer'); 14 | } 15 | public function about() 16 | { 17 | $data['session'] = \Config\Services::session(); 18 | $data['title'] = $this->title . "ABOUT"; 19 | return view('templates/header', $data) . view('about') . view('templates/footer'); 20 | } 21 | } -------------------------------------------------------------------------------- /app/Controllers/Dashboard.php: -------------------------------------------------------------------------------- 1 | title . "DASHBOARD"; 13 | $data['session'] = $session; 14 | $data['message'] = $session->getFlashdata('message'); 15 | $data['email'] = $session->get('email'); 16 | $data['token'] = $session->get('token'); 17 | $data['isLogin'] = $session->get('isLogin'); 18 | 19 | if (!$data['isLogin']) { 20 | return redirect()->to('/login'); 21 | } 22 | 23 | return view('templates/header', $data) . view('dashboard/index', $data) . view('templates/footer'); 24 | } 25 | } -------------------------------------------------------------------------------- /app/Config/Images.php: -------------------------------------------------------------------------------- 1 | 26 | */ 27 | public array $handlers = [ 28 | 'gd' => GDHandler::class, 29 | 'imagick' => ImageMagickHandler::class, 30 | ]; 31 | } 32 | -------------------------------------------------------------------------------- /app/Config/Boot/production.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/Honeypot.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/Services.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Config/Boot/testing.php: -------------------------------------------------------------------------------- 1 | 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /app/Config/Boot/development.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/unit/HealthTest.php: -------------------------------------------------------------------------------- 1 | assertTrue(defined('APPPATH')); 16 | } 17 | 18 | public function testBaseUrlHasBeenSet() 19 | { 20 | $validation = Services::validation(); 21 | 22 | $env = false; 23 | 24 | // Check the baseURL in .env 25 | if (is_file(HOMEPATH . '.env')) { 26 | $env = preg_grep('/^app\.baseURL = ./', file(HOMEPATH . '.env')) !== false; 27 | } 28 | 29 | if ($env) { 30 | // BaseURL in .env is a valid URL? 31 | // phpunit.xml.dist sets app.baseURL in $_SERVER 32 | // So if you set app.baseURL in .env, it takes precedence 33 | $config = new App(); 34 | $this->assertTrue( 35 | $validation->check($config->baseURL, 'valid_url'), 36 | 'baseURL "' . $config->baseURL . '" in .env is not valid URL' 37 | ); 38 | } 39 | 40 | // Get the baseURL in app/Config/App.php 41 | // You can't use Config\App, because phpunit.xml.dist sets app.baseURL 42 | $reader = new ConfigReader(); 43 | 44 | // BaseURL in app/Config/App.php is a valid URL? 45 | $this->assertTrue( 46 | $validation->check($reader->baseURL, 'valid_url'), 47 | 'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL' 48 | ); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gue belajar lagi hal baru dalam 2 jam 👇 2 | 3 | ## Stack: CodeIgniter 4 + Tailwind CSS 4 | 5 | ### Summary feature✨ 6 | - Home, About, Login & Register Page 7 | - All Page Validation 8 | - Creating new user 9 | - Login & Logout account 10 | - Database creation for users (only for id, email, token). 11 | - Basic password hashing 12 | - Basic dynamic component layouting 13 | - 14 | 15 | ### PROS 👍 16 | -super strong MVC pattern 17 | -super lightweight 18 | -fase development bisa dibilang cukup cepet 19 | -koneksi ke database gak terlalu ribet 20 | -query builder kek punyanya eloquent laravel 21 | -layouting cukup enak 22 | 23 | ### CONS 😢 24 | -validasi lemparan data yang sedikit ribet mesti agak muter 25 | 26 | ### WHAT NEXT? 😊 27 | - posting data 28 | - multirole user permission 29 | - cleaning some code 30 | - creating some API & using external API 31 | - and much more... 32 | 33 | ### WHAT TO BELIEVE? 🤦‍♂️ 34 | -belum nyoba production 35 | -belum nyoba middleware & module services 36 | -belum nyoba manage API 37 | -belum nyoba integrated RULES module 38 | -belum nyoba relasi & advance modeling 39 | -belum nyoba helper function 40 | 41 | Banyak banget yang belom kan? iyeelah orang cuma 2 jam taek 🤣 42 | lanjut lagi nanti dah... 43 | 44 | ### Cara jalanin projectnya? 👇🎉 45 | 1. CLONE REPO 46 | 2. composer update 47 | 3. setup database MYSQL, kasih nama db simple_user 48 | 4. bikin table: users 49 | 5. bikin field table: id (auto increment), email (255: string), password(255:string), token(8, int). 50 | 6. nyalain project nya: php spark serve 51 | 7. pelajari. 52 | 53 | Sorry gue belom taro code nya di ENV, masih kebelet kepo jadi gak keburu. 54 | moga lancar ya 🙌😁 55 | 56 | -------------------------------------------------------------------------------- /app/Config/Events.php: -------------------------------------------------------------------------------- 1 | 0) { 32 | ob_end_flush(); 33 | } 34 | 35 | ob_start(static fn ($buffer) => $buffer); 36 | } 37 | 38 | /* 39 | * -------------------------------------------------------------------- 40 | * Debug Toolbar Listeners. 41 | * -------------------------------------------------------------------- 42 | * If you delete, they will no longer be collected. 43 | */ 44 | if (CI_DEBUG && ! is_cli()) { 45 | Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect'); 46 | Services::toolbar()->respond(); 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /app/Config/Kint.php: -------------------------------------------------------------------------------- 1 | session = \Config\Services::session(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /public/.htaccess: -------------------------------------------------------------------------------- 1 | # Disable directory browsing 2 | Options -Indexes 3 | 4 | # ---------------------------------------------------------------------- 5 | # Rewrite engine 6 | # ---------------------------------------------------------------------- 7 | 8 | # Turning on the rewrite engine is necessary for the following rules and features. 9 | # FollowSymLinks must be enabled for this to work. 10 | 11 | Options +FollowSymlinks 12 | RewriteEngine On 13 | 14 | # If you installed CodeIgniter in a subfolder, you will need to 15 | # change the following line to match the subfolder you need. 16 | # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase 17 | # RewriteBase / 18 | 19 | # Redirect Trailing Slashes... 20 | RewriteCond %{REQUEST_FILENAME} !-d 21 | RewriteCond %{REQUEST_URI} (.+)/$ 22 | RewriteRule ^ %1 [L,R=301] 23 | 24 | # Rewrite "www.example.com -> example.com" 25 | RewriteCond %{HTTPS} !=on 26 | RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] 27 | RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] 28 | 29 | # Checks to see if the user is attempting to access a valid file, 30 | # such as an image or css document, if this isn't true it sends the 31 | # request to the front controller, index.php 32 | RewriteCond %{REQUEST_FILENAME} !-f 33 | RewriteCond %{REQUEST_FILENAME} !-d 34 | RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA] 35 | 36 | # Ensure Authorization header is passed along 37 | RewriteCond %{HTTP:Authorization} . 38 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 39 | 40 | 41 | 42 | # If we don't have mod_rewrite installed, all 404's 43 | # can be sent to index.php, and everything works as normal. 44 | ErrorDocument 404 index.php 45 | 46 | 47 | # Disable server signature start 48 | ServerSignature Off 49 | # Disable server signature end 50 | -------------------------------------------------------------------------------- /app/Views/form/register.php: -------------------------------------------------------------------------------- 1 |
2 |

REGISTER PAGE

3 |
4 | 5 |
6 |
7 | 9 | 12 |
13 |
14 | 16 | 19 |
20 |
21 | 24 | or login here 25 |
26 |
-------------------------------------------------------------------------------- /app/Config/Filters.php: -------------------------------------------------------------------------------- 1 | CSRF::class, 20 | 'toolbar' => DebugToolbar::class, 21 | 'honeypot' => Honeypot::class, 22 | 'invalidchars' => InvalidChars::class, 23 | 'secureheaders' => SecureHeaders::class, 24 | ]; 25 | 26 | /** 27 | * List of filter aliases that are always 28 | * applied before and after every request. 29 | */ 30 | public array $globals = [ 31 | 'before' => [ 32 | // 'honeypot', 33 | // 'csrf', 34 | // 'invalidchars', 35 | ], 36 | 'after' => [ 37 | 'toolbar', 38 | // 'honeypot', 39 | // 'secureheaders', 40 | ], 41 | ]; 42 | 43 | /** 44 | * List of filter aliases that works on a 45 | * particular HTTP method (GET, POST, etc.). 46 | * 47 | * Example: 48 | * 'post' => ['foo', 'bar'] 49 | * 50 | * If you use this, you should disable auto-routing because auto-routing 51 | * permits any HTTP method to access a controller. Accessing the controller 52 | * with a method you don’t expect could bypass the filter. 53 | */ 54 | public array $methods = []; 55 | 56 | /** 57 | * List of filter aliases that should run on any 58 | * before or after URI patterns. 59 | * 60 | * Example: 61 | * 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']] 62 | */ 63 | public array $filters = []; 64 | } 65 | -------------------------------------------------------------------------------- /app/Config/Migrations.php: -------------------------------------------------------------------------------- 1 | php spark make:migration 42 | * 43 | * Note: if you set an unsupported format, migration runner will not find 44 | * your migration files. 45 | * 46 | * Supported formats: 47 | * - YmdHis_ 48 | * - Y-m-d-His_ 49 | * - Y_m_d_His_ 50 | */ 51 | public string $timestampFormat = 'Y-m-d-His_'; 52 | } 53 | -------------------------------------------------------------------------------- /app/Config/View.php: -------------------------------------------------------------------------------- 1 | [] 54 | */ 55 | public array $decorators = []; 56 | } 57 | -------------------------------------------------------------------------------- /app/Config/Generators.php: -------------------------------------------------------------------------------- 1 | 27 | */ 28 | public array $views = [ 29 | 'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php', 30 | 'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php', 31 | 'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php', 32 | 'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php', 33 | 'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php', 34 | 'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php', 35 | 'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php', 36 | 'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php', 37 | 'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php', 38 | 'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php', 39 | ]; 40 | } 41 | -------------------------------------------------------------------------------- /app/Views/form/login.php: -------------------------------------------------------------------------------- 1 |
2 |

PLEASE LOGIN HERE

3 |

4 | 9 |

10 |
11 | 12 |
13 |
14 | 16 | 19 |
20 |
21 | 23 | 26 |
27 |
28 | 31 | or register here 32 |
33 |
-------------------------------------------------------------------------------- /app/Views/errors/cli/error_exception.php: -------------------------------------------------------------------------------- 1 | getFile()) . ':' . $exception->getLine(), 'green')); 12 | CLI::newLine(); 13 | 14 | // The backtrace 15 | if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) { 16 | $backtraces = $exception->getTrace(); 17 | 18 | if ($backtraces) { 19 | CLI::write('Backtrace:', 'green'); 20 | } 21 | 22 | foreach ($backtraces as $i => $error) { 23 | $padFile = ' '; // 4 spaces 24 | $padClass = ' '; // 7 spaces 25 | $c = str_pad($i + 1, 3, ' ', STR_PAD_LEFT); 26 | 27 | if (isset($error['file'])) { 28 | $filepath = clean_path($error['file']) . ':' . $error['line']; 29 | 30 | CLI::write($c . $padFile . CLI::color($filepath, 'yellow')); 31 | } else { 32 | CLI::write($c . $padFile . CLI::color('[internal function]', 'yellow')); 33 | } 34 | 35 | $function = ''; 36 | 37 | if (isset($error['class'])) { 38 | $type = ($error['type'] === '->') ? '()' . $error['type'] : $error['type']; 39 | $function .= $padClass . $error['class'] . $type . $error['function']; 40 | } elseif (! isset($error['class']) && isset($error['function'])) { 41 | $function .= $padClass . $error['function']; 42 | } 43 | 44 | $args = implode(', ', array_map(static function ($value) { 45 | switch (true) { 46 | case is_object($value): 47 | return 'Object(' . get_class($value) . ')'; 48 | 49 | case is_array($value): 50 | return count($value) ? '[...]' : '[]'; 51 | 52 | case $value === null: 53 | return 'null'; // return the lowercased version 54 | 55 | default: 56 | return var_export($value, true); 57 | } 58 | }, array_values($error['args'] ?? []))); 59 | 60 | $function .= '(' . $args . ')'; 61 | 62 | CLI::write($function); 63 | CLI::newLine(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /app/Config/Routes.php: -------------------------------------------------------------------------------- 1 | setDefaultNamespace('App\Controllers'); 14 | $routes->setDefaultController('Home'); 15 | $routes->setDefaultMethod('index'); 16 | $routes->setTranslateURIDashes(false); 17 | $routes->set404Override(); 18 | // The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps 19 | // where controller filters or CSRF protection are bypassed. 20 | // If you don't want to define all routes, please use the Auto Routing (Improved). 21 | // Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true. 22 | // $routes->setAutoRoute(false); 23 | 24 | /* 25 | * -------------------------------------------------------------------- 26 | * Route Definitions 27 | * -------------------------------------------------------------------- 28 | */ 29 | 30 | // We get a performance increase by specifying the default 31 | // route since we don't have to scan directories. 32 | $routes->get('/', 'Home::index'); 33 | $routes->get('/about', 'Home::about'); 34 | $routes->get('/login', 'User::login'); 35 | $routes->get('/logout', 'User::logout'); 36 | $routes->get('/register', 'User::register'); 37 | $routes->post('/login/auth', 'User::login_auth'); 38 | $routes->post('/register/auth', 'User::register_auth'); 39 | 40 | //dashboard panel 41 | $routes->get('/dashboard', 'Dashboard::index'); 42 | 43 | /* 44 | * -------------------------------------------------------------------- 45 | * Additional Routing 46 | * -------------------------------------------------------------------- 47 | * 48 | * There will often be times that you need additional routing and you 49 | * need it to be able to override any defaults in this file. Environment 50 | * based routes is one such time. require() additional route files here 51 | * to make that happen. 52 | * 53 | * You will have access to the $routes object within that file without 54 | * needing to reload it. 55 | */ 56 | if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) { 57 | require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php'; 58 | } -------------------------------------------------------------------------------- /app/Views/errors/html/error_404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | <?= lang('Errors.pageNotFound') ?> 6 | 7 | 70 | 71 | 72 |
73 |

404

74 | 75 |

76 | 77 | 78 | 79 | 80 | 81 |

82 |
83 | 84 | 85 | -------------------------------------------------------------------------------- /app/Config/Modules.php: -------------------------------------------------------------------------------- 1 | [ 41 | * // List up all packages to auto-discover 42 | * 'codeigniter4/shield', 43 | * ], 44 | * ] 45 | * or 46 | * [ 47 | * 'exclude' => [ 48 | * // List up packages to exclude. 49 | * 'pestphp/pest', 50 | * ], 51 | * ] 52 | * 53 | * @var array 54 | */ 55 | public $composerPackages = []; 56 | 57 | /** 58 | * -------------------------------------------------------------------------- 59 | * Auto-Discovery Rules 60 | * -------------------------------------------------------------------------- 61 | * 62 | * Aliases list of all discovery classes that will be active and used during 63 | * the current application request. 64 | * 65 | * If it is not listed, only the base application elements will be used. 66 | * 67 | * @var string[] 68 | */ 69 | public $aliases = [ 70 | 'events', 71 | 'filters', 72 | 'registrars', 73 | 'routes', 74 | 'services', 75 | ]; 76 | } 77 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; 39 | 40 | // Load environment settings from .env files into $_SERVER and $_ENV 41 | require_once SYSTEMPATH . 'Config/DotEnv.php'; 42 | (new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); 43 | 44 | /* 45 | * --------------------------------------------------------------- 46 | * GRAB OUR CODEIGNITER INSTANCE 47 | * --------------------------------------------------------------- 48 | * 49 | * The CodeIgniter class contains the core functionality to make 50 | * the application run, and does all of the dirty work to get 51 | * the pieces all working together. 52 | */ 53 | 54 | $app = Config\Services::codeigniter(); 55 | $app->initialize(); 56 | $context = is_cli() ? 'php-cli' : 'web'; 57 | $app->setContext($context); 58 | 59 | /* 60 | *--------------------------------------------------------------- 61 | * LAUNCH THE APPLICATION 62 | *--------------------------------------------------------------- 63 | * Now that everything is setup, it's time to actually fire 64 | * up the engines and make this app do its thang. 65 | */ 66 | 67 | $app->run(); 68 | -------------------------------------------------------------------------------- /app/Config/Database.php: -------------------------------------------------------------------------------- 1 | '', 29 | 'hostname' => 'localhost', 30 | 'username' => 'root', 31 | 'password' => '', 32 | 'database' => 'simple_user', 33 | 'DBDriver' => 'MySQLi', 34 | 'DBPrefix' => '', 35 | 'pConnect' => false, 36 | 'DBDebug' => true, 37 | 'charset' => 'utf8', 38 | 'DBCollat' => 'utf8_general_ci', 39 | 'swapPre' => '', 40 | 'encrypt' => false, 41 | 'compress' => false, 42 | 'strictOn' => false, 43 | 'failover' => [], 44 | 'port' => 3306, 45 | ]; 46 | 47 | /** 48 | * This database connection is used when 49 | * running PHPUnit database tests. 50 | */ 51 | public array $tests = [ 52 | 'DSN' => '', 53 | 'hostname' => '127.0.0.1', 54 | 'username' => '', 55 | 'password' => '', 56 | 'database' => ':memory:', 57 | 'DBDriver' => 'SQLite3', 58 | 'DBPrefix' => 'db_', 59 | // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS 60 | 'pConnect' => false, 61 | 'DBDebug' => true, 62 | 'charset' => 'utf8', 63 | 'DBCollat' => 'utf8_general_ci', 64 | 'swapPre' => '', 65 | 'encrypt' => false, 66 | 'compress' => false, 67 | 'strictOn' => false, 68 | 'failover' => [], 69 | 'port' => 3306, 70 | 'foreignKeys' => true, 71 | 'busyTimeout' => 1000, 72 | ]; 73 | 74 | public function __construct() 75 | { 76 | parent::__construct(); 77 | 78 | // Ensure that we always set the database group to 'tests' if 79 | // we are currently running an automated test suite, so that 80 | // we don't overwrite live data on accident. 81 | if (ENVIRONMENT === 'testing') { 82 | $this->defaultGroup = 'tests'; 83 | } 84 | } 85 | } -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 16 | ./app 17 | 18 | 19 | ./app/Views 20 | ./app/Config/Routes.php 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | ./tests 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /app/Config/Email.php: -------------------------------------------------------------------------------- 1 | 43 | */ 44 | public array $formatters = [ 45 | 'application/json' => JSONFormatter::class, 46 | 'application/xml' => XMLFormatter::class, 47 | 'text/xml' => XMLFormatter::class, 48 | ]; 49 | 50 | /** 51 | * -------------------------------------------------------------------------- 52 | * Formatters Options 53 | * -------------------------------------------------------------------------- 54 | * 55 | * Additional Options to adjust default formatters behaviour. 56 | * For each mime type, list the additional options that should be used. 57 | * 58 | * @var array 59 | */ 60 | public array $formatterOptions = [ 61 | 'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES, 62 | 'application/xml' => 0, 63 | 'text/xml' => 0, 64 | ]; 65 | 66 | /** 67 | * A Factory method to return the appropriate formatter for the given mime type. 68 | * 69 | * @return FormatterInterface 70 | * 71 | * @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead. 72 | */ 73 | public function getFormatter(string $mime) 74 | { 75 | return Services::format()->getFormatter($mime); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /app/Config/Encryption.php: -------------------------------------------------------------------------------- 1 | get('isLogin')) { 16 | return redirect()->to('/dashboard'); 17 | } 18 | 19 | $data['title'] = $this->title . 'LOGIN'; 20 | $data['session'] = $session; 21 | $data['message'] = $session->getFlashdata('message'); 22 | 23 | return view('templates/header', $data) . view('form/login', $data) . view('templates/footer'); 24 | } 25 | 26 | public function logout() 27 | { 28 | $session = \Config\Services::session(); 29 | $session->destroy(); 30 | $session->setFlashdata('message', 'please come again later 😘'); 31 | return redirect()->to('/'); 32 | } 33 | 34 | public function register() 35 | { 36 | $session = \Config\Services::session(); 37 | 38 | $data['title'] = $this->title . 'REGISTER'; 39 | $data['session'] = $session; 40 | $data['message'] = $session->getFlashdata('message'); 41 | 42 | return view('templates/header', $data) . view('form/register') . view('templates/footer'); 43 | } 44 | 45 | public function login_auth() 46 | { 47 | $userModel = new \App\Models\UserModel(); 48 | $session = \Config\Services::session(); 49 | 50 | $email = $this->request->getVar('email'); 51 | $password = $this->request->getVar('password'); 52 | 53 | $user = $userModel->where('email', $email)->first(); 54 | 55 | if (!empty($user['email']) && password_verify($password, $user['password'])) { 56 | $session->set('isLogin', true); 57 | $session->set('email', $email); 58 | $session->set('token', $user['token']); 59 | 60 | $session->setFlashdata('message', 'welcome back! 😘'); 61 | return redirect()->to('/dashboard'); 62 | } else { 63 | $session->setFlashdata('message', 'sorry your account is invalid 😢'); 64 | return redirect()->back(); 65 | } 66 | } 67 | 68 | public function register_auth() 69 | { 70 | $userModel = new \App\Models\UserModel(); 71 | $session = \Config\Services::session(); 72 | 73 | $token = rand(1000000, 9999999); 74 | $password = password_hash($this->request->getVar('password'), PASSWORD_DEFAULT); 75 | 76 | $data = [ 77 | 'email' => $this->request->getVar('email'), 78 | 'password' => $password, 79 | 'token' => $token 80 | ]; 81 | 82 | $addUser = $userModel->insert($data); 83 | 84 | if ($addUser) { 85 | $session->setFlashdata('message', 'thanks for registrating here 😍'); 86 | return redirect()->to('/login'); 87 | } else { 88 | $session->setFlashdata('message', 'please try again later 😢'); 89 | return redirect()->back(); 90 | } 91 | } 92 | } -------------------------------------------------------------------------------- /app/Config/DocTypes.php: -------------------------------------------------------------------------------- 1 | 11 | */ 12 | public array $list = [ 13 | 'xhtml11' => '', 14 | 'xhtml1-strict' => '', 15 | 'xhtml1-trans' => '', 16 | 'xhtml1-frame' => '', 17 | 'xhtml-basic11' => '', 18 | 'html5' => '', 19 | 'html4-strict' => '', 20 | 'html4-trans' => '', 21 | 'html4-frame' => '', 22 | 'mathml1' => '', 23 | 'mathml2' => '', 24 | 'svg10' => '', 25 | 'svg11' => '', 26 | 'svg11-basic' => '', 27 | 'svg11-tiny' => '', 28 | 'xhtml-math-svg-xh' => '', 29 | 'xhtml-math-svg-sh' => '', 30 | 'xhtml-rdfa-1' => '', 31 | 'xhtml-rdfa-2' => '', 32 | ]; 33 | 34 | /** 35 | * Whether to remove the solidus (`/`) character for void HTML elements (e.g. ``) 36 | * for HTML5 compatibility. 37 | * 38 | * Set to: 39 | * `true` - to be HTML5 compatible 40 | * `false` - to be XHTML compatible 41 | */ 42 | public bool $html5 = true; 43 | } 44 | -------------------------------------------------------------------------------- /app/Config/Exceptions.php: -------------------------------------------------------------------------------- 1 | SYSTEMPATH, 36 | * 'App' => APPPATH 37 | * ]; 38 | * 39 | * @var array|string> 40 | * @phpstan-var array> 41 | */ 42 | public $psr4 = [ 43 | APP_NAMESPACE => APPPATH, // For custom app namespace 44 | 'Config' => APPPATH . 'Config', 45 | ]; 46 | 47 | /** 48 | * ------------------------------------------------------------------- 49 | * Class Map 50 | * ------------------------------------------------------------------- 51 | * The class map provides a map of class names and their exact 52 | * location on the drive. Classes loaded in this manner will have 53 | * slightly faster performance because they will not have to be 54 | * searched for within one or more directories as they would if they 55 | * were being autoloaded through a namespace. 56 | * 57 | * Prototype: 58 | * $classmap = [ 59 | * 'MyClass' => '/path/to/class/file.php' 60 | * ]; 61 | * 62 | * @var array 63 | */ 64 | public $classmap = []; 65 | 66 | /** 67 | * ------------------------------------------------------------------- 68 | * Files 69 | * ------------------------------------------------------------------- 70 | * The files array provides a list of paths to __non-class__ files 71 | * that will be autoloaded. This can be useful for bootstrap operations 72 | * or for loading functions. 73 | * 74 | * Prototype: 75 | * $files = [ 76 | * '/path/to/my/file.php', 77 | * ]; 78 | * 79 | * @var string[] 80 | * @phpstan-var list 81 | */ 82 | public $files = []; 83 | 84 | /** 85 | * ------------------------------------------------------------------- 86 | * Helpers 87 | * ------------------------------------------------------------------- 88 | * Prototype: 89 | * $helpers = [ 90 | * 'form', 91 | * ]; 92 | * 93 | * @var string[] 94 | * @phpstan-var list 95 | */ 96 | public $helpers = []; 97 | } 98 | -------------------------------------------------------------------------------- /spark: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | 8 | * 9 | * For the full copyright and license information, please view 10 | * the LICENSE file that was distributed with this source code. 11 | */ 12 | 13 | /* 14 | * -------------------------------------------------------------------- 15 | * CodeIgniter command-line tools 16 | * -------------------------------------------------------------------- 17 | * The main entry point into the CLI system and allows you to run 18 | * commands and perform maintenance on your application. 19 | * 20 | * Because CodeIgniter can handle CLI requests as just another web request 21 | * this class mainly acts as a passthru to the framework itself. 22 | */ 23 | 24 | // Refuse to run when called from php-cgi 25 | if (strpos(PHP_SAPI, 'cgi') === 0) { 26 | exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n"); 27 | } 28 | 29 | // Check PHP version. 30 | $minPhpVersion = '7.4'; // If you update this, don't forget to update `public/index.php`. 31 | if (version_compare(PHP_VERSION, $minPhpVersion, '<')) { 32 | $message = sprintf( 33 | 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s', 34 | $minPhpVersion, 35 | PHP_VERSION 36 | ); 37 | 38 | exit($message); 39 | } 40 | 41 | // We want errors to be shown when using it from the CLI. 42 | error_reporting(-1); 43 | ini_set('display_errors', '1'); 44 | 45 | /** 46 | * @var bool 47 | * 48 | * @deprecated No longer in use. `CodeIgniter` has `$context` property. 49 | */ 50 | define('SPARKED', true); 51 | 52 | // Path to the front controller 53 | define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR); 54 | 55 | // Ensure the current directory is pointing to the front controller's directory 56 | chdir(FCPATH); 57 | 58 | /* 59 | *--------------------------------------------------------------- 60 | * BOOTSTRAP THE APPLICATION 61 | *--------------------------------------------------------------- 62 | * This process sets up the path constants, loads and registers 63 | * our autoloader, along with Composer's, loads our constants 64 | * and fires up an environment-specific bootstrapping. 65 | */ 66 | 67 | // Load our paths config file 68 | // This is the line that might need to be changed, depending on your folder structure. 69 | require FCPATH . '../app/Config/Paths.php'; 70 | // ^^^ Change this line if you move your application folder 71 | 72 | $paths = new Config\Paths(); 73 | 74 | // Location of the framework bootstrap file. 75 | require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; 76 | 77 | // Load environment settings from .env files into $_SERVER and $_ENV 78 | require_once SYSTEMPATH . 'Config/DotEnv.php'; 79 | (new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); 80 | 81 | // Grab our CodeIgniter 82 | $app = Config\Services::codeigniter(); 83 | $app->initialize(); 84 | 85 | // Grab our Console 86 | $console = new CodeIgniter\CLI\Console(); 87 | 88 | // Show basic information before we do anything else. 89 | if (is_int($suppress = array_search('--no-header', $_SERVER['argv'], true))) { 90 | unset($_SERVER['argv'][$suppress]); // @codeCoverageIgnore 91 | $suppress = true; 92 | } 93 | 94 | $console->showHeader($suppress); 95 | 96 | // fire off the command in the main framework. 97 | $exit = $console->run(); 98 | 99 | exit(is_int($exit) ? $exit : EXIT_SUCCESS); 100 | -------------------------------------------------------------------------------- /preload.php: -------------------------------------------------------------------------------- 1 | 7 | * 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 | *--------------------------------------------------------------- 14 | * Sample file for Preloading 15 | *--------------------------------------------------------------- 16 | * See https://www.php.net/manual/en/opcache.preloading.php 17 | * 18 | * How to Use: 19 | * 0. Copy this file to your project root folder. 20 | * 1. Set the $paths property of the preload class below. 21 | * 2. Set opcache.preload in php.ini. 22 | * php.ini: 23 | * opcache.preload=/path/to/preload.php 24 | */ 25 | 26 | // Load the paths config file 27 | require __DIR__ . '/app/Config/Paths.php'; 28 | 29 | // Path to the front controller 30 | define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR); 31 | 32 | /** 33 | * See https://www.php.net/manual/en/function.str-contains.php#126277 34 | */ 35 | if (! function_exists('str_contains')) { 36 | /** 37 | * Polyfill of str_contains() 38 | */ 39 | function str_contains(string $haystack, string $needle): bool 40 | { 41 | return empty($needle) || strpos($haystack, $needle) !== false; 42 | } 43 | } 44 | 45 | class preload 46 | { 47 | /** 48 | * @var array Paths to preload. 49 | */ 50 | private array $paths = [ 51 | [ 52 | 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', 53 | 'exclude' => [ 54 | // Not needed if you don't use them. 55 | '/system/Database/OCI8/', 56 | '/system/Database/Postgre/', 57 | '/system/Database/SQLSRV/', 58 | // Not needed. 59 | '/system/Database/Seeder.php', 60 | '/system/Test/', 61 | '/system/Language/', 62 | '/system/CLI/', 63 | '/system/Commands/', 64 | '/system/Publisher/', 65 | '/system/ComposerScripts.php', 66 | '/Views/', 67 | // Errors occur. 68 | '/system/Config/Routes.php', 69 | '/system/ThirdParty/', 70 | ], 71 | ], 72 | ]; 73 | 74 | public function __construct() 75 | { 76 | $this->loadAutoloader(); 77 | } 78 | 79 | private function loadAutoloader() 80 | { 81 | $paths = new Config\Paths(); 82 | require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; 83 | } 84 | 85 | /** 86 | * Load PHP files. 87 | */ 88 | public function load() 89 | { 90 | foreach ($this->paths as $path) { 91 | $directory = new RecursiveDirectoryIterator($path['include']); 92 | $fullTree = new RecursiveIteratorIterator($directory); 93 | $phpFiles = new RegexIterator( 94 | $fullTree, 95 | '/.+((? $file) { 100 | foreach ($path['exclude'] as $exclude) { 101 | if (str_contains($file[0], $exclude)) { 102 | continue 2; 103 | } 104 | } 105 | 106 | require_once $file[0]; 107 | echo 'Loaded: ' . $file[0] . "\n"; 108 | } 109 | } 110 | } 111 | } 112 | 113 | (new preload())->load(); 114 | -------------------------------------------------------------------------------- /app/Config/Toolbar.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public string $driver = FileHandler::class; 25 | 26 | /** 27 | * -------------------------------------------------------------------------- 28 | * Session Cookie Name 29 | * -------------------------------------------------------------------------- 30 | * 31 | * The session cookie name, must contain only [0-9a-z_-] characters 32 | */ 33 | public string $cookieName = 'ci_session'; 34 | 35 | /** 36 | * -------------------------------------------------------------------------- 37 | * Session Expiration 38 | * -------------------------------------------------------------------------- 39 | * 40 | * The number of SECONDS you want the session to last. 41 | * Setting to 0 (zero) means expire when the browser is closed. 42 | */ 43 | public int $expiration = 7200; 44 | 45 | /** 46 | * -------------------------------------------------------------------------- 47 | * Session Save Path 48 | * -------------------------------------------------------------------------- 49 | * 50 | * The location to save sessions to and is driver dependent. 51 | * 52 | * For the 'files' driver, it's a path to a writable directory. 53 | * WARNING: Only absolute paths are supported! 54 | * 55 | * For the 'database' driver, it's a table name. 56 | * Please read up the manual for the format with other session drivers. 57 | * 58 | * IMPORTANT: You are REQUIRED to set a valid save path! 59 | */ 60 | public string $savePath = WRITEPATH . 'session'; 61 | 62 | /** 63 | * -------------------------------------------------------------------------- 64 | * Session Match IP 65 | * -------------------------------------------------------------------------- 66 | * 67 | * Whether to match the user's IP address when reading the session data. 68 | * 69 | * WARNING: If you're using the database driver, don't forget to update 70 | * your session table's PRIMARY KEY when changing this setting. 71 | */ 72 | public bool $matchIP = false; 73 | 74 | /** 75 | * -------------------------------------------------------------------------- 76 | * Session Time to Update 77 | * -------------------------------------------------------------------------- 78 | * 79 | * How many seconds between CI regenerating the session ID. 80 | */ 81 | public int $timeToUpdate = 300; 82 | 83 | /** 84 | * -------------------------------------------------------------------------- 85 | * Session Regenerate Destroy 86 | * -------------------------------------------------------------------------- 87 | * 88 | * Whether to destroy session data associated with the old session ID 89 | * when auto-regenerating the session ID. When set to FALSE, the data 90 | * will be later deleted by the garbage collector. 91 | */ 92 | public bool $regenerateDestroy = false; 93 | 94 | /** 95 | * -------------------------------------------------------------------------- 96 | * Session Database Group 97 | * -------------------------------------------------------------------------- 98 | * 99 | * DB Group for the database session. 100 | */ 101 | public ?string $DBGroup = null; 102 | } 103 | -------------------------------------------------------------------------------- /app/Config/Constants.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | <?= esc($title); ?> 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/Views/errors/html/debug.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --main-bg-color: #fff; 3 | --main-text-color: #555; 4 | --dark-text-color: #222; 5 | --light-text-color: #c7c7c7; 6 | --brand-primary-color: #E06E3F; 7 | --light-bg-color: #ededee; 8 | --dark-bg-color: #404040; 9 | } 10 | 11 | body { 12 | height: 100%; 13 | background: var(--main-bg-color); 14 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; 15 | color: var(--main-text-color); 16 | font-weight: 300; 17 | margin: 0; 18 | padding: 0; 19 | } 20 | h1 { 21 | font-weight: lighter; 22 | letter-spacing: 0.8; 23 | font-size: 3rem; 24 | color: var(--dark-text-color); 25 | margin: 0; 26 | } 27 | h1.headline { 28 | margin-top: 20%; 29 | font-size: 5rem; 30 | } 31 | .text-center { 32 | text-align: center; 33 | } 34 | p.lead { 35 | font-size: 1.6rem; 36 | } 37 | .container { 38 | max-width: 75rem; 39 | margin: 0 auto; 40 | padding: 1rem; 41 | } 42 | .header { 43 | background: var(--light-bg-color); 44 | color: var(--dark-text-color); 45 | } 46 | .header .container { 47 | padding: 1rem 1.75rem 1.75rem 1.75rem; 48 | } 49 | .header h1 { 50 | font-size: 2.5rem; 51 | font-weight: 500; 52 | } 53 | .header p { 54 | font-size: 1.2rem; 55 | margin: 0; 56 | line-height: 2.5; 57 | } 58 | .header a { 59 | color: var(--brand-primary-color); 60 | margin-left: 2rem; 61 | display: none; 62 | text-decoration: none; 63 | } 64 | .header:hover a { 65 | display: inline; 66 | } 67 | 68 | .footer { 69 | background: var(--dark-bg-color); 70 | color: var(--light-text-color); 71 | } 72 | .footer .container { 73 | border-top: 1px solid #e7e7e7; 74 | margin-top: 1rem; 75 | text-align: center; 76 | } 77 | 78 | .source { 79 | background: #343434; 80 | color: var(--light-text-color); 81 | padding: 0.5em 1em; 82 | border-radius: 5px; 83 | font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 84 | font-size: 0.85rem; 85 | margin: 0; 86 | overflow-x: scroll; 87 | } 88 | .source span.line { 89 | line-height: 1.4; 90 | } 91 | .source span.line .number { 92 | color: #666; 93 | } 94 | .source .line .highlight { 95 | display: block; 96 | background: var(--dark-text-color); 97 | color: var(--light-text-color); 98 | } 99 | .source span.highlight .number { 100 | color: #fff; 101 | } 102 | 103 | .tabs { 104 | list-style: none; 105 | list-style-position: inside; 106 | margin: 0; 107 | padding: 0; 108 | margin-bottom: -1px; 109 | } 110 | .tabs li { 111 | display: inline; 112 | } 113 | .tabs a:link, 114 | .tabs a:visited { 115 | padding: 0rem 1rem; 116 | line-height: 2.7; 117 | text-decoration: none; 118 | color: var(--dark-text-color); 119 | background: var(--light-bg-color); 120 | border: 1px solid rgba(0,0,0,0.15); 121 | border-bottom: 0; 122 | border-top-left-radius: 5px; 123 | border-top-right-radius: 5px; 124 | display: inline-block; 125 | } 126 | .tabs a:hover { 127 | background: var(--light-bg-color); 128 | border-color: rgba(0,0,0,0.15); 129 | } 130 | .tabs a.active { 131 | background: var(--main-bg-color); 132 | color: var(--main-text-color); 133 | } 134 | .tab-content { 135 | background: var(--main-bg-color); 136 | border: 1px solid rgba(0,0,0,0.15); 137 | } 138 | .content { 139 | padding: 1rem; 140 | } 141 | .hide { 142 | display: none; 143 | } 144 | 145 | .alert { 146 | margin-top: 2rem; 147 | display: block; 148 | text-align: center; 149 | line-height: 3.0; 150 | background: #d9edf7; 151 | border: 1px solid #bcdff1; 152 | border-radius: 5px; 153 | color: #31708f; 154 | } 155 | ul, ol { 156 | line-height: 1.8; 157 | } 158 | 159 | table { 160 | width: 100%; 161 | overflow: hidden; 162 | } 163 | th { 164 | text-align: left; 165 | border-bottom: 1px solid #e7e7e7; 166 | padding-bottom: 0.5rem; 167 | } 168 | td { 169 | padding: 0.2rem 0.5rem 0.2rem 0; 170 | } 171 | tr:hover td { 172 | background: #f1f1f1; 173 | } 174 | td pre { 175 | white-space: pre-wrap; 176 | } 177 | 178 | .trace a { 179 | color: inherit; 180 | } 181 | .trace table { 182 | width: auto; 183 | } 184 | .trace tr td:first-child { 185 | min-width: 5em; 186 | font-weight: bold; 187 | } 188 | .trace td { 189 | background: var(--light-bg-color); 190 | padding: 0 1rem; 191 | } 192 | .trace td pre { 193 | margin: 0; 194 | } 195 | .args { 196 | display: none; 197 | } 198 | -------------------------------------------------------------------------------- /app/Config/ContentSecurityPolicy.php: -------------------------------------------------------------------------------- 1 | ` element. 75 | * 76 | * Will default to self if not overridden 77 | * 78 | * @var string|string[]|null 79 | */ 80 | public $baseURI; 81 | 82 | /** 83 | * Lists the URLs for workers and embedded frame contents 84 | * 85 | * @var string|string[] 86 | */ 87 | public $childSrc = 'self'; 88 | 89 | /** 90 | * Limits the origins that you can connect to (via XHR, 91 | * WebSockets, and EventSource). 92 | * 93 | * @var string|string[] 94 | */ 95 | public $connectSrc = 'self'; 96 | 97 | /** 98 | * Specifies the origins that can serve web fonts. 99 | * 100 | * @var string|string[] 101 | */ 102 | public $fontSrc; 103 | 104 | /** 105 | * Lists valid endpoints for submission from `
` tags. 106 | * 107 | * @var string|string[] 108 | */ 109 | public $formAction = 'self'; 110 | 111 | /** 112 | * Specifies the sources that can embed the current page. 113 | * This directive applies to ``, `