add silaras to git repo

This commit is contained in:
ryan
2026-05-13 08:55:17 +07:00
commit 780f120c77
123 changed files with 11777 additions and 0 deletions

No files matched your search

+8
View File
@@ -0,0 +1,8 @@
.git
.gitignore
writable/cache/*
writable/logs/*
writable/session/*
writable/debugbar/*
node_modules
.DS_Store
+126
View File
@@ -0,0 +1,126 @@
#-------------------------
# Operating Specific Junk Files
#-------------------------
# 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
#-------------------------
/writable/cache/*
!/writable/cache/index.html
/writable/logs/*
!/writable/logs/index.html
/writable/session/*
!/writable/session/index.html
/writable/uploads/*
!/writable/uploads/index.html
/writable/debugbar/*
!/writable/debugbar/index.html
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
+34
View File
@@ -0,0 +1,34 @@
FROM php:8.3-apache
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
libicu-dev \
libzip-dev \
libonig-dev \
unzip \
git \
curl \
&& docker-php-ext-install \
intl \
mbstring \
mysqli \
pdo_mysql \
zip \
&& a2enmod rewrite headers \
&& rm -rf /var/lib/apt/lists/*
COPY docker/apache.conf /etc/apache2/sites-available/000-default.conf
COPY docker/entrypoint.sh /usr/local/bin/silaras-entrypoint
RUN chmod +x /usr/local/bin/silaras-entrypoint
WORKDIR /var/www/html
COPY . /var/www/html
RUN mkdir -p /var/www/html/writable/cache \
/var/www/html/writable/logs \
/var/www/html/writable/session \
/var/www/html/writable/uploads \
&& chown -R www-data:www-data /var/www/html/writable /var/www/html/public
ENTRYPOINT ["silaras-entrypoint"]
CMD ["apache2-foreground"]
+22
View File
@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2014-2019 British Columbia Institute of Technology
Copyright (c) 2019-present 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.
+69
View File
@@ -0,0 +1,69 @@
# CodeIgniter 4 Application Starter
## What is CodeIgniter?
CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
More information can be found at the [official site](https://codeigniter.com).
This repository holds a composer-installable app starter.
It has been built from the
[development repository](https://github.com/codeigniter4/CodeIgniter4).
More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
You can read the [user guide](https://codeigniter.com/user_guide/)
corresponding to the latest version of the framework.
## Installation & updates
`composer create-project codeigniter4/appstarter` then `composer update` whenever
there is a new release of the framework.
When updating, check the release notes to see if there are any changes you might need to apply
to your `app` folder. The affected files can be copied or merged from
`vendor/codeigniter4/framework/app`.
## Setup
Copy `env` to `.env` and tailor for your app, specifically the baseURL
and any database settings.
## Important Change with index.php
`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
for better security and separation of components.
This means that you should configure your web server to "point" to your project's *public* folder, and
not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
framework are exposed.
**Please** read the user guide for a better explanation of how CI4 works!
## Repository Management
We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
FEATURE REQUESTS.
This repository is a "distribution" one, built by our release preparation script.
Problems with it can be raised on our forum, or as issues in the main repository.
## Server Requirements
PHP version 8.2 or higher is required, with the following extensions installed:
- [intl](http://php.net/manual/en/intl.requirements.php)
- [mbstring](http://php.net/manual/en/mbstring.installation.php)
> [!WARNING]
> - The end of life date for PHP 7.4 was November 28, 2022.
> - The end of life date for PHP 8.0 was November 26, 2023.
> - The end of life date for PHP 8.1 was December 31, 2025.
> - If you are still using below PHP 8.2, you should upgrade immediately.
> - The end of life date for PHP 8.2 will be December 31, 2026.
Additionally, make sure that the following extensions are enabled in your PHP:
- json (enabled by default - don't turn it off)
- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
+302
View File
@@ -0,0 +1,302 @@
# Panduan Test SiLARAS 119 di Ubuntu 24.04
Arsip ini berisi aplikasi **SiLARAS 119** berbasis **CodeIgniter 4.7.2**. PHP minimal yang dibutuhkan adalah **PHP 8.2**. Untuk Ubuntu 24.04, PHP 8.3 sudah cocok.
## Ringkasan hasil pengecekan
- Framework: CodeIgniter 4.
- Web root yang benar: folder `public/`.
- Driver database: `MySQLi`.
- Database target yang diberikan:
- host: `10.10.123.199`
- port: `5017`
- user: `silaras_sys`
- database: `db_silaras`
- File SQL/migration production tidak ditemukan di arsip asli, sehingga mode Docker simulasi memakai schema minimal yang saya susun dari controller, model, dan view.
- Syntax PHP di folder `app/` dan `public/` sudah dicek dengan `php -l` dan tidak ditemukan error syntax.
> Catatan keamanan: jangan commit file `.env` berisi credential database ke repository publik.
---
# Opsi A — Jalankan dengan Docker Compose memakai database asli
Gunakan opsi ini jika komputer Ubuntu 24.04 berada di jaringan/VPN yang bisa mengakses database `10.10.123.199:5017`.
## 1. Install Docker
```bash
sudo apt update
sudo apt install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo usermod -aG docker $USER
newgrp docker
```
Cek instalasi:
```bash
docker --version
docker compose version
```
## 2. Masuk ke folder project
Jika masih berbentuk RAR:
```bash
sudo apt install -y unrar
mkdir -p ~/apps/silaras119
unrar x silaras119.rar ~/apps/silaras119/
cd ~/apps/silaras119/silaras119
```
Jika sudah memakai folder hasil ekstrak dari paket ini:
```bash
cd silaras119
```
## 3. Jalankan aplikasi
```bash
docker compose up -d --build
```
Buka browser:
```text
http://localhost:8080
```
Lihat log jika ada error:
```bash
docker compose logs -f app
```
Cek koneksi dari dalam container ke database asli:
```bash
docker compose exec app php -r '$m=new mysqli("10.10.123.199","silaras_sys","119-silaras","db_silaras",5017); echo $m->connect_error ? $m->connect_error.PHP_EOL : "DB OK\n";'
```
Jika hasilnya `DB OK`, koneksi database sudah berhasil.
---
# Opsi B — Jalankan simulasi lokal dengan MariaDB dummy
Gunakan opsi ini untuk mencoba UI dan flow aplikasi tanpa konek ke database asli.
## 1. Jalankan mode simulasi
```bash
docker compose -f docker-compose.simulasi.yml up -d --build
```
Buka:
```text
http://localhost:8080
```
Akun simulasi:
| Username | Password | Role |
|---|---|---|
| `admin119` | `119admin` | admin |
| `leader119` | `119mako` | leader |
| `perawat119` | `nurse119` | perawat |
| `driver119` | `olo119` | driver |
## 2. Jalankan smoke test sederhana
```bash
bash docker/smoke-test.sh
```
## 3. Reset database simulasi dari awal
```bash
docker compose -f docker-compose.simulasi.yml down -v
docker compose -f docker-compose.simulasi.yml up -d --build
```
## 4. Akses database simulasi dari host
Database simulasi dibuka ke host pada port `3307`.
```bash
mysql -h 127.0.0.1 -P 3307 -u silaras_sys -p db_silaras
```
Password:
```text
119-silaras
```
---
# Opsi C — Jalankan native langsung di Ubuntu 24.04 tanpa Docker
## 1. Install dependency PHP
```bash
sudo apt update
sudo apt install -y php php-cli php-mysql php-mbstring php-intl php-curl php-xml php-zip unzip curl composer netcat-openbsd
```
Cek versi dan ekstensi penting:
```bash
php -v
php -m | grep -E 'mysqli|mbstring|intl|curl|xml|zip'
```
## 2. Edit file `.env`
Pastikan bagian database menjadi seperti ini:
```ini
CI_ENVIRONMENT = development
app.baseURL = 'http://localhost:8080/'
database.default.hostname = 10.10.123.199
database.default.database = db_silaras
database.default.username = silaras_sys
database.default.password = 119-silaras
database.default.DBDriver = MySQLi
database.default.port = 5017
encryption.key = silaras119-local-dev-key-change-me
```
## 3. Pastikan dependency vendor ada
Arsip ini sudah menyertakan folder `vendor/`. Jika folder `vendor/` hilang, jalankan:
```bash
composer install
```
## 4. Set permission writable
```bash
chmod -R 775 writable
```
## 5. Test koneksi database
```bash
nc -vz 10.10.123.199 5017
php -r '$m=new mysqli("10.10.123.199","silaras_sys","119-silaras","db_silaras",5017); echo $m->connect_error ? $m->connect_error.PHP_EOL : "DB OK\n";'
```
## 6. Jalankan development server
```bash
php spark serve --host 0.0.0.0 --port 8080
```
Buka:
```text
http://localhost:8080
```
---
# Alur uji manual yang disarankan
1. Buka `http://localhost:8080`.
2. Login.
3. Masuk ke menu **Data Pasien Aktif**.
4. Klik **Tambah Pasien Baru**.
5. Input data pasien/panggilan.
6. Simpan.
7. Pastikan pasien muncul pada halaman **Pasien Aktif**.
8. Klik fase **Pre Dispatch** untuk melihat detail.
9. Klik **Lanjut** untuk menggeser fase ambulans.
Untuk mode simulasi, data awal sudah tersedia sehingga setelah login seharusnya langsung ada data pasien aktif.
---
# Troubleshooting
## 1. Halaman 500 / Whoops
Cek log:
```bash
docker compose logs -f app
# atau untuk simulasi:
docker compose -f docker-compose.simulasi.yml logs -f app
```
Cek log CodeIgniter:
```bash
ls -lah writable/logs
cat writable/logs/log-*.php
```
## 2. Database asli tidak bisa diakses
Cek apakah host dan port terbuka dari komputer:
```bash
nc -vz 10.10.123.199 5017
```
Jika gagal, biasanya penyebabnya:
- belum tersambung VPN/jaringan internal,
- firewall menutup port `5017`,
- user database belum diberi akses dari IP komputer/container,
- host database hanya menerima koneksi dari server tertentu.
## 3. Login gagal
Aplikasi mengecek tabel `users` dan memverifikasi password dengan `password_verify()`. Untuk database asli, pastikan tabel `users` memiliki kolom:
```text
id, nama, username, password, role
```
Kolom `password` harus berisi hash dari `password_hash()`, bukan plain text.
## 4. Composer error karena versi PHP
Pastikan PHP minimal 8.2:
```bash
php -v
```
Ubuntu 24.04 umumnya memakai PHP 8.3 sehingga aman.
---
# File Docker yang ditambahkan
- `Dockerfile`
- `docker-compose.yml` — mode database asli
- `docker-compose.simulasi.yml` — mode MariaDB dummy lokal
- `docker/apache.conf`
- `docker/entrypoint.sh`
- `docker/mysql/init/001_schema_seed.sql`
- `docker/smoke-test.sh`
+6
View File
@@ -0,0 +1,6 @@
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
+15
View File
@@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter.com/user_guide/extending/common.html
*/
+202
View File
@@ -0,0 +1,202 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class App extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Base Site URL
* --------------------------------------------------------------------------
*
* URL to your CodeIgniter root. Typically, this will be your base URL,
* WITH a trailing slash:
*
* E.g., http://example.com/
*/
public string $baseURL = 'http://localhost:8080/';
/**
* Allowed Hostnames in the Site URL other than the hostname in the baseURL.
* If you want to accept multiple Hostnames, set this.
*
* E.g.,
* When your site URL ($baseURL) is 'http://example.com/', and your site
* also accepts 'http://media.example.com/' and 'http://accounts.example.com/':
* ['media.example.com', 'accounts.example.com']
*
* @var list<string>
*/
public array $allowedHostnames = [];
/**
* --------------------------------------------------------------------------
* Index File
* --------------------------------------------------------------------------
*
* Typically, this will be your `index.php` file, unless you've renamed it to
* something else. If you have configured your web server to remove this file
* from your site URIs, set this variable to an empty string.
*/
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';
/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.
|
| By default, only these are allowed: `a-z 0-9~%.:_-`
|
| Set an empty string to allow all characters -- but only if you are insane.
|
| The configured value is actually a regular expression character group
| and it will be used as: '/\A[<permittedURIChars>]+\z/iu'
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
public string $permittedURIChars = 'a-z 0-9~%.:_\-';
/**
* --------------------------------------------------------------------------
* 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 list<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 = 'UTC';
/**
* --------------------------------------------------------------------------
* 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 (HSTS) 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<string, string>
*/
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;
}
+92
View File
@@ -0,0 +1,92 @@
<?php
namespace Config;
use CodeIgniter\Config\AutoloadConfig;
/**
* -------------------------------------------------------------------
* AUTOLOADER CONFIGURATION
* -------------------------------------------------------------------
*
* This file defines the namespaces and class maps so the Autoloader
* can find the files as needed.
*
* NOTE: If you use an identical key in $psr4 or $classmap, then
* the values in this file will overwrite the framework's values.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Autoload extends AutoloadConfig
{
/**
* -------------------------------------------------------------------
* Namespaces
* -------------------------------------------------------------------
* This maps the locations of any namespaces in your application to
* their location on the file system. These are used by the autoloader
* to locate files the first time they have been instantiated.
*
* The 'Config' (APPPATH . 'Config') and 'CodeIgniter' (SYSTEMPATH) are
* already mapped for you.
*
* You may change the name of the 'App' namespace if you wish,
* but this should be done prior to creating any namespaced classes,
* else you will need to modify all of those classes for this to work.
*
* @var array<string, list<string>|string>
*/
public $psr4 = [
APP_NAMESPACE => APPPATH,
];
/**
* -------------------------------------------------------------------
* 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<string, string>
*/
public $classmap = [];
/**
* -------------------------------------------------------------------
* 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 list<string>
*/
public $files = [];
/**
* -------------------------------------------------------------------
* Helpers
* -------------------------------------------------------------------
* Prototype:
* $helpers = [
* 'form',
* ];
*
* @var list<string>
*/
public $helpers = [];
}
+34
View File
@@ -0,0 +1,34 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. This will control whether Kint is loaded, and a few other
| items. It can always be used within your own application too.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);
+25
View File
@@ -0,0 +1,25 @@
<?php
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| Don't show ANY in production environments. Instead, let the system catch
| it and display a generic error message.
|
| If you set 'display_errors' to '1', CI4's detailed error report will show.
*/
error_reporting(E_ALL & ~E_DEPRECATED);
// If you want to suppress more types of errors.
// error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
ini_set('display_errors', '0');
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', false);
+38
View File
@@ -0,0 +1,38 @@
<?php
/*
* The environment testing is reserved for PHPUnit testing. It has special
* conditions built into the framework at various places to assist with that.
* You cant use it for your development.
*/
/*
|--------------------------------------------------------------------------
| ERROR DISPLAY
|--------------------------------------------------------------------------
| In development, we want to show as many errors as possible to help
| make sure they don't make it to production. And save us hours of
| painful debugging.
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
/*
|--------------------------------------------------------------------------
| DEBUG BACKTRACES
|--------------------------------------------------------------------------
| If true, this constant will tell the error screens to display debug
| backtraces along with the other error information. If you would
| prefer to not see this, set this value to false.
*/
defined('SHOW_DEBUG_BACKTRACE') || define('SHOW_DEBUG_BACKTRACE', true);
/*
|--------------------------------------------------------------------------
| DEBUG MODE
|--------------------------------------------------------------------------
| Debug mode is an experimental flag that can allow changes throughout
| the system. It's not widely used currently, and may not survive
| release of the framework.
*/
defined('CI_DEBUG') || define('CI_DEBUG', true);
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class CURLRequest extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CURLRequest Share Connection Options
* --------------------------------------------------------------------------
*
* Share connection options between requests.
*
* @var list<int>
*
* @see https://www.php.net/manual/en/curl.constants.php#constant.curl-lock-data-connect
*/
public array $shareConnectionOptions = [
CURL_LOCK_DATA_CONNECT,
CURL_LOCK_DATA_DNS,
];
/**
* --------------------------------------------------------------------------
* CURLRequest Share Options
* --------------------------------------------------------------------------
*
* Whether share options between requests or not.
*
* If true, all the options won't be reset between requests.
* It may cause an error request with unnecessary headers.
*/
public bool $shareOptions = false;
}
+198
View File
@@ -0,0 +1,198 @@
<?php
namespace Config;
use CodeIgniter\Cache\CacheInterface;
use CodeIgniter\Cache\Handlers\ApcuHandler;
use CodeIgniter\Cache\Handlers\DummyHandler;
use CodeIgniter\Cache\Handlers\FileHandler;
use CodeIgniter\Cache\Handlers\MemcachedHandler;
use CodeIgniter\Cache\Handlers\PredisHandler;
use CodeIgniter\Cache\Handlers\RedisHandler;
use CodeIgniter\Cache\Handlers\WincacheHandler;
use CodeIgniter\Config\BaseConfig;
class Cache extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Primary Handler
* --------------------------------------------------------------------------
*
* The name of the preferred handler that should be used. If for some reason
* it is not available, the $backupHandler will be used in its place.
*/
public string $handler = 'file';
/**
* --------------------------------------------------------------------------
* Backup Handler
* --------------------------------------------------------------------------
*
* The name of the handler that will be used in case the first one is
* unreachable. Often, 'file' is used here since the filesystem is
* always available, though that's not always practical for the app.
*/
public string $backupHandler = 'dummy';
/**
* --------------------------------------------------------------------------
* Key Prefix
* --------------------------------------------------------------------------
*
* This string is added to all cache item names to help avoid collisions
* if you run multiple applications with the same cache engine.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Default TTL
* --------------------------------------------------------------------------
*
* The default number of seconds to save items when none is specified.
*
* WARNING: This is not used by framework handlers where 60 seconds is
* hard-coded, but may be useful to projects and modules. This will replace
* the hard-coded value in a future release.
*/
public int $ttl = 60;
/**
* --------------------------------------------------------------------------
* Reserved Characters
* --------------------------------------------------------------------------
*
* A string of reserved characters that will not be allowed in keys or tags.
* Strings that violate this restriction will cause handlers to throw.
* Default: {}()/\@:
*
* NOTE: The default set is required for PSR-6 compliance.
*/
public string $reservedCharacters = '{}()/\@:';
/**
* --------------------------------------------------------------------------
* File settings
* --------------------------------------------------------------------------
*
* Your file storage preferences can be specified below, if you are using
* the File driver.
*
* @var array{storePath?: string, mode?: int}
*/
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{host?: string, port?: int, weight?: int, raw?: bool}
*/
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{
* host?: string,
* password?: string|null,
* port?: int,
* timeout?: int,
* async?: bool,
* persistent?: bool,
* database?: int
* }
*/
public array $redis = [
'host' => '127.0.0.1',
'password' => null,
'port' => 6379,
'timeout' => 0,
'async' => false, // specific to Predis and ignored by the native Redis extension
'persistent' => false,
'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<string, class-string<CacheInterface>>
*/
public array $validHandlers = [
'apcu' => ApcuHandler::class,
'dummy' => DummyHandler::class,
'file' => FileHandler::class,
'memcached' => MemcachedHandler::class,
'predis' => PredisHandler::class,
'redis' => RedisHandler::class,
'wincache' => WincacheHandler::class,
];
/**
* --------------------------------------------------------------------------
* Web Page Caching: Cache Include Query String
* --------------------------------------------------------------------------
*
* Whether to take the URL query string into consideration when generating
* output cache files. Valid options are:
*
* false = Disabled
* true = Enabled, take all query parameters into account.
* Please be aware that this may result in numerous cache
* files generated for the same page over and over again.
* ['q'] = Enabled, but only take into account the specified list
* of query parameters.
*
* @var bool|list<string>
*/
public $cacheQueryString = false;
/**
* --------------------------------------------------------------------------
* Web Page Caching: Cache Status Codes
* --------------------------------------------------------------------------
*
* HTTP status codes that are allowed to be cached. Only responses with
* these status codes will be cached by the PageCache filter.
*
* Default: [] - Cache all status codes (backward compatible)
*
* Recommended: [200] - Only cache successful responses
*
* You can also use status codes like:
* [200, 404, 410] - Cache successful responses and specific error codes
* [200, 201, 202, 203, 204] - All 2xx successful responses
*
* WARNING: Using [] may cache temporary error pages (404, 500, etc).
* Consider restricting to [200] for production applications to avoid
* caching errors that should be temporary.
*
* @var list<int>
*/
public array $cacheStatusCodes = [];
}
+79
View File
@@ -0,0 +1,79 @@
<?php
/*
| --------------------------------------------------------------------
| App Namespace
| --------------------------------------------------------------------
|
| This defines the default Namespace that is used throughout
| CodeIgniter to refer to the Application directory. Change
| this constant to change the namespace that all application
| classes should use.
|
| NOTE: changing this will require manually modifying the
| existing namespaces of App\* namespaced-classes.
*/
defined('APP_NAMESPACE') || define('APP_NAMESPACE', 'App');
/*
| --------------------------------------------------------------------------
| Composer Path
| --------------------------------------------------------------------------
|
| The path that Composer's autoload file is expected to live. By default,
| the vendor folder is in the Root directory, but you can customize that here.
*/
defined('COMPOSER_PATH') || define('COMPOSER_PATH', ROOTPATH . 'vendor/autoload.php');
/*
|--------------------------------------------------------------------------
| Timing Constants
|--------------------------------------------------------------------------
|
| Provide simple ways to work with the myriad of PHP functions that
| require information to be in seconds.
*/
defined('SECOND') || define('SECOND', 1);
defined('MINUTE') || define('MINUTE', 60);
defined('HOUR') || define('HOUR', 3600);
defined('DAY') || define('DAY', 86400);
defined('WEEK') || define('WEEK', 604800);
defined('MONTH') || define('MONTH', 2_592_000);
defined('YEAR') || define('YEAR', 31_536_000);
defined('DECADE') || define('DECADE', 315_360_000);
/*
| --------------------------------------------------------------------------
| Exit Status Codes
| --------------------------------------------------------------------------
|
| Used to indicate the conditions under which the script is exit()ing.
| While there is no universal standard for error codes, there are some
| broad conventions. Three such conventions are mentioned below, for
| those who wish to make use of them. The CodeIgniter defaults were
| chosen for the least overlap with these conventions, while still
| leaving room for others to be defined in future versions and user
| applications.
|
| The three main conventions used for determining exit status codes
| are as follows:
|
| Standard C/C++ Library (stdlibc):
| http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
| (This link also contains other GNU-specific conventions)
| BSD sysexits.h:
| http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
| Bash scripting:
| http://tldp.org/LDP/abs/html/exitcodes.html
|
*/
defined('EXIT_SUCCESS') || define('EXIT_SUCCESS', 0); // no errors
defined('EXIT_ERROR') || define('EXIT_ERROR', 1); // generic error
defined('EXIT_CONFIG') || define('EXIT_CONFIG', 3); // configuration error
defined('EXIT_UNKNOWN_FILE') || define('EXIT_UNKNOWN_FILE', 4); // file not found
defined('EXIT_UNKNOWN_CLASS') || define('EXIT_UNKNOWN_CLASS', 5); // unknown class
defined('EXIT_UNKNOWN_METHOD') || define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
defined('EXIT_USER_INPUT') || define('EXIT_USER_INPUT', 7); // invalid user input
defined('EXIT_DATABASE') || define('EXIT_DATABASE', 8); // database error
defined('EXIT__AUTO_MIN') || define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
defined('EXIT__AUTO_MAX') || define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
+216
View File
@@ -0,0 +1,216 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Stores the default settings for the ContentSecurityPolicy, if you
* choose to use it. The values here will be read in and set as defaults
* for the site. If needed, they can be overridden on a page-by-page basis.
*
* Suggested reference for explanations:
*
* @see https://www.html5rocks.com/en/tutorials/security/content-security-policy/
*/
class ContentSecurityPolicy extends BaseConfig
{
// -------------------------------------------------------------------------
// Broadbrush CSP management
// -------------------------------------------------------------------------
/**
* Default CSP report context
*/
public bool $reportOnly = false;
/**
* Specifies a URL where a browser will send reports
* when a content security policy is violated.
*/
public ?string $reportURI = null;
/**
* Specifies a reporting endpoint to which violation reports ought to be sent.
*/
public ?string $reportTo = null;
/**
* Instructs user agents to rewrite URL schemes, changing
* HTTP to HTTPS. This directive is for websites with
* large numbers of old URLs that need to be rewritten.
*/
public bool $upgradeInsecureRequests = false;
// -------------------------------------------------------------------------
// CSP DIRECTIVES SETTINGS
// NOTE: once you set a policy to 'none', it cannot be further restricted
// -------------------------------------------------------------------------
/**
* Will default to `'self'` if not overridden
*
* @var list<string>|string|null
*/
public $defaultSrc;
/**
* Lists allowed scripts' URLs.
*
* @var list<string>|string
*/
public $scriptSrc = 'self';
/**
* Specifies valid sources for JavaScript <script> elements.
*
* @var list<string>|string
*/
public array|string $scriptSrcElem = 'self';
/**
* Specifies valid sources for JavaScript inline event
* handlers and JavaScript URLs.
*
* @var list<string>|string
*/
public array|string $scriptSrcAttr = 'self';
/**
* Lists allowed stylesheets' URLs.
*
* @var list<string>|string
*/
public $styleSrc = 'self';
/**
* Specifies valid sources for stylesheets <link> elements.
*
* @var list<string>|string
*/
public array|string $styleSrcElem = 'self';
/**
* Specifies valid sources for stylesheets inline
* style attributes and `<style>` elements.
*
* @var list<string>|string
*/
public array|string $styleSrcAttr = 'self';
/**
* Defines the origins from which images can be loaded.
*
* @var list<string>|string
*/
public $imageSrc = 'self';
/**
* Restricts the URLs that can appear in a page's `<base>` element.
*
* Will default to self if not overridden
*
* @var list<string>|string|null
*/
public $baseURI;
/**
* Lists the URLs for workers and embedded frame contents
*
* @var list<string>|string
*/
public $childSrc = 'self';
/**
* Limits the origins that you can connect to (via XHR,
* WebSockets, and EventSource).
*
* @var list<string>|string
*/
public $connectSrc = 'self';
/**
* Specifies the origins that can serve web fonts.
*
* @var list<string>|string
*/
public $fontSrc;
/**
* Lists valid endpoints for submission from `<form>` tags.
*
* @var list<string>|string
*/
public $formAction = 'self';
/**
* Specifies the sources that can embed the current page.
* This directive applies to `<frame>`, `<iframe>`, `<embed>`,
* and `<applet>` tags. This directive can't be used in
* `<meta>` tags and applies only to non-HTML resources.
*
* @var list<string>|string|null
*/
public $frameAncestors;
/**
* The frame-src directive restricts the URLs which may
* be loaded into nested browsing contexts.
*
* @var list<string>|string|null
*/
public $frameSrc;
/**
* Restricts the origins allowed to deliver video and audio.
*
* @var list<string>|string|null
*/
public $mediaSrc;
/**
* Allows control over Flash and other plugins.
*
* @var list<string>|string
*/
public $objectSrc = 'self';
/**
* @var list<string>|string|null
*/
public $manifestSrc;
/**
* @var list<string>|string
*/
public array|string $workerSrc = [];
/**
* Limits the kinds of plugins a page may invoke.
*
* @var list<string>|string|null
*/
public $pluginTypes;
/**
* List of actions allowed.
*
* @var list<string>|string|null
*/
public $sandbox;
/**
* Nonce placeholder for style tags.
*/
public string $styleNonceTag = '{csp-style-nonce}';
/**
* Nonce placeholder for script tags.
*/
public string $scriptNonceTag = '{csp-script-nonce}';
/**
* Replace nonce tag automatically?
*/
public bool $autoNonce = true;
}
+107
View File
@@ -0,0 +1,107 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use DateTimeInterface;
class Cookie extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Cookie Prefix
* --------------------------------------------------------------------------
*
* Set a cookie name prefix if you need to avoid collisions.
*/
public string $prefix = '';
/**
* --------------------------------------------------------------------------
* Cookie Expires Timestamp
* --------------------------------------------------------------------------
*
* Default expires timestamp for cookies. Setting this to `0` will mean the
* cookie will not have the `Expires` attribute and will behave as a session
* cookie.
*
* @var DateTimeInterface|int|string
*/
public $expires = 0;
/**
* --------------------------------------------------------------------------
* Cookie Path
* --------------------------------------------------------------------------
*
* Typically will be a forward slash.
*/
public string $path = '/';
/**
* --------------------------------------------------------------------------
* Cookie Domain
* --------------------------------------------------------------------------
*
* Set to `.your-domain.com` for site-wide cookies.
*/
public string $domain = '';
/**
* --------------------------------------------------------------------------
* Cookie Secure
* --------------------------------------------------------------------------
*
* Cookie will only be set if a secure HTTPS connection exists.
*/
public bool $secure = false;
/**
* --------------------------------------------------------------------------
* Cookie HTTPOnly
* --------------------------------------------------------------------------
*
* Cookie will only be accessible via HTTP(S) (no JavaScript).
*/
public bool $httponly = true;
/**
* --------------------------------------------------------------------------
* Cookie SameSite
* --------------------------------------------------------------------------
*
* Configure cookie SameSite setting. Allowed values are:
* - None
* - Lax
* - Strict
* - ''
*
* Alternatively, you can use the constant names:
* - `Cookie::SAMESITE_NONE`
* - `Cookie::SAMESITE_LAX`
* - `Cookie::SAMESITE_STRICT`
*
* Defaults to `Lax` for compatibility with modern browsers. Setting `''`
* (empty string) means default SameSite attribute set by browsers (`Lax`)
* will be set on cookies. If set to `None`, `$secure` must also be set.
*
* @var ''|'Lax'|'None'|'Strict'
*/
public string $samesite = 'Lax';
/**
* --------------------------------------------------------------------------
* Cookie Raw
* --------------------------------------------------------------------------
*
* This flag allows setting a "raw" cookie, i.e., its name and value are
* not URL encoded using `rawurlencode()`.
*
* If this is set to `true`, cookie names should be compliant of RFC 2616's
* list of allowed characters.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#attributes
* @see https://tools.ietf.org/html/rfc2616#section-2.2
*/
public bool $raw = false;
}
+105
View File
@@ -0,0 +1,105 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Cross-Origin Resource Sharing (CORS) Configuration
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
*/
class Cors extends BaseConfig
{
/**
* The default CORS configuration.
*
* @var array{
* allowedOrigins: list<string>,
* allowedOriginsPatterns: list<string>,
* supportsCredentials: bool,
* allowedHeaders: list<string>,
* exposedHeaders: list<string>,
* allowedMethods: list<string>,
* maxAge: int,
* }
*/
public array $default = [
/**
* Origins for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* E.g.:
* - ['http://localhost:8080']
* - ['https://www.example.com']
*/
'allowedOrigins' => [],
/**
* Origin regex patterns for the `Access-Control-Allow-Origin` header.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin
*
* NOTE: A pattern specified here is part of a regular expression. It will
* be actually `#\A<pattern>\z#`.
*
* E.g.:
* - ['https://\w+\.example\.com']
*/
'allowedOriginsPatterns' => [],
/**
* Weather to send the `Access-Control-Allow-Credentials` header.
*
* The Access-Control-Allow-Credentials response header tells browsers whether
* the server allows cross-origin HTTP requests to include credentials.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials
*/
'supportsCredentials' => false,
/**
* Set headers to allow.
*
* The Access-Control-Allow-Headers response header is used in response to
* a preflight request which includes the Access-Control-Request-Headers to
* indicate which HTTP headers can be used during the actual request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers
*/
'allowedHeaders' => [],
/**
* Set headers to expose.
*
* The Access-Control-Expose-Headers response header allows a server to
* indicate which response headers should be made available to scripts running
* in the browser, in response to a cross-origin request.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers
*/
'exposedHeaders' => [],
/**
* Set methods to allow.
*
* The Access-Control-Allow-Methods response header specifies one or more
* methods allowed when accessing a resource in response to a preflight
* request.
*
* E.g.:
* - ['GET', 'POST', 'PUT', 'DELETE']
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods
*/
'allowedMethods' => [],
/**
* Set how many seconds the results of a preflight request can be cached.
*
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Max-Age
*/
'maxAge' => 7200,
];
}
+204
View File
@@ -0,0 +1,204 @@
<?php
namespace Config;
use CodeIgniter\Database\Config;
/**
* Database Configuration
*/
class Database extends Config
{
/**
* The directory that holds the Migrations and Seeds directories.
*/
public string $filesPath = APPPATH . 'Database' . DIRECTORY_SEPARATOR;
/**
* Lets you choose which connection group to use if no other is specified.
*/
public string $defaultGroup = 'default';
/**
* The default database connection.
*
* @var array<string, mixed>
*/
public array $default = [
'DSN' => '',
'hostname' => 'localhost',
'username' => '',
'password' => '',
'database' => '',
'DBDriver' => 'MySQLi',
'DBPrefix' => '',
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8mb4',
'DBCollat' => 'utf8mb4_general_ci',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => false,
'failover' => [],
'port' => 3306,
'numberNative' => false,
'foundRows' => false,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
// /**
// * Sample database connection for SQLite3.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'database' => 'database.db',
// 'DBDriver' => 'SQLite3',
// 'DBPrefix' => '',
// 'DBDebug' => true,
// 'swapPre' => '',
// 'failover' => [],
// 'foreignKeys' => true,
// 'busyTimeout' => 1000,
// 'synchronous' => null,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for Postgre.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'public',
// 'DBDriver' => 'Postgre',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'failover' => [],
// 'port' => 5432,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for SQLSRV.
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => '',
// 'hostname' => 'localhost',
// 'username' => 'root',
// 'password' => 'root',
// 'database' => 'ci4',
// 'schema' => 'dbo',
// 'DBDriver' => 'SQLSRV',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'utf8',
// 'swapPre' => '',
// 'encrypt' => false,
// 'failover' => [],
// 'port' => 1433,
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
// /**
// * Sample database connection for OCI8.
// *
// * You may need the following environment variables:
// * NLS_LANG = 'AMERICAN_AMERICA.UTF8'
// * NLS_DATE_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// * NLS_TIMESTAMP_TZ_FORMAT = 'YYYY-MM-DD HH24:MI:SS'
// *
// * @var array<string, mixed>
// */
// public array $default = [
// 'DSN' => 'localhost:1521/XEPDB1',
// 'username' => 'root',
// 'password' => 'root',
// 'DBDriver' => 'OCI8',
// 'DBPrefix' => '',
// 'pConnect' => false,
// 'DBDebug' => true,
// 'charset' => 'AL32UTF8',
// 'swapPre' => '',
// 'failover' => [],
// 'dateFormat' => [
// 'date' => 'Y-m-d',
// 'datetime' => 'Y-m-d H:i:s',
// 'time' => 'H:i:s',
// ],
// ];
/**
* This database connection is used when running PHPUnit database tests.
*
* @var array<string, mixed>
*/
public array $tests = [
'DSN' => '',
'hostname' => '127.0.0.1',
'username' => '',
'password' => '',
'database' => ':memory:',
'DBDriver' => 'SQLite3',
'DBPrefix' => 'db_', // Needed to ensure we're working correctly with prefixes live. DO NOT REMOVE FOR CI DEVS
'pConnect' => false,
'DBDebug' => true,
'charset' => 'utf8',
'DBCollat' => '',
'swapPre' => '',
'encrypt' => false,
'compress' => false,
'strictOn' => true,
'failover' => [],
'port' => 3306,
'foreignKeys' => true,
'busyTimeout' => 1000,
'synchronous' => null,
'dateFormat' => [
'date' => 'Y-m-d',
'datetime' => 'Y-m-d H:i:s',
'time' => 'H:i:s',
],
];
public function __construct()
{
parent::__construct();
// Ensure that we always set the database group to 'tests' if
// we are currently running an automated test suite, so that
// we don't overwrite live data on accident.
if (ENVIRONMENT === 'testing') {
$this->defaultGroup = 'tests';
}
}
}
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace Config;
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}
+126
View File
@@ -0,0 +1,126 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Email extends BaseConfig
{
public string $fromEmail = '';
public string $fromName = '';
public string $recipients = '';
/**
* The "user agent"
*/
public string $userAgent = 'CodeIgniter';
/**
* The mail sending protocol: mail, sendmail, smtp
*/
public string $protocol = 'mail';
/**
* The server path to Sendmail.
*/
public string $mailPath = '/usr/sbin/sendmail';
/**
* SMTP Server Hostname
*/
public string $SMTPHost = '';
/**
* Which SMTP authentication method to use: login, plain
*/
public string $SMTPAuthMethod = 'login';
/**
* SMTP Username
*/
public string $SMTPUser = '';
/**
* SMTP Password
*/
public string $SMTPPass = '';
/**
* SMTP Port
*/
public int $SMTPPort = 25;
/**
* SMTP Timeout (in seconds)
*/
public int $SMTPTimeout = 5;
/**
* Enable persistent SMTP connections
*/
public bool $SMTPKeepAlive = false;
/**
* SMTP Encryption.
*
* @var string '', 'tls' or 'ssl'. 'tls' will issue a STARTTLS command
* to the server. 'ssl' means implicit SSL. Connection on port
* 465 should set this to ''.
*/
public string $SMTPCrypto = 'tls';
/**
* Enable word-wrap
*/
public bool $wordWrap = true;
/**
* Character count to wrap at
*/
public int $wrapChars = 76;
/**
* Type of mail, either 'text' or 'html'
*/
public string $mailType = 'text';
/**
* Character set (utf-8, iso-8859-1, etc.)
*/
public string $charset = 'UTF-8';
/**
* Whether to validate the email address
*/
public bool $validate = false;
/**
* Email Priority. 1 = highest. 5 = lowest. 3 = normal
*/
public int $priority = 3;
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $CRLF = "\r\n";
/**
* Newline character. (Use “\r\n” to comply with RFC 822)
*/
public string $newline = "\r\n";
/**
* Enable BCC Batch Mode.
*/
public bool $BCCBatchMode = false;
/**
* Number of emails in each BCC batch
*/
public int $BCCBatchSize = 200;
/**
* Enable notify message from server
*/
public bool $DSN = false;
}
+109
View File
@@ -0,0 +1,109 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Encryption configuration.
*
* These are the settings used for encryption, if you don't pass a parameter
* array to the encrypter for creation/initialization.
*/
class Encryption extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Encryption Key Starter
* --------------------------------------------------------------------------
*
* If you use the Encryption class you must set an encryption key (seed).
* You need to ensure it is long enough for the cipher and mode you plan to use.
* See the user guide for more info.
*/
public string $key = '';
/**
* --------------------------------------------------------------------------
* Previous Encryption Keys
* --------------------------------------------------------------------------
*
* When rotating encryption keys, add old keys here to maintain ability
* to decrypt data encrypted with previous keys. Encryption always uses
* the current $key. Decryption tries current key first, then falls back
* to previous keys if decryption fails.
*
* In .env file, use comma-separated string:
* encryption.previousKeys = hex2bin:9be8c64fcea509867...,hex2bin:3f5a1d8e9c2b7a4f6...
*
* @var list<string>|string
*/
public array|string $previousKeys = '';
/**
* --------------------------------------------------------------------------
* Encryption Driver to Use
* --------------------------------------------------------------------------
*
* One of the supported encryption drivers.
*
* Available drivers:
* - OpenSSL
* - Sodium
*/
public string $driver = 'OpenSSL';
/**
* --------------------------------------------------------------------------
* SodiumHandler's Padding Length in Bytes
* --------------------------------------------------------------------------
*
* This is the number of bytes that will be padded to the plaintext message
* before it is encrypted. This value should be greater than zero.
*
* See the user guide for more information on padding.
*/
public int $blockSize = 16;
/**
* --------------------------------------------------------------------------
* Encryption digest
* --------------------------------------------------------------------------
*
* HMAC digest to use, e.g. 'SHA512' or 'SHA256'. Default value is 'SHA512'.
*/
public string $digest = 'SHA512';
/**
* Whether the cipher-text should be raw. If set to false, then it will be base64 encoded.
* This setting is only used by OpenSSLHandler.
*
* Set to false for CI3 Encryption compatibility.
*/
public bool $rawData = true;
/**
* Encryption key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'encryption' for CI3 Encryption compatibility.
*/
public string $encryptKeyInfo = '';
/**
* Authentication key info.
* This setting is only used by OpenSSLHandler.
*
* Set to 'authentication' for CI3 Encryption compatibility.
*/
public string $authKeyInfo = '';
/**
* Cipher to use.
* This setting is only used by OpenSSLHandler.
*
* Set to 'AES-128-CBC' to decrypt encrypted data that encrypted
* by CI3 Encryption default configuration.
*/
public string $cipher = 'AES-256-CTR';
}
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace Config;
use CodeIgniter\Events\Events;
use CodeIgniter\Exceptions\FrameworkException;
use CodeIgniter\HotReloader\HotReloader;
/*
* --------------------------------------------------------------------
* Application Events
* --------------------------------------------------------------------
* Events allow you to tap into the execution of the program without
* modifying or extending core files. This file provides a central
* location to define your events, though they can always be added
* at run-time, also, if needed.
*
* You create code that can execute by subscribing to events with
* the 'on()' method. This accepts any form of callable, including
* Closures, that will be executed when the event is triggered.
*
* Example:
* Events::on('create', [$myInstance, 'myMethod']);
*/
Events::on('pre_system', static function (): void {
if (ENVIRONMENT !== 'testing') {
if (ini_get('zlib.output_compression')) {
throw FrameworkException::forEnabledZlibOutputCompression();
}
while (ob_get_level() > 0) {
ob_end_flush();
}
ob_start(static fn ($buffer) => $buffer);
}
/*
* --------------------------------------------------------------------
* Debug Toolbar Listeners.
* --------------------------------------------------------------------
* If you delete, they will no longer be collected.
*/
if (CI_DEBUG && ! is_cli()) {
Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
service('toolbar')->respond();
// Hot Reload route - for framework use on the hot reloader.
if (ENVIRONMENT === 'development') {
service('routes')->get('__hot-reload', static function (): void {
(new HotReloader())->run();
});
}
}
});
+106
View File
@@ -0,0 +1,106 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\ExceptionHandler;
use CodeIgniter\Debug\ExceptionHandlerInterface;
use Psr\Log\LogLevel;
use Throwable;
/**
* Setup how the exception handler works.
*/
class Exceptions extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* LOG EXCEPTIONS?
* --------------------------------------------------------------------------
* If true, then exceptions will be logged
* through Services::Log.
*
* Default: true
*/
public bool $log = true;
/**
* --------------------------------------------------------------------------
* DO NOT LOG STATUS CODES
* --------------------------------------------------------------------------
* Any status codes here will NOT be logged if logging is turned on.
* By default, only 404 (Page Not Found) exceptions are ignored.
*
* @var list<int>
*/
public array $ignoreCodes = [404];
/**
* --------------------------------------------------------------------------
* Error Views Path
* --------------------------------------------------------------------------
* This is the path to the directory that contains the 'cli' and 'html'
* directories that hold the views used to generate errors.
*
* Default: APPPATH.'Views/errors'
*/
public string $errorViewPath = APPPATH . 'Views/errors';
/**
* --------------------------------------------------------------------------
* HIDE FROM DEBUG TRACE
* --------------------------------------------------------------------------
* Any data that you would like to hide from the debug trace.
* In order to specify 2 levels, use "/" to separate.
* ex. ['server', 'setup/password', 'secret_token']
*
* @var list<string>
*/
public array $sensitiveDataInTrace = [];
/**
* --------------------------------------------------------------------------
* WHETHER TO THROW AN EXCEPTION ON DEPRECATED ERRORS
* --------------------------------------------------------------------------
* If set to `true`, DEPRECATED errors are only logged and no exceptions are
* thrown. This option also works for user deprecations.
*/
public bool $logDeprecations = true;
/**
* --------------------------------------------------------------------------
* LOG LEVEL THRESHOLD FOR DEPRECATIONS
* --------------------------------------------------------------------------
* If `$logDeprecations` is set to `true`, this sets the log level
* to which the deprecation will be logged. This should be one of the log
* levels recognized by PSR-3.
*
* The related `Config\Logger::$threshold` should be adjusted, if needed,
* to capture logging the deprecations.
*/
public string $deprecationLogLevel = LogLevel::WARNING;
/*
* DEFINE THE HANDLERS USED
* --------------------------------------------------------------------------
* Given the HTTP status code, returns exception handler that
* should be used to deal with this error. By default, it will run CodeIgniter's
* default handler and display the error information in the expected format
* for CLI, HTTP, or AJAX requests, as determined by is_cli() and the expected
* response format.
*
* Custom handlers can be returned if you want to handle one or more specific
* error codes yourself like:
*
* if (in_array($statusCode, [400, 404, 500])) {
* return new \App\Libraries\MyExceptionHandler();
* }
* if ($exception instanceOf PageNotFoundException) {
* return new \App\Libraries\MyExceptionHandler();
* }
*/
public function handler(int $statusCode, Throwable $exception): ExceptionHandlerInterface
{
return new ExceptionHandler($this);
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* Enable/disable backward compatibility breaking features.
*/
class Feature extends BaseConfig
{
/**
* Use improved new auto routing instead of the legacy version.
*/
public bool $autoRoutesImproved = true;
/**
* Use filter execution order in 4.4 or before.
*/
public bool $oldFilterOrder = false;
/**
* The behavior of `limit(0)` in Query Builder.
*
* If true, `limit(0)` returns all records. (the behavior of 4.4.x or before in version 4.x.)
* If false, `limit(0)` returns no records. (the behavior of 3.1.9 or later in version 3.x.)
*/
public bool $limitZeroAsAll = true;
/**
* Use strict location negotiation.
*
* By default, the locale is selected based on a loose comparison of the language code (ISO 639-1)
* Enabling strict comparison will also consider the region code (ISO 3166-1 alpha-2).
*/
public bool $strictLocaleNegotiation = false;
}
+110
View File
@@ -0,0 +1,110 @@
<?php
namespace Config;
use CodeIgniter\Config\Filters as BaseFilters;
use CodeIgniter\Filters\Cors;
use CodeIgniter\Filters\CSRF;
use CodeIgniter\Filters\DebugToolbar;
use CodeIgniter\Filters\ForceHTTPS;
use CodeIgniter\Filters\Honeypot;
use CodeIgniter\Filters\InvalidChars;
use CodeIgniter\Filters\PageCache;
use CodeIgniter\Filters\PerformanceMetrics;
use CodeIgniter\Filters\SecureHeaders;
class Filters extends BaseFilters
{
/**
* Configures aliases for Filter classes to
* make reading things nicer and simpler.
*
* @var array<string, class-string|list<class-string>>
*
* [filter_name => classname]
* or [filter_name => [classname1, classname2, ...]]
*/
public array $aliases = [
'csrf' => CSRF::class,
'toolbar' => DebugToolbar::class,
'honeypot' => Honeypot::class,
'invalidchars' => InvalidChars::class,
'secureheaders' => SecureHeaders::class,
'cors' => Cors::class,
'forcehttps' => ForceHTTPS::class,
'pagecache' => PageCache::class,
'performance' => PerformanceMetrics::class,
];
/**
* List of special required filters.
*
* The filters listed here are special. They are applied before and after
* other kinds of filters, and always applied even if a route does not exist.
*
* Filters set by default provide framework functionality. If removed,
* those functions will no longer work.
*
* @see https://codeigniter.com/user_guide/incoming/filters.html#provided-filters
*
* @var array{before: list<string>, after: list<string>}
*/
public array $required = [
'before' => [
'forcehttps', // Force Global Secure Requests
'pagecache', // Web Page Caching
],
'after' => [
'pagecache', // Web Page Caching
'performance', // Performance Metrics
'toolbar', // Debug Toolbar
],
];
/**
* List of filter aliases that are always
* applied before and after every request.
*
* @var array{
* before: array<string, array{except: list<string>|string}>|list<string>,
* after: array<string, array{except: list<string>|string}>|list<string>
* }
*/
public array $globals = [
'before' => [
// 'honeypot',
// 'csrf',
// 'invalidchars',
],
'after' => [
// 'honeypot',
// 'secureheaders',
],
];
/**
* List of filter aliases that works on a
* particular HTTP method (GET, POST, etc.).
*
* Example:
* 'POST' => ['foo', 'bar']
*
* If you use this, you should disable auto-routing because auto-routing
* permits any HTTP method to access a controller. Accessing the controller
* with a method you don't expect could bypass the filter.
*
* @var array<string, list<string>>
*/
public array $methods = [];
/**
* List of filter aliases that should run on any
* before or after URI patterns.
*
* Example:
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
*
* @var array<string, array<string, list<string>>>
*/
public array $filters = [];
}
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace Config;
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
/**
* @immutable
*/
class ForeignCharacters extends BaseForeignCharacters
{
}
+73
View File
@@ -0,0 +1,73 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Format\JSONFormatter;
use CodeIgniter\Format\XMLFormatter;
class Format extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Available Response Formats
* --------------------------------------------------------------------------
*
* When you perform content negotiation with the request, these are the
* available formats that your application supports. This is currently
* only used with the API\ResponseTrait. A valid Formatter must exist
* for the specified format.
*
* These formats are only checked when the data passed to the respond()
* method is an array.
*
* @var list<string>
*/
public array $supportedResponseFormats = [
'application/json',
'application/xml', // machine-readable XML
'text/xml', // human-readable XML
];
/**
* --------------------------------------------------------------------------
* Formatters
* --------------------------------------------------------------------------
*
* Lists the class to use to format responses with of a particular type.
* For each mime type, list the class that should be used. Formatters
* can be retrieved through the getFormatter() method.
*
* @var array<string, string>
*/
public array $formatters = [
'application/json' => JSONFormatter::class,
'application/xml' => XMLFormatter::class,
'text/xml' => XMLFormatter::class,
];
/**
* --------------------------------------------------------------------------
* Formatters Options
* --------------------------------------------------------------------------
*
* Additional Options to adjust default formatters behaviour.
* For each mime type, list the additional options that should be used.
*
* @var array<string, int>
*/
public array $formatterOptions = [
'application/json' => JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES,
'application/xml' => 0,
'text/xml' => 0,
];
/**
* --------------------------------------------------------------------------
* Maximum depth for JSON encoding.
* --------------------------------------------------------------------------
*
* This value determines how deep the JSON encoder will traverse nested structures.
*/
public int $jsonEncodeDepth = 512;
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Generators extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Generator Commands' Views
* --------------------------------------------------------------------------
*
* This array defines the mapping of generator commands to the view files
* they are using. If you need to customize them for your own, copy these
* view files in your own folder and indicate the location here.
*
* You will notice that the views have special placeholders enclosed in
* curly braces `{...}`. These placeholders are used internally by the
* generator commands in processing replacements, thus you are warned
* not to delete them or modify the names. If you will do so, you may
* end up disrupting the scaffolding process and throw errors.
*
* YOU HAVE BEEN WARNED!
*
* @var array<string, array<string, string>|string>
*/
public array $views = [
'make:cell' => [
'class' => 'CodeIgniter\Commands\Generators\Views\cell.tpl.php',
'view' => 'CodeIgniter\Commands\Generators\Views\cell_view.tpl.php',
],
'make:command' => 'CodeIgniter\Commands\Generators\Views\command.tpl.php',
'make:config' => 'CodeIgniter\Commands\Generators\Views\config.tpl.php',
'make:controller' => 'CodeIgniter\Commands\Generators\Views\controller.tpl.php',
'make:entity' => 'CodeIgniter\Commands\Generators\Views\entity.tpl.php',
'make:filter' => 'CodeIgniter\Commands\Generators\Views\filter.tpl.php',
'make:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
'make:model' => 'CodeIgniter\Commands\Generators\Views\model.tpl.php',
'make:seeder' => 'CodeIgniter\Commands\Generators\Views\seeder.tpl.php',
'make:validation' => 'CodeIgniter\Commands\Generators\Views\validation.tpl.php',
'session:migration' => 'CodeIgniter\Commands\Generators\Views\migration.tpl.php',
];
}
+42
View File
@@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace Config;
class Hostnames
{
// List of known two-part TLDs for subdomain extraction
public const TWO_PART_TLDS = [
'co.uk', 'org.uk', 'gov.uk', 'ac.uk', 'sch.uk', 'ltd.uk', 'plc.uk',
'com.au', 'net.au', 'org.au', 'edu.au', 'gov.au', 'asn.au', 'id.au',
'co.jp', 'ac.jp', 'go.jp', 'or.jp', 'ne.jp', 'gr.jp',
'co.nz', 'org.nz', 'govt.nz', 'ac.nz', 'net.nz', 'geek.nz', 'maori.nz', 'school.nz',
'co.in', 'net.in', 'org.in', 'ind.in', 'ac.in', 'gov.in', 'res.in',
'com.cn', 'net.cn', 'org.cn', 'gov.cn', 'edu.cn',
'com.sg', 'net.sg', 'org.sg', 'gov.sg', 'edu.sg', 'per.sg',
'co.za', 'org.za', 'gov.za', 'ac.za', 'net.za',
'co.kr', 'or.kr', 'go.kr', 'ac.kr', 'ne.kr', 'pe.kr',
'co.th', 'or.th', 'go.th', 'ac.th', 'net.th', 'in.th',
'com.my', 'net.my', 'org.my', 'edu.my', 'gov.my', 'mil.my', 'name.my',
'com.mx', 'org.mx', 'net.mx', 'edu.mx', 'gob.mx',
'com.br', 'net.br', 'org.br', 'gov.br', 'edu.br', 'art.br', 'eng.br',
'co.il', 'org.il', 'ac.il', 'gov.il', 'net.il', 'muni.il',
'co.id', 'or.id', 'ac.id', 'go.id', 'net.id', 'web.id', 'my.id',
'com.hk', 'edu.hk', 'gov.hk', 'idv.hk', 'net.hk', 'org.hk',
'com.tw', 'net.tw', 'org.tw', 'edu.tw', 'gov.tw', 'idv.tw',
'com.sa', 'net.sa', 'org.sa', 'gov.sa', 'edu.sa', 'sch.sa', 'med.sa',
'co.ae', 'net.ae', 'org.ae', 'gov.ae', 'ac.ae', 'sch.ae',
'com.tr', 'net.tr', 'org.tr', 'gov.tr', 'edu.tr', 'av.tr', 'gen.tr',
'co.ke', 'or.ke', 'go.ke', 'ac.ke', 'sc.ke', 'me.ke', 'mobi.ke', 'info.ke',
'com.ng', 'org.ng', 'gov.ng', 'edu.ng', 'net.ng', 'sch.ng', 'name.ng',
'com.pk', 'net.pk', 'org.pk', 'gov.pk', 'edu.pk', 'fam.pk',
'com.eg', 'edu.eg', 'gov.eg', 'org.eg', 'net.eg',
'com.cy', 'net.cy', 'org.cy', 'gov.cy', 'ac.cy',
'com.lk', 'org.lk', 'edu.lk', 'gov.lk', 'net.lk', 'int.lk',
'com.bd', 'net.bd', 'org.bd', 'ac.bd', 'gov.bd', 'mil.bd',
'com.ar', 'net.ar', 'org.ar', 'gov.ar', 'edu.ar', 'mil.ar',
'gob.cl', 'com.pl', 'net.pl', 'org.pl', 'gov.pl', 'edu.pl',
'co.ir', 'ac.ir', 'org.ir', 'id.ir', 'gov.ir', 'sch.ir', 'net.ir',
];
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Images\Handlers\GDHandler;
use CodeIgniter\Images\Handlers\ImageMagickHandler;
class Images extends BaseConfig
{
/**
* Default handler used if no other handler is specified.
*/
public string $defaultHandler = 'gd';
/**
* The path to the image library.
* Required for ImageMagick, GraphicsMagick, or NetPBM.
*
* @deprecated 4.7.0 No longer used.
*/
public string $libraryPath = '/usr/local/bin/convert';
/**
* The available handler classes.
*
* @var array<string, string>
*/
public array $handlers = [
'gd' => GDHandler::class,
'imagick' => ImageMagickHandler::class,
];
}
+63
View File
@@ -0,0 +1,63 @@
<?php
namespace Config;
use Kint\Parser\ConstructablePluginInterface;
use Kint\Renderer\Rich\TabPluginInterface;
use Kint\Renderer\Rich\ValuePluginInterface;
/**
* --------------------------------------------------------------------------
* Kint
* --------------------------------------------------------------------------
*
* We use Kint's `RichRenderer` and `CLIRenderer`. This area contains options
* that you can set to customize how Kint works for you.
*
* @see https://kint-php.github.io/kint/ for details on these settings.
*/
class Kint
{
/*
|--------------------------------------------------------------------------
| Global Settings
|--------------------------------------------------------------------------
*/
/**
* @var list<class-string<ConstructablePluginInterface>|ConstructablePluginInterface>|null
*/
public $plugins;
public int $maxDepth = 6;
public bool $displayCalledFrom = true;
public bool $expanded = false;
/*
|--------------------------------------------------------------------------
| RichRenderer Settings
|--------------------------------------------------------------------------
*/
public string $richTheme = 'aante-light.css';
public bool $richFolder = false;
/**
* @var array<string, class-string<ValuePluginInterface>>|null
*/
public $richObjectPlugins;
/**
* @var array<string, class-string<TabPluginInterface>>|null
*/
public $richTabPlugins;
/*
|--------------------------------------------------------------------------
| CLI Settings
|--------------------------------------------------------------------------
*/
public bool $cliColors = true;
public bool $cliForceUTF8 = false;
public bool $cliDetectWidth = true;
public int $cliMinWidth = 40;
}
+151
View File
@@ -0,0 +1,151 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Log\Handlers\FileHandler;
use CodeIgniter\Log\Handlers\HandlerInterface;
class Logger extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Error Logging Threshold
* --------------------------------------------------------------------------
*
* You can enable error logging by setting a threshold over zero. The
* threshold determines what gets logged. Any values below or equal to the
* threshold will be logged.
*
* Threshold options are:
*
* - 0 = Disables logging, Error logging TURNED OFF
* - 1 = Emergency Messages - System is unusable
* - 2 = Alert Messages - Action Must Be Taken Immediately
* - 3 = Critical Messages - Application component unavailable, unexpected exception.
* - 4 = Runtime Errors - Don't need immediate action, but should be monitored.
* - 5 = Warnings - Exceptional occurrences that are not errors.
* - 6 = Notices - Normal but significant events.
* - 7 = Info - Interesting events, like user logging in, etc.
* - 8 = Debug - Detailed debug information.
* - 9 = All Messages
*
* You can also pass an array with threshold levels to show individual error types
*
* array(1, 2, 3, 8) = Emergency, Alert, Critical, and Debug messages
*
* For a live site you'll usually enable Critical or higher (3) to be logged otherwise
* your log files will fill up very fast.
*
* @var int|list<int>
*/
public $threshold = (ENVIRONMENT === 'production') ? 4 : 9;
/**
* --------------------------------------------------------------------------
* Date Format for Logs
* --------------------------------------------------------------------------
*
* Each item that is logged has an associated date. You can use PHP date
* codes to set your own date formatting
*/
public string $dateFormat = 'Y-m-d H:i:s';
/**
* --------------------------------------------------------------------------
* Log Handlers
* --------------------------------------------------------------------------
*
* The logging system supports multiple actions to be taken when something
* is logged. This is done by allowing for multiple Handlers, special classes
* designed to write the log to their chosen destinations, whether that is
* a file on the getServer, a cloud-based service, or even taking actions such
* as emailing the dev team.
*
* Each handler is defined by the class name used for that handler, and it
* MUST implement the `CodeIgniter\Log\Handlers\HandlerInterface` interface.
*
* The value of each key is an array of configuration items that are sent
* to the constructor of each handler. The only required configuration item
* is the 'handles' element, which must be an array of integer log levels.
* This is most easily handled by using the constants defined in the
* `Psr\Log\LogLevel` class.
*
* Handlers are executed in the order defined in this array, starting with
* the handler on top and continuing down.
*
* @var array<class-string<HandlerInterface>, array<string, int|list<string>|string>>
*/
public array $handlers = [
/*
* --------------------------------------------------------------------
* File Handler
* --------------------------------------------------------------------
*/
FileHandler::class => [
// The log levels that this handler will handle.
'handles' => [
'critical',
'alert',
'emergency',
'debug',
'error',
'info',
'notice',
'warning',
],
/*
* The default filename extension for log files.
* An extension of 'php' allows for protecting the log files via basic
* scripting, when they are to be stored under a publicly accessible directory.
*
* NOTE: Leaving it blank will default to 'log'.
*/
'fileExtension' => '',
/*
* The file system permissions to be applied on newly created log files.
*
* IMPORTANT: This MUST be an integer (no quotes) and you MUST use octal
* integer notation (i.e. 0700, 0644, etc.)
*/
'filePermissions' => 0644,
/*
* Logging Directory Path
*
* By default, logs are written to WRITEPATH . 'logs/'
* Specify a different destination here, if desired.
*/
'path' => '',
],
/*
* The ChromeLoggerHandler requires the use of the Chrome web browser
* and the ChromeLogger extension. Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ChromeLoggerHandler' => [
// /*
// * The log levels that this handler will handle.
// */
// 'handles' => ['critical', 'alert', 'emergency', 'debug',
// 'error', 'info', 'notice', 'warning'],
// ],
/*
* The ErrorlogHandler writes the logs to PHP's native `error_log()` function.
* Uncomment this block to use it.
*/
// 'CodeIgniter\Log\Handlers\ErrorlogHandler' => [
// /* The log levels this handler can handle. */
// 'handles' => ['critical', 'alert', 'emergency', 'debug', 'error', 'info', 'notice', 'warning'],
//
// /*
// * The message type where the error should go. Can be 0 or 4, or use the
// * class constants: `ErrorlogHandler::TYPE_OS` (0) or `ErrorlogHandler::TYPE_SAPI` (4)
// */
// 'messageType' => 0,
// ],
];
}
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Migrations extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Enable/Disable Migrations
* --------------------------------------------------------------------------
*
* Migrations are enabled by default.
*
* You should enable migrations whenever you intend to do a schema migration
* and disable it back when you're done.
*/
public bool $enabled = true;
/**
* --------------------------------------------------------------------------
* Migrations Table
* --------------------------------------------------------------------------
*
* This is the name of the table that will store the current migrations state.
* When migrations runs it will store in a database table which migration
* files have already been run.
*/
public string $table = 'migrations';
/**
* --------------------------------------------------------------------------
* Timestamp Format
* --------------------------------------------------------------------------
*
* This is the format that will be used when creating new migrations
* using the CLI command:
* > php spark make:migration
*
* NOTE: if you set an unsupported format, migration runner will not find
* your migration files.
*
* Supported formats:
* - YmdHis_
* - Y-m-d-His_
* - Y_m_d_His_
*/
public string $timestampFormat = 'Y-m-d-His_';
/**
* --------------------------------------------------------------------------
* Enable/Disable Migration Lock
* --------------------------------------------------------------------------
*
* Locking is disabled by default.
*
* When enabled, it will prevent multiple migration processes
* from running at the same time by using a lock mechanism.
*
* This is useful in production environments to avoid conflicts
* or race conditions during concurrent deployments.
*/
public bool $lock = false;
}
+534
View File
@@ -0,0 +1,534 @@
<?php
namespace Config;
/**
* This file contains an array of mime types. It is used by the
* Upload class to help identify allowed file types.
*
* When more than one variation for an extension exist (like jpg, jpeg, etc)
* the most common one should be first in the array to aid the guess*
* methods. The same applies when more than one mime-type exists for a
* single extension.
*
* When working with mime types, please make sure you have the ´fileinfo´
* extension enabled to reliably detect the media types.
*/
class Mimes
{
/**
* Map of extensions to mime types.
*
* @var array<string, list<string>|string>
*/
public static array $mimes = [
'hqx' => [
'application/mac-binhex40',
'application/mac-binhex',
'application/x-binhex40',
'application/x-mac-binhex40',
],
'cpt' => 'application/mac-compactpro',
'csv' => [
'text/csv',
'text/x-comma-separated-values',
'text/comma-separated-values',
'application/vnd.ms-excel',
'application/x-csv',
'text/x-csv',
'application/csv',
'application/excel',
'application/vnd.msexcel',
'text/plain',
],
'bin' => [
'application/macbinary',
'application/mac-binary',
'application/octet-stream',
'application/x-binary',
'application/x-macbinary',
],
'dms' => 'application/octet-stream',
'lha' => 'application/octet-stream',
'lzh' => 'application/octet-stream',
'exe' => [
'application/octet-stream',
'application/vnd.microsoft.portable-executable',
'application/x-dosexec',
'application/x-msdownload',
],
'class' => 'application/octet-stream',
'psd' => [
'application/x-photoshop',
'image/vnd.adobe.photoshop',
],
'so' => 'application/octet-stream',
'sea' => 'application/octet-stream',
'dll' => 'application/octet-stream',
'oda' => 'application/oda',
'pdf' => [
'application/pdf',
'application/force-download',
'application/x-download',
],
'ai' => [
'application/pdf',
'application/postscript',
],
'eps' => 'application/postscript',
'ps' => 'application/postscript',
'smi' => 'application/smil',
'smil' => 'application/smil',
'mif' => 'application/vnd.mif',
'xls' => [
'application/vnd.ms-excel',
'application/msexcel',
'application/x-msexcel',
'application/x-ms-excel',
'application/x-excel',
'application/x-dos_ms_excel',
'application/xls',
'application/x-xls',
'application/excel',
'application/download',
'application/vnd.ms-office',
'application/msword',
],
'ppt' => [
'application/vnd.ms-powerpoint',
'application/powerpoint',
'application/vnd.ms-office',
'application/msword',
],
'pptx' => [
'application/vnd.openxmlformats-officedocument.presentationml.presentation',
],
'wbxml' => 'application/wbxml',
'wmlc' => 'application/wmlc',
'dcr' => 'application/x-director',
'dir' => 'application/x-director',
'dxr' => 'application/x-director',
'dvi' => 'application/x-dvi',
'gtar' => 'application/x-gtar',
'gz' => 'application/x-gzip',
'gzip' => 'application/x-gzip',
'php' => [
'application/x-php',
'application/x-httpd-php',
'application/php',
'text/php',
'text/x-php',
'application/x-httpd-php-source',
],
'php4' => 'application/x-httpd-php',
'php3' => 'application/x-httpd-php',
'phtml' => 'application/x-httpd-php',
'phps' => 'application/x-httpd-php-source',
'js' => [
'application/x-javascript',
'text/plain',
],
'swf' => 'application/x-shockwave-flash',
'sit' => 'application/x-stuffit',
'tar' => 'application/x-tar',
'tgz' => [
'application/x-tar',
'application/x-gzip-compressed',
],
'z' => 'application/x-compress',
'xhtml' => 'application/xhtml+xml',
'xht' => 'application/xhtml+xml',
'zip' => [
'application/x-zip',
'application/zip',
'application/x-zip-compressed',
'application/s-compressed',
'multipart/x-zip',
],
'rar' => [
'application/vnd.rar',
'application/x-rar',
'application/rar',
'application/x-rar-compressed',
],
'mid' => 'audio/midi',
'midi' => 'audio/midi',
'mpga' => 'audio/mpeg',
'mp2' => 'audio/mpeg',
'mp3' => [
'audio/mpeg',
'audio/mpg',
'audio/mpeg3',
'audio/mp3',
],
'aif' => [
'audio/x-aiff',
'audio/aiff',
],
'aiff' => [
'audio/x-aiff',
'audio/aiff',
],
'aifc' => 'audio/x-aiff',
'ram' => 'audio/x-pn-realaudio',
'rm' => 'audio/x-pn-realaudio',
'rpm' => 'audio/x-pn-realaudio-plugin',
'ra' => 'audio/x-realaudio',
'rv' => 'video/vnd.rn-realvideo',
'wav' => [
'audio/x-wav',
'audio/wave',
'audio/wav',
],
'bmp' => [
'image/bmp',
'image/x-bmp',
'image/x-bitmap',
'image/x-xbitmap',
'image/x-win-bitmap',
'image/x-windows-bmp',
'image/ms-bmp',
'image/x-ms-bmp',
'application/bmp',
'application/x-bmp',
'application/x-win-bitmap',
],
'gif' => 'image/gif',
'jpg' => [
'image/jpeg',
'image/pjpeg',
],
'jpeg' => [
'image/jpeg',
'image/pjpeg',
],
'jpe' => [
'image/jpeg',
'image/pjpeg',
],
'jp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'j2k' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpf' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpg2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpx' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'jpm' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mj2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'mjp2' => [
'image/jp2',
'video/mj2',
'image/jpx',
'image/jpm',
],
'png' => [
'image/png',
'image/x-png',
],
'webp' => 'image/webp',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'css' => [
'text/css',
'text/plain',
],
'html' => [
'text/html',
'text/plain',
],
'htm' => [
'text/html',
'text/plain',
],
'shtml' => [
'text/html',
'text/plain',
],
'txt' => 'text/plain',
'text' => 'text/plain',
'log' => [
'text/plain',
'text/x-log',
],
'rtx' => 'text/richtext',
'rtf' => 'text/rtf',
'xml' => [
'application/xml',
'text/xml',
'text/plain',
],
'xsl' => [
'application/xml',
'text/xsl',
'text/xml',
],
'mpeg' => 'video/mpeg',
'mpg' => 'video/mpeg',
'mpe' => 'video/mpeg',
'qt' => 'video/quicktime',
'mov' => 'video/quicktime',
'avi' => [
'video/x-msvideo',
'video/msvideo',
'video/avi',
'application/x-troff-msvideo',
],
'movie' => 'video/x-sgi-movie',
'doc' => [
'application/msword',
'application/vnd.ms-office',
],
'docx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
'application/x-zip',
],
'dot' => [
'application/msword',
'application/vnd.ms-office',
],
'dotx' => [
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/msword',
],
'xlsx' => [
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/zip',
'application/vnd.ms-excel',
'application/msword',
'application/x-zip',
],
'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12',
'word' => [
'application/msword',
'application/octet-stream',
],
'xl' => 'application/excel',
'eml' => 'message/rfc822',
'json' => [
'application/json',
'text/json',
],
'pem' => [
'application/x-x509-user-cert',
'application/x-pem-file',
'application/octet-stream',
],
'p10' => [
'application/x-pkcs10',
'application/pkcs10',
],
'p12' => 'application/x-pkcs12',
'p7a' => 'application/x-pkcs7-signature',
'p7c' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7m' => [
'application/pkcs7-mime',
'application/x-pkcs7-mime',
],
'p7r' => 'application/x-pkcs7-certreqresp',
'p7s' => 'application/pkcs7-signature',
'crt' => [
'application/x-x509-ca-cert',
'application/x-x509-user-cert',
'application/pkix-cert',
],
'crl' => [
'application/pkix-crl',
'application/pkcs-crl',
],
'der' => 'application/x-x509-ca-cert',
'kdb' => 'application/octet-stream',
'pgp' => 'application/pgp',
'gpg' => 'application/gpg-keys',
'sst' => 'application/octet-stream',
'csr' => 'application/octet-stream',
'rsa' => 'application/x-pkcs7',
'cer' => [
'application/pkix-cert',
'application/x-x509-ca-cert',
],
'3g2' => 'video/3gpp2',
'3gp' => [
'video/3gp',
'video/3gpp',
],
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => [
'video/mp4',
'video/x-f4v',
],
'flv' => 'video/x-flv',
'webm' => 'video/webm',
'aac' => 'audio/x-acc',
'm4u' => 'application/vnd.mpegurl',
'm3u' => 'text/plain',
'xspf' => 'application/xspf+xml',
'vlc' => 'application/videolan',
'wmv' => [
'video/x-ms-wmv',
'video/x-ms-asf',
],
'au' => 'audio/x-au',
'ac3' => 'audio/ac3',
'flac' => 'audio/x-flac',
'ogg' => [
'audio/ogg',
'video/ogg',
'application/ogg',
],
'kmz' => [
'application/vnd.google-earth.kmz',
'application/zip',
'application/x-zip',
],
'kml' => [
'application/vnd.google-earth.kml+xml',
'application/xml',
'text/xml',
],
'ics' => 'text/calendar',
'ical' => 'text/calendar',
'zsh' => 'text/x-scriptzsh',
'7zip' => [
'application/x-compressed',
'application/x-zip-compressed',
'application/zip',
'multipart/x-zip',
],
'cdr' => [
'application/cdr',
'application/coreldraw',
'application/x-cdr',
'application/x-coreldraw',
'image/cdr',
'image/x-cdr',
'zz-application/zz-winassoc-cdr',
],
'wma' => [
'audio/x-ms-wma',
'video/x-ms-asf',
],
'jar' => [
'application/java-archive',
'application/x-java-application',
'application/x-jar',
'application/x-compressed',
],
'svg' => [
'image/svg+xml',
'image/svg',
'application/xml',
'text/xml',
],
'vcf' => 'text/x-vcard',
'srt' => [
'text/srt',
'text/plain',
],
'vtt' => [
'text/vtt',
'text/plain',
],
'ico' => [
'image/x-icon',
'image/x-ico',
'image/vnd.microsoft.icon',
],
'stl' => [
'application/sla',
'application/vnd.ms-pki.stl',
'application/x-navistyle',
'model/stl',
'application/octet-stream',
],
];
/**
* Attempts to determine the best mime type for the given file extension.
*
* @return string|null The mime type found, or none if unable to determine.
*/
public static function guessTypeFromExtension(string $extension)
{
$extension = trim(strtolower($extension), '. ');
if (! array_key_exists($extension, static::$mimes)) {
return null;
}
return is_array(static::$mimes[$extension]) ? static::$mimes[$extension][0] : static::$mimes[$extension];
}
/**
* Attempts to determine the best file extension for a given mime type.
*
* @param string|null $proposedExtension - default extension (in case there is more than one with the same mime type)
*
* @return string|null The extension determined, or null if unable to match.
*/
public static function guessExtensionFromType(string $type, ?string $proposedExtension = null)
{
$type = trim(strtolower($type), '. ');
$proposedExtension = trim(strtolower($proposedExtension ?? ''));
if (
$proposedExtension !== ''
&& array_key_exists($proposedExtension, static::$mimes)
&& in_array($type, (array) static::$mimes[$proposedExtension], true)
) {
// The detected mime type matches with the proposed extension.
return $proposedExtension;
}
// Reverse check the mime type list if no extension was proposed.
// This search is order sensitive!
foreach (static::$mimes as $ext => $types) {
if (in_array($type, (array) $types, true)) {
return $ext;
}
}
return null;
}
}
+82
View File
@@ -0,0 +1,82 @@
<?php
namespace Config;
use CodeIgniter\Modules\Modules as BaseModules;
/**
* Modules Configuration.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Modules extends BaseModules
{
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all elements listed in
* $aliases below. If false, no auto-discovery will happen at all,
* giving a slight performance boost.
*
* @var bool
*/
public $enabled = true;
/**
* --------------------------------------------------------------------------
* Enable Auto-Discovery Within Composer Packages?
* --------------------------------------------------------------------------
*
* If true, then auto-discovery will happen across all namespaces loaded
* by Composer, as well as the namespaces configured locally.
*
* @var bool
*/
public $discoverInComposer = true;
/**
* The Composer package list for Auto-Discovery
* This setting is optional.
*
* E.g.:
* [
* 'only' => [
* // List up all packages to auto-discover
* 'codeigniter4/shield',
* ],
* ]
* or
* [
* 'exclude' => [
* // List up packages to exclude.
* 'pestphp/pest',
* ],
* ]
*
* @var array{only?: list<string>, exclude?: list<string>}
*/
public $composerPackages = [];
/**
* --------------------------------------------------------------------------
* Auto-Discovery Rules
* --------------------------------------------------------------------------
*
* Aliases list of all discovery classes that will be active and used during
* the current application request.
*
* If it is not listed, only the base application elements will be used.
*
* @var list<string>
*/
public $aliases = [
'events',
'filters',
'registrars',
'routes',
'services',
];
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Config;
/**
* Optimization Configuration.
*
* NOTE: This class does not extend BaseConfig for performance reasons.
* So you cannot replace the property values with Environment Variables.
*
* WARNING: Do not use these options when running the app in the Worker Mode.
*/
class Optimize
{
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/factories.html#config-caching
*/
public bool $configCacheEnabled = false;
/**
* --------------------------------------------------------------------------
* Config Caching
* --------------------------------------------------------------------------
*
* @see https://codeigniter.com/user_guide/concepts/autoloader.html#file-locator-caching
*/
public bool $locatorCacheEnabled = false;
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Pager extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Templates
* --------------------------------------------------------------------------
*
* Pagination links are rendered out using views to configure their
* appearance. This array contains aliases and the view names to
* use when rendering the links.
*
* Within each view, the Pager object will be available as $pager,
* and the desired group as $pagerGroup;
*
* @var array<string, string>
*/
public array $templates = [
'default_full' => 'CodeIgniter\Pager\Views\default_full',
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
'default_head' => 'CodeIgniter\Pager\Views\default_head',
];
/**
* --------------------------------------------------------------------------
* Items Per Page
* --------------------------------------------------------------------------
*
* The default number of results shown in a single page.
*/
public int $perPage = 20;
}
+90
View File
@@ -0,0 +1,90 @@
<?php
namespace Config;
/**
* Paths
*
* Holds the paths that are used by the system to
* locate the main directories, app, system, etc.
*
* Modifying these allows you to restructure your application,
* share a system folder between multiple applications, and more.
*
* All paths are relative to the project's root folder.
*
* NOTE: This class is required prior to Autoloader instantiation,
* and does not extend BaseConfig.
*/
class Paths
{
/**
* ---------------------------------------------------------------
* SYSTEM FOLDER NAME
* ---------------------------------------------------------------
*
* This must contain the name of your "system" folder. Include
* the path if the folder is not in the same directory as this file.
*/
public string $systemDirectory = __DIR__ . '/../../vendor/codeigniter4/framework/system';
/**
* ---------------------------------------------------------------
* APPLICATION FOLDER NAME
* ---------------------------------------------------------------
*
* If you want this front controller to use a different "app"
* folder than the default one you can set its name here. The folder
* can also be renamed or relocated anywhere on your server. If
* you do, use a full server path.
*
* @see http://codeigniter.com/user_guide/general/managing_apps.html
*/
public string $appDirectory = __DIR__ . '/..';
/**
* ---------------------------------------------------------------
* WRITABLE DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "writable" directory.
* The writable directory allows you to group all directories that
* need write permission to a single place that can be tucked away
* for maximum security, keeping it out of the app and/or
* system directories.
*/
public string $writableDirectory = __DIR__ . '/../../writable';
/**
* ---------------------------------------------------------------
* TESTS DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of your "tests" directory.
*/
public string $testsDirectory = __DIR__ . '/../../tests';
/**
* ---------------------------------------------------------------
* VIEW DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory that
* contains the view files used by your application. By
* default this is in `app/Views`. This value
* is used when no value is provided to `Services::renderer()`.
*/
public string $viewDirectory = __DIR__ . '/../Views';
/**
* ---------------------------------------------------------------
* ENVIRONMENT DIRECTORY NAME
* ---------------------------------------------------------------
*
* This variable must contain the name of the directory where
* the .env file is located.
* Please consider security implications when changing this
* value - the directory should not be publicly accessible.
*/
public string $envDirectory = __DIR__ . '/../../';
}
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string, string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}
+43
View File
@@ -0,0 +1,43 @@
<?php
use CodeIgniter\Router\RouteCollection;
/**
* @var RouteCollection $routes
*/
// ======================================================
// AUTHENTICATION
// ======================================================
$routes->get('/', 'Auth::login');
$routes->get('/login', 'Auth::login');
$routes->post('/login', 'Auth::attempt');
$routes->get('/logout', 'Auth::logout');
// ======================================================
// DASHBOARD
// ======================================================
$routes->get('/dashboard', 'Pasien::dashboard');
// ======================================================
// PASIEN
// ======================================================
$routes->get('/pasien/aktif', 'Pasien::aktif');
$routes->get('/pasien/input', 'Pasien::input');
$routes->post('/pasien/simpan', 'Pasien::simpan');
$routes->get('/pasien/next/(:num)', 'Pasien::next/$1');
// FASE AMBULANS
$routes->get('/pasien/predispatch/(:num)', 'Pasien::predispatch/$1');
// ======================================================
// AJAX PEGAWAI
// ======================================================
$routes->get('/pegawai/search', 'Pegawai::search');
// ======================================================
// AJAX RM
// ======================================================
$routes->post('/rm/cek', 'RmController::cek');
$routes->post('/rm/search', 'RmController::search');
$routes->post('/rm/link', 'RmController::link');
+149
View File
@@ -0,0 +1,149 @@
<?php
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Config;
use CodeIgniter\Config\Routing as BaseRouting;
/**
* Routing configuration
*/
class Routing extends BaseRouting
{
/**
* For Defined Routes.
* An array of files that contain route definitions.
* Route files are read in order, with the first match
* found taking precedence.
*
* Default: APPPATH . 'Config/Routes.php'
*
* @var list<string>
*/
public array $routeFiles = [
APPPATH . 'Config/Routes.php',
];
/**
* For Defined Routes and Auto Routing.
* The default namespace to use for Controllers when no other
* namespace has been specified.
*
* Default: 'App\Controllers'
*/
public string $defaultNamespace = 'App\Controllers';
/**
* For Auto Routing.
* The default controller to use when no other controller has been
* specified.
*
* Default: 'Home'
*/
public string $defaultController = 'Home';
/**
* For Defined Routes and Auto Routing.
* The default method to call on the controller when no other
* method has been set in the route.
*
* Default: 'index'
*/
public string $defaultMethod = 'index';
/**
* For Auto Routing.
* Whether to translate dashes in URIs for controller/method to underscores.
* Primarily useful when using the auto-routing.
*
* Default: false
*/
public bool $translateURIDashes = false;
/**
* Sets the class/method that should be called if routing doesn't
* find a match. It can be the controller/method name like: Users::index
*
* This setting is passed to the Router class and handled there.
*
* If you want to use a closure, you will have to set it in the
* routes file by calling:
*
* $routes->set404Override(function() {
* // Do something here
* });
*
* Example:
* public $override404 = 'App\Errors::show404';
*/
public ?string $override404 = null;
/**
* If TRUE, the system will attempt to match the URI against
* Controllers by matching each segment against folders/files
* in APPPATH/Controllers, when a match wasn't found against
* defined routes.
*
* If FALSE, will stop searching and do NO automatic routing.
*/
public bool $autoRoute = false;
/**
* If TRUE, the system will look for attributes on controller
* class and methods that can run before and after the
* controller/method.
*
* If FALSE, will ignore any attributes.
*/
public bool $useControllerAttributes = true;
/**
* For Defined Routes.
* If TRUE, will enable the use of the 'prioritize' option
* when defining routes.
*
* Default: false
*/
public bool $prioritize = false;
/**
* For Defined Routes.
* If TRUE, matched multiple URI segments will be passed as one parameter.
*
* Default: false
*/
public bool $multipleSegmentsOneParam = false;
/**
* For Auto Routing (Improved).
* Map of URI segments and namespaces.
*
* The key is the first URI segment. The value is the controller namespace.
* E.g.,
* [
* 'blog' => 'Acme\Blog\Controllers',
* ]
*
* @var array<string, string>
*/
public array $moduleRoutes = [];
/**
* For Auto Routing (Improved).
* Whether to translate dashes in URIs for controller/method to CamelCase.
* E.g., blog-controller -> BlogController
*
* If you enable this, $translateURIDashes is ignored.
*
* Default: false
*/
public bool $translateUriToCamelCase = true;
}
+86
View File
@@ -0,0 +1,86 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Security extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* CSRF Protection Method
* --------------------------------------------------------------------------
*
* Protection Method for Cross Site Request Forgery protection.
*
* @var string 'cookie' or 'session'
*/
public string $csrfProtection = 'cookie';
/**
* --------------------------------------------------------------------------
* CSRF Token Randomization
* --------------------------------------------------------------------------
*
* Randomize the CSRF Token for added security.
*/
public bool $tokenRandomize = false;
/**
* --------------------------------------------------------------------------
* CSRF Token Name
* --------------------------------------------------------------------------
*
* Token name for Cross Site Request Forgery protection.
*/
public string $tokenName = 'csrf_test_name';
/**
* --------------------------------------------------------------------------
* CSRF Header Name
* --------------------------------------------------------------------------
*
* Header name for Cross Site Request Forgery protection.
*/
public string $headerName = 'X-CSRF-TOKEN';
/**
* --------------------------------------------------------------------------
* CSRF Cookie Name
* --------------------------------------------------------------------------
*
* Cookie name for Cross Site Request Forgery protection.
*/
public string $cookieName = 'csrf_cookie_name';
/**
* --------------------------------------------------------------------------
* CSRF Expires
* --------------------------------------------------------------------------
*
* Expiration time for Cross Site Request Forgery protection cookie.
*
* Defaults to two hours (in seconds).
*/
public int $expires = 7200;
/**
* --------------------------------------------------------------------------
* CSRF Regenerate
* --------------------------------------------------------------------------
*
* Regenerate CSRF Token on every submission.
*/
public bool $regenerate = true;
/**
* --------------------------------------------------------------------------
* CSRF Redirect
* --------------------------------------------------------------------------
*
* Redirect to previous page with error on failure.
*
* @see https://codeigniter4.github.io/userguide/libraries/security.html#redirection-on-failure
*/
public bool $redirect = (ENVIRONMENT === 'production');
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}
+128
View File
@@ -0,0 +1,128 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Session\Handlers\BaseHandler;
use CodeIgniter\Session\Handlers\FileHandler;
class Session extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Session Driver
* --------------------------------------------------------------------------
*
* The session storage driver to use:
* - `CodeIgniter\Session\Handlers\ArrayHandler` (for testing)
* - `CodeIgniter\Session\Handlers\FileHandler`
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
* - `CodeIgniter\Session\Handlers\RedisHandler`
*
* @var class-string<BaseHandler>
*/
public string $driver = FileHandler::class;
/**
* --------------------------------------------------------------------------
* Session Cookie Name
* --------------------------------------------------------------------------
*
* The session cookie name, must contain only [0-9a-z_-] characters
*/
public string $cookieName = 'ci_session';
/**
* --------------------------------------------------------------------------
* Session Expiration
* --------------------------------------------------------------------------
*
* The number of SECONDS you want the session to last.
* Setting to 0 (zero) means expire when the browser is closed.
*/
public int $expiration = 7200;
/**
* --------------------------------------------------------------------------
* Session Save Path
* --------------------------------------------------------------------------
*
* The location to save sessions to and is driver dependent.
*
* For the 'files' driver, it's a path to a writable directory.
* WARNING: Only absolute paths are supported!
*
* For the 'database' driver, it's a table name.
* Please read up the manual for the format with other session drivers.
*
* IMPORTANT: You are REQUIRED to set a valid save path!
*/
public string $savePath = WRITEPATH . 'session';
/**
* --------------------------------------------------------------------------
* Session Match IP
* --------------------------------------------------------------------------
*
* Whether to match the user's IP address when reading the session data.
*
* WARNING: If you're using the database driver, don't forget to update
* your session table's PRIMARY KEY when changing this setting.
*/
public bool $matchIP = false;
/**
* --------------------------------------------------------------------------
* Session Time to Update
* --------------------------------------------------------------------------
*
* How many seconds between CI regenerating the session ID.
*/
public int $timeToUpdate = 300;
/**
* --------------------------------------------------------------------------
* Session Regenerate Destroy
* --------------------------------------------------------------------------
*
* Whether to destroy session data associated with the old session ID
* when auto-regenerating the session ID. When set to FALSE, the data
* will be later deleted by the garbage collector.
*/
public bool $regenerateDestroy = false;
/**
* --------------------------------------------------------------------------
* Session Database Group
* --------------------------------------------------------------------------
*
* DB Group for the database session.
*/
public ?string $DBGroup = null;
/**
* --------------------------------------------------------------------------
* Lock Retry Interval (microseconds)
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Time (microseconds) to wait if lock cannot be acquired.
* The default is 100,000 microseconds (= 0.1 seconds).
*/
public int $lockRetryInterval = 100_000;
/**
* --------------------------------------------------------------------------
* Lock Max Retries
* --------------------------------------------------------------------------
*
* This is used for RedisHandler.
*
* Maximum number of lock acquisition attempts.
* The default is 300 times. That is lock timeout is about 30 (0.1 * 300)
* seconds.
*/
public int $lockMaxRetries = 300;
}
+147
View File
@@ -0,0 +1,147 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Debug\Toolbar\Collectors\Database;
use CodeIgniter\Debug\Toolbar\Collectors\Events;
use CodeIgniter\Debug\Toolbar\Collectors\Files;
use CodeIgniter\Debug\Toolbar\Collectors\Logs;
use CodeIgniter\Debug\Toolbar\Collectors\Routes;
use CodeIgniter\Debug\Toolbar\Collectors\Timers;
use CodeIgniter\Debug\Toolbar\Collectors\Views;
/**
* --------------------------------------------------------------------------
* Debug Toolbar
* --------------------------------------------------------------------------
*
* The Debug Toolbar provides a way to see information about the performance
* and state of your application during that page display. By default it will
* NOT be displayed under production environments, and will only display if
* `CI_DEBUG` is true, since if it's not, there's not much to display anyway.
*/
class Toolbar extends BaseConfig
{
/**
* --------------------------------------------------------------------------
* Toolbar Collectors
* --------------------------------------------------------------------------
*
* List of toolbar collectors that will be called when Debug Toolbar
* fires up and collects data from.
*
* @var list<class-string>
*/
public array $collectors = [
Timers::class,
Database::class,
Logs::class,
Views::class,
// \CodeIgniter\Debug\Toolbar\Collectors\Cache::class,
Files::class,
Routes::class,
Events::class,
];
/**
* --------------------------------------------------------------------------
* Collect Var Data
* --------------------------------------------------------------------------
*
* If set to false var data from the views will not be collected. Useful to
* avoid high memory usage when there are lots of data passed to the view.
*/
public bool $collectVarData = true;
/**
* --------------------------------------------------------------------------
* Max History
* --------------------------------------------------------------------------
*
* `$maxHistory` sets a limit on the number of past requests that are stored,
* helping to conserve file space used to store them. You can set it to
* 0 (zero) to not have any history stored, or -1 for unlimited history.
*/
public int $maxHistory = 20;
/**
* --------------------------------------------------------------------------
* Toolbar Views Path
* --------------------------------------------------------------------------
*
* The full path to the the views that are used by the toolbar.
* This MUST have a trailing slash.
*/
public string $viewsPath = SYSTEMPATH . 'Debug/Toolbar/Views/';
/**
* --------------------------------------------------------------------------
* Max Queries
* --------------------------------------------------------------------------
*
* If the Database Collector is enabled, it will log every query that the
* the system generates so they can be displayed on the toolbar's timeline
* and in the query log. This can lead to memory issues in some instances
* with hundreds of queries.
*
* `$maxQueries` defines the maximum amount of queries that will be stored.
*/
public int $maxQueries = 100;
/**
* --------------------------------------------------------------------------
* Watched Directories
* --------------------------------------------------------------------------
*
* Contains an array of directories that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
* We restrict the values to keep performance as high as possible.
*
* NOTE: The ROOTPATH will be prepended to all values.
*
* @var list<string>
*/
public array $watchedDirectories = [
'app',
];
/**
* --------------------------------------------------------------------------
* Watched File Extensions
* --------------------------------------------------------------------------
*
* Contains an array of file extensions that will be watched for changes and
* used to determine if the hot-reload feature should reload the page or not.
*
* @var list<string>
*/
public array $watchedExtensions = [
'php', 'css', 'js', 'html', 'svg', 'json', 'env',
];
/**
* --------------------------------------------------------------------------
* Ignored HTTP Headers
* --------------------------------------------------------------------------
*
* CodeIgniter Debug Toolbar normally injects HTML and JavaScript into every
* HTML response. This is correct for full page loads, but it breaks requests
* that expect only a clean HTML fragment.
*
* Libraries like HTMX, Unpoly, and Hotwire (Turbo) update parts of the page or
* manage navigation on the client side. Injecting the Debug Toolbar into their
* responses can cause invalid HTML, duplicated scripts, or JavaScript errors
* (such as infinite loops or "Maximum call stack size exceeded").
*
* Any request containing one of the following headers is treated as a
* client-managed or partial request, and the Debug Toolbar injection is skipped.
*
* @var array<string, string|null>
*/
public array $disableOnHeaders = [
'X-Requested-With' => 'xmlhttprequest', // AJAX requests
'HX-Request' => 'true', // HTMX requests
'X-Up-Version' => null, // Unpoly partial requests
];
}
+262
View File
@@ -0,0 +1,262 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
/**
* -------------------------------------------------------------------
* User Agents
* -------------------------------------------------------------------
*
* This file contains four arrays of user agent data. It is used by the
* User Agent Class to help identify browser, platform, robot, and
* mobile device data. The array keys are used to identify the device
* and the array values are used to set the actual name of the item.
*/
class UserAgents extends BaseConfig
{
/**
* -------------------------------------------------------------------
* OS Platforms
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $platforms = [
'windows nt 10.0' => 'Windows 10',
'windows nt 6.3' => 'Windows 8.1',
'windows nt 6.2' => 'Windows 8',
'windows nt 6.1' => 'Windows 7',
'windows nt 6.0' => 'Windows Vista',
'windows nt 5.2' => 'Windows 2003',
'windows nt 5.1' => 'Windows XP',
'windows nt 5.0' => 'Windows 2000',
'windows nt 4.0' => 'Windows NT 4.0',
'winnt4.0' => 'Windows NT 4.0',
'winnt 4.0' => 'Windows NT',
'winnt' => 'Windows NT',
'windows 98' => 'Windows 98',
'win98' => 'Windows 98',
'windows 95' => 'Windows 95',
'win95' => 'Windows 95',
'windows phone' => 'Windows Phone',
'windows' => 'Unknown Windows OS',
'android' => 'Android',
'blackberry' => 'BlackBerry',
'iphone' => 'iOS',
'ipad' => 'iOS',
'ipod' => 'iOS',
'os x' => 'Mac OS X',
'ppc mac' => 'Power PC Mac',
'freebsd' => 'FreeBSD',
'ppc' => 'Macintosh',
'linux' => 'Linux',
'debian' => 'Debian',
'sunos' => 'Sun Solaris',
'beos' => 'BeOS',
'apachebench' => 'ApacheBench',
'aix' => 'AIX',
'irix' => 'Irix',
'osf' => 'DEC OSF',
'hp-ux' => 'HP-UX',
'netbsd' => 'NetBSD',
'bsdi' => 'BSDi',
'openbsd' => 'OpenBSD',
'gnu' => 'GNU/Linux',
'unix' => 'Unknown Unix OS',
'symbian' => 'Symbian OS',
];
/**
* -------------------------------------------------------------------
* Browsers
* -------------------------------------------------------------------
*
* The order of this array should NOT be changed. Many browsers return
* multiple browser types so we want to identify the subtype first.
*
* @var array<string, string>
*/
public array $browsers = [
'OPR' => 'Opera',
'Flock' => 'Flock',
'Edge' => 'Spartan',
'Edg' => 'Edge',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
'Opera' => 'Opera',
'MSIE' => 'Internet Explorer',
'Internet Explorer' => 'Internet Explorer',
'Trident.* rv' => 'Internet Explorer',
'Shiira' => 'Shiira',
'Firefox' => 'Firefox',
'Chimera' => 'Chimera',
'Phoenix' => 'Phoenix',
'Firebird' => 'Firebird',
'Camino' => 'Camino',
'Netscape' => 'Netscape',
'OmniWeb' => 'OmniWeb',
'Safari' => 'Safari',
'Mozilla' => 'Mozilla',
'Konqueror' => 'Konqueror',
'icab' => 'iCab',
'Lynx' => 'Lynx',
'Links' => 'Links',
'hotjava' => 'HotJava',
'amaya' => 'Amaya',
'IBrowse' => 'IBrowse',
'Maxthon' => 'Maxthon',
'Ubuntu' => 'Ubuntu Web Browser',
'Vivaldi' => 'Vivaldi',
];
/**
* -------------------------------------------------------------------
* Mobiles
* -------------------------------------------------------------------
*
* @var array<string, string>
*/
public array $mobiles = [
// legacy array, old values commented out
'mobileexplorer' => 'Mobile Explorer',
// 'openwave' => 'Open Wave',
// 'opera mini' => 'Opera Mini',
// 'operamini' => 'Opera Mini',
// 'elaine' => 'Palm',
'palmsource' => 'Palm',
// 'digital paths' => 'Palm',
// 'avantgo' => 'Avantgo',
// 'xiino' => 'Xiino',
'palmscape' => 'Palmscape',
// 'nokia' => 'Nokia',
// 'ericsson' => 'Ericsson',
// 'blackberry' => 'BlackBerry',
// 'motorola' => 'Motorola'
// Phones and Manufacturers
'motorola' => 'Motorola',
'nokia' => 'Nokia',
'palm' => 'Palm',
'iphone' => 'Apple iPhone',
'ipad' => 'iPad',
'ipod' => 'Apple iPod Touch',
'sony' => 'Sony Ericsson',
'ericsson' => 'Sony Ericsson',
'blackberry' => 'BlackBerry',
'cocoon' => 'O2 Cocoon',
'blazer' => 'Treo',
'lg' => 'LG',
'amoi' => 'Amoi',
'xda' => 'XDA',
'mda' => 'MDA',
'vario' => 'Vario',
'htc' => 'HTC',
'samsung' => 'Samsung',
'sharp' => 'Sharp',
'sie-' => 'Siemens',
'alcatel' => 'Alcatel',
'benq' => 'BenQ',
'ipaq' => 'HP iPaq',
'mot-' => 'Motorola',
'playstation portable' => 'PlayStation Portable',
'playstation 3' => 'PlayStation 3',
'playstation vita' => 'PlayStation Vita',
'hiptop' => 'Danger Hiptop',
'nec-' => 'NEC',
'panasonic' => 'Panasonic',
'philips' => 'Philips',
'sagem' => 'Sagem',
'sanyo' => 'Sanyo',
'spv' => 'SPV',
'zte' => 'ZTE',
'sendo' => 'Sendo',
'nintendo dsi' => 'Nintendo DSi',
'nintendo ds' => 'Nintendo DS',
'nintendo 3ds' => 'Nintendo 3DS',
'wii' => 'Nintendo Wii',
'open web' => 'Open Web',
'openweb' => 'OpenWeb',
// Operating Systems
'android' => 'Android',
'symbian' => 'Symbian',
'SymbianOS' => 'SymbianOS',
'elaine' => 'Palm',
'series60' => 'Symbian S60',
'windows ce' => 'Windows CE',
// Browsers
'obigo' => 'Obigo',
'netfront' => 'Netfront Browser',
'openwave' => 'Openwave Browser',
'mobilexplorer' => 'Mobile Explorer',
'operamini' => 'Opera Mini',
'opera mini' => 'Opera Mini',
'opera mobi' => 'Opera Mobile',
'fennec' => 'Firefox Mobile',
// Other
'digital paths' => 'Digital Paths',
'avantgo' => 'AvantGo',
'xiino' => 'Xiino',
'novarra' => 'Novarra Transcoder',
'vodafone' => 'Vodafone',
'docomo' => 'NTT DoCoMo',
'o2' => 'O2',
// Fallback
'mobile' => 'Generic Mobile',
'wireless' => 'Generic Mobile',
'j2me' => 'Generic Mobile',
'midp' => 'Generic Mobile',
'cldc' => 'Generic Mobile',
'up.link' => 'Generic Mobile',
'up.browser' => 'Generic Mobile',
'smartphone' => 'Generic Mobile',
'cellphone' => 'Generic Mobile',
];
/**
* -------------------------------------------------------------------
* Robots
* -------------------------------------------------------------------
*
* There are hundred of bots but these are the most common.
*
* @var array<string, string>
*/
public array $robots = [
'googlebot' => 'Googlebot',
'google-pagerenderer' => 'Google Page Renderer',
'google-read-aloud' => 'Google Read Aloud',
'google-safety' => 'Google Safety Bot',
'msnbot' => 'MSNBot',
'baiduspider' => 'Baiduspider',
'bingbot' => 'Bing',
'bingpreview' => 'BingPreview',
'slurp' => 'Inktomi Slurp',
'yahoo' => 'Yahoo',
'ask jeeves' => 'Ask Jeeves',
'fastcrawler' => 'FastCrawler',
'infoseek' => 'InfoSeek Robot 1.0',
'lycos' => 'Lycos',
'yandex' => 'YandexBot',
'mediapartners-google' => 'MediaPartners Google',
'CRAZYWEBCRAWLER' => 'Crazy Webcrawler',
'adsbot-google' => 'AdsBot Google',
'feedfetcher-google' => 'Feedfetcher Google',
'curious george' => 'Curious George',
'ia_archiver' => 'Alexa Crawler',
'MJ12bot' => 'Majestic-12',
'Uptimebot' => 'Uptimebot',
'duckduckbot' => 'DuckDuckBot',
'sogou' => 'Sogou Spider',
'exabot' => 'Exabot',
'bot' => 'Generic Bot',
'crawler' => 'Generic Crawler',
'spider' => 'Generic Spider',
];
}
+44
View File
@@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var list<string>
*/
public array $ruleSets = [
Rules::class,
FormatRules::class,
FileRules::class,
CreditCardRules::class,
];
/**
* Specifies the views that are used to display the
* errors.
*
* @var array<string, string>
*/
public array $templates = [
'list' => 'CodeIgniter\Validation\Views\list',
'single' => 'CodeIgniter\Validation\Views\single',
];
// --------------------------------------------------------------------
// Rules
// --------------------------------------------------------------------
}
+79
View File
@@ -0,0 +1,79 @@
<?php
namespace Config;
use CodeIgniter\Config\View as BaseView;
use CodeIgniter\View\ViewDecoratorInterface;
/**
* @phpstan-type parser_callable (callable(mixed): mixed)
* @phpstan-type parser_callable_string (callable(mixed): mixed)&string
*/
class View extends BaseView
{
/**
* When false, the view method will clear the data between each
* call. This keeps your data safe and ensures there is no accidental
* leaking between calls, so you would need to explicitly pass the data
* to each view. You might prefer to have the data stick around between
* calls so that it is available to all views. If that is the case,
* set $saveData to true.
*
* @var bool
*/
public $saveData = true;
/**
* Parser Filters map a filter name with any PHP callable. When the
* Parser prepares a variable for display, it will chain it
* through the filters in the order defined, inserting any parameters.
* To prevent potential abuse, all filters MUST be defined here
* in order for them to be available for use within the Parser.
*
* Examples:
* { title|esc(js) }
* { created_on|date(Y-m-d)|esc(attr) }
*
* @var array<string, string>
* @phpstan-var array<string, parser_callable_string>
*/
public $filters = [];
/**
* Parser Plugins provide a way to extend the functionality provided
* by the core Parser by creating aliases that will be replaced with
* any callable. Can be single or tag pair.
*
* @var array<string, callable|list<string>|string>
* @phpstan-var array<string, list<parser_callable_string>|parser_callable_string|parser_callable>
*/
public $plugins = [];
/**
* View Decorators are class methods that will be run in sequence to
* have a chance to alter the generated output just prior to caching
* the results.
*
* All classes must implement CodeIgniter\View\ViewDecoratorInterface
*
* @var list<class-string<ViewDecoratorInterface>>
*/
public array $decorators = [];
/**
* Subdirectory within app/Views for namespaced view overrides.
*
* Namespaced views will be searched in:
*
* app/Views/{$appOverridesFolder}/{Namespace}/{view_path}.{php|html...}
*
* This allows application-level overrides for package or module views
* without modifying vendor source files.
*
* Examples:
* 'overrides' -> app/Views/overrides/Example/Blog/post/card.php
* 'vendor' -> app/Views/vendor/Example/Blog/post/card.php
* '' -> app/Views/Example/Blog/post/card.php (direct mapping)
*/
public string $appOverridesFolder = 'overrides';
}
+62
View File
@@ -0,0 +1,62 @@
<?php
namespace Config;
/**
* This configuration controls how CodeIgniter behaves when running
* in worker mode (with FrankenPHP).
*/
class WorkerMode
{
/**
* Persistent Services
*
* List of service names that should persist across requests.
* These services will NOT be reset between requests.
*
* Services not in this list will be reset for each request to prevent
* state leakage.
*
* Recommended persistent services:
* - `autoloader`: PSR-4 autoloading configuration
* - `locator`: File locator
* - `exceptions`: Exception handler
* - `commands`: CLI commands registry
* - `codeigniter`: Main application instance
* - `superglobals`: Superglobals wrapper
* - `routes`: Router configuration
* - `cache`: Cache instance
*
* @var list<string>
*/
public array $persistentServices = [
'autoloader',
'locator',
'exceptions',
'commands',
'codeigniter',
'superglobals',
'routes',
'cache',
];
/**
* Reset Event Listeners
*
* List of event names whose listeners should be removed between requests.
* Use this if you register event listeners inside other event callbacks
* (rather than at the top level of Config/Events.php), which would cause
* them to accumulate across requests in worker mode.
*
* @var list<string>
*/
public array $resetEventListeners = [];
/**
* Force Garbage Collection
*
* Whether to force garbage collection after each request.
* Helps prevent memory leaks at a small performance cost.
*/
public bool $forceGarbageCollection = true;
}
+49
View File
@@ -0,0 +1,49 @@
<?php
namespace App\Controllers;
use App\Models\UserModel;
class Auth extends BaseController
{
public function login()
{
if (session()->get('logged_in')) {
return redirect()->to('/dashboard');
}
return view('auth/login');
}
public function attempt()
{
$username = trim($this->request->getPost('username'));
$password = trim($this->request->getPost('password'));
$model = new UserModel();
$user = $model->where('username', $username)->first();
if (!$user || !password_verify($password, $user['password'])) {
return redirect()->back()
->withInput()
->with('error', 'Username atau password salah.');
}
session()->set([
'id' => $user['id'],
'nama' => $user['nama'],
'username' => $user['username'],
'role' => $user['role'],
'logged_in' => true,
'last_activity' => time(),
]);
return redirect()->to('/dashboard');
}
public function logout()
{
session()->destroy();
return redirect()->to('/login');
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Controllers;
use CodeIgniter\Controller;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
/**
* BaseController provides a convenient place for loading components
* and performing functions that are needed by all your controllers.
*
* Extend this class in any new controllers:
* ```
* class Home extends BaseController
* ```
*
* For security, be sure to declare any new methods as protected or private.
*/
abstract class BaseController extends Controller
{
/**
* Be sure to declare properties for any property fetch you initialized.
* The creation of dynamic property is deprecated in PHP 8.2.
*/
// protected $session;
/**
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
// Load here all helpers you want to be available in your controllers that extend BaseController.
// Caution: Do not put the this below the parent::initController() call below.
// $this->helpers = ['form', 'url'];
// Caution: Do not edit this line.
parent::initController($request, $response, $logger);
// Preload any models, libraries, etc, here.
// $this->session = service('session');
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
namespace App\Controllers;
class Dashboard extends BaseController
{
public function index()
{
// Cek apakah user sudah login
if (!session()->get('logged_in')) {
return redirect()->to('/login');
}
return view('dashboard');
}
}
+11
View File
@@ -0,0 +1,11 @@
<?php
namespace App\Controllers;
class Home extends BaseController
{
public function index()
{
return view('dashboard');
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Controllers;
use App\Models\PegawaiModel;
class Pegawai extends BaseController
{
public function search()
{
$term = $this->request->getGet('q');
$model = new PegawaiModel();
$data = $model
->groupStart()
->like('nama', $term)
->orLike('jabatan', $term)
->groupEnd()
->orderBy('nama', 'ASC')
->findAll(10);
$result = [];
foreach ($data as $row) {
$result[] = [
'id' => $row['id'],
'text' => $row['nama'] . ' - ' . $row['jabatan']
];
}
return $this->response->setJSON($result);
}
}
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace App\Controllers;
use App\Models\PasienModel;
class RmController extends BaseController
{
public function cek()
{
$rm = $this->request->getPost('rm');
$db = \Config\Database::connect();
$data = $db->table('pasien')
->where('rm', $rm)
->get()
->getRowArray();
if ($data) {
return $this->response->setJSON([
'status' => 'found',
'data' => $data
]);
}
return $this->response->setJSON([
'status' => 'not_found'
]);
}
public function search()
{
$q = $this->request->getPost('q');
$db = \Config\Database::connect();
$data = $db->table('pasien')
->like('rm', $q)
->orLike('nama', $q)
->limit(10)
->get()
->getResultArray();
return $this->response->setJSON([
'data' => $data
]);
}
public function link()
{
$rm = $this->request->getPost('rm');
$register_id = $this->request->getPost('register_id');
$db = \Config\Database::connect();
$db->table('register_ambulans')
->where('id', $register_id)
->update(['rm' => $rm]);
return $this->response->setJSON([
'status' => 'success'
]);
}
}
+341
View File
@@ -0,0 +1,341 @@
<?php
namespace App\Controllers;
use App\Models\PasienModel;
class Pasien extends BaseController
{
public function __construct()
{
$session = session();
// Jika belum login
if (!$session->get('logged_in')) {
header('Location: ' . base_url('login'));
exit;
}
$timeout = 600;
if (
$session->get('last_activity') &&
(time() - $session->get('last_activity')) > $timeout
) {
$session->remove([
'id',
'nama',
'username',
'role',
'logged_in',
'last_activity'
]);
$session->setFlashdata(
'error',
'Sesi Anda telah berakhir karena tidak ada aktivitas selama 10 menit.'
);
header('Location: ' . base_url('login'));
exit;
}
$session->set('last_activity', time());
}
public function login()
{
if (session()->get('logged_in')) {
return redirect()->to('/');
}
return view('auth/login');
}
public function dashboard()
{
$db = \Config\Database::connect();
$builder = $db->table('register_ambulans');
$data = [
'total' => (clone $builder)->countAllResults(),
'emergency' => (clone $builder)
->where('order_type', 'True Emergency')
->countAllResults(),
'non' => (clone $builder)
->where('order_type', 'Non Emergency')
->countAllResults(),
'pending' => (clone $builder)
->where('order_type', 'Pending Order')
->countAllResults(),
];
return view('dashboard', $data);
}
public function input()
{
$data['register'] = $this->generateRegister();
return view('input', $data);
}
public function aktif()
{
$db = \Config\Database::connect();
$builder = $db->table('register_ambulans r');
$builder->select('
r.id,
r.register,
r.rm,
r.order_type,
r.status,
r.fase,
r.prioritas,
r.created_at,
r.nama_penelpon,
r.no_penelpon,
p.nama,
p.gender,
p.alamat
');
$builder->join('pasien p', 'p.rm = r.rm', 'left');
$builder->orderBy('r.id', 'DESC');
$data['pasien'] = $builder->get()->getResultArray();
return view('pasien_aktif', $data);
}
public function next($id)
{
$db = \Config\Database::connect();
$builder = $db->table('register_ambulans');
$p = $builder->where('id', $id)->get()->getRowArray();
if (!$p) return redirect()->back();
$fase = $p['fase'] ?? 1;
if ($fase < 6) {
$fase++;
}
$status = ($fase == 6) ? 'Selesai' : 'Diproses';
$builder->where('id', $id)->update([
'fase' => $fase,
'status' => $status
]);
return redirect()->back();
}
public function create()
{
return view('pasien/create');
}
private function generateRegister()
{
$today = date('ymd');
$db = \Config\Database::connect();
$builder = $db->table('register_ambulans');
$builder->like('register', "AMB-$today", 'after');
$count = $builder->countAllResults();
$urutan = str_pad($count + 1, 3, '0', STR_PAD_LEFT);
return "AMB-$today-$urutan";
}
private function hitungUmur($tglLahir)
{
if (!$tglLahir) return '-';
$birth = new \DateTime($tglLahir);
$today = new \DateTime();
$umur = $today->diff($birth)->y;
return $umur . ' tahun';
}
public function simpan()
{
$db = \Config\Database::connect();
$rm = $this->request->getPost('no_rm');
if (empty($rm)) {
$rm = null;
}
// ================= CEK PASIEN =================
$pasien = null;
if ($rm) {
$pasien = $db->table('pasien')
->where('rm', $rm)
->get()
->getRowArray();
}
// ================= JIKA PASIEN BARU =================
if ($rm && !$pasien) {
$dataPasien = [
'rm' => $rm,
'atribut' => $this->request->getPost('panggilan_depan'),
'nama' => $this->request->getPost('nama'),
'gender' => $this->request->getPost('gender'),
'alamat' => $this->request->getPost('alamat'),
'tgl_lahir' => $this->request->getPost('tanggal_lahir'),
];
$db->table('pasien')->insert($dataPasien);
}
// ================= SIMPAN REGISTER =================
$dataRegister = [
'rm' => $rm,
'register' => $this->generateRegister(),
'order_type' => $this->request->getPost('order_type'),
'fase' => 1,
'status' => 'Predispatch',
];
$db->table('register_ambulans')->insert($dataRegister);
$registerId = $db->insertID();
$dataOrder = [
'register_id' => $registerId,
'nama_penelpon' => $this->request->getPost('nama_penelpon'),
'no_penelpon' => $this->request->getPost('no_penelpon'),
'kesadaran' => $this->request->getPost('kesadaran'),
'kategori' => $this->request->getPost('kategori'),
'pernafasan' => json_encode([
'sesak' => $this->request->getPost('sesak'),
'batuk' => $this->request->getPost('batuk'),
]),
'posisi' => json_encode([
'lokasi' => $this->request->getPost('posisi_pasien'),
'lainnya' => $this->request->getPost('posisi_lainnya')
]),
'keterbatasan' => $this->request->getPost('gerak'),
'nyeri' => json_encode([
'status' => $this->request->getPost('status_nyeri'),
'lokasi' => $this->request->getPost('lokasi_nyeri'),
'lain' => $this->request->getPost('nyeri_lain'),
]),
'suhu' => $this->request->getPost('suhu'),
'bahaya' => json_encode([
'status' => $this->request->getPost('bahaya'),
'detail' => $this->request->getPost('bahaya_detail')
]),
'berat_badan' => $this->request->getPost('berat_badan'),
'keluhan_utama' => $this->request->getPost('keluhan_utama'),
'tujuan' => $this->request->getPost('tujuan'),
'tujuan_detail' => $this->request->getPost('tujuan_detail'),
'persetujuan' => $this->request->getPost('persetujuan'),
'biaya' => $this->request->getPost('biaya'),
'validasi' => $this->request->getPost('validasi'),
'petugas_id' => $this->request->getPost('petugas_id'),
];
$db->table('pasien_order')->insert($dataOrder);
return redirect()->to('/pasien/aktif');
}
public function cekRM()
{
$model = new \App\Models\PasienModel();
$rm = $this->request->getPost('rm');
$data = $model->where('rm', $rm)->first();
if ($data) {
return $this->response->setJSON([
'status' => 'found',
'data' => $data
]);
}
return $this->response->setJSON([
'status' => 'not_found'
]);
}
public function linkRM()
{
$db = \Config\Database::connect();
$registerId = $this->request->getPost('register_id');
$rm = $this->request->getPost('rm');
$db->table('register_ambulans')
->where('id', $registerId)
->update(['rm' => $rm]);
return $this->response->setJSON([
'status' => 'success'
]);
}
public function search()
{
$q = $this->request->getPost('q');
$db = \Config\Database::connect();
$data = $db->table('pasien')
->like('rm', $q)
->orLike('nama', $q)
->limit(10)
->get()
->getResultArray();
return $this->response->setJSON([
'data' => $data
]);
}
public function predispatch($id)
{
$db = \Config\Database::connect();
// ================= REGISTER + PASIEN =================
$data['pasien'] = $db->table('register_ambulans r')
->select('r.*, p.nama, p.alamat, p.gender, p.tgl_lahir')
->join('pasien p', 'p.rm = r.rm', 'left')
->where('r.id', $id)
->get()
->getRowArray();
// ================= UMUR =================
$data['pasien']['umur'] = $this->hitungUmur($data['pasien']['tgl_lahir'] ?? null);
// ================= ORDER + PETUGAS =================
$order = $db->table('pasien_order o')
->select('o.*, pg.nama as petugas_nama')
->join('pegawai pg', 'pg.id = o.petugas_id', 'left')
->where('o.register_id', $id)
->get()
->getRowArray();
$data['order'] = $order ?? [];
return view('predispatch', $data);
}
}
View File
View File
View File
View File
View File
+4
View File
@@ -0,0 +1,4 @@
<?php
// override core en language system validation or define your own en language validation message
return [];
View File
View File
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PasienModel extends Model
{
protected $table = 'pasien';
protected $primaryKey = 'id';
protected $allowedFields = [
'rm',
'nama',
'tgl_lahir',
'gender',
'alamat'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
// 🔵 cari pasien berdasarkan RM
public function findByRM($rm)
{
return $this->where('rm', $rm)->first();
}
}
+16
View File
@@ -0,0 +1,16 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class PegawaiModel extends Model
{
protected $table = 'pegawai'; // nama tabel di database
protected $primaryKey = 'id';
protected $allowedFields = [
'nama',
'unit'
];
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class RegisterModel extends Model
{
protected $table = 'register_ambulans';
protected $primaryKey = 'id';
protected $allowedFields = [
'rm',
'register',
'order_type',
'status',
'fase',
'prioritas'
];
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class UserModel extends Model
{
protected $table = 'users';
protected $primaryKey = 'id';
protected $returnType = 'array';
protected $allowedFields = [
'nama',
'username',
'password',
'role'
];
}
View File
+79
View File
@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Login SiLARAS 119</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon"
href="https://raw.githubusercontent.com/ambulan119/inventarisambulans119/refs/heads/main/silarass2.ico">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
rel="stylesheet">
</head>
<body class="bg-light">
<div class="container">
<div class="row justify-content-center align-items-center vh-100">
<div class="col-md-4">
<div class="card shadow-lg border-0">
<div class="card-body p-4">
<div class="text-center mb-4">
<img src="https://raw.githubusercontent.com/ambulan119/inventarisambulans119/refs/heads/main/silarass2.ico"
width="80">
<h3 class="mt-3">SiLARAS 119</h3>
<p class="text-muted">Silakan login</p>
</div>
<?php if(session()->getFlashdata('error')): ?>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<?= session()->getFlashdata('error') ?>
<button type="button"
class="btn-close"
data-bs-dismiss="alert"></button>
</div>
<?php endif; ?>
<?php if(session()->getFlashdata('success')): ?>
<div class="alert alert-success alert-dismissible fade show" role="alert">
<?= session()->getFlashdata('success') ?>
<button type="button"
class="btn-close"
data-bs-dismiss="alert"></button>
</div>
<?php endif; ?>
<form action="<?= base_url('login') ?>" method="post">
<?= csrf_field() ?>
<div class="mb-3">
<label class="form-label">Username</label>
<input type="text"
name="username"
class="form-control"
required
autofocus>
</div>
<div class="mb-3">
<label class="form-label">Password</label>
<input type="password"
name="password"
class="form-control"
required>
</div>
<button type="submit"
class="btn btn-danger w-100">
Login
</button>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
+164
View File
@@ -0,0 +1,164 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>SiLARAS 119</title>
<link rel="icon" href="https://raw.githubusercontent.com/ambulan119/inventarisambulans119/refs/heads/main/silarass2.ico">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body{
min-height:100vh;
font-family:"Segoe UI",sans-serif;
color:#fff;
background:
linear-gradient(rgba(2,6,23,.85), rgba(2,6,23,.95)),
url("https://raw.githubusercontent.com/ambulan119/inventarisambulans119/refs/heads/main/silarasss.jpg")
center/cover no-repeat fixed;
}
.judul{text-align:center;margin-top:60px;}
.hero-logo{
width:90px;border-radius:16px;padding:6px;
background:rgba(255,255,255,.1);
box-shadow:0 0 15px rgba(34,211,238,.5);
}
.title-anim{
font-size:clamp(2.5rem,6vw,4rem);
font-weight:900;margin-top:15px;
}
.text-119{color:#ff1e1e;}
.subtitle-anim{opacity:.8;}
.menu-card{
border-radius:18px;padding:22px;text-align:center;
cursor:pointer;transition:.3s;
background:rgba(255,255,255,.06);
border:1px solid rgba(255,255,255,.1);
width:100%;height:100%;
display:flex;flex-direction:column;
justify-content:center;min-height:180px;
}
.menu-card:hover{
transform:translateY(-8px) scale(1.03);
box-shadow:0 0 25px rgba(0,255,200,.4);
}
.menu-icon{font-size:40px;margin-bottom:12px;}
.c1{color:#00d4ff;}
.c2{color:#00ff9d;}
.c3{color:#ffc107;}
.c4{color:#ff6b6b;}
.c5{color:#a29bfe;}
.c6{color:#00e5ff;}
.row-menu{margin-top:50px;}
.footer{text-align:center;margin-top:60px;opacity:.6;font-size:13px;}
</style>
</head>
<body>
<div class="container-fluid p-3 d-flex justify-content-between align-items-center">
<div class="text-white">
Selamat datang,
<strong><?= session('nama') ?></strong>
<span class="badge bg-info ms-2">
<?= strtoupper(session('role')) ?>
</span>
</div>
<a href="<?= base_url('logout') ?>" class="btn btn-danger">
Logout
</a>
</div>
<!-- HERO -->
<div class="container text-center judul">
<img src="https://raw.githubusercontent.com/ambulan119/inventarisambulans119/refs/heads/main/silarass2.ico" class="hero-logo">
<h1 class="title-anim">SiLARAS <span class="text-119">119</span></h1>
<p class="subtitle-anim">Sistem Laporan Aktivitas Respon Ambulans 119</p>
</div>
<!-- MENU -->
<div class="container">
<div class="row g-4 row-menu">
<div class="col-md-4 d-flex">
<div class="menu-card" onclick="maintenance()">
<div class="menu-icon c1">📋</div>
<h5>Laporan Kepala Jaga</h5>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="menu-card" onclick="maintenance()">
<div class="menu-icon c2">🧾</div>
<h5>E-Rekam Medik</h5>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="menu-card" onclick="window.location.href='/pasien/aktif'">
<div class="menu-icon c3">🚑</div>
<h5>Data Pasien Aktif</h5>
<p><?= $total ?? 0 ?> pasien aktif</p>
<div>
🚨 True Emergency: <?= $emergency ?? 0 ?><br>
👤 Non Emergency: <?= $non ?? 0 ?><br>
⏳ Pending Order: <?= $pending ?? 0 ?>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="menu-card" onclick="goExternal('https://ambulan119.github.io/inventarisambulans119/')">
<div class="menu-icon c4">📦</div>
<h5>Inventaris Ambulans</h5>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="menu-card" onclick="maintenance()">
<div class="menu-icon c5">🎪</div>
<h5>Siaga Event & Bencana</h5>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="menu-card" onclick="maintenance()">
<div class="menu-icon c6">🏃</div>
<h5>Endurance Exercise</h5>
</div>
</div>
</div>
</div>
<div class="footer">
© 2026 SiLARAS 119 | RSSA
</div>
<script>
function goExternal(url){
window.open(url, "_blank");
}
function maintenance(){
alert("Fitur masih dalam pengembangan 🚧");
}
</script>
</body>
</html>
+7
View File
@@ -0,0 +1,7 @@
<?php
use CodeIgniter\CLI\CLI;
CLI::error('ERROR: ' . $code);
CLI::write($message);
CLI::newLine();
+65
View File
@@ -0,0 +1,65 @@
<?php
use CodeIgniter\CLI\CLI;
// The main Exception
CLI::write('[' . $exception::class . ']', 'light_gray', 'red');
CLI::write($message);
CLI::write('at ' . CLI::color(clean_path($exception->getFile()) . ':' . $exception->getLine(), 'green'));
CLI::newLine();
$last = $exception;
while ($prevException = $last->getPrevious()) {
$last = $prevException;
CLI::write(' Caused by:');
CLI::write(' [' . $prevException::class . ']', 'red');
CLI::write(' ' . $prevException->getMessage());
CLI::write(' at ' . CLI::color(clean_path($prevException->getFile()) . ':' . $prevException->getLine(), 'green'));
CLI::newLine();
}
// The backtrace
if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
$backtraces = $last->getTrace();
if ($backtraces) {
CLI::write('Backtrace:', 'green');
}
foreach ($backtraces as $i => $error) {
$padFile = ' '; // 4 spaces
$padClass = ' '; // 7 spaces
$c = str_pad($i + 1, 3, ' ', STR_PAD_LEFT);
if (isset($error['file'])) {
$filepath = clean_path($error['file']) . ':' . $error['line'];
CLI::write($c . $padFile . CLI::color($filepath, 'yellow'));
} else {
CLI::write($c . $padFile . CLI::color('[internal function]', 'yellow'));
}
$function = '';
if (isset($error['class'])) {
$type = ($error['type'] === '->') ? '()' . $error['type'] : $error['type'];
$function .= $padClass . $error['class'] . $type . $error['function'];
} elseif (! isset($error['class']) && isset($error['function'])) {
$function .= $padClass . $error['function'];
}
$args = implode(', ', array_map(static fn ($value): string => match (true) {
is_object($value) => 'Object(' . $value::class . ')',
is_array($value) => $value !== [] ? '[...]' : '[]',
$value === null => 'null', // return the lowercased version
default => var_export($value, true),
}, array_values($error['args'] ?? [])));
$function .= '(' . $args . ')';
CLI::write($function);
CLI::newLine();
}
}
+5
View File
@@ -0,0 +1,5 @@
<?php
// On the CLI, we still want errors in productions
// so just use the exception template.
include __DIR__ . '/error_exception.php';
+194
View File
@@ -0,0 +1,194 @@
:root {
--main-bg-color: #fff;
--main-text-color: #555;
--dark-text-color: #222;
--light-text-color: #c7c7c7;
--brand-primary-color: #DC4814;
--light-bg-color: #ededee;
--dark-bg-color: #404040;
}
body {
height: 100%;
background: var(--main-bg-color);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
color: var(--main-text-color);
font-weight: 300;
margin: 0;
padding: 0;
}
h1 {
font-weight: lighter;
font-size: 3rem;
color: var(--dark-text-color);
margin: 0;
}
h1.headline {
margin-top: 20%;
font-size: 5rem;
}
.text-center {
text-align: center;
}
p.lead {
font-size: 1.6rem;
}
.container {
max-width: 75rem;
margin: 0 auto;
padding: 1rem;
}
.header {
background: var(--light-bg-color);
color: var(--dark-text-color);
margin-top: 2.17rem;
}
.header .container {
padding: 1rem;
}
.header h1 {
font-size: 2.5rem;
font-weight: 500;
}
.header p {
font-size: 1.2rem;
margin: 0;
line-height: 2.5;
}
.header a {
color: var(--brand-primary-color);
margin-left: 2rem;
display: none;
text-decoration: none;
}
.header:hover a {
display: inline;
}
.environment {
background: var(--brand-primary-color);
color: var(--main-bg-color);
text-align: center;
padding: calc(4px + 0.2083vw);
width: 100%;
top: 0;
position: fixed;
}
.source {
background: #343434;
color: var(--light-text-color);
padding: 0.5em 1em;
border-radius: 5px;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
font-size: 0.85rem;
margin: 0;
overflow-x: scroll;
}
.source span.line {
line-height: 1.4;
}
.source span.line .number {
color: #666;
}
.source .line .highlight {
display: block;
background: var(--dark-text-color);
color: var(--light-text-color);
}
.source span.highlight .number {
color: #fff;
}
.tabs {
list-style: none;
list-style-position: inside;
margin: 0;
padding: 0;
margin-bottom: -1px;
}
.tabs li {
display: inline;
}
.tabs a:link,
.tabs a:visited {
padding: 0 1rem;
line-height: 2.7;
text-decoration: none;
color: var(--dark-text-color);
background: var(--light-bg-color);
border: 1px solid rgba(0,0,0,0.15);
border-bottom: 0;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
display: inline-block;
}
.tabs a:hover {
background: var(--light-bg-color);
border-color: rgba(0,0,0,0.15);
}
.tabs a.active {
background: var(--main-bg-color);
color: var(--main-text-color);
}
.tab-content {
background: var(--main-bg-color);
border: 1px solid rgba(0,0,0,0.15);
}
.content {
padding: 1rem;
}
.hide {
display: none;
}
.alert {
margin-top: 2rem;
display: block;
text-align: center;
line-height: 3.0;
background: #d9edf7;
border: 1px solid #bcdff1;
border-radius: 5px;
color: #31708f;
}
table {
width: 100%;
overflow: hidden;
}
th {
text-align: left;
border-bottom: 1px solid #e7e7e7;
padding-bottom: 0.5rem;
}
td {
padding: 0.2rem 0.5rem 0.2rem 0;
}
tr:hover td {
background: #f1f1f1;
}
td pre {
white-space: pre-wrap;
}
.trace a {
color: inherit;
}
.trace table {
width: auto;
}
.trace tr td:first-child {
min-width: 5em;
font-weight: bold;
}
.trace td {
background: var(--light-bg-color);
padding: 0 1rem;
}
.trace td pre {
margin: 0;
}
.args {
display: none;
}
+116
View File
@@ -0,0 +1,116 @@
var tabLinks = new Array();
var contentDivs = new Array();
function init()
{
// Grab the tab links and content divs from the page
var tabListItems = document.getElementById('tabs').childNodes;
console.log(tabListItems);
for (var i = 0; i < tabListItems.length; i ++)
{
if (tabListItems[i].nodeName == "LI")
{
var tabLink = getFirstChildWithTagName(tabListItems[i], 'A');
var id = getHash(tabLink.getAttribute('href'));
tabLinks[id] = tabLink;
contentDivs[id] = document.getElementById(id);
}
}
// Assign onclick events to the tab links, and
// highlight the first tab
var i = 0;
for (var id in tabLinks)
{
tabLinks[id].onclick = showTab;
tabLinks[id].onfocus = function () {
this.blur()
};
if (i == 0)
{
tabLinks[id].className = 'active';
}
i ++;
}
// Hide all content divs except the first
var i = 0;
for (var id in contentDivs)
{
if (i != 0)
{
console.log(contentDivs[id]);
contentDivs[id].className = 'content hide';
}
i ++;
}
}
function showTab()
{
var selectedId = getHash(this.getAttribute('href'));
// Highlight the selected tab, and dim all others.
// Also show the selected content div, and hide all others.
for (var id in contentDivs)
{
if (id == selectedId)
{
tabLinks[id].className = 'active';
contentDivs[id].className = 'content';
}
else
{
tabLinks[id].className = '';
contentDivs[id].className = 'content hide';
}
}
// Stop the browser following the link
return false;
}
function getFirstChildWithTagName(element, tagName)
{
for (var i = 0; i < element.childNodes.length; i ++)
{
if (element.childNodes[i].nodeName == tagName)
{
return element.childNodes[i];
}
}
}
function getHash(url)
{
var hashPos = url.lastIndexOf('#');
return url.substring(hashPos + 1);
}
function toggle(elem)
{
elem = document.getElementById(elem);
if (elem.style && elem.style['display'])
{
// Only works with the "style" attr
var disp = elem.style['display'];
}
else if (elem.currentStyle)
{
// For MSIE, naturally
var disp = elem.currentStyle['display'];
}
else if (window.getComputedStyle)
{
// For most other browsers
var disp = document.defaultView.getComputedStyle(elem, null).getPropertyValue('display');
}
// Toggle the state of the "display" style
elem.style.display = disp == 'block' ? 'none' : 'block';
return false;
}
+84
View File
@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= lang('Errors.badRequest') ?></title>
<style>
div.logo {
height: 200px;
width: 155px;
display: inline-block;
opacity: 0.08;
position: absolute;
top: 2rem;
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: normal;
font-size: 3rem;
margin-top: 0;
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
padding: 2rem;
background: #fff;
text-align: center;
border: 1px solid #efefef;
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
padding: 0.5rem 1rem;
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
padding: 1em 2em 0 2em;
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
</head>
<body>
<div class="wrap">
<h1>400</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryBadRequest') ?>
<?php endif; ?>
</p>
</div>
</body>
</html>
+84
View File
@@ -0,0 +1,84 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title><?= lang('Errors.pageNotFound') ?></title>
<style>
div.logo {
height: 200px;
width: 155px;
display: inline-block;
opacity: 0.08;
position: absolute;
top: 2rem;
left: 50%;
margin-left: -73px;
}
body {
height: 100%;
background: #fafafa;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
color: #777;
font-weight: 300;
}
h1 {
font-weight: lighter;
letter-spacing: normal;
font-size: 3rem;
margin-top: 0;
margin-bottom: 0;
color: #222;
}
.wrap {
max-width: 1024px;
margin: 5rem auto;
padding: 2rem;
background: #fff;
text-align: center;
border: 1px solid #efefef;
border-radius: 0.5rem;
position: relative;
}
pre {
white-space: normal;
margin-top: 1.5rem;
}
code {
background: #fafafa;
border: 1px solid #efefef;
padding: 0.5rem 1rem;
border-radius: 5px;
display: block;
}
p {
margin-top: 1.5rem;
}
.footer {
margin-top: 2rem;
border-top: 1px solid #efefef;
padding: 1em 2em 0 2em;
font-size: 85%;
color: #999;
}
a:active,
a:link,
a:visited {
color: #dd4814;
}
</style>
</head>
<body>
<div class="wrap">
<h1>404</h1>
<p>
<?php if (ENVIRONMENT !== 'production') : ?>
<?= nl2br(esc($message)) ?>
<?php else : ?>
<?= lang('Errors.sorryCannotFind') ?>
<?php endif; ?>
</p>
</div>
</body>
</html>
+429
View File
@@ -0,0 +1,429 @@
<?php
use CodeIgniter\HTTP\Header;
use CodeIgniter\CodeIgniter;
$errorId = uniqid('error', true);
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= esc($title) ?></title>
<style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
<script>
<?= file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.js') ?>
</script>
</head>
<body onload="init()">
<!-- Header -->
<div class="header">
<div class="environment">
Displayed at <?= esc(date('H:i:s')) ?> &mdash;
PHP: <?= esc(PHP_VERSION) ?> &mdash;
CodeIgniter: <?= esc(CodeIgniter::CI_VERSION) ?> --
Environment: <?= ENVIRONMENT ?>
</div>
<div class="container">
<h1><?= esc($title), esc($exception->getCode() ? ' #' . $exception->getCode() : '') ?></h1>
<p>
<?= nl2br(esc($exception->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode($title . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $exception->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
</p>
</div>
</div>
<!-- Source -->
<div class="container">
<p><b><?= esc(clean_path($file)) ?></b> at line <b><?= esc($line) ?></b></p>
<?php if (is_file($file)) : ?>
<div class="source">
<?= static::highlightFile($file, $line, 15); ?>
</div>
<?php endif; ?>
</div>
<div class="container">
<?php
$last = $exception;
while ($prevException = $last->getPrevious()) {
$last = $prevException;
?>
<pre>
Caused by:
<?= esc($prevException::class), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
<?= nl2br(esc($prevException->getMessage())) ?>
<a href="https://www.duckduckgo.com/?q=<?= urlencode($prevException::class . ' ' . preg_replace('#\'.*\'|".*"#Us', '', $prevException->getMessage())) ?>"
rel="noreferrer" target="_blank">search &rarr;</a>
<?= esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
</pre>
<?php
}
?>
</div>
<?php if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) : ?>
<div class="container">
<ul class="tabs" id="tabs">
<li><a href="#backtrace">Backtrace</a></li>
<li><a href="#server">Server</a></li>
<li><a href="#request">Request</a></li>
<li><a href="#response">Response</a></li>
<li><a href="#files">Files</a></li>
<li><a href="#memory">Memory</a></li>
</ul>
<div class="tab-content">
<!-- Backtrace -->
<div class="content" id="backtrace">
<ol class="trace">
<?php foreach ($trace as $index => $row) : ?>
<li>
<p>
<!-- Trace info -->
<?php if (isset($row['file']) && is_file($row['file'])) : ?>
<?php
if (isset($row['function']) && in_array($row['function'], ['include', 'include_once', 'require', 'require_once'], true)) {
echo esc($row['function'] . ' ' . clean_path($row['file']));
} else {
echo esc(clean_path($row['file']) . ' : ' . $row['line']);
}
?>
<?php else: ?>
{PHP internal code}
<?php endif; ?>
<!-- Class/Method -->
<?php if (isset($row['class'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp;<?= esc($row['class'] . $row['type'] . $row['function']) ?>
<?php if (! empty($row['args'])) : ?>
<?php $argsId = $errorId . 'args' . $index ?>
( <a href="#" onclick="return toggle('<?= esc($argsId, 'attr') ?>');">arguments</a> )
<div class="args" id="<?= esc($argsId, 'attr') ?>">
<table cellspacing="0">
<?php
$params = null;
// Reflection by name is not available for closure function
if (! str_ends_with($row['function'], '}')) {
$mirror = isset($row['class']) ? new ReflectionMethod($row['class'], $row['function']) : new ReflectionFunction($row['function']);
$params = $mirror->getParameters();
}
foreach ($row['args'] as $key => $value) : ?>
<tr>
<td><code><?= esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?></code></td>
<td><pre><?= esc(print_r($value, true)) ?></pre></td>
</tr>
<?php endforeach ?>
</table>
</div>
<?php else : ?>
()
<?php endif; ?>
<?php endif; ?>
<?php if (! isset($row['class']) && isset($row['function'])) : ?>
&nbsp;&nbsp;&mdash;&nbsp;&nbsp; <?= esc($row['function']) ?>()
<?php endif; ?>
</p>
<!-- Source? -->
<?php if (isset($row['file']) && is_file($row['file']) && isset($row['class'])) : ?>
<div class="source">
<?= static::highlightFile($row['file'], $row['line']) ?>
</div>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ol>
</div>
<!-- Server -->
<div class="content" id="server">
<?php foreach (['_SERVER', '_SESSION'] as $var) : ?>
<?php
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
continue;
} ?>
<h3>$<?= esc($var) ?></h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<!-- Constants -->
<?php $constants = get_defined_constants(true); ?>
<?php if (! empty($constants['user'])) : ?>
<h3>Constants</h3>
<table>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($constants['user'] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Request -->
<div class="content" id="request">
<?php $request = service('request'); ?>
<table>
<tbody>
<tr>
<td style="width: 10em">Path</td>
<td><?= esc($request->getUri()) ?></td>
</tr>
<tr>
<td>HTTP Method</td>
<td><?= esc($request->getMethod()) ?></td>
</tr>
<tr>
<td>IP Address</td>
<td><?= esc($request->getIPAddress()) ?></td>
</tr>
<tr>
<td style="width: 10em">Is AJAX Request?</td>
<td><?= $request->isAJAX() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is CLI Request?</td>
<td><?= $request->isCLI() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>Is Secure Request?</td>
<td><?= $request->isSecure() ? 'yes' : 'no' ?></td>
</tr>
<tr>
<td>User Agent</td>
<td><?= esc($request->getUserAgent()->getAgentString()) ?></td>
</tr>
</tbody>
</table>
<?php $empty = true; ?>
<?php foreach (['_GET', '_POST', '_COOKIE'] as $var) : ?>
<?php
if (empty($GLOBALS[$var]) || ! is_array($GLOBALS[$var])) {
continue;
} ?>
<?php $empty = false; ?>
<h3>$<?= esc($var) ?></h3>
<table style="width: 100%">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($GLOBALS[$var] as $key => $value) : ?>
<tr>
<td><?= esc($key) ?></td>
<td>
<?php if (is_string($value)) : ?>
<?= esc($value) ?>
<?php else: ?>
<pre><?= esc(print_r($value, true)) ?></pre>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endforeach ?>
<?php if ($empty) : ?>
<div class="alert">
No $_GET, $_POST, or $_COOKIE Information to show.
</div>
<?php endif; ?>
<?php $headers = $request->headers(); ?>
<?php if (! empty($headers)) : ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($headers as $name => $value) : ?>
<tr>
<td><?= esc($name, 'html') ?></td>
<td>
<?php
if ($value instanceof Header) {
echo esc($value->getValueLine(), 'html');
} else {
foreach ($value as $i => $header) {
echo ' ('. $i+1 . ') ' . esc($header->getValueLine(), 'html');
}
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Response -->
<?php
$response = service('response');
$response->setStatusCode(http_response_code());
?>
<div class="content" id="response">
<table>
<tr>
<td style="width: 15em">Response Status</td>
<td><?= esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?></td>
</tr>
</table>
<?php $headers = $response->headers(); ?>
<?php if (! empty($headers)) : ?>
<h3>Headers</h3>
<table>
<thead>
<tr>
<th>Header</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<?php foreach ($headers as $name => $value) : ?>
<tr>
<td><?= esc($name, 'html') ?></td>
<td>
<?php
if ($value instanceof Header) {
echo esc($response->getHeaderLine($name), 'html');
} else {
foreach ($value as $i => $header) {
echo ' ('. $i+1 . ') ' . esc($header->getValueLine(), 'html');
}
}
?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
<!-- Files -->
<div class="content" id="files">
<?php $files = get_included_files(); ?>
<ol>
<?php foreach ($files as $file) :?>
<li><?= esc(clean_path($file)) ?></li>
<?php endforeach ?>
</ol>
</div>
<!-- Memory -->
<div class="content" id="memory">
<table>
<tbody>
<tr>
<td>Memory Usage</td>
<td><?= esc(static::describeMemory(memory_get_usage(true))) ?></td>
</tr>
<tr>
<td style="width: 12em">Peak Memory Usage:</td>
<td><?= esc(static::describeMemory(memory_get_peak_usage(true))) ?></td>
</tr>
<tr>
<td>Memory Limit:</td>
<td><?= esc(ini_get('memory_limit')) ?></td>
</tr>
</tbody>
</table>
</div>
</div> <!-- /tab-content -->
</div> <!-- /container -->
<?php endif; ?>
</body>
</html>
+25
View File
@@ -0,0 +1,25 @@
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex">
<title><?= lang('Errors.whoops') ?></title>
<style>
<?= preg_replace('#[\r\n\t ]+#', ' ', file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . 'debug.css')) ?>
</style>
</head>
<body>
<div class="container text-center">
<h1 class="headline"><?= lang('Errors.whoops') ?></h1>
<p class="lead"><?= lang('Errors.weHitASnag') ?></p>
</div>
</body>
</html>
+936
View File
@@ -0,0 +1,936 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Form Input Pasien Ambulans Emergensi 119 RSSA</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background-color: #f8f9fa;
padding: 2rem;
}
.form-label {
font-weight: 500;
}
#inputTujuanContainer {
display: none;
}
.perawat-wrapper {
position: relative;
margin-bottom: 1rem;
}
.hapus-perawat-btn {
position: absolute;
top: 4px;
right: 8px;
font-size: 16px;
color: #dc3545;
background: none;
border: none;
cursor: pointer;
}
.hapus-perawat-btn:hover {
color: #a71d2a;
}
</style>
</head>
<body>
<div class="container py-5">
<div class="card shadow p-4">
<h4 class="mb-4 text-primary">
🚑 Form Input Pasien Ambulans Emergensi 119 RSSA
</h4>
<!-- FORM START -->
<form id="formPasien" method="post" action="<?= base_url('pasien/simpan') ?>">
<?= csrf_field(); ?>
<!-- ================= HEADER ================= -->
<div class="row mb-3">
<div class="col-md-2">
<label class="form-label">Tanggal & Jam</label>
<input
type="datetime-local"
id="tanggal"
name="tanggal"
class="form-control">
</div>
<div class="col-md-2">
<label class="form-label">Register Ambulans</label>
<input
type="text"
class="form-control"
name="register"
value="<?= $register ?>"
readonly>
</div>
<div class="col-md-2 position-relative">
<label class="form-label">No RM</label>
<div class="input-group">
<input
type="text"
id="noRM"
name="no_rm"
class="form-control"
placeholder="Ketik RM"
>
<button type="button" class="btn btn-primary" onclick="searchRM()">
🔍
</button>
</div>
<div id="rmResult" class="list-group position-absolute w-100 z-3"></div>
</div>
<div class="col-md-3">
<label class="form-label">Nama Penelpon</label>
<input
type="text"
class="form-control"
id="penelpon"
name="nama_penelpon"
placeholder="Nama penelpon">
</div>
<div class="col-md-3">
<label class="form-label">No. Penelpon</label>
<input
type="tel"
class="form-control"
id="no_penelpon"
name="no_penelpon"
placeholder="08xxxx">
</div>
</div>
<!-- ================= IDENTITAS ================= -->
<div class="row mb-3">
<div class="col-md-2">
<label class="form-label">Atribut</label>
<select class="form-select" id="panggilanDepan" name="panggilan_depan">
<option>...</option>
<option>By.</option>
<option>An.</option>
<option>Sdr.</option>
<option>Nn.</option>
<option>Tn.</option>
<option>Ny.</option>
</select>
</div>
<div class="col-md-4">
<label class="form-label">Nama Pasien</label>
<input type="text" class="form-control" id="nama" name="nama">
</div>
<div class="col-md-2">
<label class="form-label">JK</label>
<select class="form-select" id="gender" name="gender">
<option>...</option>
<option>Laki-laki</option>
<option>Perempuan</option>
</select>
</div>
<div class="col-md-2">
<label class="form-label">Tanggal Lahir</label>
<input type="date" id="tanggalLahir" class="form-control" name="tanggal_lahir">
</div>
<div class="col-md-2">
<label class="form-label">Umur</label>
<input type="text" id="umur" class="form-control" name="umur" readonly>
</div>
</div>
<!-- ================= ALAMAT + POSISI ================= -->
<div class="row mb-3">
<!-- ALAMAT (kiri) -->
<div class="col-md-6">
<label class="form-label">Alamat</label>
<textarea id="alamat" name="alamat" class="form-control" rows="4"></textarea>
</div>
<!-- POSISI PASIEN (kanan) -->
<div class="col-md-6">
<!-- HEADER: Judul kiri, Lantai kanan -->
<div class="d-flex justify-content-between align-items-center mb-2">
<label class="form-label mb-0">
Posisi Pasien (Saat Ditemukan)
</label>
<div class="d-flex align-items-center">
<label for="lantai" class="me-2 mb-0">Lantai</label>
<select id="lantai" name="lantai" class="form-select form-select-sm">
<option value="">Pilih</option>
<?php for($i = 1; $i <= 50; $i++): ?>
<option value="<?= $i ?>">Lantai <?= $i ?></option>
<?php endfor; ?>
</select>
</div>
</div>
<!-- CHECKBOX -->
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tidur" name="posisi_pasien[]" value="kamar_tidur">
<label class="form-check-label" for="tidur">Di Kamar Tidur</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="tamu" name="posisi_pasien[]" value="ruang_tamu">
<label class="form-check-label" for="tamu">Di Ruang Tamu</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" id="mandi" name="posisi_pasien[]" value="kamar_mandi">
<label class="form-check-label" for="mandi">Di Kamar Mandi</label>
</div>
<div class="d-flex align-items-center mb-2">
<input
class="form-check-input me-2"
type="checkbox"
id="ruanglain"
name="posisi_pasien[]"
value="lainnya"
onchange="toggleInputRuangLain()">
<label class="form-check-label me-2" for="ruanglain">
Di Ruang Lain:
</label>
<input
type="text"
id="inputRuangLain"
name="posisi_lainnya"
class="form-control form-control-sm w-50"
placeholder="Sebutkan..."
disabled>
</div>
</div>
<div class="row mb-3">
<!-- Keluhan Utama -->
<div class="col-md-12">
<label class="form-label">Keluhan Utama</label>
<textarea
class="form-control"
name="keluhan_utama"
rows="2"
placeholder="Contoh: sesak napas, nyeri dada, kecelakaan, dll"></textarea>
</div>
</div>
<div class="row mb-3">
<!-- 1. Kesadaran -->
<div class="col-md-4">
<label class="form-label">Kesadaran</label>
<select class="form-select" id="kesadaran" name="kesadaran">
<option>...</option>
<option>Sadar</option>
<option>Tidak Sadar</option>
<option>Gelisah</option>
</select>
</div>
<!-- 2. Kategori -->
<div class="col-md-4">
<label class="form-label">Kategori</label>
<select class="form-select" id="kategori" name="kategori">
<option value="">...</option>
<option value="Trauma">Trauma</option>
<option value="Non Trauma">Non Trauma</option>
</select>
</div>
<!-- 3. Order Type -->
<div class="col-md-4">
<label class="form-label">Order Type</label>
<select class="form-select" id="orderType" name="order_type">
<option value="Pending Order">🟢 Pending Order</option>
<option value="Non Emergency">🟡 Non Emergency</option>
<option value="True Emergency">🔴 True Emergency</option>
</select>
</div>
</div>
<div class="row g-3">
<!-- KIRI: PERNAFASAN + SUHU + BAHAYA -->
<div class="col-md-3">
<div class="border rounded p-3 h-100">
<!-- Pernafasan -->
<label class="fw-bold">Pernafasan</label>
<!-- SESAK -->
<div class="mt-2">
<div class="d-flex gap-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="sesak" value="ya" id="sesakYa">
<label class="form-check-label" for="sesakYa">Sesak</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="sesak" value="tidak" id="sesakTidak">
<label class="form-check-label" for="sesakTidak">Tidak Sesak</label>
</div>
</div>
</div>
<!-- BATUK -->
<div class="mt-2">
<div class="d-flex gap-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="batuk" value="ya" id="batukYa">
<label class="form-check-label" for="batukYa">Batuk</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="batuk" value="tidak" id="batukTidak">
<label class="form-check-label" for="batukTidak">Tidak Batuk</label>
</div>
</div>
</div>
<!-- Suhu -->
<label class="fw-bold">Suhu Tubuh</label>
<div class="d-flex gap-3 mt-2 mb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="suhu" value="demam" id="demam">
<label class="form-check-label" for="demam">Demam</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="suhu" value="tidak_demam" id="tidak_demam">
<label class="form-check-label" for="tidak_demam">Tidak</label>
</div>
</div>
<!-- Bahaya -->
<label class="fw-bold">Kondisi Bahaya</label>
<div class="d-flex gap-3 mt-2">
<div class="form-check">
<input class="form-check-input" type="radio" name="bahaya" value="ada" id="bahayaAda">
<label class="form-check-label" for="bahayaAda">Ada</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="bahaya" value="tidak" id="bahayaTidakAda" checked>
<label class="form-check-label" for="bahayaTidakAda">Tidak</label>
</div>
</div>
<!-- DETAIL (selalu tampil, tapi disabled) -->
<div id="bahayaInputDiv" class="mt-2 opacity-50">
<input type="text"
class="form-control"
name="bahaya_detail"
placeholder="Jenis bahaya..."
disabled>
</div>
</div>
</div>
<!-- TENGAH: KETERBATASAN GERAK -->
<div class="col-md-3">
<div class="border rounded p-3 h-100">
<label class="form-label fw-bold">Keterbatasan Gerak</label>
<div class="d-flex flex-column gap-2 mt-2">
<div class="form-check">
<input class="form-check-input" type="radio" name="gerak" value="tangan">
<label class="form-check-label">Tangan</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="gerak" value="kaki">
<label class="form-check-label">Kaki</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="gerak" value="semua">
<label class="form-check-label">Semua Anggota Gerak</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="gerak" value="normal">
<label class="form-check-label">Tidak Ada Keterbatasan</label>
</div>
</div>
<!-- Berat Badan -->
<label class="fw-bold">Berat Badan</label>
<div class="input-group mt-2 mb-3">
<input type="number" class="form-control" id="beratBadan" name="berat_badan" placeholder="Berat badan pasien">
<span class="input-group-text">Kg</span>
</div>
</div>
</div>
<!-- KANAN: NYERI -->
<div class="col-md-6">
<div class="border rounded p-3 h-100">
<label class="form-label fw-bold">Nyeri / Luka</label>
<!-- RADIO -->
<div class="d-flex gap-3 mt-2 mb-2">
<div class="form-check">
<input class="form-check-input" type="radio" name="status_nyeri" id="adaNyeri" value="ya">
<label class="form-check-label" for="adaNyeri">Nyeri</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="status_nyeri" id="tidakNyeri" value="tidak" checked>
<label class="form-check-label" for="tidakNyeri">Tidak Nyeri</label>
</div>
</div>
<!-- DETAIL (selalu tampil, tapi default nonaktif) -->
<div id="detailNyeri" class="opacity-50">
<label class="form-label fw-semibold mb-2">Lokasi Nyeri</label>
<div class="row row-cols-2 row-cols-md-4 g-2">
<?php
$lokasi = ['kepala','leher','dada','punggung','perut','panggul','tangan','kaki'];
foreach($lokasi as $l): ?>
<div class="col">
<div class="form-check">
<input class="form-check-input"
type="checkbox"
name="lokasi_nyeri[]"
value="<?= $l ?>"
id="nyeri_<?= $l ?>"
disabled>
<label class="form-check-label" for="nyeri_<?= $l ?>">
<?= ucfirst($l) ?>
</label>
</div>
</div>
<?php endforeach; ?>
</div>
<input type="text" name="nyeri_lain" class="form-control mt-3"
placeholder="Lain-lain..." disabled>
</div>
</div>
</div>
<!-- Informasi Lain -->
<div class="row mt-3">
<div class="col-md-12">
<label class="form-label">Informasi Lain</label>
<input
type="text"
class="form-control"
name="informasi_lain"
placeholder="Contoh: alergi obat, kondisi khusus, permintaan khusus, Peralatan Khusus, dll">
</div>
</div>
</div>
<!-- ================= TUJUAN ================= -->
<div class="row mt-3 g-3">
<!-- TUJUAN -->
<div class="col-md-5">
<div class="border rounded p-3 h-100">
<label for="tujuan" class="form-label fw-bold">🎯 Tujuan</label>
<select class="form-select" id="tujuan" name="tujuan">
<option value="">-- Pilih Tujuan --</option>
<option value="RFDK">RFDK Rumah ke Faskes Dalam Kota</option>
<option value="F-FDK">F-FDK Fasilitas Umum ke Faskes Dalam Kota</option>
<option value="AFDK">AFDK Antar Faskes Dalam Kota</option>
<option value="AFLK">AFLK Antar Faskes Luar Kota</option>
<option value="PDK">PDK Pulang Dalam Kota</option>
<option value="PLK">PLK Pulang Luar Kota</option>
</select>
<div class="mt-3">
<label class="form-label small">Detail Tujuan</label>
<input
type="text"
class="form-control"
name="tujuan_detail"
placeholder="Nama RS / alamat / keterangan">
</div>
</div>
</div>
<!-- PERSETUJUAN BIAYA -->
<div class="col-md-3">
<div class="border rounded p-3 h-100">
<label class="form-label fw-bold">Persetujuan Biaya</label>
<div class="d-flex gap-3 mt-2 mb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="persetujuan" value="setuju">
<label class="form-check-label">Setuju</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="persetujuan" value="tidak">
<label class="form-check-label">Tidak</label>
</div>
</div>
<label class="form-label small">Nominal Biaya</label>
<div class="input-group">
<span class="input-group-text">Rp</span>
<input
type="number"
class="form-control"
name="biaya"
placeholder="Masukkan nominal">
</div>
</div>
</div>
<!-- VALIDASI + PETUGAS -->
<div class="col-md-4">
<div class="border rounded p-3 h-100">
<label class="form-label fw-bold">Validasi Pelayanan</label>
<input
type="text"
class="form-control mt-2 mb-3"
name="validasi"
placeholder="Valid / Tidak Valid">
<!-- PETUGAS (SELECT) -->
<label class="form-label small">Petugas Penerima</label>
<select id="petugas" name="petugas_id" style="width:100%"></select>
</div>
</div>
</div>
<!-- ================= BUTTON ================= -->
<div class="d-flex justify-content-between mt-4">
<button type="button" class="btn btn-secondary" onclick="location.reload()">
Reset
</button>
<button type="submit" id="btnSubmit" class="btn btn-success">
Simpan Pasien
</button>
</div>
</form>
<!-- FORM END -->
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/select2.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/select2.min.js"></script>
<script>
let isSubmitting = false;
document.getElementById('formPasien').addEventListener('submit', function(e){
if(isSubmitting){
e.preventDefault();
return;
}
if(!confirm("Yakin simpan data pasien?")){
e.preventDefault();
return;
}
isSubmitting = true;
const btn = document.getElementById('btnSubmit');
if(btn){
btn.disabled = true;
btn.innerText = 'Menyimpan...';
}
});
window.addEventListener('pageshow', function () {
const btn = document.getElementById('btnSubmit');
if(btn){
btn.disabled = false;
btn.innerText = 'Simpan Pasien';
}
isSubmitting = false;
});
$(document).ready(function() {
$('#petugas').select2({
width: '100%',
placeholder: 'Ketik nama petugas...',
minimumInputLength: 2,
ajax: {
url: '/pegawai/search',
dataType: 'json',
delay: 300,
data: function (params) {
return { q: params.term };
},
processResults: function (data) {
return {
results: data
};
}
}
});
// ================= TOGGLE RADIO (ENABLE / DISABLE) =================
function toggleByRadio(name, targetId, activeValue) {
const radios = document.querySelectorAll(`input[name="${name}"]`);
const target = document.getElementById(targetId);
radios.forEach(el => {
el.addEventListener("change", function () {
const aktif = this.value === activeValue;
// enable / disable semua input di dalam target
target.querySelectorAll('input').forEach(input => {
input.disabled = !aktif;
});
// efek visual (abu kalau nonaktif)
target.classList.toggle('opacity-50', !aktif);
});
});
}
toggleByRadio("status_nyeri", "detailNyeri", "ya");
toggleByRadio("bahaya", "bahayaInputDiv", "ada");
document.querySelectorAll('input[type="radio"]:checked')
.forEach(el => el.dispatchEvent(new Event('change')));
document.getElementById('noRM').addEventListener('input', searchRM);
});
// ================= auto umur =================
document.getElementById('tanggalLahir')
.addEventListener('change', hitungUmur);
function hitungUmur()
{
const val = document.getElementById('tanggalLahir').value;
if(!val) {
document.getElementById('umur').value = '';
return;
}
const lahir = new Date(val);
const today = new Date();
if(isNaN(lahir.getTime())) {
document.getElementById('umur').value = '';
return;
}
let tahun = today.getFullYear() - lahir.getFullYear();
let bulan = today.getMonth() - lahir.getMonth();
let hari = today.getDate() - lahir.getDate();
if (hari < 0) {
bulan--;
const lastMonth = new Date(today.getFullYear(), today.getMonth(), 0);
hari += lastMonth.getDate();
}
if (bulan < 0) {
tahun--;
bulan += 12;
}
document.getElementById('umur').value =
`${tahun} Th ${bulan} Bln ${hari} Hr`;
}
function toggleInputRuangLain(){
const check = document.getElementById('ruanglain');
const input = document.getElementById('inputRuangLain');
input.disabled = !check.checked;
if(!check.checked) input.value = '';
}
// ================= Fungsi Modal RM =================
let currentRegisterId = null;
function openCekRM(){
currentRegisterId = null;
new bootstrap.Modal(document.getElementById('modalCekRM')).show();
}
function cekRM(){
let rm = document.getElementById('inputRM').value;
fetch("<?= base_url('rm/cek') ?>", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: "rm=" + rm
})
.then(res => res.json())
.then(res => {
let hasil = document.getElementById('hasilRM');
if(res.status === 'found'){
let p = res.data;
hasil.innerHTML = `
<div class="alert alert-success">
<b>✔ RM Ditemukan</b><br>
Nama: ${p.nama}<br>
Gender: ${p.gender ?? '-'}<br>
Alamat: ${p.alamat ?? '-'}
</div>
<button class="btn btn-success" onclick="linkRM('${rm}')">
✔ Konfirmasi RM
</button>
`;
} else {
hasil.innerHTML = `
<div class="alert alert-danger">
⚠ RM tidak ditemukan
</div>
<button class="btn btn-warning" onclick="linkRM('${rm}')">
Tetap Gunakan RM Ini
</button>
`;
}
});
}
function linkRM(rm){
fetch("<?= base_url('rm/link') ?>", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: "register_id=" + currentRegisterId + "&rm=" + rm
})
.then(res => res.json())
.then(res => {
if(res.status === 'success'){
alert("RM berhasil di-update");
location.reload();
}
});
}
//Fungsi Pencari RM//
let rmTimeout;
function searchRM() {
clearTimeout(rmTimeout);
rmTimeout = setTimeout(() => {
let q = document.getElementById('noRM').value;
if (!q) {
alert("RM masih kosong");
return;
}
fetch("<?= base_url('rm/search') ?>", {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: "q=" + encodeURIComponent(q)
})
.then(res => res.json())
.then(res => {
let box = document.getElementById('rmResult');
// ================== RM TIDAK ADA ==================
if (!res.data || res.data.length === 0) {
box.innerHTML = `
<div class="list-group-item text-danger">
❌ RM tidak ditemukan
</div>
<div class="list-group-item">
<button class="btn btn-warning w-100"
onclick="useNewRM('${q}')">
Gunakan RM ini (Pasien Baru)
</button>
</div>
`;
return;
}
// ================== RM DITEMUKAN ==================
let html = `
<div class="list-group-item bg-light">
<b>⚠ RM ditemukan</b><br>
Pilih data pasien:
</div>
`;
res.data.forEach(p => {
html += `
<button type="button"
class="list-group-item list-group-item-action"
onclick="confirmRM('${p.rm}','${p.nama}','${p.alamat}','${p.gender}','${p.tanggal_lahir}')">
<b>${p.rm}</b> - ${p.nama}
<br>
<small class="text-muted">${p.alamat ?? ''}</small>
</button>
`;
});
box.innerHTML = html;
});
}, 300);
}
function confirmRM(rm, nama, alamat, gender, tanggal_lahir)
{
if(!rm) {
alert("Data RM tidak ditemukan");
return;
}
if(!confirm(`Gunakan data RM: ${nama}?`)) return;
document.getElementById('noRM').value = rm;
document.getElementById('nama').value = nama ?? '';
document.getElementById('alamat').value = alamat ?? '';
document.getElementById('gender').value = gender ?? '';
document.getElementById('tanggalLahir').value = tanggal_lahir ?? '';
// trigger umur
const tgl = document.getElementById('tanggalLahir');
if(tgl) tgl.dispatchEvent(new Event('change'));
document.getElementById('rmResult').innerHTML = `
<div class="alert alert-success py-2">
✔ RM aktif: <b>${rm}</b><br>
👤 ${nama}
</div>
`;
}
function useNewRM(rm)
{
document.getElementById('noRM').value = rm;
document.getElementById('rmResult').innerHTML = `
<div class="alert alert-warning alert-dismissible fade show" role="alert">
⚠ RM ${rm} sebagai PASIEN BARU
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
</div>
`;
setTimeout(() => {
let el = document.querySelector('.alert-warning');
if(el) el.remove();
}, 2000);
}
function fillRM(rm,nama,alamat,gender,tgl)
{
document.getElementById('noRM').value = rm;
document.getElementById('nama').value = nama;
document.getElementById('alamat').value = alamat;
document.getElementById('gender').value = gender;
document.getElementById('rmResult').innerHTML = '';
if(tgl){
document.getElementById('tanggalLahir').value = tgl;
document.getElementById('tanggalLahir').dispatchEvent(new Event('change'));
}
}
</script>
<!-- ================= Modal RM ================= -->
<div class="modal fade" id="modalCekRM" tabindex="-1">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Cek RM</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<input type="hidden" id="registerId">
<label>Masukkan RM</label>
<input type="text" id="inputRM" class="form-control">
<button class="btn btn-primary mt-2" onclick="cekRM()">
🔍 Cek RM
</button>
<hr>
<div id="hasilRM"></div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
+28
View File
@@ -0,0 +1,28 @@
<h3>Daftar Pasien</h3>
<?php if (!empty($pasien)): ?>
<table border="1" cellpadding="8">
<tr>
<th>No</th>
<th>RM</th>
<th>Nama</th>
<th>Tgl Lahir</th>
<th>Gender</th>
<th>Alamat</th>
</tr>
<?php $no=1; foreach($pasien as $p): ?>
<tr>
<td><?= $no++ ?></td>
<td><?= $p['rm'] ?></td>
<td><?= $p['nama'] ?></td>
<td><?= $p['tgl_lahir'] ?></td>
<td><?= $p['gender'] ?></td>
<td><?= $p['alamat'] ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>Belum ada data</p>
<?php endif; ?>
+210
View File
@@ -0,0 +1,210 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pasien Aktif Ambulans</title>
<meta http-equiv="refresh" content="5">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body {
background: linear-gradient(135deg,#eef2f7,#f8fafc);
font-family: 'Segoe UI', sans-serif;
}
.header-title {
font-weight: bold;
letter-spacing: .5px;
}
.card {
border-radius: 18px;
border: none;
transition: all .2s ease;
}
.card:hover {
transform: translateY(-3px);
box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}
.fase-box {
padding: 10px 12px;
border-radius: 12px;
margin-bottom: 6px;
font-size: 13px;
}
.done {
background: #d1e7dd;
border-left: 5px solid #198754;
}
.active {
background: #fff3cd;
border-left: 5px solid #ffc107;
}
.locked {
background: #e9ecef;
color: #999;
}
.badge-emergency {
background:#dc3545;
color:white;
animation:blinkRed 1s infinite;
font-weight:bold;
}
.badge-non {
background:#ffc107;
color:black;
font-weight:500;
}
.badge-pending {
background:#198754;
color:white;
}
@keyframes blinkRed{
0%,100%{opacity:1;}
50%{opacity:.4;}
}
.btn-sm {
font-size: 12px;
border-radius: 20px;
padding: 4px 10px;
}
.menu-card {
background: white;
border-radius: 15px;
padding: 15px;
text-align: center;
cursor: pointer;
margin-bottom: 15px;
transition: .2s;
}
.menu-card:hover {
background: #0d6efd;
color: white;
}
.menu-icon {
font-size: 24px;
}
.empty-state {
margin-top: 80px;
opacity: .6;
}
</style>
</head>
<body>
<div class="container py-4">
<div class="d-flex justify-content-between align-items-center mb-3">
<h4 class="header-title">🚑 Pasien Aktif</h4>
<small class="text-muted">Auto refresh 5 detik</small>
</div>
<div class="menu-card" onclick="window.location.href='/pasien/input'">
<div class="menu-icon"></div>
<h6 class="mt-2 mb-0">Tambah Pasien Baru</h6>
</div>
<!-- ================= LIST PASIEN ================= -->
<?php if (!empty($pasien)): ?>
<?php foreach($pasien as $p): ?>
<?php
$fase = $p['fase'] ?? 1;
$orderType = $p['order_type'] ?? 'Pending Order';
switch ($orderType) {
case 'True Emergency':
$badgeClass = 'badge-emergency';
break;
case 'Non Emergency':
$badgeClass = 'badge-non';
break;
default:
$badgeClass = 'badge-pending';
break;
}
$steps = [
1 => "Pre Dispatch",
2 => "Dispatch",
3 => "En Route",
4 => "On Scene",
5 => "Transport",
6 => "Selesai"
];
?>
<div class="card mb-3 shadow-sm">
<div class="card-body">
<!-- HEADER -->
<div class="d-flex justify-content-between align-items-center">
<h6 class="mb-1">👤 <?= esc($p['nama']) ?></h6>
<span class="badge <?= $badgeClass ?>">
<?= esc($orderType) ?>
</span>
</div>
<p class="text-muted small mb-2">
<?= esc($p['alamat'] ?? '-') ?>
</p>
<hr>
<!-- FASE AMBULANS-->
<?php foreach($steps as $key => $label): ?>
<?php
$class =
$fase > $key ? 'done' :
($fase == $key ? 'active' : 'locked');
?>
<div class="fase-box <?= $class ?>">
<div class="d-flex justify-content-between align-items-center">
<?php if($key == 1): ?>
<!-- PRE DISPATCH -->
<a href="/pasien/predispatch/<?= $p['id'] ?>" style="text-decoration:none; color:inherit;">
<b><?= $label ?></b>
</a>
<?php else: ?>
<b><?= $label ?></b>
<?php endif; ?>
<?php if($fase == $key && $fase < 6): ?>
<a href="/pasien/next/<?= $p['id'] ?>" class="btn btn-sm btn-warning">
➡️ Lanjut
</a>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<?php endforeach; ?>
<?php else: ?>
<div class="text-center empty-state">
<h1>🚑</h1>
<p>Tidak ada pasien aktif</p>
</div>
<?php endif; ?>
</div>
</body>
</html>
+429
View File
@@ -0,0 +1,429 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<title>Form Permintaan Pasien Ambulans</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
/* ================= GLOBAL ================= */
body {
font-size: 11px;
background: #e9ecef;
font-family: Arial, sans-serif;
margin: 0;
padding: 20px;
color: #212529;
}
/* ================= A4 CONTAINER LOOK ================= */
.container-a4 {
width: 210mm;
min-height: 297mm;
margin: auto;
background: #fff;
padding: 12mm;
border: 1px solid #000;
box-shadow: 0 0 10px rgba(0,0,0,0.15);
}
/* ================= SECTION TITLE ================= */
.section-title {
background: #dee2e6;
padding: 6px 10px;
font-weight: bold;
margin-top: 12px;
margin-bottom: 8px;
border-radius: 4px;
border: 1px solid #ccc;
}
/* ================= BOX KIRI-TENGAH-KANAN ================= */
.border {
border: 1px solid #000 !important;
padding: 8px;
border-radius: 4px;
height: 100%;
}
/* isi box lebih rapi */
.border div {
margin-bottom: 4px;
line-height: 1.3;
}
/* ================= ROW SPACING RAPAT ================= */
.row {
margin-left: 0;
margin-right: 0;
}
.row > div {
padding: 4px;
}
/* ================= BUTTON ================= */
.center-box {
display: flex;
justify-content: center;
margin-top: 25px;
}
.blink {
animation: blinkAnim 1s infinite;
font-weight: bold;
padding: 10px 18px;
border-radius: 6px;
}
@keyframes blinkAnim {
0% { opacity: 1; }
50% { opacity: 0.4; }
100% { opacity: 1; }
}
/* ================= PRINT SETTING ================= */
@media print {
@page {
size: A4;
margin: 8mm;
}
body {
background: #fff !important;
padding: 0 !important;
}
.no-print {
display: none !important;
}
.container-a4 {
width: 100%;
min-height: auto;
box-shadow: none;
border: none;
padding: 0;
}
.blink {
animation: none !important;
}
}
/* ================= TEXT CONSISTENCY ================= */
b {
font-weight: 600;
}
</style>
</head>
<body>
<div class="container-a4">
<div class="no-print mb-3 d-flex justify-content-end gap-2">
<button class="btn btn-secondary" onclick="history.back()">⬅️ Kembali</button>
<button class="btn btn-warning">✏️ Edit</button>
<button onclick="window.print()" class="btn btn-primary">🖨️ Cetak</button>
</div>
<h4 class="text-center mb-4">
📄 FORM PERMINTAAN PASIEN AMBULANS 119
</h4>
<?php if (!$pasien): ?>
<div class="alert alert-danger">Data tidak ditemukan</div>
<?php else: ?>
<div class="row mb-3">
<!-- ================= KIRI ================= -->
<div class="col-md-4">
<div class="border p-2 h-100">
<h6 class="fw-bold">👤 IDENTITAS PASIEN</h6>
<div>
<b>Nama:</b>
<?= trim(($pasien['atribut'] ?? '') . ' ' . ($pasien['nama'] ?? '')) ?>
</div>
<div><b>Tgl Lahir:</b> <?= $pasien['tgl_lahir'] ?? '-' ?></div>
<div><b>Usia:</b> <?= esc($pasien['umur'] ?? '-') ?></div>
<div><b>Jenis Kelamin:</b> <?= $pasien['gender'] ?? '-' ?></div>
<div><b>Alamat:</b> <?= $pasien['alamat'] ?? '-' ?></div>
</div>
</div>
<!-- ================= TENGAH ================= -->
<div class="col-md-4">
<div class="border p-2 h-100">
<h6 class="fw-bold">📋 REGISTRASI</h6>
<div><b>No RM:</b> <?= $pasien['rm'] ?? '-' ?></div>
<div><b>Register Ambulans:</b> <?= $pasien['register'] ?? '-' ?></div>
<div><b>Nama Penelpon:</b> <?= $pasien['nama_penelpon'] ?? '-' ?></div>
<div><b>No Penelpon:</b> <?= $pasien['no_penelpon'] ?? '-' ?></div>
</div>
</div>
<!-- ================= KANAN ================= -->
<div class="col-md-4">
<div class="border p-2 h-100">
<h6 class="fw-bold">🚑 STATUS ORDER</h6>
<div>
<b>Tanggal & Jam Order:</b><br>
<?= !empty($pasien['created_at'])
? date('d-m-Y H:i', strtotime($pasien['created_at']))
: '-' ?>
</div>
<div class="mt-2">
<b>Status Order:</b><br>
<?php
$type = $pasien['order_type'] ?? 'Pending Order';
if ($type == 'True Emergency') {
echo '🔴 True Emergency';
} elseif ($type == 'Non Emergency') {
echo '🟡 Non Emergency';
} else {
echo '🟢 Pending Order';
}
?>
</div>
<div class="mt-2">
<b>Status Fase Ambulans:</b><br>
<?php
$fase = $pasien['fase'] ?? 1;
if ($fase == 1) {
echo 'Predispatch';
} elseif ($fase == 2) {
echo 'On Scene';
} elseif ($fase == 3) {
echo 'Transport';
} elseif ($fase == 4) {
echo 'Arrival RS';
} elseif ($fase == 5) {
echo 'Handover';
} elseif ($fase >= 6) {
echo 'Selesai';
} else {
echo 'Predispatch';
}
?>
</div>
</div>
</div>
<!-- ================= PRE DISPATCH ================= -->
<div class="section-title">Kondisi Awal Pasien (Pre Dispatch)</div>
<?php
$nafas = json_decode($order['pernafasan'] ?? '', true);
$pos = json_decode($order['posisi'] ?? '{}', true);
$nyeri = json_decode($order['nyeri'] ?? '', true);
$bahaya = json_decode($order['bahaya'] ?? '', true);
$kat = $order['kategori'] ?? '-';
?>
<style>
.kv {
display: flex;
align-items: flex-start;
gap: 4px;
margin-bottom: 2px;
font-size: 11px;
line-height: 1.2;
}
.kv b {
min-width: 120px; /* cukup untuk rata */
display: inline-block;
}
.kv span {
display: inline-block;
}
</style>
<div class="kv">
<b>Keluhan Utama:</b>
<span><?= $order['keluhan_utama'] ?? '-' ?></span>
</div>
<div class="col-4">
<div class="kv"><b>Kesadaran</b>: <span><?= $order['kesadaran'] ?? '-' ?></span></div>
<div class="kv">
<b>Pernafasan</b>:
<span><?= ($nafas['sesak'] ?? '-') . ' / ' . ($nafas['batuk'] ?? '-') ?></span>
</div>
<div class="kv">
<b>Posisi Pasien Ditemukan</b>:
<span>
<?= is_array($pos['lokasi'] ?? null) ? implode(', ', $pos['lokasi']) : '-' ?>
<?= !empty($pos['lainnya']) ? ' - ' . $pos['lainnya'] : '' ?>
</span>
</div>
</div>
<div class="col-4">
<div class="kv"><b>Keterbatasan</b>: <span><?= $order['keterbatasan'] ?? '-' ?></span></div>
<div class="kv"><b>Nyeri</b>: <span><?= $nyeri['status'] ?? '-' ?></span></div>
<div class="kv">
<b>Lokasi Nyeri</b>:
<span>
<?= isset($nyeri['lokasi']) && is_array($nyeri['lokasi'])
? implode(', ', $nyeri['lokasi'])
: '-' ?>
</span>
</div>
</div>
<div class="col-4">
<div class="kv">
<b>Kategori</b>:
<span>
<?php
if ($kat == 'Trauma') echo 'Trauma';
elseif ($kat == 'Non Trauma') echo 'Non Trauma';
else echo '-';
?>
</span>
</div>
<div class="kv"><b>Suhu</b>: <span><?= $order['suhu'] ?? '-' ?></span></div>
<div class="kv">
<b>Bahaya</b>:
<span>
<?= $bahaya['status'] ?? '-' ?>
<?= !empty($bahaya['detail']) ? ' - ' . $bahaya['detail'] : '' ?>
</span>
</div>
<div class="kv"><b>BB</b>: <span><?= $order['berat_badan'] ?? '-' ?> Kg</span></div>
</div>
<?php
$tujuanList = [
'RFDK' => 'Rumah ke Faskes Dalam Kota',
'F-FDK' => 'Fasilitas Umum ke Faskes Dalam Kota',
'AFDK' => 'Antar Faskes Dalam Kota',
'AFLK' => 'Antar Faskes Luar Kota',
'PDK' => 'Pulang Dalam Kota',
'PLK' => 'Pulang Luar Kota',
];
$tujuan = $order['tujuan'] ?? '-';
?>
<!-- ================= Tujuan dan Biaya ================= -->
<div class="section-title">Tujuan dan Biaya</div>
<!-- ================= KIRI ================= -->
<div class="col-md-6">
<div class="kv">
<b>Tujuan</b>
<span>: <?= $tujuanList[$tujuan] ?? $tujuan ?></span>
</div>
<div class="kv">
<b>Detail Tujuan</b>
<span>: <?= $order['tujuan_detail'] ?? '-' ?></span>
</div>
</div>
<!-- ================= KANAN ================= -->
<div class="col-md-6">
<div class="kv">
<b>Persetujuan Biaya</b>
<span>: <?= $order['persetujuan'] ?? '-' ?></span>
</div>
<div class="kv">
<b>KIE Estimasi Biaya</b>
<span>:
Rp <?= !empty($order['biaya'])
? number_format($order['biaya'],0,',','.')
: '-' ?>
</span>
</div>
</div>
<!-- ================= VALIDASI + PETUGAS ================= -->
<div class="section-title">Validasi & Petugas</div>
<div class="col-md-6">
<div class="kv">
<b>Validasi Pelayanan</b>
<span>: <?= $order['validasi'] ?? '-' ?></span>
</div>
</div>
<div class="col-md-6">
<div class="kv">
<b>Petugas Predispatch</b>
<span>: <?= $order['petugas_nama'] ?? $order['petugas_id'] ?? '-' ?></span>
</div>
</div>
</div>
<!-- ================= TANDA TANGAN ================= -->
<div class="row mb-2"> </div>
<div class="ttd-box no-print-break">
<div class="ttd-title">________________</div>
<div class="ttd-colon">tanda tangan</div>
<div class="ttd-row">
<div class="ttd-label">Nama Pemesan :</div>
<div class="ttd-line"></div>
</div>
<div class="ttd-row">
<div class="ttd-label">Nomor WA:</div>
<div class="ttd-line"></div>
</div>
</div>
<!-- ================= BUTTON ================= -->
<div class="center-box">
<button class="btn btn-success blink"
onclick="terimaOrder(<?= $pasien['id'] ?>)">
✅ Terima Order & Lanjut Dispatch
</button>
</div>
<?php endif; ?>
<script>
function terimaOrder(id){
fetch("<?= base_url('pasien/next') ?>/" + id)
.then(() => {
window.location.href = "<?= base_url('pasien/aktif') ?>";
});
}
</script>
</body>
</html>
+17
View File
@@ -0,0 +1,17 @@
<?php
$passwords = [
'admin119' => '119admin',
'leader119' => '119mako',
'perawat119' => 'nurse119',
'driver119' => 'olo119'
];
echo "<h2>Hash Password SiLARAS 119</h2>";
foreach ($passwords as $username => $password) {
echo "<p>";
echo "<strong>{$username}</strong><br>";
echo password_hash($password, PASSWORD_DEFAULT);
echo "</p>";
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>
+17
View File
@@ -0,0 +1,17 @@
"nama;jabatan"
"Danang Guntoro S.Kep. Ns;Sub Ur Ruang"
"Brian Septa SP AMd.Kep;PJ Tim"
"Aguswanto AMd.Kep;Ka Jaga"
"Bhaktiar Rahyung Dwi A S.Kep. Ners;Ka Jaga"
"Lega Ulmani S.Kep. Ners;Ka Jaga"
"Nadhira Wahyu Lestari S.Kep. Ners;Ka Jaga"
"M. Sudrajat P AMd.Kep;Ka Jaga"
"Wiwik Miftahul Jannah S.Kep. Ners;Perawat"
"Dody Dwi Laksono AMd.Kep;Perawat"
"Faisal Anam AMd.Kep;Perawat"
"Uswatun Hasanah S.Kep. Ners;Perawat"
"Yahya Citra Winata;Pengemudi"
"Widodo;Pengemudi"
"Ichwan Prasetyo;Pengemudi"
"Ahwan Patty;Pengemudi"
"Muhamad Dedi Trianto;Pengemudi"
1 nama;jabatan
2 Danang Guntoro S.Kep. Ns;Sub Ur Ruang
3 Brian Septa SP AMd.Kep;PJ Tim
4 Aguswanto AMd.Kep;Ka Jaga
5 Bhaktiar Rahyung Dwi A S.Kep. Ners;Ka Jaga
6 Lega Ulmani S.Kep. Ners;Ka Jaga
7 Nadhira Wahyu Lestari S.Kep. Ners;Ka Jaga
8 M. Sudrajat P AMd.Kep;Ka Jaga
9 Wiwik Miftahul Jannah S.Kep. Ners;Perawat
10 Dody Dwi Laksono AMd.Kep;Perawat
11 Faisal Anam AMd.Kep;Perawat
12 Uswatun Hasanah S.Kep. Ners;Perawat
13 Yahya Citra Winata;Pengemudi
14 Widodo;Pengemudi
15 Ichwan Prasetyo;Pengemudi
16 Ahwan Patty;Pengemudi
17 Muhamad Dedi Trianto;Pengemudi
+128
View File
@@ -0,0 +1,128 @@
#!/usr/bin/env php
<?php
define('LATEST_RELEASE', '^4.7');
define('DEVELOP_BRANCH', 'dev-develop');
define('NEXT_MINOR', '^4.8-dev');
define('GITHUB_URL', 'https://github.com/codeigniter4/codeigniter4');
/*
* --------------------------------------------------------------------
* Stability Toggle
* --------------------------------------------------------------------
* Use this script to toggle the CodeIgniter dependency between the
* latest stable release and the most recent development update.
*
* Usage: php builds [release|development|next]
*/
$branch = $argv[1] ?? '';
// Determine the requested stability
if ($branch === '' || ! in_array($branch, ['release', 'development', 'next'], true)) {
echo 'Usage: php builds [release|development|next]' . PHP_EOL;
exit;
}
$modified = [];
// Locate each file and update it for the requested stability
$file = __DIR__ . DIRECTORY_SEPARATOR . 'composer.json';
if (is_file($file)) {
$contents = file_get_contents($file);
if ((string) $contents !== '') {
$array = json_decode($contents, true);
if (is_array($array)) {
if ($branch !== 'release') {
$array['minimum-stability'] = 'dev';
$array['prefer-stable'] = true;
$array['repositories'] ??= [];
$found = false;
foreach ($array['repositories'] as $repository) {
if ($repository['url'] === GITHUB_URL) {
$found = true;
break;
}
}
if (! $found) {
$array['repositories'][] = [
'type' => 'vcs',
'url' => GITHUB_URL,
];
}
$array['require']['codeigniter4/codeigniter4'] = $branch === 'next' ? NEXT_MINOR : DEVELOP_BRANCH;
unset($array['require']['codeigniter4/framework']);
} else {
unset($array['minimum-stability']);
if (isset($array['repositories'])) {
foreach ($array['repositories'] as $i => $repository) {
if ($repository['url'] === GITHUB_URL) {
unset($array['repositories'][$i]);
break;
}
}
if ($array['repositories'] === []) {
unset($array['repositories']);
}
}
$array['require']['codeigniter4/framework'] = LATEST_RELEASE;
unset($array['require']['codeigniter4/codeigniter4']);
}
file_put_contents($file, json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);
$modified[] = $file;
} else {
echo 'Warning: Unable to decode composer.json! Skipping...' . PHP_EOL;
}
} else {
echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL;
}
}
$files = [
__DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php',
__DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist',
__DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml',
];
foreach ($files as $file) {
if (is_file($file)) {
$contents = file_get_contents($file);
if ($branch !== 'release') {
$contents = str_replace('vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents);
} else {
$contents = str_replace('vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents);
}
file_put_contents($file, $contents);
$modified[] = $file;
}
}
if ($modified === []) {
echo 'No files modified.' . PHP_EOL;
} else {
echo 'The following files were modified:' . PHP_EOL;
foreach ($modified as $file) {
echo " * {$file}" . PHP_EOL;
}
}
echo 'Run `composer update` to sync changes with your vendor folder.' . PHP_EOL;
echo 'Don\'t forget to update the project files in app folder from "vendor/codeigniter4/*/app/".' . PHP_EOL;
+43
View File
@@ -0,0 +1,43 @@
{
"name": "codeigniter4/appstarter",
"description": "CodeIgniter4 starter app",
"license": "MIT",
"type": "project",
"homepage": "https://codeigniter.com",
"support": {
"forum": "https://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^8.2",
"codeigniter4/framework": "^4.7"
},
"require-dev": {
"fakerphp/faker": "^1.9",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^10.5.16"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Config\\": "app/Config/"
},
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\Support\\": "tests/_support"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"scripts": {
"test": "phpunit"
}
}
Generated
+2114
View File
File diff suppressed because it is too large Load diff
+43
View File
@@ -0,0 +1,43 @@
services:
app:
build: .
container_name: silaras119_app_simulasi
restart: unless-stopped
ports:
- "8080:80"
environment:
CI_ENVIRONMENT: development
APP_BASE_URL: http://localhost:8080/
DB_HOST: db
DB_PORT: 3306
DB_NAME: db_silaras
DB_USER: silaras_sys
DB_PASS: 119-silaras
volumes:
- .:/var/www/html
depends_on:
db:
condition: service_healthy
db:
image: mariadb:11.4
container_name: silaras119_db_simulasi
restart: unless-stopped
ports:
- "3307:3306"
environment:
MARIADB_ROOT_PASSWORD: root119
MARIADB_DATABASE: db_silaras
MARIADB_USER: silaras_sys
MARIADB_PASSWORD: 119-silaras
volumes:
- silaras119_dbdata:/var/lib/mysql
- ./docker/mysql/init:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
interval: 10s
timeout: 5s
retries: 10
volumes:
silaras119_dbdata:
+17
View File
@@ -0,0 +1,17 @@
services:
app:
build: .
container_name: silaras119_app
restart: unless-stopped
ports:
- "8080:80"
environment:
CI_ENVIRONMENT: development
APP_BASE_URL: http://10.10.123.224:8080/
DB_HOST: 10.10.123.197
DB_PORT: 3003
DB_NAME: db_silaras
DB_USER: silaras_sys
DB_PASS: 119-silaras
volumes:
- .:/var/www/html
+17
View File
@@ -0,0 +1,17 @@
<VirtualHost *:80>
ServerName localhost
DocumentRoot /var/www/html/public
<Directory /var/www/html/public>
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/html>
Require all denied
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -e
cd /var/www/html
: "${CI_ENVIRONMENT:=development}"
: "${APP_BASE_URL:=http://localhost:8080/}"
: "${DB_HOST:=10.10.123.199}"
: "${DB_PORT:=5017}"
: "${DB_NAME:=db_silaras}"
: "${DB_USER:=silaras_sys}"
: "${DB_PASS:=119-silaras}"
cat > .env <<ENVFILE
CI_ENVIRONMENT = ${CI_ENVIRONMENT}
app.baseURL = '${APP_BASE_URL}'
app.forceGlobalSecureRequests = false
app.CSPEnabled = false
# Database aktif untuk container
# Jangan commit file .env berisi credential production ke repository publik.
database.default.hostname = ${DB_HOST}
database.default.database = ${DB_NAME}
database.default.username = ${DB_USER}
database.default.password = ${DB_PASS}
database.default.DBDriver = MySQLi
database.default.port = ${DB_PORT}
encryption.key = ${ENCRYPTION_KEY:-silaras119-local-dev-key-change-me}
logger.threshold = 4
ENVFILE
mkdir -p writable/cache writable/logs writable/session writable/uploads
chown -R www-data:www-data writable public || true
chmod -R ug+rwX writable || true
exec "$@"
+136
View File
@@ -0,0 +1,136 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
DROP TABLE IF EXISTS pasien_order;
DROP TABLE IF EXISTS register_ambulans;
DROP TABLE IF EXISTS pegawai;
DROP TABLE IF EXISTS pasien;
DROP TABLE IF EXISTS users;
CREATE TABLE users (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nama VARCHAR(150) NOT NULL,
username VARCHAR(80) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
role VARCHAR(50) NOT NULL DEFAULT 'user',
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE pasien (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
rm VARCHAR(50) NULL,
atribut VARCHAR(30) NULL,
nama VARCHAR(150) NOT NULL,
tgl_lahir DATE NULL,
gender VARCHAR(30) NULL,
alamat TEXT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY idx_pasien_rm (rm),
KEY idx_pasien_nama (nama)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE pegawai (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
nama VARCHAR(150) NOT NULL,
jabatan VARCHAR(100) NULL,
unit VARCHAR(100) NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY idx_pegawai_nama (nama),
KEY idx_pegawai_jabatan (jabatan)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE register_ambulans (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
rm VARCHAR(50) NULL,
register VARCHAR(80) NOT NULL UNIQUE,
order_type ENUM('True Emergency','Non Emergency','Pending Order') NOT NULL DEFAULT 'Pending Order',
status VARCHAR(50) NOT NULL DEFAULT 'Predispatch',
fase TINYINT UNSIGNED NOT NULL DEFAULT 1,
prioritas VARCHAR(50) NULL,
nama_penelpon VARCHAR(150) NULL,
no_penelpon VARCHAR(50) NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY idx_register_rm (rm),
KEY idx_register_fase (fase),
KEY idx_register_order_type (order_type),
CONSTRAINT fk_register_pasien_rm FOREIGN KEY (rm) REFERENCES pasien(rm) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
CREATE TABLE pasien_order (
id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
register_id INT UNSIGNED NOT NULL,
nama_penelpon VARCHAR(150) NULL,
no_penelpon VARCHAR(50) NULL,
kesadaran VARCHAR(100) NULL,
kategori VARCHAR(100) NULL,
pernafasan JSON NULL,
posisi JSON NULL,
keterbatasan VARCHAR(100) NULL,
nyeri JSON NULL,
suhu VARCHAR(50) NULL,
bahaya JSON NULL,
berat_badan VARCHAR(50) NULL,
keluhan_utama TEXT NULL,
tujuan VARCHAR(150) NULL,
tujuan_detail TEXT NULL,
persetujuan VARCHAR(100) NULL,
biaya VARCHAR(100) NULL,
validasi VARCHAR(100) NULL,
petugas_id INT UNSIGNED NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
KEY idx_order_register (register_id),
KEY idx_order_petugas (petugas_id),
CONSTRAINT fk_order_register FOREIGN KEY (register_id) REFERENCES register_ambulans(id) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT fk_order_petugas FOREIGN KEY (petugas_id) REFERENCES pegawai(id) ON UPDATE CASCADE ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO users (nama, username, password, role) VALUES
('Administrator 119', 'admin119', '$2y$12$snjqy2Ep5eBKNDaRQPdTNOWM5Bjht7UECBRbaY6mFaQu.G1phJmwK', 'admin'),
('Leader 119', 'leader119', '$2y$12$QGTVOQRFP8xScmpeNutadOWDIS6EEMfL9hXuyKC7PWmbiV9SAnSEK', 'leader'),
('Perawat 119', 'perawat119', '$2y$12$rTHZKpqq9qOrydr981uqvOmBu/OeIxUUrrhSyF/pXf2mGd9tzRObq', 'perawat'),
('Driver 119', 'driver119', '$2y$12$FDJ8hS2bUqqxpuo69YGlOO1icl.6CCHr7NLlEOe1BtOW7q.TsTApy', 'driver');
INSERT INTO pegawai (nama, jabatan, unit) VALUES
('Danang Guntoro S.Kep. Ns', 'Sub Ur Ruang', 'Ambulans 119'),
('Brian Septa SP AMd.Kep', 'PJ Tim', 'Ambulans 119'),
('Aguswanto AMd.Kep', 'Ka Jaga', 'Ambulans 119'),
('Bhaktiar Rahyung Dwi A S.Kep. Ners', 'Ka Jaga', 'Ambulans 119'),
('Lega Ulmani S.Kep. Ners', 'Ka Jaga', 'Ambulans 119'),
('Nadhira Wahyu Lestari S.Kep. Ners', 'Ka Jaga', 'Ambulans 119'),
('M. Sudrajat P AMd.Kep', 'Ka Jaga', 'Ambulans 119'),
('Wiwik Miftahul Jannah S.Kep. Ners', 'Perawat', 'Ambulans 119'),
('Dody Dwi Laksono AMd.Kep', 'Perawat', 'Ambulans 119'),
('Faisal Anam AMd.Kep', 'Perawat', 'Ambulans 119'),
('Uswatun Hasanah S.Kep. Ners', 'Perawat', 'Ambulans 119'),
('Yahya Citra Winata', 'Pengemudi', 'Ambulans 119'),
('Widodo', 'Pengemudi', 'Ambulans 119'),
('Ichwan Prasetyo', 'Pengemudi', 'Ambulans 119'),
('Ahwan Patty', 'Pengemudi', 'Ambulans 119'),
('Muhamad Dedi Trianto', 'Pengemudi', 'Ambulans 119');
INSERT INTO pasien (rm, atribut, nama, tgl_lahir, gender, alamat) VALUES
('000001', 'Tn.', 'Budi Santoso', '1988-02-14', 'Laki-laki', 'Jl. Simulasi No. 1, Malang'),
('000002', 'Ny.', 'Siti Aminah', '1979-08-20', 'Perempuan', 'Jl. Contoh No. 2, Malang');
INSERT INTO register_ambulans (rm, register, order_type, status, fase, prioritas, nama_penelpon, no_penelpon, created_at) VALUES
('000001', 'AMB-260505-001', 'True Emergency', 'Predispatch', 1, 'Tinggi', 'Andi', '081234567890', NOW()),
('000002', 'AMB-260505-002', 'Non Emergency', 'Diproses', 3, 'Sedang', 'Rina', '081298765432', NOW());
INSERT INTO pasien_order (
register_id, nama_penelpon, no_penelpon, kesadaran, kategori, pernafasan, posisi,
keterbatasan, nyeri, suhu, bahaya, berat_badan, keluhan_utama, tujuan,
tujuan_detail, persetujuan, biaya, validasi, petugas_id
) VALUES
(1, 'Andi', '081234567890', 'Sadar', 'Dewasa', JSON_OBJECT('sesak','Ya','batuk','Tidak'), JSON_OBJECT('lokasi', JSON_ARRAY('ruang_tamu'), 'lainnya', NULL),
'Tidak', JSON_OBJECT('status','Ya','lokasi', JSON_ARRAY('Dada'), 'lain', NULL), '37.8', JSON_OBJECT('status','Tidak','detail',NULL), '70',
'Nyeri dada dan sesak napas sejak 30 menit sebelum panggilan.', 'IGD RSSA', 'Rujuk ke IGD', 'Setuju', 'Umum', 'Valid', 8),
(2, 'Rina', '081298765432', 'Sadar', 'Dewasa', JSON_OBJECT('sesak','Tidak','batuk','Tidak'), JSON_OBJECT('lokasi', JSON_ARRAY('kamar_tidur'), 'lainnya', NULL),
'Tidak', JSON_OBJECT('status','Tidak','lokasi', JSON_ARRAY(), 'lain', NULL), '36.7', JSON_OBJECT('status','Tidak','detail',NULL), '55',
'Kontrol pasien non-emergency dengan kebutuhan transport ambulans.', 'Poliklinik RSSA', 'Transport pasien', 'Setuju', 'BPJS', 'Valid', 12);
SET FOREIGN_KEY_CHECKS = 1;
+16
View File
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail
BASE_URL="${1:-http://localhost:8080}"
echo "[1/3] Cek halaman login..."
curl -fsS "$BASE_URL/login" | grep -qi "Login SiLARAS 119"
echo "OK: halaman login terbaca"
echo "[2/3] Cek header HTTP..."
curl -fsSI "$BASE_URL/login" | head -n 1
echo "[3/3] Cek container..."
docker compose ps || docker compose -f docker-compose.simulasi.yml ps
echo "Smoke test selesai. Lanjut uji manual via browser: $BASE_URL"
+63
View File
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
bootstrap="vendor/codeigniter4/framework/system/Test/bootstrap.php"
backupGlobals="false"
beStrictAboutOutputDuringTests="true"
colors="true"
columns="max"
failOnRisky="true"
failOnWarning="true"
cacheDirectory="build/.phpunit.cache">
<coverage
includeUncoveredFiles="true"
pathCoverage="false"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true">
<report>
<clover outputFile="build/logs/clover.xml"/>
<html outputDirectory="build/logs/html"/>
<php outputFile="build/logs/coverage.serialized"/>
<text outputFile="php://stdout" showUncoveredFiles="false"/>
</report>
</coverage>
<testsuites>
<testsuite name="App">
<directory>./tests</directory>
</testsuite>
</testsuites>
<logging>
<testdoxHtml outputFile="build/logs/testdox.html"/>
<testdoxText outputFile="build/logs/testdox.txt"/>
<junit outputFile="build/logs/logfile.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">./app</directory>
</include>
<exclude>
<directory suffix=".php">./app/Views</directory>
<file>./app/Config/Routes.php</file>
</exclude>
</source>
<php>
<server name="app.baseURL" value="http://example.com/"/>
<server name="CODEIGNITER_SCREAM_DEPRECATIONS" value="0"/>
<!-- Directory containing phpunit.xml -->
<const name="HOMEPATH" value="./"/>
<!-- Directory containing the Paths config file -->
<const name="CONFIGPATH" value="./app/Config/"/>
<!-- Directory containing the front controller (index.php) -->
<const name="PUBLICPATH" value="./public/"/>
<!-- Database configuration -->
<!-- Uncomment to provide your own database for testing
<env name="database.tests.hostname" value="localhost"/>
<env name="database.tests.database" value="tests"/>
<env name="database.tests.username" value="tests_user"/>
<env name="database.tests.password" value=""/>
<env name="database.tests.DBDriver" value="MySQLi"/>
<env name="database.tests.DBPrefix" value="tests_"/>
-->
</php>
</phpunit>
Loaded 100 of 123 files, more files were not shown because too many files have changed in this diff. Show more