dbmsv3 init...
This commit is contained in:
commit
40b4443f41
18
.gitignore
vendored
Normal file
18
.gitignore
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
#codeigniter4
|
||||
.env
|
||||
composer.lock
|
||||
vendor/
|
||||
public/vendors/
|
||||
public/tinymce_uploads/
|
||||
writable/caceh/*
|
||||
!writable/caceh/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
|
||||
writable/excel/*
|
||||
!writable/excel/index.html
|
||||
22
LICENSE
Normal file
22
LICENSE
Normal 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.
|
||||
68
README.md
Normal file
68
README.md
Normal file
@ -0,0 +1,68 @@
|
||||
# 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.1 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.
|
||||
> - If you are still using PHP 7.4 or 8.0, you should upgrade immediately.
|
||||
> - The end of life date for PHP 8.1 will be December 31, 2025.
|
||||
|
||||
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
|
||||
19
app/Cells/CommonCell.php
Normal file
19
app/Cells/CommonCell.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells;
|
||||
|
||||
use App\Services\CommonService;
|
||||
|
||||
abstract class CommonCell
|
||||
{
|
||||
protected $_service = null;
|
||||
|
||||
protected function __construct(CommonService $service)
|
||||
{
|
||||
$this->_service = $service;
|
||||
}
|
||||
final public function getService(): mixed
|
||||
{
|
||||
return $this->_service;
|
||||
}
|
||||
}
|
||||
15
app/Cells/Customer/CustomerCell.php
Normal file
15
app/Cells/Customer/CustomerCell.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Customer;
|
||||
|
||||
use App\Cells\CommonCell;
|
||||
use App\Services\CommonService;
|
||||
|
||||
abstract class CustomerCell extends CommonCell
|
||||
{
|
||||
|
||||
protected function __construct(CommonService $service)
|
||||
{
|
||||
parent::__construct($service);
|
||||
}
|
||||
}
|
||||
32
app/Cells/Customer/PaymentCell.php
Normal file
32
app/Cells/Customer/PaymentCell.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Customer;
|
||||
|
||||
use App\Services\PaymentService;
|
||||
|
||||
class PaymentCell extends CustomerCell
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new PaymentService());
|
||||
}
|
||||
|
||||
public function detail(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$entities = $this->getService()->getEntities(['clientinfo_uid' => $params['clientinfo_uid'], 'billing' => PAYMENT['BILLING']['ONETIME'], 'status' => STATUS['UNPAID']]);
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/payment/' . $template, [
|
||||
'serviceCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $entities,
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
43
app/Cells/Customer/ServiceCell.php
Normal file
43
app/Cells/Customer/ServiceCell.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Customer;
|
||||
|
||||
use App\Services\PaymentService;
|
||||
use App\Services\Customer\ServiceService;
|
||||
|
||||
class ServiceCell extends CustomerCell
|
||||
{
|
||||
|
||||
private ?PaymentService $_paymentService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new ServiceService());
|
||||
}
|
||||
final public function getPaymentService(): PaymentService
|
||||
{
|
||||
if (!$this->_paymentService) {
|
||||
$this->_paymentService = new PaymentService();
|
||||
}
|
||||
return $this->_paymentService;
|
||||
}
|
||||
|
||||
public function detail(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$unPaids = $this->getPaymentService()->getUnPaids('serviceinfo_uid', ['clientinfo_uid' => $params['clientinfo_uid']]);
|
||||
$entities = $this->getService()->getEntities(['clientinfo_uid' => $params['clientinfo_uid']]);
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/service/' . $template, [
|
||||
'serviceCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $entities,
|
||||
'unPaids' => $unPaids
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
15
app/Cells/Equipment/EquipmentCell.php
Normal file
15
app/Cells/Equipment/EquipmentCell.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Equipment;
|
||||
|
||||
use App\Cells\CommonCell;
|
||||
use App\Services\CommonService;
|
||||
|
||||
abstract class EquipmentCell extends CommonCell
|
||||
{
|
||||
|
||||
protected function __construct(CommonService $service)
|
||||
{
|
||||
parent::__construct($service);
|
||||
}
|
||||
}
|
||||
29
app/Cells/Equipment/ServerCell.php
Normal file
29
app/Cells/Equipment/ServerCell.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Equipment;
|
||||
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class ServerCell extends EquipmentCell
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new ServerService());
|
||||
}
|
||||
|
||||
//서비스 방식에 따른 서비스별 Count
|
||||
final public function totalCountDashboard(array $params): string
|
||||
{
|
||||
$totalCounts = $this->getService()->getTotalServiceCount(array_key_exists('where', $params) ? $params['where'] : []);
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/server/' . $template, [
|
||||
'serviceCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'label' => $params['where']['serviceinfo.site'],
|
||||
'totalCounts' => $totalCounts,
|
||||
]
|
||||
]);
|
||||
}
|
||||
}
|
||||
63
app/Cells/Equipment/ServerPartCell.php
Normal file
63
app/Cells/Equipment/ServerPartCell.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Equipment;
|
||||
|
||||
|
||||
use App\Entities\Equipment\ServerEntity;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
|
||||
class ServerPartCell extends EquipmentCell
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new ServerPartService());
|
||||
}
|
||||
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
|
||||
public function parttable(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
if (!array_key_exists('serverinfo_uid', $params)) {
|
||||
return "서버정보를 정의하셔야합니다.";
|
||||
}
|
||||
if (!array_key_exists('types', $params)) {
|
||||
return "부품정보 형태(Types) 리스트를 정의하셔야합니다.";
|
||||
}
|
||||
//서버정보
|
||||
$serverEntity = $this->getServerService()->getEntity($params['serverinfo_uid']);
|
||||
if (!$serverEntity instanceof ServerEntity) {
|
||||
return "[{$params['serverinfo_uid']}]의 서버정보를 확인할수없습니다..";
|
||||
}
|
||||
//PartType별 Entities
|
||||
$entities = [];
|
||||
foreach ($params['types'] as $type) {
|
||||
$entities[$type] = [];
|
||||
$entities[$type][] = $this->getService()->getEntities(['serverinfo_uid' => $serverEntity->getPK(), 'type' => $type]);
|
||||
}
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : __FUNCTION__;
|
||||
return view('cells/serverpart/' . $template, [
|
||||
'serverPartCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'serverinfo_uid' => $params['serverinfo_uid'],
|
||||
'serviceinfo_serverinfo_uid' => $params['serviceinfo_serverinfo_uid'] ?? 0,
|
||||
'types' => $params['types'],
|
||||
'serverEntity' => $serverEntity,
|
||||
'entities' => $entities,
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
30
app/Cells/Part/DISKCell.php
Normal file
30
app/Cells/Part/DISKCell.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Part;
|
||||
|
||||
use App\Services\Part\DISKService;
|
||||
|
||||
class DISKCell extends PartCell
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new DISKService());
|
||||
}
|
||||
|
||||
public function stock(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : 'disk_stock';
|
||||
return view('cells/part/' . $template, [
|
||||
'partCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $this->getService()->getEntities(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
15
app/Cells/Part/PartCell.php
Normal file
15
app/Cells/Part/PartCell.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Part;
|
||||
|
||||
use App\Cells\CommonCell;
|
||||
use App\Services\CommonService;
|
||||
|
||||
abstract class PartCell extends CommonCell
|
||||
{
|
||||
|
||||
protected function __construct(CommonService $service)
|
||||
{
|
||||
parent::__construct($service);
|
||||
}
|
||||
}
|
||||
30
app/Cells/Part/RAMCell.php
Normal file
30
app/Cells/Part/RAMCell.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Cells\Part;
|
||||
|
||||
use App\Services\Part\RAMService;
|
||||
|
||||
class RAMCell extends PartCell
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(new RAMService());
|
||||
}
|
||||
|
||||
public function stock(array $params): string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$template = array_key_exists('template', $params) ? $params['template'] : 'ram_stock';
|
||||
return view('cells/part/' . $template, [
|
||||
'partCellDatas' => [
|
||||
'control' => $this->getService()->getControlDatas(),
|
||||
'service' => $this->getService(),
|
||||
'entities' => $this->getService()->getEntities(),
|
||||
],
|
||||
]);
|
||||
}
|
||||
}
|
||||
202
app/Config/App.php
Normal file
202
app/Config/App.php
Normal 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
app/Config/Autoload.php
Normal file
92
app/Config/Autoload.php
Normal 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
app/Config/Boot/development.php
Normal file
34
app/Config/Boot/development.php
Normal 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
app/Config/Boot/production.php
Normal file
25
app/Config/Boot/production.php
Normal 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
app/Config/Boot/testing.php
Normal file
38
app/Config/Boot/testing.php
Normal 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 can’t 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);
|
||||
20
app/Config/CURLRequest.php
Normal file
20
app/Config/CURLRequest.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
class CURLRequest extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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;
|
||||
}
|
||||
162
app/Config/Cache.php
Normal file
162
app/Config/Cache.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Cache\CacheInterface;
|
||||
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, database?: int}
|
||||
*/
|
||||
public array $redis = [
|
||||
'host' => '127.0.0.1',
|
||||
'password' => null,
|
||||
'port' => 6379,
|
||||
'timeout' => 0,
|
||||
'database' => 0,
|
||||
];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Available Cache Handlers
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This is an array of cache engine alias' and class names. Only engines
|
||||
* that are listed here are allowed to be used.
|
||||
*
|
||||
* @var array<string, class-string<CacheInterface>>
|
||||
*/
|
||||
public array $validHandlers = [
|
||||
'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;
|
||||
}
|
||||
425
app/Config/Constants.php
Normal file
425
app/Config/Constants.php
Normal file
@ -0,0 +1,425 @@
|
||||
<?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
|
||||
|
||||
//Default값 정의
|
||||
define('DEFAULTS', [
|
||||
'DELIMITER_FILE' => "||",
|
||||
'DELIMITER_ROLE' => ","
|
||||
]);
|
||||
define('MESSAGES', [
|
||||
'CREATED' => '생성되었습니다.',
|
||||
'UPDATED' => '수정되였습니다.',
|
||||
'DELETED' => '삭제되였습니다.',
|
||||
'SUCCESS' => '작업이 성공적으로 완료되었습니다.',
|
||||
'FAILED' => '작업이 실패하였습니다.',
|
||||
'NOT_FOUND' => '데이터가 존재하지 않습니다.',
|
||||
'NOT_AUTH' => '권한이 없습니다.',
|
||||
'NOT_LOGIN' => '로그인이 필요합니다.',
|
||||
'NOT_MATCH' => '데이터가 일치하지 않습니다.',
|
||||
'NOT_EMPTY' => '데이터가 비어있습니다.',
|
||||
'NOT_UNIQUE' => '중복된 데이터가 존재합니다.',
|
||||
'NOT_DELETE' => '삭제할 수 없는 데이터가 존재합니다.',
|
||||
'NOT_UPDATE' => '수정할 수 없는 데이터가 존재합니다.',
|
||||
'NOT_CREATE' => '생성할 수 없는 데이터가 존재합니다.',
|
||||
'NOT_SYNC' => '동기화할 수 없는 데이터가 존재합니다.',
|
||||
'NOT_SYNC_RESULT' => '동기화 결과가 실패하였습니다.',
|
||||
'NOT_SYNC_SUCCESS' => '동기화 결과가 성공하였습니다.',
|
||||
'NOT_SYNC_ERROR' => '동기화 결과가 실패하였습니다.',
|
||||
'NOT_SYNC_NOTHING' => '동기화할 데이터가 없습니다.',
|
||||
'NOT_SYNC_NOTHING_RESULT' => '동기화 결과가 없습니다.',
|
||||
'NOT_SYNC_NOTHING_ERROR' => '동기화 결과가 없습니다.',
|
||||
'LOGIN' => '로그인 하셨습니다.',
|
||||
'LOGOUT' => '로그아웃 하셨습니다.'
|
||||
]);
|
||||
//URL
|
||||
define('URLS', [
|
||||
'LOGIN' => '/auth/login',
|
||||
'GOOGLE_LOGIN' => '/auth/google_login',
|
||||
'SIGNUP' => '/auth/signup',
|
||||
'LOGOUT' => '/auth/logout',
|
||||
]);
|
||||
//SESSION 관련
|
||||
define('SESSION_NAMES', [
|
||||
'RETURN_URL' => "return_url",
|
||||
'RETURN_MSG' => "return_message",
|
||||
'ISLOGIN' => "islogined",
|
||||
'AUTH' => 'auth',
|
||||
]);
|
||||
//메신저 관련
|
||||
define("MESSENGERS", [
|
||||
"skype" => [
|
||||
"url" => "//join.skype.com/invite/uKUgXfZThSQC",
|
||||
"icon" => '<img src="/images/common/top_skype.png" alt="스카이프">',
|
||||
"id" => '',
|
||||
],
|
||||
"discord" => [
|
||||
"url" => "//discord.gg/k6nQg84N",
|
||||
"icon" => '<img src="/images/common/discord.png" alt="디스코드">',
|
||||
"id" => '',
|
||||
],
|
||||
"telegram" => [
|
||||
"url" => "//t.me/daemonidc",
|
||||
"icon" => '<img src="/images/common/telegram.png" alt="텔레그램">',
|
||||
"id" => '@daemonidc',
|
||||
],
|
||||
"kakaotalk" => [
|
||||
"url" => "//t.me/daemonidc",
|
||||
"icon" => '<img src="/images/common/kakaotalk.png" alt="카카오톡">',
|
||||
"id" => '',
|
||||
],
|
||||
]);
|
||||
//아이콘 및 Sound관련
|
||||
define('ICONS', [
|
||||
'ADD' => '<i class="bi bi-plus-circle"></i>',
|
||||
'LOGO' => '<img src="/images/logo/android-icon-48x48.png">',
|
||||
'EXCEL' => '<img src="/images/common/excel.png"/>',
|
||||
'PDF' => '<img src="/images/common/pdf.png"/>',
|
||||
'GOOGLE' => '<img src="https://www.google.com/favicon.ico" alt="Google" width="20" height="20" class="me-2">',
|
||||
'MEMBER' => '<i class="bi bi-people"></i>',
|
||||
'LOGIN' => '<i class="bi bi-shield-check"></i>',
|
||||
'LOGOUT' => '<i class="bi bi-sign-stop-fill"></i>',
|
||||
'HOME' => '<i class="bi bi-house"></i>',
|
||||
'MENU' => '<i class="bi bi-menu-button"></i>',
|
||||
'NEW' => '<i class="bi bi-database-add"></i>',
|
||||
'REPLY' => '<i class="bi bi-arrow-return-right"></i>',
|
||||
'DATABASE' => '<i class="bi bi-database"></i>',
|
||||
'DISLIKE' => '<i class="bi bi-hand-thumbs-down"></i>',
|
||||
'LIKE' => '<i class="bi bi-hand-thumbs-up"></i>',
|
||||
'DOWNLOAD' => '<i class="bi bi-download"></i>',
|
||||
'UPLOAD' => '<i class="bi bi-upload"></i>',
|
||||
'COPY' => '<i class="bi bi-files"></i>',
|
||||
'PASTE' => '<i class="bi bi-clipboard"></i>',
|
||||
'EDIT' => '<i class="bi bi-pencil-square"></i>',
|
||||
'VIEW' => '<i class="bi bi-eye"></i>',
|
||||
'VIEW_OFF' => '<i class="bi bi-eye-slash"></i>',
|
||||
'PRINT' => '<i class="bi bi-printer"></i>',
|
||||
'SAVE' => '<i class="bi bi-save"></i>',
|
||||
'CANCEL' => '<i class="bi bi-x-circle"></i>',
|
||||
'CLOSE' => '<i class="bi bi-x-circle-fill"></i>',
|
||||
'CLIENT' => '<i class="bi bi-person-circle"></i>',
|
||||
'CHART' => '<i class="bi bi-bar-chart"></i>',
|
||||
'CHECK' => '<i class="bi bi-check-circle"></i>',
|
||||
'CHECK_OFF' => '<i class="bi bi-check-circle-fill"></i>',
|
||||
'CHECK_ON' => '<i class="bi bi-check2-circle"></i>',
|
||||
'CHECK_ALL' => '<i class="bi bi-check-all"></i>',
|
||||
'CHECK_NONE' => '<i class="bi bi-check2"></i>',
|
||||
'CHECK_SOME' => '<i class="bi bi-check2-square"></i>',
|
||||
'COUPON' => '<i class="bi bi-ticket-perforated"></i>',
|
||||
'HISTORY' => '<i class="bi bi-clock-history"></i>',
|
||||
'MODIFY' => '<i class="bi bi-pencil-square"></i>',
|
||||
'MODIFY_ALL' => '<i class="bi bi-pencil-square"></i>',
|
||||
'BATCHJOB' => '<i class="bi bi-clipboard-data"></i>',
|
||||
'DELETE' => '<i class="bi bi-trash"></i>',
|
||||
'REBOOT' => '<i class="bi bi-repeat"></i>',
|
||||
'RELOAD' => '<i class="bi bi-bootstrap-reboot"></i>',
|
||||
'SETUP' => '<i class="bi bi-gear"></i>',
|
||||
'FLAG' => '<i class="bi bi-send"></i>',
|
||||
'SEARCH' => '<i class="bi bi-search"></i>',
|
||||
'PLAY' => '<i class="bi bi-play-fill"></i>',
|
||||
'CART' => '<i class="bi bi-cart4"></i>',
|
||||
'CARD' => '<i class="bi bi-credit-card"></i>',
|
||||
'DEPOSIT' => '<i class="bi bi-cash-coin"></i>',
|
||||
'DESKTOP' => '<i class="bi bi-pc-display-horizontal"></i>',
|
||||
'DEVICE' => '<i class="bi bi-device-hdd"></i>',
|
||||
'UP' => '<i class="bi bi-arrow-up"></i>',
|
||||
'DOWN' => '<i class="bi bi-arrow-down"></i>',
|
||||
'LEFT' => '<i class="bi bi-arrow-left"></i>',
|
||||
'RIGHT' => '<i class="bi bi-arrow-right"></i>',
|
||||
'IMAGE_FILE' => '<i class="bi bi-file-earmark-image"></i>',
|
||||
'CLOUD' => '<i class="bi bi-cloud"></i>',
|
||||
'SIGNPOST' => '<i class="bi bi-signpost"></i>',
|
||||
'LOCK' => '<i class="bi bi-lock"></i>',
|
||||
'UNLOCK' => '<i class="bi bi-unlock"></i>',
|
||||
'BOX' => '<i class="bi bi-box"></i>',
|
||||
'BOXS' => '<i class="bi bi-boxes"></i>',
|
||||
'ONETIME' => '<i class="bi bi-1-circle-fill text-warning"></i>',
|
||||
'MONTH' => '<i class="bi bi-calendar-check text-warning"></i>',
|
||||
'EMAIL' => '<i class="bi bi-mailbox"></i>',
|
||||
'MAIL' => '<i class="bi bi-envelope"></i>',
|
||||
'PHONE' => '<i class="bi bi-phone"></i>',
|
||||
'POINT' => '<i class="bi bi-coin"></i>',
|
||||
'ALRAM' => '<i class="bi bi-bell"></i>',
|
||||
'PAYMENT' => '<i class="bi bi-credit-card-2-back"></i>',
|
||||
'LINK' => '<i class="bi bi-link-45deg"></i>',
|
||||
'SALE_UP' => '<i class="bi bi-graph-up-arrow"></i>',
|
||||
'SALE_DOWN' => '<i class="bi bi-graph-down-arrow"></i>',
|
||||
'SERVICE' => '<i class="bi bi-gear-wide-connected"></i>',
|
||||
'SERVICE_ITEM' => '<i class="bi bi-gear-wide-connected"></i>',
|
||||
'SERVICE_ITEM_LINE' => '<i class="bi bi-chat-left-text"></i>',
|
||||
'SERVICE_ITEM_IP' => '<i class="bi bi-globe"></i>',
|
||||
'SERVICE_ITEM_SERVER' => '<i class="bi bi-server"></i>',
|
||||
'SERVICE_ITEM_CPU' => '<i class="bi bi-cpu"></i>',
|
||||
'SERVICE_ITEM_RAM' => '<i class="bi bi-memory"></i>',
|
||||
'SERVICE_ITEM_STORAGE' => '<i class="bi bi-hdd-stack"></i>',
|
||||
'SERVICE_ITEM_SOFTWARE' => '<i class="bi bi-box-seam"></i>',
|
||||
'SERVICE_ITEM_DEFENCE' => '<i class="bi bi-shield-lock"></i>',
|
||||
'SERVICE_ITEM_DOMAIN' => '<i class="bi bi-globe2"></i>',
|
||||
'SERVICE_ITEM_OTHER' => '<i class="bi bi-gear-wide-connected"></i>',
|
||||
'SERVER_ITEM_CPU' => '<i class="bi bi-cpu"></i>',
|
||||
'SERVER_ITEM_RAM' => '<i class="bi bi-memory"></i>',
|
||||
'SERVER_ITEM_DISK' => '<i class="bi bi-device-hdd"></i>',
|
||||
'SERVER_ITEM_SWITCH' => '<i class="bi bi-diagram-3"></i>',
|
||||
'SERVER_ITEM_OS' => '<i class="bi bi-microsoft"></i>',
|
||||
'SERVER_ITEM_DB' => '<i class="bi bi-database"></i>',
|
||||
'SERVER_ITEM_SOFTWARE' => '<i class="bi bi-window-sidebar"></i>',
|
||||
'SERVER_ITEM_IP' => '<i class="bi bi-globe2"></i>',
|
||||
'SERVER_ITEM_CS' => '<i class="bi bi-shield-check"></i>',
|
||||
'SERVER_ITEM_ETC' => '<i class="bi bi-patch-question"></i>',
|
||||
]);
|
||||
//메신저 아이콘
|
||||
define('MESSENGER_ICONS', [
|
||||
'WHATSAPP' => '<i class="bi bi-whatsapp"></i>',
|
||||
'VIBER' => '<i class="bi bi-viber"></i>',
|
||||
'LINE' => '<i class="bi bi-chat-left-text"></i>',
|
||||
'KAKAO' => '<i class="bi bi-chat-left-text"></i>',
|
||||
'DISCORD' => '<i class="bi bi-discord"></i>',
|
||||
'TELEGRAM' => '<i class="bi bi-telegram"></i>',
|
||||
'SKYPE' => '<i class="bi bi-skype"></i>',
|
||||
'YOUTUBE' => '<i class="bi bi-youtube"></i>',
|
||||
'FACEBOOK' => '<i class="bi bi-facebook"></i>',
|
||||
'TWITTER' => '<i class="bi bi-twitter"></i>',
|
||||
'INSTAGRAM' => '<i class="bi bi-instagram"></i>',
|
||||
'LINKEDIN' => '<i class="bi bi-linkedin"></i>',
|
||||
'GITHUB' => '<i class="bi bi-github"></i>',
|
||||
'GITLAB' => '<i class="bi bi-gitlab"></i>',
|
||||
'BITBUCKET' => '<i class="bi bi-bitbucket"></i>',
|
||||
'REDDIT' => '<i class="bi bi-reddit"></i>',
|
||||
'TIKTOK' => '<i class="bi bi-tiktok"></i>',
|
||||
'PINTEREST' => '<i class="bi bi-pinterest"></i>',
|
||||
'TUMBLR' => '<i class="bi bi-tumblr"></i>',
|
||||
'SNAPCHAT' => '<i class="bi bi-snapchat"></i>',
|
||||
]);
|
||||
//배너관련
|
||||
define('TOP_BANNER', [
|
||||
'default' => '<img src="/images/banner/sub_visual1.jpg"/>',
|
||||
'aboutus' => '<img src="/images/banner/sub_visual1.jpg"/>',
|
||||
'member' => '<img src="/images/banner/sub_visual1.jpg"/>',
|
||||
'hosting' => '<img src="/images/banner/sub_visual2.jpg"/>',
|
||||
'serverdevice' => '<img src="/images/banner/sub_visual3.jpg"/>',
|
||||
'service' => '<img src="/images/banner/sub_visual3.jpg"/>',
|
||||
'support' => '<img src="/images/banner/sub_visual4.jpg"/>',
|
||||
]);
|
||||
//소리관련
|
||||
define('AUDIOS', [
|
||||
'Alram_GetEmail' => '<object width=0 height=0 data="/sound/jarvis_email.mp3" type="audio/mpeg"></object>',
|
||||
]);
|
||||
//Layout관련
|
||||
define('KEYWORD', '일본IDC 일본서버 일본 서버 일본호스팅 서버호스팅 디도스 공격 해외 호스팅 DDOS 방어 ddos 의뢰 디도스 보안 일본 단독서버 가상서버');
|
||||
define('LAYOUTS', [
|
||||
'empty' => [
|
||||
'title' => KEYWORD,
|
||||
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty',
|
||||
'metas' => [
|
||||
'<meta charset="UTF-8">',
|
||||
'<meta name="viewport" content="width=device-width, initial-scale=1.0">',
|
||||
'<meta http-equiv="X-UA-Compatible" content="IE=Edge">',
|
||||
'<meta name="subject" content="Daemon IDC">',
|
||||
'<meta name="description" content="' . KEYWORD . '">',
|
||||
'<meta name="keywords" content="' . KEYWORD . '">',
|
||||
'<meta property="og:type" content="website">',
|
||||
'<meta property="og:title" content="Daemon IDC">',
|
||||
'<meta property="og:description" content="' . KEYWORD . '">',
|
||||
],
|
||||
'stylesheets' => [
|
||||
'<link rel="icon" href="/favicon.ico">',
|
||||
'<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
|
||||
'<link rel="stylesheet" href="/css/common/style.css" />',
|
||||
],
|
||||
'javascripts' => [
|
||||
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
|
||||
],
|
||||
],
|
||||
'front' => [
|
||||
'title' => KEYWORD,
|
||||
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front',
|
||||
'topmenus' => ['aboutus', 'hosting', 'service', 'support'],
|
||||
'metas' => [
|
||||
'<meta charset="UTF-8">',
|
||||
'<meta name="viewport" content="width=device-width, initial-scale=1.0">',
|
||||
'<meta http-equiv="X-UA-Compatible" content="IE=Edge">',
|
||||
'<meta name="subject" content="Daemon IDC">',
|
||||
'<meta name="description" content="' . KEYWORD . '">',
|
||||
'<meta name="keywords" content="' . KEYWORD . '">',
|
||||
'<meta property="og:type" content="website">',
|
||||
'<meta property="og:title" content="Daemon IDC">',
|
||||
'<meta property="og:description" content="' . KEYWORD . '">',
|
||||
],
|
||||
'stylesheets' => [
|
||||
'<link rel="icon" href="/favicon.ico">',
|
||||
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">',
|
||||
'<link rel="stylesheet" href="/css/common/style.css" />',
|
||||
],
|
||||
'javascripts' => [
|
||||
'<script src="//cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>',
|
||||
'<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>',
|
||||
],
|
||||
],
|
||||
'admin' => [
|
||||
'title' => '관리자화면',
|
||||
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin',
|
||||
'metas' => [
|
||||
'<meta charset="UTF-8">',
|
||||
'<meta name="viewport" content="width=device-width, initial-scale=1.0">',
|
||||
'<meta http-equiv="X-UA-Compatible" content="IE=Edge">',
|
||||
'<meta name="subject" content="Daemon IDC">',
|
||||
'<meta name="description" content="' . KEYWORD . '">',
|
||||
'<meta name="keywords" content="' . KEYWORD . '">',
|
||||
'<meta property="og:type" content="website">',
|
||||
'<meta property="og:title" content="Daemon IDC">',
|
||||
'<meta property="og:description" content="' . KEYWORD . '">',
|
||||
],
|
||||
'stylesheets' => [
|
||||
'<link rel="icon" href="/favicon.ico">',
|
||||
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css">',
|
||||
'<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/select2-bootstrap-5-theme@1.3.0/dist/select2-bootstrap-5-theme.min.css" />',
|
||||
'<link rel="stylesheet" href="/assets/tagify/dist/tagify.css">',
|
||||
'<link rel="stylesheet" href="/css/common/style.css" />',
|
||||
],
|
||||
'javascripts' => [
|
||||
'<script src="//cdn.jsdelivr.net/npm/jquery@3.7.0/dist/jquery.min.js"></script>',
|
||||
'<script src="//code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>',
|
||||
'<script src="//cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>',
|
||||
'<script src="/assets/tinymce/tinymce.min.js" referrerpolicy="origin"></script>',
|
||||
'<script src="/assets/tagify/dist/tagify.js"></script>'
|
||||
],
|
||||
],
|
||||
]);
|
||||
|
||||
define("SITES", [
|
||||
"prime" => "PRIME",
|
||||
"itsolution" => "ITSOLUTION",
|
||||
"gdidc" => "GDIDC",
|
||||
]);
|
||||
//STATUS
|
||||
define("STATUS", [
|
||||
'AVAILABLE' => "available",
|
||||
'FORBIDDEN' => "forbidden",
|
||||
'OCCUPIED' => "occupied",
|
||||
'SUCCESS' => "success",
|
||||
'FAILED' => "fail",
|
||||
'PAUSE' => "pause",
|
||||
'TERMINATED' => "terminated",
|
||||
'WIDTHDRAWAL' => "widthdrawal",
|
||||
'DEPOSIT' => "deposit",
|
||||
'PAID' => 'paid',
|
||||
'UNPAID' => 'unpaid',
|
||||
]);
|
||||
define("STATUS_ICONS", [
|
||||
'AVAILABLE' => "",
|
||||
'NOT_AVAILABLE' => "❌"
|
||||
]);
|
||||
//List의 Page당 갯수
|
||||
define('DEFAULT_LIST_PERPAGE', $_ENV['LIST_PERPAGE'] ?? $_SERVER['LIST_PERPAGE'] ?? 20);
|
||||
|
||||
//서버 관련
|
||||
define("SERVER", []);
|
||||
//서비스 관련
|
||||
define("SERVICE", [
|
||||
"NEW_INTERVAL" => $_ENV['SERVICE_NEW_INTERVAL'] ?? $_SERVER['SERVICE_NEW_INTERVAL'] ?? 7,
|
||||
]);
|
||||
//서버파트 관련
|
||||
define("SERVERPART", [
|
||||
"CNT_RANGE" => array_combine(range(1, 10), range(1, 10)),
|
||||
"STOCK_PARTTYPES" => ['RAM', 'DISK'],
|
||||
"SERVER_PARTTYPES" => ['CPU', 'RAM', 'DISK'],
|
||||
"SERVICE_PARTTYPES" => ['SWITCH', 'IP', 'OS', 'SOFTWARE', 'CS'],
|
||||
"ALL_PARTTYPES" => ['CPU', 'RAM', 'DISK', 'OS', 'SOFTWARE', 'SWITCH', 'IP', 'CS'],
|
||||
]);
|
||||
//결제 관련
|
||||
define("PAYMENT", [
|
||||
'BILLING' => [
|
||||
'BASE' => 'base',
|
||||
'MONTH' => 'month',
|
||||
'ONETIME' => 'onetime'
|
||||
],
|
||||
'PAY' => [
|
||||
'ACCOUNT' => 'account',
|
||||
'COUPON' => 'coupon',
|
||||
'POINT' => 'point'
|
||||
]
|
||||
]);
|
||||
176
app/Config/ContentSecurityPolicy.php
Normal file
176
app/Config/ContentSecurityPolicy.php
Normal file
@ -0,0 +1,176 @@
|
||||
<?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;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// Sources allowed
|
||||
// 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';
|
||||
|
||||
/**
|
||||
* Lists allowed stylesheets' URLs.
|
||||
*
|
||||
* @var list<string>|string
|
||||
*/
|
||||
public $styleSrc = '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;
|
||||
|
||||
/**
|
||||
* 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 tag for style
|
||||
*/
|
||||
public string $styleNonceTag = '{csp-style-nonce}';
|
||||
|
||||
/**
|
||||
* Nonce tag for script
|
||||
*/
|
||||
public string $scriptNonceTag = '{csp-script-nonce}';
|
||||
|
||||
/**
|
||||
* Replace nonce tag automatically
|
||||
*/
|
||||
public bool $autoNonce = true;
|
||||
}
|
||||
107
app/Config/Cookie.php
Normal file
107
app/Config/Cookie.php
Normal 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
app/Config/Cors.php
Normal file
105
app/Config/Cors.php
Normal 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,
|
||||
];
|
||||
}
|
||||
203
app/Config/Database.php
Normal file
203
app/Config/Database.php
Normal file
@ -0,0 +1,203 @@
|
||||
<?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' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'foreignKeys' => true,
|
||||
'busyTimeout' => 1000,
|
||||
'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
app/Config/DocTypes.php
Normal file
43
app/Config/DocTypes.php
Normal 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;
|
||||
}
|
||||
121
app/Config/Email.php
Normal file
121
app/Config/Email.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?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 = '';
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
92
app/Config/Encryption.php
Normal file
92
app/Config/Encryption.php
Normal file
@ -0,0 +1,92 @@
|
||||
<?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 = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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
app/Config/Events.php
Normal file
55
app/Config/Events.php
Normal 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
app/Config/Exceptions.php
Normal file
106
app/Config/Exceptions.php
Normal 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
app/Config/Feature.php
Normal file
37
app/Config/Feature.php
Normal 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;
|
||||
}
|
||||
113
app/Config/Filters.php
Normal file
113
app/Config/Filters.php
Normal file
@ -0,0 +1,113 @@
|
||||
<?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;
|
||||
|
||||
use App\Filters\AuthFilter;
|
||||
|
||||
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,
|
||||
'authFilter' => AuthFilter::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
app/Config/ForeignCharacters.php
Normal file
12
app/Config/ForeignCharacters.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||
|
||||
/**
|
||||
* @immutable
|
||||
*/
|
||||
class ForeignCharacters extends BaseForeignCharacters
|
||||
{
|
||||
}
|
||||
64
app/Config/Format.php
Normal file
64
app/Config/Format.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?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,
|
||||
];
|
||||
}
|
||||
44
app/Config/Generators.php
Normal file
44
app/Config/Generators.php
Normal 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
app/Config/Honeypot.php
Normal file
42
app/Config/Honeypot.php
Normal 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';
|
||||
}
|
||||
31
app/Config/Images.php
Normal file
31
app/Config/Images.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?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.
|
||||
*/
|
||||
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
app/Config/Kint.php
Normal file
63
app/Config/Kint.php
Normal 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
app/Config/Logger.php
Normal file
151
app/Config/Logger.php
Normal 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,
|
||||
// ],
|
||||
];
|
||||
}
|
||||
50
app/Config/Migrations.php
Normal file
50
app/Config/Migrations.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?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_';
|
||||
}
|
||||
534
app/Config/Mimes.php
Normal file
534
app/Config/Mimes.php
Normal 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
app/Config/Modules.php
Normal file
82
app/Config/Modules.php
Normal 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',
|
||||
];
|
||||
}
|
||||
30
app/Config/Optimize.php
Normal file
30
app/Config/Optimize.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
39
app/Config/Pager.php
Normal file
39
app/Config/Pager.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?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',
|
||||
'bootstrap_full' => 'Pagers/bootstrap_full',
|
||||
'bootstrap_simple' => 'Pagers/bootstrap_simple',
|
||||
];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Items Per Page
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The default number of results shown in a single page.
|
||||
*/
|
||||
public int $perPage = 20;
|
||||
}
|
||||
75
app/Config/Paths.php
Normal file
75
app/Config/Paths.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?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.
|
||||
*/
|
||||
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';
|
||||
}
|
||||
28
app/Config/Publisher.php
Normal file
28
app/Config/Publisher.php
Normal 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',
|
||||
];
|
||||
}
|
||||
302
app/Config/Routes.php
Normal file
302
app/Config/Routes.php
Normal file
@ -0,0 +1,302 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\Router\RouteCollection;
|
||||
|
||||
/**
|
||||
* @var RouteCollection $routes
|
||||
*/
|
||||
// $routes->get('/', 'Home::index');
|
||||
|
||||
//추가 Custom RULE 만들때 : ex)UUID형식
|
||||
$routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}');
|
||||
//authFilter는 추가적인 작업이 필요
|
||||
//1. app/Filters/AuthFilter.php
|
||||
//2. Config/Filters.php -> $aliases = ['authFilter' => AuthFilter::class]
|
||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||
$routes->cli('billing', 'Payment::billing');
|
||||
$routes->group('migration', ['namespace' => 'App\Controllers\CLI\DBMigration'], function ($routes) {
|
||||
$routes->cli('client', 'SourceDB::client');
|
||||
$routes->cli('servercode', 'SourceDB::servercode');
|
||||
$routes->cli('switchcode', 'SourceDB::switchcode');
|
||||
$routes->cli('partcode', 'SourceDB::partcode');
|
||||
});
|
||||
});
|
||||
$routes->group('', ['namespace' => 'App\Controllers'], function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->group('auth', ['namespace' => 'App\Controllers\Auth'], function ($routes) {
|
||||
$routes->get('login', 'LocalController::login_form');
|
||||
$routes->post('login', 'LocalController::login');
|
||||
$routes->get('google_login', 'GoogleController::login');
|
||||
$routes->get('logout', 'LocalController::logout');
|
||||
});
|
||||
});
|
||||
//Admin 관련
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->get('/search', 'SearchController::index');
|
||||
$routes->group('user', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
$routes->get('/', 'UserController::index', ['filter' => 'authFilter:master']);
|
||||
$routes->get('create', 'UserController::create_form', ['filter' => 'authFilter:master']);
|
||||
$routes->post('create', 'UserController::create', ['filter' => 'authFilter:master']);
|
||||
$routes->get('modify/(:num)', 'UserController::modify_form/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->post('modify/(:num)', 'UserController::modify/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('view/(:num)', 'UserController::view/$1', ['filter' => 'authFilter:manager']);
|
||||
$routes->get('delete/(:num)', 'UserController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:num)/(:any)', 'UserController::toggle/$1/$2', ['filter' => 'authFilter:master']);
|
||||
$routes->post('batchjob', 'UserController::batchjob', ['filter' => 'authFilter:master']);
|
||||
$routes->post('batchjob_delete', 'UserController::batchjob_delete', ['filter' => 'authFilter:master']);
|
||||
$routes->get('download/(:alpha)', 'UserController::download/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('profile/(:num)', 'UserController::profile_form/$1', ['filter' => 'authFilter:manager']);
|
||||
$routes->post('profile/(:num)', 'UserController::profile/$1', ['filter' => 'authFilter:manager']);
|
||||
});
|
||||
$routes->group('mylog', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
$routes->get('/', 'MyLogController::index');
|
||||
$routes->get('view/(:num)', 'MyLogController::view/$1');
|
||||
});
|
||||
$routes->group('search', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
$routes->get('/', 'SearchController::index');
|
||||
});
|
||||
//Customer 관련
|
||||
$routes->group('customer', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->group('client', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'ClientController::index');
|
||||
$routes->get('create', 'ClientController::create_form');
|
||||
$routes->post('create', 'ClientController::create');
|
||||
$routes->get('modify/(:num)', 'ClientController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ClientController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ClientController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ClientController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ClientController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ClientController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ClientController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ClientController::download/$1');
|
||||
$routes->get('detail/(:num)', 'ClientController::detail/$1');
|
||||
$routes->post('history/(:num)', 'ClientController::history/$1');
|
||||
});
|
||||
$routes->group('account', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'AccountController::index');
|
||||
$routes->get('create', 'AccountController::create_form');
|
||||
$routes->post('create', 'AccountController::create');
|
||||
$routes->get('modify/(:num)', 'AccountController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'AccountController::modify/$1');
|
||||
$routes->get('view/(:num)', 'AccountController::view/$1');
|
||||
$routes->get('delete/(:num)', 'AccountController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'AccountController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'AccountController::batchjob');
|
||||
$routes->post('batchjob_delete', 'AccountController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'AccountController::download/$1');
|
||||
});
|
||||
$routes->group('coupon', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'CouponController::index');
|
||||
$routes->get('create', 'CouponController::create_form');
|
||||
$routes->post('create', 'CouponController::create');
|
||||
$routes->get('modify/(:num)', 'CouponController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'CouponController::modify/$1');
|
||||
$routes->get('view/(:num)', 'CouponController::view/$1');
|
||||
$routes->get('delete/(:num)', 'CouponController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'CouponController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'CouponController::batchjob');
|
||||
$routes->post('batchjob_delete', 'CouponController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'CouponController::download/$1');
|
||||
});
|
||||
$routes->group('point', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'PointController::index');
|
||||
$routes->get('create', 'PointController::create_form');
|
||||
$routes->post('create', 'PointController::create');
|
||||
$routes->get('modify/(:num)', 'PointController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'PointController::modify/$1');
|
||||
$routes->get('view/(:num)', 'PointController::view/$1');
|
||||
$routes->get('delete/(:num)', 'PointController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'PointController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'PointController::batchjob');
|
||||
$routes->post('batchjob_delete', 'PointController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PointController::download/$1');
|
||||
});
|
||||
$routes->group('service', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'ServiceController::index');
|
||||
$routes->get('create', 'ServiceController::create_form');
|
||||
$routes->post('create', 'ServiceController::create');
|
||||
$routes->get('modify/(:num)', 'ServiceController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ServiceController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ServiceController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ServiceController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ServiceController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ServiceController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServiceController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServiceController::download/$1');
|
||||
$routes->get('addServer/(:num)', 'ServiceController::addServer_form/$1');
|
||||
$routes->post('addServer/(:num)', 'ServiceController::addServer/$1');
|
||||
$routes->get('changeServere/(:num)', 'ServiceController::changeServere/$1');
|
||||
$routes->get('terminateServer/(:num)', 'ServiceController::terminateServer/$1');
|
||||
$routes->post('history/(:num)', 'ServiceController::history/$1');
|
||||
});
|
||||
$routes->group('payment', ['namespace' => 'App\Controllers\Admin\Customer'], function ($routes) {
|
||||
$routes->get('/', 'PaymentController::index');
|
||||
//일회성결제관련용
|
||||
$routes->get('create', 'PaymentController::create_form');
|
||||
$routes->post('create', 'PaymentController::create');
|
||||
// $routes->get('modify/(:num)', 'PaymentController::modify_form/$1');
|
||||
// $routes->post('modify/(:num)', 'PaymentController::modify/$1');
|
||||
$routes->get('view/(:num)', 'PaymentController::view/$1');
|
||||
// $routes->get('delete/(:num)', 'PaymentController::delete/$1');
|
||||
// $routes->get('toggle/(:num)/(:any)', 'PaymentController::toggle/$1/$2');
|
||||
//일괄결제용
|
||||
$routes->post('batchjob', 'PaymentController::batchjob');
|
||||
// $routes->post('batchjob_delete', 'PaymentController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'PaymentController::download/$1');
|
||||
//청구서발행용
|
||||
$routes->post('invoice', 'PaymentController::invoice');
|
||||
});
|
||||
});
|
||||
//Customer 관련
|
||||
//Equipment 관련
|
||||
$routes->group('equipment', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->group('line', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'LineController::index');
|
||||
$routes->get('create', 'LineController::create_form');
|
||||
$routes->post('create', 'LineController::create');
|
||||
$routes->get('modify/(:num)', 'LineController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'LineController::modify/$1');
|
||||
$routes->get('view/(:num)', 'LineController::view/$1');
|
||||
$routes->get('delete/(:num)', 'LineController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'LineController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'LineController::batchjob');
|
||||
$routes->post('batchjob_delete', 'LineController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'LineController::download/$1');
|
||||
});
|
||||
$routes->group('server', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'ServerController::index');
|
||||
$routes->get('create', 'ServerController::create_form');
|
||||
$routes->post('create', 'ServerController::create');
|
||||
$routes->get('modify/(:num)', 'ServerController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ServerController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ServerController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ServerController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ServerController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ServerController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServerController::batchjob_delete');
|
||||
});
|
||||
$routes->group('serverpart', ['namespace' => 'App\Controllers\Admin\Equipment'], function ($routes) {
|
||||
$routes->get('/', 'ServerPartController::index');
|
||||
$routes->get('create', 'ServerPartController::create_form');
|
||||
$routes->post('create', 'ServerPartController::create');
|
||||
$routes->get('modify/(:num)', 'ServerPartController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'ServerPartController::modify/$1');
|
||||
$routes->get('view/(:num)', 'ServerPartController::view/$1');
|
||||
$routes->get('delete/(:num)', 'ServerPartController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'ServerPartController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'ServerPartController::batchjob');
|
||||
$routes->post('batchjob_delete', 'ServerPartController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'ServerPartController::download/$1');
|
||||
});
|
||||
});
|
||||
//Equipment 관련
|
||||
//Part 관련
|
||||
$routes->group('part', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->group('switch', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'SWITCHController::index');
|
||||
$routes->get('create', 'SWITCHController::create_form');
|
||||
$routes->post('create', 'SWITCHController::create');
|
||||
$routes->get('modify/(:alphanum)', 'SWITCHController::modify_form/$1');
|
||||
$routes->post('modify/(:alphanum)', 'SWITCHController::modify/$1');
|
||||
$routes->get('view/(:alphanum)', 'SWITCHController::view/$1');
|
||||
$routes->get('delete/(:alphanum)', 'SWITCHController::delete/$1');
|
||||
$routes->get('toggle/(:alphanum)/(:any)', 'SWITCHController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'SWITCHController::batchjob');
|
||||
$routes->post('batchjob_delete', 'SWITCHController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'SWITCHController::download/$1');
|
||||
});
|
||||
$routes->group('ip', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'IPController::index');
|
||||
$routes->get('create', 'IPController::create_form');
|
||||
$routes->post('create', 'IPController::create');
|
||||
$routes->get('modify/(:num)', 'IPController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'IPController::modify/$1');
|
||||
$routes->get('view/(:num)', 'IPController::view/$1');
|
||||
$routes->get('delete/(:num)', 'IPController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'IPController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'IPController::batchjob');
|
||||
$routes->post('batchjob_delete', 'IPController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'IPController::download/$1');
|
||||
});
|
||||
$routes->group('cs', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'CSController::index');
|
||||
$routes->get('create', 'CSController::create_form');
|
||||
$routes->post('create', 'CSController::create');
|
||||
$routes->get('modify/(:num)', 'CSController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'CSController::modify/$1');
|
||||
$routes->get('view/(:num)', 'CSController::view/$1');
|
||||
$routes->get('delete/(:num)', 'CSController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'CSController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'CSController::batchjob');
|
||||
$routes->post('batchjob_delete', 'CSController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'CSController::download/$1');
|
||||
});
|
||||
$routes->group('cpu', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'CPUController::index');
|
||||
$routes->get('create', 'CPUController::create_form');
|
||||
$routes->post('create', 'CPUController::create');
|
||||
$routes->get('modify/(:num)', 'CPUController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'CPUController::modify/$1');
|
||||
$routes->get('view/(:num)', 'CPUController::view/$1');
|
||||
$routes->get('delete/(:num)', 'CPUController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'CPUController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'CPUController::batchjob');
|
||||
$routes->post('batchjob_delete', 'CPUController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'CPUController::download/$1');
|
||||
});
|
||||
$routes->group('ram', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'RAMController::index');
|
||||
$routes->get('create', 'RAMController::create_form');
|
||||
$routes->post('create', 'RAMController::create');
|
||||
$routes->get('modify/(:num)', 'RAMController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'RAMController::modify/$1');
|
||||
$routes->get('view/(:num)', 'RAMController::view/$1');
|
||||
$routes->get('delete/(:num)', 'RAMController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'RAMController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'RAMController::batchjob');
|
||||
$routes->post('batchjob_delete', 'RAMController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'RAMController::download/$1');
|
||||
});
|
||||
$routes->group('disk', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'DISKController::index');
|
||||
$routes->get('create', 'DISKController::create_form');
|
||||
$routes->post('create', 'DISKController::create');
|
||||
$routes->get('modify/(:num)', 'DISKController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'DISKController::modify/$1');
|
||||
$routes->get('view/(:num)', 'DISKController::view/$1');
|
||||
$routes->get('delete/(:num)', 'DISKController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'DISKController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'DISKController::batchjob');
|
||||
$routes->post('batchjob_delete', 'DISKController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'DISKController::download/$1');
|
||||
});
|
||||
$routes->group('os', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'OSController::index');
|
||||
$routes->get('create', 'OSController::create_form');
|
||||
$routes->post('create', 'OSController::create');
|
||||
$routes->get('modify/(:num)', 'OSController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'OSController::modify/$1');
|
||||
$routes->get('view/(:num)', 'OSController::view/$1');
|
||||
$routes->get('delete/(:num)', 'OSController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'OSController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'OSController::batchjob');
|
||||
$routes->post('batchjob_delete', 'OSController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'OSController::download/$1');
|
||||
});
|
||||
$routes->group('software', ['namespace' => 'App\Controllers\Admin\Part'], function ($routes) {
|
||||
$routes->get('/', 'SOFTWAREController::index');
|
||||
$routes->get('create', 'SOFTWAREController::create_form');
|
||||
$routes->post('create', 'SOFTWAREController::create');
|
||||
$routes->get('modify/(:num)', 'SOFTWAREController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'SOFTWAREController::modify/$1');
|
||||
$routes->get('view/(:num)', 'SOFTWAREController::view/$1');
|
||||
$routes->get('delete/(:num)', 'SOFTWAREController::delete/$1');
|
||||
$routes->get('toggle/(:num)/(:any)', 'SOFTWAREController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'SOFTWAREController::batchjob');
|
||||
$routes->post('batchjob_delete', 'SOFTWAREController::batchjob_delete');
|
||||
$routes->get('download/(:alpha)', 'SOFTWAREController::download/$1');
|
||||
});
|
||||
});
|
||||
//Part 관련
|
||||
});
|
||||
140
app/Config/Routing.php
Normal file
140
app/Config/Routing.php
Normal file
@ -0,0 +1,140 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of CodeIgniter 4 framework.
|
||||
*
|
||||
* (c) CodeIgniter Foundation <admin@codeigniter.com>
|
||||
*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* 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
app/Config/Security.php
Normal file
86
app/Config/Security.php
Normal 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');
|
||||
}
|
||||
43
app/Config/Services.php
Normal file
43
app/Config/Services.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Services\Auth\LocalService;
|
||||
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();
|
||||
* }
|
||||
*/
|
||||
|
||||
public static function myauth($getShared = true): LocalService
|
||||
{
|
||||
if ($getShared) {
|
||||
return static::getSharedInstance('myauth');
|
||||
} else {
|
||||
return new LocalService();
|
||||
}
|
||||
}
|
||||
}
|
||||
127
app/Config/Session.php
Normal file
127
app/Config/Session.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?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\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;
|
||||
}
|
||||
122
app/Config/Toolbar.php
Normal file
122
app/Config/Toolbar.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?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',
|
||||
];
|
||||
}
|
||||
252
app/Config/UserAgents.php
Normal file
252
app/Config/UserAgents.php
Normal file
@ -0,0 +1,252 @@
|
||||
<?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',
|
||||
'msnbot' => 'MSNBot',
|
||||
'baiduspider' => 'Baiduspider',
|
||||
'bingbot' => 'Bing',
|
||||
'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',
|
||||
];
|
||||
}
|
||||
44
app/Config/Validation.php
Normal file
44
app/Config/Validation.php
Normal 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
|
||||
// --------------------------------------------------------------------
|
||||
}
|
||||
62
app/Config/View.php
Normal file
62
app/Config/View.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?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 = [];
|
||||
}
|
||||
20
app/Controllers/Admin/AdminController.php
Normal file
20
app/Controllers/Admin/AdminController.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\CommonController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class AdminController extends CommonController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->layout = "admin";
|
||||
$this->uri_path = "admin/";
|
||||
$this->view_path = "admin" . DIRECTORY_SEPARATOR;
|
||||
$this->content_title = "관리자";
|
||||
}
|
||||
}
|
||||
32
app/Controllers/Admin/Customer/AccountController.php
Normal file
32
app/Controllers/Admin/Customer/AccountController.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\AccountEntity;
|
||||
use App\Helpers\Customer\AccountHelper;
|
||||
use App\Services\Customer\AccountService;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AccountController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): AccountService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new AccountService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
134
app/Controllers/Admin/Customer/ClientController.php
Normal file
134
app/Controllers/Admin/Customer/ClientController.php
Normal file
@ -0,0 +1,134 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Services\Customer\ClientService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ClientController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): ClientService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ClientService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
|
||||
|
||||
//Index,FieldForm관련
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::doValidation($validation, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
// case 'create_form':
|
||||
// case 'modify_form':
|
||||
case 'detail':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'client';
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case 'history':
|
||||
$result = redirect()->to($this->request->getGET('return_url'))->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
public function detail(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
//기본값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormOptions();
|
||||
//일괄작업용 Fields정의
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$uid}에 해당하는 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->totalCounts = $this->getService()->getServerService()->getTotalServiceCount(['serviceinfo.clientinfo_uid' => $entity->getPK()]);
|
||||
$this->totalAmounts = $this->getService()->getServiceService()->getTotalAmounts([
|
||||
'clientinfo_uid' => $entity->getPK(),
|
||||
'status' => STATUS['AVAILABLE']
|
||||
]);
|
||||
//서비스별 미납 Count
|
||||
$this->unPaids = $this->getService()->getPaymentService()->getUnPaids('clientinfo_uid', [
|
||||
'clientinfo_uid' => $entity->getPK()
|
||||
]);
|
||||
$this->serviceEntities = $this->getService()->getServiceService()->getEntities(['clientinfo_uid' => $entity->getPK()]);
|
||||
$this->entity = $entity;
|
||||
helper(['form']);
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $e->getMessage();
|
||||
// return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function history(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['history']);
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ClientEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->modify($entity, $this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess('고객 비고가 수정되었습니다.');
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
32
app/Controllers/Admin/Customer/CouponController.php
Normal file
32
app/Controllers/Admin/Customer/CouponController.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\CouponEntity;
|
||||
use App\Helpers\Customer\CouponHelper;
|
||||
use App\Services\Customer\CouponService;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CouponController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): CouponService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new CouponService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
18
app/Controllers/Admin/Customer/CustomerController.php
Normal file
18
app/Controllers/Admin/Customer/CustomerController.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Controllers\Admin\AdminController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class CustomerController extends AdminController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
127
app/Controllers/Admin/Customer/PaymentController.php
Normal file
127
app/Controllers/Admin/Customer/PaymentController.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ClientEntity;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Services\Customer\ClientService;
|
||||
use App\Services\PaymentService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PaymentController extends CustomerController
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
public function getService(): PaymentService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new PaymentService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'invoice':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'payment';
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//Invoice 관련
|
||||
public function invoice(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("청구서에 적용될 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
$rows = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof PaymentEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$uid}에 대한 결제정보를 찾을수 없습니다.");
|
||||
}
|
||||
//entities에 고객 설정
|
||||
$clientEntity = $this->getClientService()->getEntity($entity->getClientInfoUID());
|
||||
if (!$clientEntity instanceof ClientEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$entity->getClientInfoUID()}에 대한 고객정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!array_key_exists($clientEntity->getPK(), $rows)) {
|
||||
$rows[$clientEntity->getPK()] = [
|
||||
'name' => $clientEntity->getName(),
|
||||
'total_amount' => 0,
|
||||
'services' => []
|
||||
];
|
||||
}
|
||||
//entities에 서비스 설정
|
||||
$serviceEntity = $this->getService()->getServiceService()->getEntity($entity->getServiceInfoUid());
|
||||
if (!$serviceEntity instanceof ServiceEntity) {
|
||||
throw new \Exception(__METHOD__ . "에서 {$entity->getServiceInfoUid()}에 대한 서비스정보를 찾을수 없습니다.");
|
||||
}
|
||||
if (!array_key_exists($serviceEntity->getPK(), $rows[$clientEntity->getPK()]['services'])) {
|
||||
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()] = [
|
||||
'code' => $serviceEntity->getCode(),
|
||||
'billing_at' => $serviceEntity->getBillingAt(),
|
||||
'items' => []
|
||||
];
|
||||
}
|
||||
//entities에 총 결제금액 설정
|
||||
$rows[$clientEntity->getPK()]['services'][$serviceEntity->getPK()]['items'][] = ['title' => $entity->getTitle(), 'amount' => $entity->getAmount()];
|
||||
$rows[$clientEntity->getPK()]['total_amount'] += $entity->getAmount();
|
||||
}
|
||||
// dd($rows);
|
||||
$this->rows = $rows;
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//일회성관련
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
$formDatas['billing'] = PAYMENT['BILLING']['ONETIME'];
|
||||
$formDatas['billing_at'] = date("Y-m-d");
|
||||
$this->getService()->setFormDatas($formDatas);
|
||||
parent::create_form_process();
|
||||
}
|
||||
}
|
||||
32
app/Controllers/Admin/Customer/PointController.php
Normal file
32
app/Controllers/Admin/Customer/PointController.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\PointEntity;
|
||||
use App\Helpers\Customer\PointHelper;
|
||||
use App\Services\Customer\PointService;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class PointController extends CustomerController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): PointService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new PointService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
}
|
||||
256
app/Controllers/Admin/Customer/ServiceController.php
Normal file
256
app/Controllers/Admin/Customer/ServiceController.php
Normal file
@ -0,0 +1,256 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Customer;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\PaymentService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServiceController extends CustomerController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?PaymentService $_paymentService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): ServiceService
|
||||
{
|
||||
if ($this->_service === null) {
|
||||
$this->_service = new ServiceService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getServerService(): ServerService
|
||||
{
|
||||
if ($this->_serverService === null) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
public function getPaymentService(): PaymentService
|
||||
{
|
||||
if ($this->_paymentService === null) {
|
||||
$this->_paymentService = new PaymentService();
|
||||
}
|
||||
return $this->_paymentService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'alternative':
|
||||
$result = "대체서버 추가가 완료되었습니다.";
|
||||
break;
|
||||
case 'create_form':
|
||||
case 'modify_form':
|
||||
case 'addServer_form':
|
||||
case 'view':
|
||||
case 'index':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'service';
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case 'history':
|
||||
$result = redirect()->to($this->request->getGET('return_url'))->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//생성관련
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
$formDatas['location'] = 'chiba';
|
||||
$formDatas['rack'] = '100000';
|
||||
$formDatas['line'] = '300000';
|
||||
$formDatas['type'] = 'normal';
|
||||
$formDatas['billing_at'] = date("Y-m-d");
|
||||
$formDatas['start_at'] = date("Y-m-d");
|
||||
$formDatas['status'] = ServiceEntity::DEFAULT_STATUS;
|
||||
$this->getService()->setFormDatas($formDatas);
|
||||
parent::create_form_process();
|
||||
}
|
||||
private function getChildServers(ServiceEntity $entity): array
|
||||
{
|
||||
$servers = [];
|
||||
foreach ($this->getServerService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $serverEntity) {
|
||||
$servers[] = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
'serverinfo_uid' => $serverEntity->getPK(),
|
||||
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||
'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(),
|
||||
'template' => 'partlist_service'
|
||||
]);
|
||||
}
|
||||
return $servers;
|
||||
}
|
||||
//List 관련
|
||||
protected function index_process(array $entities = []): array
|
||||
{
|
||||
//서비스별 미납 Count
|
||||
$childServers = [];
|
||||
$this->unPaids = $this->getPaymentService()->getUnPaids('serviceinfo_uid');
|
||||
foreach ($this->getService()->getEntities() as $entity) {
|
||||
$entities[] = $entity;
|
||||
$childServers[$entity->getPK()] = $this->getChildServers($entity);
|
||||
}
|
||||
$this->childServers = $childServers;
|
||||
return $entities;
|
||||
}
|
||||
//대체서버선정
|
||||
public function addServer_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['serverinfo_uid']);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//대체서버 등록
|
||||
public function addServer(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['serverinfo_uid']);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
$formDatas['type'] = 'alternative'; //대체서버로 등록하기위해 필요
|
||||
$this->entity = $this->getService()->addServer($entity, $formDatas);
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//대체서버를 MAIN서버로 설정
|
||||
public function changeServere(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['serverinfo_uid']);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
if (!array_key_exists('serverinfo_uid', $formDatas)) {
|
||||
throw new \Exception("서비스의 메인서버로 설정할 서버정보가 없습니다.");
|
||||
}
|
||||
//서버정보설정
|
||||
$this->getService()->changeServere($entity, $formDatas);
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//서비스 서버해지
|
||||
public function terminateServer(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['serverinfo_uid']);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
$this->getService()->terminateServer($entity, $formDatas);
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
public function history(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields(['history']);
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof ServiceEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getService()->modify($entity, $this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess('서비스객 비고가 수정되었습니다.');
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
26
app/Controllers/Admin/Equipment/EquipmentController.php
Normal file
26
app/Controllers/Admin/Equipment/EquipmentController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Controllers\Admin\AdminController;
|
||||
use App\Services\Customer\ClientService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class EquipmentController extends AdminController
|
||||
{
|
||||
private ?ClientService $_clientService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
final public function getClientService(): ClientService
|
||||
{
|
||||
if (!$this->_clientService) {
|
||||
$this->_clientService = new ClientService();
|
||||
}
|
||||
return $this->_clientService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
62
app/Controllers/Admin/Equipment/LineController.php
Normal file
62
app/Controllers/Admin/Equipment/LineController.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use App\Services\Equipment\LineService;
|
||||
use App\Services\Equipment\IPService;
|
||||
use App\Helpers\Equipment\LineHelper;
|
||||
use App\Entities\Equipment\LineEntity;
|
||||
use App\Entities\Equipment\IPEntity;
|
||||
|
||||
class LineController extends EquipmentController
|
||||
{
|
||||
private ?IpService $_ipService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): LineService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new LineService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
final public function getIPService(): IpService
|
||||
{
|
||||
if (!$this->_ipService) {
|
||||
$this->_ipService = new IpService();
|
||||
}
|
||||
return $this->_ipService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
|
||||
//생성
|
||||
protected function create_process(array $formDatas): LineEntity
|
||||
{
|
||||
//Line 등록
|
||||
if (!$this->getService()->getHelper()->isValidCIDR($formDatas['bandwith'])) {
|
||||
throw new \Exception("{$formDatas['bandwith']}는 CIDR 형식에 부합되지 않습니다.");
|
||||
}
|
||||
//부모처리
|
||||
$entity = parent::create_process($formDatas);
|
||||
//Prefixed IP to array 자동 등록
|
||||
foreach ($this->getService()->getHelper()->cidrToIpRange($formDatas['bandwith']) as $ip) {
|
||||
$this->getIPService()->create([
|
||||
'lineinfo_uid' => $entity->getPK(),
|
||||
'ip' => $ip,
|
||||
'status' => IPEntity::DEFAULT_STATUS,
|
||||
]);
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
59
app/Controllers/Admin/Equipment/ServerController.php
Normal file
59
app/Controllers/Admin/Equipment/ServerController.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class ServerController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
public function getService(): ServerService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServerService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'index':
|
||||
case 'view':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'server';
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
$formDatas['code'] = sprintf("%d%dXX-M%d", date("y"), ceil((int)date("m") / 3), $this->getService()->getLatestPK());
|
||||
$this->getService()->setFormDatas($formDatas);
|
||||
parent::create_form_process();
|
||||
}
|
||||
}
|
||||
65
app/Controllers/Admin/Equipment/ServerPartController.php
Normal file
65
app/Controllers/Admin/Equipment/ServerPartController.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Equipment;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use App\Services\Equipment\ServerPartService;
|
||||
|
||||
class ServerPartController extends EquipmentController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
public function getService(): ServerPartService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServerPartService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'create_form':
|
||||
case 'modify_form':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate ?? 'serverpart';
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case 'history':
|
||||
$result = redirect()->to($this->request->getGET('return_url'))->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
//생성관련
|
||||
protected function create_form_process(): void
|
||||
{
|
||||
//Form 기본값정의
|
||||
$formDatas = $this->getService()->getFormDatas();
|
||||
$formDatas['billing'] = 'base';
|
||||
$formDatas['cnt'] = 1;
|
||||
$this->getService()->setFormDatas($formDatas);
|
||||
parent::create_form_process();
|
||||
}
|
||||
}
|
||||
88
app/Controllers/Admin/Home.php
Normal file
88
app/Controllers/Admin/Home.php
Normal file
@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\PaymentService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Home extends AdminController
|
||||
{
|
||||
private $_service = null;
|
||||
private ?PaymentService $_PaymentService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
$this->view_path .= 'welcome' . DIRECTORY_SEPARATOR;
|
||||
}
|
||||
|
||||
final public function getService(): ServiceService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServiceService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
final public function getPaymentService(): PaymentService
|
||||
{
|
||||
if (!$this->_PaymentService) {
|
||||
$this->_PaymentService = new PaymentService();
|
||||
}
|
||||
return $this->_PaymentService;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'index':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate;
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
//Index,FieldForm관련
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
//기본전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//Total 서버 현황
|
||||
//interval을 기준으로 최근 신규 서비스정보 가져오기
|
||||
$this->interval = intval($this->request->getVar('interval') ?? SERVICE['NEW_INTERVAL']);
|
||||
$this->newServiceEntities = $this->getService()->getEntitiesByNewService($this->interval);
|
||||
$this->newServiceCount = count($this->newServiceEntities);
|
||||
//서비스별 미납 Count
|
||||
$totalUnPaidCount = 0;
|
||||
$totalUnPaidAmount = 0;
|
||||
foreach ($this->getPaymentService()->getUnPaids('serviceinfo_uid') as $key => $datas) {
|
||||
$totalUnPaidCount += $datas['cnt'];
|
||||
$totalUnPaidAmount += $datas['amount'];
|
||||
}
|
||||
$this->totalUnPaidCount = $totalUnPaidCount;
|
||||
$this->totalUnPaidAmount = $totalUnPaidAmount;
|
||||
helper(['form']);
|
||||
return $this->getResultSuccess();
|
||||
}
|
||||
}
|
||||
33
app/Controllers/Admin/MyLogController.php
Normal file
33
app/Controllers/Admin/MyLogController.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\MyLogService;
|
||||
use App\Helpers\MyLogHelper;
|
||||
|
||||
class MyLogController extends AdminController
|
||||
{
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
final public function getService(): MyLogService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new MyLogService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
29
app/Controllers/Admin/Part/CPUController.php
Normal file
29
app/Controllers/Admin/Part/CPUController.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Part\CPUService;
|
||||
|
||||
class CPUController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): CPUService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new CPUService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
}
|
||||
30
app/Controllers/Admin/Part/CSController.php
Normal file
30
app/Controllers/Admin/Part/CSController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Part\CSService;
|
||||
|
||||
class CSController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): CSService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new CSService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
30
app/Controllers/Admin/Part/DISKController.php
Normal file
30
app/Controllers/Admin/Part/DISKController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Part\DISKService;
|
||||
|
||||
class DISKController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): DISKService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new DISKService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관
|
||||
}
|
||||
40
app/Controllers/Admin/Part/IPController.php
Normal file
40
app/Controllers/Admin/Part/IPController.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use App\Services\Part\IPService;
|
||||
|
||||
use App\Services\Equipment\LineService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class IPController extends PartController
|
||||
{
|
||||
private ?LineService $_lineService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): IPService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new IPService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
final public function getLineService(): LineService
|
||||
{
|
||||
if (!$this->_lineService) {
|
||||
$this->_lineService = new LineService();
|
||||
}
|
||||
return $this->_lineService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
30
app/Controllers/Admin/Part/OSController.php
Normal file
30
app/Controllers/Admin/Part/OSController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Part\OSService;
|
||||
|
||||
class OSController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): OSService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new OSService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관
|
||||
}
|
||||
26
app/Controllers/Admin/Part/PartController.php
Normal file
26
app/Controllers/Admin/Part/PartController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use App\Controllers\Admin\AdminController;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class PartController extends AdminController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
final public function getServerService(): ServerService
|
||||
{
|
||||
if (!$this->_serverService) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
}
|
||||
28
app/Controllers/Admin/Part/RAMController.php
Normal file
28
app/Controllers/Admin/Part/RAMController.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Services\Part\RAMService;
|
||||
|
||||
class RAMController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): RAMService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new RAMService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
}
|
||||
30
app/Controllers/Admin/Part/SOFTWAREController.php
Normal file
30
app/Controllers/Admin/Part/SOFTWAREController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Services\Part\SOFTWAREService;
|
||||
|
||||
class SOFTWAREController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): SOFTWAREService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new SOFTWAREService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관
|
||||
}
|
||||
30
app/Controllers/Admin/Part/SWITCHController.php
Normal file
30
app/Controllers/Admin/Part/SWITCHController.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin\Part;
|
||||
|
||||
use App\Services\Part\SWITCHService;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SWITCHController extends PartController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
|
||||
}
|
||||
public function getService(): SWITCHService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new SWITCHService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관
|
||||
}
|
||||
145
app/Controllers/Admin/SearchController.php
Normal file
145
app/Controllers/Admin/SearchController.php
Normal file
@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use App\Services\Equipment\ServerService;
|
||||
use App\Services\PaymentService;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class SearchController extends AdminController
|
||||
{
|
||||
private ?ServerService $_serverService = null;
|
||||
private ?PaymentService $_paymentService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path = '/admin/search';
|
||||
// $this->view_path = '/admin/search';
|
||||
}
|
||||
public function getService(): ServiceService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new ServiceService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
public function getServerService(): ServerService
|
||||
{
|
||||
if ($this->_serverService === null) {
|
||||
$this->_serverService = new ServerService();
|
||||
}
|
||||
return $this->_serverService;
|
||||
}
|
||||
public function getPaymentService(): PaymentService
|
||||
{
|
||||
if ($this->_paymentService === null) {
|
||||
$this->_paymentService = new PaymentService();
|
||||
}
|
||||
return $this->_paymentService;
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'index':
|
||||
$result = parent::getResultSuccess($message, 'search');
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
protected function getChildServers(ServiceEntity $entity): array
|
||||
{
|
||||
$servers = [];
|
||||
foreach ($this->getServerService()->getEntities(['serviceinfo_uid' => $entity->getPK()]) as $serverEntity) {
|
||||
$servers[] = view_cell("\App\Cells\Equipment\ServerPartCell::parttable", [
|
||||
'serverinfo_uid' => $serverEntity->getPK(),
|
||||
'types' => SERVERPART['SERVICE_PARTTYPES'],
|
||||
'serviceinfo_serverinfo_uid' => $entity->getServerEntity()->getPK(),
|
||||
'template' => 'partlist_service'
|
||||
]);
|
||||
}
|
||||
return $servers;
|
||||
}
|
||||
//
|
||||
|
||||
protected function index_process(array $entities = []): array
|
||||
{
|
||||
$keyword = $this->request->getGet('keyword'); // 검색어
|
||||
if (!$keyword) {
|
||||
throw new \Exception("[{$keyword}] 검색어가 지정되지 않았습니다. ");
|
||||
}
|
||||
// ->select([
|
||||
// 's.serviceinfo_uid',
|
||||
// 's.uid AS server_uid',
|
||||
// 's.title AS server_title',
|
||||
// 'c.uid AS client_uid',
|
||||
// 'c.name AS client_name',
|
||||
// 'sp.uid AS part_uid',
|
||||
// 'sp.title AS part_title'
|
||||
// ])
|
||||
$db = \Config\Database::connect();
|
||||
$builder = $db->table('serverinfo s')
|
||||
->distinct()
|
||||
->select('s.serviceinfo_uid AS serviceinfo_uid')
|
||||
->join('clientinfo c', 'c.uid = s.clientinfo_uid')
|
||||
->join('serverpartinfo sp', 'sp.clientinfo_uid = c.uid', 'left')
|
||||
->groupStart()
|
||||
->like('c.name', $keyword, 'both', null, true) // escape=true
|
||||
->orLike('s.title', $keyword, 'both', null, true)
|
||||
->orLike('sp.title', $keyword, 'both', null, true)
|
||||
->groupEnd();
|
||||
// SQL 확인용 (실제 운영에서는 주석 처리)
|
||||
// echo $builder->getCompiledSelect(); exit;
|
||||
$results = $builder->get()->getResultArray();
|
||||
// dd($results);
|
||||
$uids = [];
|
||||
foreach ($results as $result) {
|
||||
$uids[] = "'{$result['serviceinfo_uid']}'";
|
||||
}
|
||||
if (!count($uids)) {
|
||||
return [];
|
||||
}
|
||||
//서비스별 미납 Count
|
||||
$childServers = [];
|
||||
foreach ($this->getService()->getEntities("uid IN (" . implode(",", $uids) . ")") as $entity) {
|
||||
$entities[] = $entity;
|
||||
$childServers[$entity->getPK()] = $this->getChildServers($entity);
|
||||
}
|
||||
$this->childServers = $childServers;
|
||||
return $entities;
|
||||
}
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
helper(['form']);
|
||||
//Return Url정의
|
||||
$this->getService()->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
$entities = $this->index_process();
|
||||
$this->total_count = count($entities);
|
||||
$this->page_options = [];
|
||||
$this->entities = $entities;
|
||||
$this->per_page = 200;
|
||||
$this->page = 1;
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
124
app/Controllers/Admin/UserController.php
Normal file
124
app/Controllers/Admin/UserController.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Services\UserService;
|
||||
|
||||
class UserController extends AdminController
|
||||
{
|
||||
private $_db;
|
||||
private $_service = null;
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->content_title = lang("{$this->getService()->getClassName()}.title");
|
||||
$this->class_path .= $this->getService()->getClassName();
|
||||
$this->uri_path .= strtolower($this->getService()->getClassName('/')) . '/';
|
||||
// $this->view_path .= strtolower($this->getService()->getClassName()) . DIRECTORY_SEPARATOR;
|
||||
$this->_db = \Config\Database::connect();
|
||||
}
|
||||
final public function getService(): UserService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new UserService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'profile_modify_form':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate;
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . 'modify_form';
|
||||
} else {
|
||||
$view_file = $this->view_path . 'modify_form';
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case 'profile_modify':
|
||||
$this->getMyLogService()->save($this->getService()->getClassName(), $this->getService()->getAction(), $message, $this->getService()->getMyAuth()->getUIDByAuthInfo());
|
||||
$result = $this->view($this->entity->getPK());
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
//아래 Rule Array는 필드명.* checkbox를 사용
|
||||
$validation->setRule("{$field}.*", $field, $rule);
|
||||
break;
|
||||
default:
|
||||
$validation = parent::doValidation($validation, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Index,FieldForm관련.
|
||||
final public function profile_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//기본값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
final public function profile(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity instanceof UserEntity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_process($entity, $this->getService()->getFormDatas());
|
||||
$this->_db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$this->_db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
107
app/Controllers/Auth/AuthController.php
Normal file
107
app/Controllers/Auth/AuthController.php
Normal file
@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Auth;
|
||||
|
||||
use App\Controllers\CommonController;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Helpers\AuthHelper;
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class AuthController extends CommonController
|
||||
{
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->layout = "auth";
|
||||
$this->uri_path = "auth/";
|
||||
$this->view_path = "auth" . DIRECTORY_SEPARATOR;
|
||||
$this->content_title = "사용자인증";
|
||||
}
|
||||
abstract protected function getSNSButton(): string;
|
||||
abstract protected function login_process(array $formDatas): UserEntity;
|
||||
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse
|
||||
{
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
return redirect()->back()->withInput()->with('error', $message);
|
||||
}
|
||||
return redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
switch ($this->getService()->getAction()) {
|
||||
case 'create': //Login처리
|
||||
$result = redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
break;
|
||||
default:
|
||||
$result = parent::getResultSuccess($message, $actionTemplate);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
final protected function create_validate_process(array $formDatas): array
|
||||
{
|
||||
return $formDatas;
|
||||
}
|
||||
//로그인화면
|
||||
public function login_form_process(): void
|
||||
{
|
||||
$this->sns_buttoh = $this->getSNSButton();
|
||||
}
|
||||
public function login_form(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//기본값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->login_form_process();
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//로그인처리
|
||||
public function login(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->doValidations();
|
||||
$this->entity = $this->login_process($this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//로그아웃
|
||||
final public function logout(): RedirectResponse
|
||||
{
|
||||
try {
|
||||
$this->getService()->logout();
|
||||
// 홈페이지로 리다이렉트
|
||||
return redirect()->route('/')->with('error', MESSAGES['LOGOUT']);
|
||||
} catch (\Exception $e) {
|
||||
log_message("error", $e->getMessage());
|
||||
return redirect()->back()->with('error', "로그아웃 중 오류가 발생했습니다.");
|
||||
}
|
||||
}
|
||||
}
|
||||
51
app/Controllers/Auth/GoogleController.php
Normal file
51
app/Controllers/Auth/GoogleController.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Auth;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Libraries\MySocket\GoogleSocket\API as GoogleSocket;
|
||||
use App\Services\Auth\GoogleService;
|
||||
use App\Entities\UserEntity;
|
||||
|
||||
class GoogleController extends AuthController
|
||||
{
|
||||
|
||||
private ?GoogleSocket $_socket = null;
|
||||
private $_service = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
final public function getSocket()
|
||||
{
|
||||
if (!$this->_socket) {
|
||||
$this->_socket = new GoogleSocket();
|
||||
}
|
||||
return $this->_socket;
|
||||
}
|
||||
final public function getService(): GoogleService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new GoogleService($this->getSocket());
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
|
||||
public function getSNSButton(): string
|
||||
{
|
||||
//구글 로그인 BUTTON용
|
||||
return anchor($this->getSocket()->createAuthUrl(), ICONS['GOOGLE'] . 'Google 로그인', ["class" => "btn-google"]);
|
||||
}
|
||||
|
||||
//로그인처리
|
||||
protected function login_process(array $formDatas): UserEntity
|
||||
{
|
||||
if (!array_key_exists('access_code', $formDatas) || !$formDatas['access_code']) {
|
||||
throw new \Exception("구글 로그인 실패");
|
||||
}
|
||||
return $this->getService()->login($formDatas);
|
||||
}
|
||||
}
|
||||
36
app/Controllers/Auth/LocalController.php
Normal file
36
app/Controllers/Auth/LocalController.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Auth;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Services\Auth\LocalService;
|
||||
|
||||
class LocalController extends AuthController
|
||||
{
|
||||
private $_service = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
final public function getService(): LocalService
|
||||
{
|
||||
if (!$this->_service) {
|
||||
$this->_service = new LocalService();
|
||||
}
|
||||
return $this->_service;
|
||||
}
|
||||
|
||||
public function getSNSButton(): string
|
||||
{
|
||||
return "";
|
||||
}
|
||||
//로그인처리
|
||||
protected function login_process(array $formDatas): UserEntity
|
||||
{
|
||||
return $this->getService()->login($formDatas);
|
||||
}
|
||||
}
|
||||
58
app/Controllers/BaseController.php
Normal file
58
app/Controllers/BaseController.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use CodeIgniter\Controller;
|
||||
use CodeIgniter\HTTP\CLIRequest;
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Class BaseController
|
||||
*
|
||||
* 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
|
||||
{
|
||||
/**
|
||||
* Instance of the main Request object.
|
||||
*
|
||||
* @var CLIRequest|IncomingRequest
|
||||
*/
|
||||
protected $request;
|
||||
|
||||
/**
|
||||
* An array of helpers to be loaded automatically upon
|
||||
* class instantiation. These helpers will be available
|
||||
* to all other controllers that extend BaseController.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $helpers = [];
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Do Not Edit This Line
|
||||
parent::initController($request, $response, $logger);
|
||||
|
||||
// Preload any models, libraries, etc, here.
|
||||
|
||||
// E.g.: $this->session = service('session');
|
||||
}
|
||||
}
|
||||
55
app/Controllers/CLI/DBMigration/DBMigration.php
Normal file
55
app/Controllers/CLI/DBMigration/DBMigration.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\CLI\DBMigration;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\Database\BaseConnection;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Libraries\DBMigration\Process\MigrationProcessInterface;
|
||||
|
||||
abstract class DBMigration extends BaseController
|
||||
{
|
||||
private $_targetDB = null;
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
abstract protected function getSourceDB(): BaseConnection;
|
||||
abstract protected function getClient(): array;
|
||||
abstract protected function getLine(): array;
|
||||
abstract protected function getServerCode(): array;
|
||||
abstract protected function getSWITCHCode(): array;
|
||||
abstract protected function getPartCode(): array;
|
||||
|
||||
final protected function getTargetDB(): BaseConnection
|
||||
{
|
||||
if ($this->_targetDB === null) {
|
||||
$this->_targetDB = \Config\Database::connect('default');
|
||||
}
|
||||
return $this->_targetDB;
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 마이그레이션 처리 로직
|
||||
*/
|
||||
final protected function migration(MigrationProcessInterface $processor, array $rows, string $functionName): void
|
||||
{
|
||||
$this->getTargetDB()->transStart();
|
||||
try {
|
||||
$cnt = 1;
|
||||
foreach ($rows as $row) {
|
||||
$processor->process($row, $cnt);
|
||||
$cnt++;
|
||||
}
|
||||
echo "{$functionName} 작업을 완료하였습니다.";
|
||||
$this->getTargetDB()->transCommit();
|
||||
} catch (\Exception $e) {
|
||||
$this->getTargetDB()->transRollback();
|
||||
echo "{$functionName} 작업을 실패하였습니다.\n--------------\n" . $e->getMessage() . "\n--------------\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
149
app/Controllers/CLI/DBMigration/SourceDB.php
Normal file
149
app/Controllers/CLI/DBMigration/SourceDB.php
Normal file
@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\CLI\DBMigration;
|
||||
|
||||
use CodeIgniter\Database\BaseConnection;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Libraries\DBMigration\Process\ClientProcess;
|
||||
use App\Libraries\DBMigration\Process\LineProcess;
|
||||
use App\Libraries\DBMigration\Process\ServerCodeProcess;
|
||||
use App\Libraries\DBMigration\Process\SWITCHCodeProcess;
|
||||
use App\Libraries\DBMigration\Process\PartCodeProcess;
|
||||
|
||||
class SourceDB extends DBMigration
|
||||
{
|
||||
private $_sourceDB = null;
|
||||
|
||||
/**
|
||||
* SQL 쿼리 상수 정의
|
||||
*/
|
||||
private const SQL_GET_CLIENT = "SELECT * FROM clientdb";
|
||||
private const SQL_GET_LINE = "SELECT Line_code, line_case, Line_ip, line_client_name, line_gateway, line_id, line_pass, line_name, line_haveip, line_phone, line_mainip FROM linedb";
|
||||
private const SQL_GET_SERVER_CODE = "SELECT DISTINCT(server_code) FROM serverdb WHERE server_code NOT LIKE ?";
|
||||
private const SQL_GET_SWITCH_CODE = "SELECT DISTINCT(service_sw) FROM servicedb WHERE service_sw NOT LIKE ?";
|
||||
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
}
|
||||
|
||||
/**
|
||||
* 소스 데이터베이스 연결 반환
|
||||
*/
|
||||
final protected function getSourceDB(): BaseConnection
|
||||
{
|
||||
if ($this->_sourceDB === null) {
|
||||
$config = [
|
||||
'DSN' => '',
|
||||
'hostname' => env('database.source.hostname', 'localhost'),
|
||||
'username' => env('database.source.username', 'root'),
|
||||
'password' => env('database.source.password', ''),
|
||||
'database' => env('database.source.database', 'primeidc'),
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => (ENVIRONMENT !== 'production'),
|
||||
'cacheOn' => false,
|
||||
'cacheDir' => '',
|
||||
'charset' => 'utf8mb4',
|
||||
'DBCollat' => 'utf8mb4_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
];
|
||||
$this->_sourceDB = \Config\Database::connect($config);
|
||||
}
|
||||
return $this->_sourceDB;
|
||||
}
|
||||
|
||||
/**
|
||||
* 공통 쿼리 실행 메서드
|
||||
*/
|
||||
private function executeQuery(string $sql, array $params = []): array
|
||||
{
|
||||
return $this->getSourceDB()
|
||||
->query($sql, $params)
|
||||
->getResultArray();
|
||||
}
|
||||
private function executeFile(string $filename, string $deilmeter = ','): array
|
||||
{
|
||||
$datas = [];
|
||||
$lines = file($filename, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
foreach ($lines as $line) {
|
||||
$datas[] = explode($deilmeter, $line);
|
||||
}
|
||||
return $datas;
|
||||
}
|
||||
|
||||
protected function getClient(): array
|
||||
{
|
||||
return $this->executeQuery(self::SQL_GET_CLIENT);
|
||||
}
|
||||
|
||||
protected function getLine(): array
|
||||
{
|
||||
return $this->executeQuery(self::SQL_GET_LINE);
|
||||
}
|
||||
|
||||
protected function getServerCode(): array
|
||||
{
|
||||
return $this->executeQuery(self::SQL_GET_SERVER_CODE, ['%일회성%']);
|
||||
}
|
||||
|
||||
protected function getSWITCHCode(): array
|
||||
{
|
||||
return $this->executeQuery(self::SQL_GET_SWITCH_CODE, ['%일회성%']);
|
||||
}
|
||||
protected function getPartCode(): array
|
||||
{
|
||||
return $this->executeFile('/home/donfig/dbmsv2/app/Database/dbmsv2_part.txt');
|
||||
}
|
||||
final public function client(): void
|
||||
{
|
||||
$this->migration(
|
||||
new ClientProcess($this->getTargetDB()),
|
||||
$this->getClient(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
|
||||
final public function line(): void
|
||||
{
|
||||
$this->migration(
|
||||
new LineProcess($this->getTargetDB()),
|
||||
$this->getLine(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
|
||||
final public function servercode(): void
|
||||
{
|
||||
$this->migration(
|
||||
new ServerCodeProcess($this->getTargetDB()),
|
||||
$this->getServerCode(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
|
||||
final public function switchcode(): void
|
||||
{
|
||||
$this->migration(
|
||||
new SWITCHCodeProcess($this->getTargetDB()),
|
||||
$this->getSWITCHCode(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
final public function partcode(): void
|
||||
{
|
||||
$this->migration(
|
||||
new PartCodeProcess($this->getTargetDB()),
|
||||
$this->getPartCode(),
|
||||
__FUNCTION__
|
||||
);
|
||||
}
|
||||
}
|
||||
62
app/Controllers/CLI/Payment.php
Normal file
62
app/Controllers/CLI/Payment.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\CLI;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Entities\PaymentEntity;
|
||||
use App\Entities\Customer\ServiceEntity;
|
||||
use App\Services\Customer\ServiceService;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class Payment extends BaseController
|
||||
{
|
||||
private $_db;
|
||||
private ?ServiceService $_serviceService = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_db = \Config\Database::connect();
|
||||
}
|
||||
public function getServiceService(): ServiceService
|
||||
{
|
||||
if (!$this->_serviceService) {
|
||||
$this->_serviceService = new ServiceService();
|
||||
}
|
||||
return $this->_serviceService;
|
||||
}
|
||||
public function billing(): void
|
||||
{
|
||||
//Transaction Start
|
||||
$this->_db->transStart();
|
||||
try {
|
||||
//서비스중 결제일이 오늘이고, 상태가 사용중이 경우만 서비스 모두 연장처리
|
||||
$this->getServiceService()->extendBillingAt(date('Y-m-d'), STATUS['UNPAID']);
|
||||
//결제일이 오늘보다 크고, 상태가 사용중인 서비스정보를 이용해서 결제정보에 신규 추가하기
|
||||
foreach ($this->getServiceService()->getEntities(['billing_at' => date("Y-m-d"), 'status' => ServiceEntity::DEFAULT_STATUS]) as $serviceEntity) {
|
||||
// echo $serviceEntity->getPK() . ":" . $serviceEntity->getBillingAt() . "\n";
|
||||
foreach ($this->getServiceItemService()->getEntities(['serviceinfo_uid' => $serviceEntity->getPK()]) as $itemEntity) {
|
||||
//결제정보 ServicePaymentService에 월별 결제만 신규등록
|
||||
if ($itemEntity->getBillingCycle() == "month") {
|
||||
//결제정보 ServicePaymentService에 등록
|
||||
$paymentFormDatas = ['status' => STATUS['UNPAID']];
|
||||
$this->getServicePaymentService()->createByServiceItemService($paymentFormDatas, $itemEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
// echo $this->getServiceService()->getModel()->getLastQuery() . "\n";
|
||||
log_message("notice", "Billing 작업을 완료하였습니다.");
|
||||
$this->_db->transCommit();
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->_db->transRollback();
|
||||
log_message(
|
||||
"error",
|
||||
"Billing 작업을 실패하였습니다.\n--------------\n" .
|
||||
$e->getMessage() .
|
||||
"\n--------------\n"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
582
app/Controllers/CommonController.php
Normal file
582
app/Controllers/CommonController.php
Normal file
@ -0,0 +1,582 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
|
||||
use App\Libraries\LogCollector;
|
||||
use App\Services\MyLogService;
|
||||
use CodeIgniter\HTTP\DownloadResponse;
|
||||
|
||||
use CodeIgniter\HTTP\RedirectResponse;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Validation\Validation;
|
||||
use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
use PhpOffice\PhpSpreadsheet\Reader\Html;
|
||||
use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
abstract class CommonController extends BaseController
|
||||
{
|
||||
private ?MyLogService $_myLogService = null;
|
||||
private $_viewDatas = [];
|
||||
abstract public function getService(): mixed;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->isLoggedIn = false;
|
||||
$this->uri = $request->getUri();
|
||||
if ($this->getService()->getMyAuth()->isLoggedIn()) {
|
||||
$this->isLoggedIn = true;
|
||||
$this->myAuthName = $this->getService()->getMyAuth()->getNameByAuthInfo();
|
||||
$this->myAuthUID = $this->getService()->getMyAuth()->getUIDByAuthInfo();
|
||||
}
|
||||
}
|
||||
final public function __get($name)
|
||||
{
|
||||
if (!array_key_exists($name, $this->_viewDatas)) {
|
||||
return null;
|
||||
}
|
||||
return $this->_viewDatas[$name];
|
||||
}
|
||||
final public function __set($name, $value): void
|
||||
{
|
||||
$this->_viewDatas[$name] = $value;
|
||||
}
|
||||
final protected function getViewDatas(): array
|
||||
{
|
||||
return $this->_viewDatas;
|
||||
}
|
||||
final protected function getMyLogService(): mixed
|
||||
{
|
||||
if (!$this->_myLogService) {
|
||||
$this->_myLogService = new MyLogService();
|
||||
}
|
||||
return $this->_myLogService;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//FormDatas 전달값,Default값
|
||||
//FormDatas 검증
|
||||
final protected function doValidations(): void
|
||||
{
|
||||
//변경할 값 확인 : Upload된 파일 검증시 $this->request->getPOST()보다 먼처 체크필요
|
||||
$validation = service('validation');
|
||||
foreach ($this->getService()->getControlDatas('field_rules') as $field => $rule) {
|
||||
$validation = $this->doValidation($validation, $field, $rule);
|
||||
}
|
||||
if (!$validation->run($this->getService()->getFormDatas())) {
|
||||
throw new \Exception("{$this->getService()->getClassName()} 작업 데이터 검증 오류발생\n" . implode(
|
||||
"\n",
|
||||
$validation->getErrors()
|
||||
));
|
||||
}
|
||||
// return $validation->getValidated();
|
||||
}
|
||||
//공통 필수기능
|
||||
//FormData Field별 전달값 처리
|
||||
protected function doValidation(Validation $validation, string $field, string $rule): Validation
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$validation->setRule($field, $field, $rule);
|
||||
break;
|
||||
}
|
||||
return $validation;
|
||||
}
|
||||
//Process Result처리
|
||||
protected function getResultFail(string $message = MESSAGES["FAILED"]): RedirectResponse
|
||||
{
|
||||
// $this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getService()->getMyAuth()->getUIDByAuthInfo());
|
||||
if ($this->request->getMethod() === 'POST') {
|
||||
return redirect()->back()->withInput()->with('error', $message);
|
||||
}
|
||||
return redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
}
|
||||
protected function getResultSuccess(string $message = MESSAGES["SUCCESS"], ?string $actionTemplate = null): RedirectResponse|string
|
||||
{
|
||||
helper(['form']);
|
||||
switch ($this->getService()->getControlDatas('action')) {
|
||||
case 'create':
|
||||
case 'modify':
|
||||
// $this->getMyLogService()->save($this->getService()->getClassName(), $this->getAction(), $message, $this->getService()->getMyAuth()->getUIDByAuthInfo());
|
||||
$result = $this->view($this->entity->getPK());
|
||||
break;
|
||||
case 'create_form':
|
||||
case 'modify_form':
|
||||
case 'login_form':
|
||||
case 'view':
|
||||
case 'index':
|
||||
case 'download':
|
||||
$this->service = $this->getService();
|
||||
$this->control = $this->getService()->getControlDatas();
|
||||
$this->getService()->getHelper()->setViewDatas($this->getViewDatas());
|
||||
$actionTemplate = $this->request->getVar('ActionTemplate') ?? $actionTemplate;
|
||||
if ($actionTemplate) {
|
||||
$view_file = $this->view_path . $actionTemplate . DIRECTORY_SEPARATOR . $this->getService()->getAction();
|
||||
} else {
|
||||
$view_file = $this->view_path . $this->getService()->getAction();
|
||||
}
|
||||
$result = view($view_file, ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$result = redirect()->to($this->getService()->getMyAuth()->popPreviousUrl())->with('error', $message);
|
||||
break;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
//Index,FieldForm관련
|
||||
//생성 기본기능
|
||||
protected function create_form_process(): void {}
|
||||
public function create_form(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
//초기화
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$this->create_form_process();
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function create_process(array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->create($formDatas);
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->doValidations();
|
||||
$this->entity = $this->create_process($this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//수정 기본기능
|
||||
protected function modify_form_process(mixed $entity): mixed
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
public function modify_form(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_form_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
protected function modify_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->modify($entity, $formDatas);
|
||||
}
|
||||
public function modify(int $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->modify_process($entity, $this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//단일필드작업기능
|
||||
protected function toggle_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->toggle($entity, $formDatas);
|
||||
}
|
||||
public function toggle(mixed $uid, string $field): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields([$field]);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$this->doValidations();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->toggle_process($entity, $this->getService()->getFormDatas());
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//일괄처리작업기능
|
||||
protected function batchjob_process(mixed $entity, array $formDatas): mixed
|
||||
{
|
||||
return $this->getService()->batchjob($entity, $formDatas);
|
||||
}
|
||||
private function batchjob_pre_process(): array
|
||||
{
|
||||
$selectedFields = [];
|
||||
$formDatas = [];
|
||||
foreach ($this->getService()->getBatchjobFields() as $field) {
|
||||
$value = $this->request->getPost($field);
|
||||
if ($value) {
|
||||
$selectedFields[] = $field;
|
||||
$formDatas[$field] = $value;
|
||||
}
|
||||
}
|
||||
if (!count($selectedFields)) {
|
||||
throw new \Exception("변경할 조건항목을 선택하셔야합니다.");
|
||||
}
|
||||
//변경할 UIDS 정의
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트을 선택하셔야합니다.");
|
||||
}
|
||||
return [$selectedFields, $formDatas, $uids];
|
||||
}
|
||||
public function batchjob(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
list($selectedFields, $formDatas, $uids) = $this->batchjob_pre_process();
|
||||
$this->getService()->setFormFields($selectedFields);
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getPost());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
$this->doValidations();
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_process($entity, $formDatas);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄작업을 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//삭제관련
|
||||
protected function delete_process(mixed $entity): mixed
|
||||
{
|
||||
return $this->getService()->delete($entity);
|
||||
}
|
||||
public function delete(mixed $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->delete_process($entity);
|
||||
$db->transCommit();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//일괄삭제관련
|
||||
protected function batchjob_delete_process(mixed $entity): mixed
|
||||
{
|
||||
return $this->getService()->delete($entity);
|
||||
}
|
||||
private function batchjob_delete_pre_process(): array
|
||||
{
|
||||
//변경할 UIDS
|
||||
$uids = $this->request->getPost('batchjob_uids[]');
|
||||
if (!is_array($uids) || !count($uids)) {
|
||||
throw new \Exception("적용할 리스트를 선택하셔야합니다.");
|
||||
}
|
||||
return $uids;
|
||||
}
|
||||
public function batchjob_delete(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$db = \Config\Database::connect();
|
||||
$db->transStart();
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$uids = $this->batchjob_delete_pre_process();
|
||||
$entities = [];
|
||||
foreach ($uids as $uid) {
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$entities[] = $this->batchjob_delete_process($entity);
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$db->transCommit();
|
||||
LogCollector::debug(sprintf("%s에서 총 %s개중 %s개 일괄삭제를 완료하였습니다.", __METHOD__, count($uids), count($this->entities)));
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
$db->transRollback();
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//View 관련
|
||||
protected function view_process(mixed $entity): mixed
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
public function view(string $uid): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//기존 Entity 가져오기
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->view_process($entity);
|
||||
helper(['form']);
|
||||
$this->forms = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//리스트관련
|
||||
//조건절 처리
|
||||
protected function index_condition_process(): void
|
||||
{
|
||||
//Filter조건절 처리
|
||||
$index_filters = [];
|
||||
foreach ($this->getService()->getControlDatas('actionFilters') as $field) {
|
||||
$value = $this->getService()->getFormDatas()[$field] ?? null;
|
||||
if ($value) {
|
||||
$this->getService()->index_condition_filterField($field, $value);
|
||||
$index_filters[$field] = $value;
|
||||
}
|
||||
}
|
||||
$this->getService()->setControlDatas('index_filters', $index_filters);
|
||||
//검색어조건절 처리
|
||||
$index_word = $this->request->getVar('index_word');
|
||||
if ($index_word !== null && $index_word !== '') {
|
||||
$this->getService()->index_condition_filterWord($index_word);
|
||||
}
|
||||
$this->getService()->setControlDatas('index_word', $index_word);
|
||||
//날자검색
|
||||
$index_start = $this->request->getVar('index_start');
|
||||
$index_end = $this->request->getVar('index_end');
|
||||
if ($index_start !== null && $index_start !== '' && $index_end !== null && $index_end !== '') {
|
||||
$this->getService()->index_condition_filterDate($index_start, $index_end);
|
||||
}
|
||||
$this->getService()->setControlDatas('index_start', $index_start);
|
||||
$this->getService()->setControlDatas('index_end', $index_end);
|
||||
}
|
||||
//PageNation 처리
|
||||
protected function index_pagenation_process($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full')
|
||||
{
|
||||
//Page, Per_page필요부분
|
||||
$this->page = (int) $this->request->getVar('page') ?: 1;
|
||||
$this->per_page = (int) $this->request->getVar('per_page') ?: intval(DEFAULT_LIST_PERPAGE ?? 20);
|
||||
// 1.Views/Pagers/에 bootstrap_full.php,bootstrap_simple.php 생성
|
||||
// 2.app/Config/Pager.php/$templates에 'bootstrap_full => 'Pagers\bootstrap_full',
|
||||
// 'bootstrap_simple' => 'Pagers\bootstrap_simple', 추가
|
||||
$pager = service("pager");
|
||||
$pager->makeLinks($this->page, $this->per_page, $this->total_count, $template, $segment, $pager_group);
|
||||
$this->page = $pager->getCurrentPage($pager_group);
|
||||
$this->total_page = $pager->getPageCount($pager_group);
|
||||
return $pager->links($pager_group, $template);
|
||||
}
|
||||
//Page출력 처리
|
||||
protected function index_pageOptions_process(): array
|
||||
{
|
||||
$page_options = ["" => "줄수선택"];
|
||||
for ($i = $this->per_page; $i <= $this->total_count; $i += $this->per_page) {
|
||||
$page_options[$i] = $i;
|
||||
}
|
||||
$page_options[$this->total_count] = $this->total_count;
|
||||
return $page_options;
|
||||
}
|
||||
//Entities처리
|
||||
protected function index_process(array $entities = []): array
|
||||
{
|
||||
foreach ($this->getService()->getEntities() as $entity) {
|
||||
$entities[] = $entity;
|
||||
}
|
||||
return $entities;
|
||||
}
|
||||
public function index(): RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//일괄작업용 Fields정의
|
||||
$this->getService()->setControlDatas('batchjob_fields', $this->getService()->getBatchjobFields());
|
||||
//일괄작업용 버튼정의
|
||||
$this->getService()->setControlDatas('batchjob_buttions', $this->getService()->getBatchjobButtons());
|
||||
helper(['form']);
|
||||
//Return Url정의
|
||||
$this->getService()->getMyAuth()->pushCurrentUrl($this->request->getUri()->getPath() . ($this->request->getUri()->getQuery() ? "?" . $this->request->getUri()->getQuery() : ""));
|
||||
//조건절 처리
|
||||
$this->index_condition_process();
|
||||
//TotalCount (SoftDelete적용이 되려면 countAllResults를 사용해야함)
|
||||
$this->total_count = $this->getService()->getTotalCount();
|
||||
//Pagination 처리
|
||||
$this->pagination = $this->index_pagenation_process();
|
||||
//줄수 처리용
|
||||
$this->page_options = $this->index_pageOptions_process();
|
||||
//조건절 처리
|
||||
//OrcerBy , Limit 처리
|
||||
$this->order_field = $this->request->getVar('order_field');
|
||||
$this->order_value = $this->request->getVar('order_value');
|
||||
$this->getService()->setOrderBy($this->order_field, $this->order_value);
|
||||
$this->getService()->setLimit($this->per_page);
|
||||
$this->getService()->setOffset(($this->page - 1) * $this->per_page);
|
||||
$this->index_condition_process();
|
||||
$this->entities = $this->index_process();
|
||||
return $this->getResultSuccess();
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
//OUPUT Document 관련
|
||||
protected function download_process(string $document_type, mixed $loaded_data): array
|
||||
{
|
||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "excel";
|
||||
switch ($document_type) {
|
||||
case 'excel':
|
||||
$file_name = sprintf("%s_%s.xlsx", $this->getService()->getClassName(), date('Y-m-d_Hm'));
|
||||
$writer = IOFactory::createWriter($loaded_data, 'Xlsx');
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
case 'pdf':
|
||||
$file_name = sprintf("%s_%s.pdf", $this->getService()->getClassName(), date('Y-m-d_Hm'));
|
||||
$writer = new Mpdf($loaded_data);
|
||||
$writer->save($full_path . DIRECTORY_SEPARATOR . $file_name);
|
||||
break;
|
||||
}
|
||||
return array($full_path, $file_name);
|
||||
}
|
||||
// Download
|
||||
public function download(string $output_type, mixed $uid = false): DownloadResponse|RedirectResponse|string
|
||||
{
|
||||
try {
|
||||
$this->getService()->setAction(__FUNCTION__);
|
||||
$this->getService()->setFormFields();
|
||||
//전달값정의
|
||||
$this->getService()->setFormDatas($this->request->getGet());
|
||||
$this->getService()->setFormFilters();
|
||||
$this->getService()->setFormRules();
|
||||
$this->getService()->setFormOptions();
|
||||
//URL처리
|
||||
// $this->uri = $this->request->getUri();
|
||||
switch ($output_type) {
|
||||
case 'excel':
|
||||
case 'pdf':
|
||||
helper(['form']);
|
||||
foreach ($this->getService()->getEntities() as $entity) {
|
||||
$entities[] = $entity;
|
||||
}
|
||||
$this->entities = $entities;
|
||||
$html = $this->getResultSuccess();
|
||||
//data loading
|
||||
$reader = new Html();
|
||||
$loaded_data = $reader->loadFromString($html);
|
||||
list($full_path, $file_name) = $this->download_process($output_type, $loaded_data);
|
||||
$full_path .= DIRECTORY_SEPARATOR . $file_name;
|
||||
break;
|
||||
default:
|
||||
if (!$uid) {
|
||||
throw new \Exception("{$output_type}은 반드시 uid의 값이 필요합니다.");
|
||||
}
|
||||
$entity = $this->getService()->getEntity($uid);
|
||||
if (!$entity) {
|
||||
throw new \Exception("{$uid}에 대한 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $entity;
|
||||
list($file_name, $uploaded_filename) = $entity->getDownlaodFile();
|
||||
$full_path = WRITEPATH . DIRECTORY_SEPARATOR . "uploads" . DIRECTORY_SEPARATOR . $uploaded_filename;
|
||||
break;
|
||||
}
|
||||
return $this->response->download($full_path, null)->setFileName($file_name);
|
||||
} catch (\Exception $e) {
|
||||
return $this->getResultFail($e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
11
app/Controllers/Home.php
Normal file
11
app/Controllers/Home.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers;
|
||||
|
||||
class Home extends BaseController
|
||||
{
|
||||
public function index(): string
|
||||
{
|
||||
return view('welcome_message');
|
||||
}
|
||||
}
|
||||
0
app/Database/Migrations/.gitkeep
Normal file
0
app/Database/Migrations/.gitkeep
Normal file
0
app/Database/Seeds/.gitkeep
Normal file
0
app/Database/Seeds/.gitkeep
Normal file
10430
app/Database/dbmsv2.vuerd.json
Normal file
10430
app/Database/dbmsv2.vuerd.json
Normal file
File diff suppressed because it is too large
Load Diff
728
app/Database/dbmsv2_init.sql
Normal file
728
app/Database/dbmsv2_init.sql
Normal file
File diff suppressed because one or more lines are too long
40
app/Database/dbmsv2_part.txt
Normal file
40
app/Database/dbmsv2_part.txt
Normal file
@ -0,0 +1,40 @@
|
||||
CPU,Xeon E5530 2.4Ghz 4Core,50000
|
||||
CPU,Xeon E5540 2.4Ghz 4Core,50000
|
||||
CPU,Xeon X5560 2.8Ghz 8Core,80000
|
||||
CPU,Xeon X5650 2.6Ghz 12Core,100000
|
||||
CPU,Xeon E5-2690v2 2.6Ghz 12Core,100000
|
||||
CPU,Xeon E5-2690v4 3.0Ghz 20Core,150000
|
||||
RAM,2G,20000
|
||||
RAM,4G,30000
|
||||
RAM,8G,40000
|
||||
RAM,16G,60000
|
||||
RAM,32G,100000
|
||||
RAM,64G,100000
|
||||
DISK,SATA 128G,50000
|
||||
DISK,SATA 256G,70000
|
||||
DISK,SATA 512G,90000
|
||||
DISK,SAS 128G,60000
|
||||
DISK,SAS 256G,80000
|
||||
DISK,SAS 512G,100000
|
||||
DISK,SSD 128G,60000
|
||||
DISK,SSD 256G,80000
|
||||
DISK,SSD 512G,100000
|
||||
DISK,SSD 1T,120000
|
||||
DISK,SSD 2T,150000
|
||||
DISK,NVME 512G,120000
|
||||
DISK,NVME 1T,150000
|
||||
DISK,NVME 2T,180000
|
||||
OS,Windows 10,10000
|
||||
OS,Windows 11,20000
|
||||
OS,Windows NT 2008R2,30000
|
||||
OS,Windows NT 2012R2,30000
|
||||
OS,Windows NT 2016R2,30000
|
||||
OS,Windows NT 2019R2,30000
|
||||
OS,CentOS 7,10000
|
||||
OS,CentOS 8,10000
|
||||
OS,CentOS 9,10000
|
||||
OS,Ununtu 20.04,10000
|
||||
OS,Ununtu 21.04,10000
|
||||
OS,Ununtu 22.04,10000
|
||||
SOFTWARE,닷디펜더,50000
|
||||
SOFTWARE,딥파인더,50000
|
||||
0
app/Database/dbmsv2_test1.sql
Normal file
0
app/Database/dbmsv2_test1.sql
Normal file
731
app/Database/dbmsv2_test2.sql
Normal file
731
app/Database/dbmsv2_test2.sql
Normal file
File diff suppressed because one or more lines are too long
62
app/Database/user.sql
Normal file
62
app/Database/user.sql
Normal file
@ -0,0 +1,62 @@
|
||||
-- MySQL dump 10.19 Distrib 10.3.28-MariaDB, for Linux (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: dbms
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.3.28-MariaDB-log
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
|
||||
--
|
||||
-- Table structure for table `user`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `user`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `user` (
|
||||
`uid` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`id` varchar(20) NOT NULL,
|
||||
`passwd` varchar(255) NOT NULL,
|
||||
`name` varchar(20) NOT NULL,
|
||||
`email` varchar(50) NOT NULL,
|
||||
`mobile` varchar(20) DEFAULT NULL,
|
||||
`role` varchar(255) DEFAULT NULL,
|
||||
`status` varchar(20) DEFAULT 'normal',
|
||||
`updated_at` timestamp NULL DEFAULT NULL,
|
||||
`created_at` timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
`deleted_at` timestamp NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`uid`),
|
||||
UNIQUE KEY `UQ_id` (`id`),
|
||||
UNIQUE KEY `UQ_email` (`email`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=46 DEFAULT CHARSET=utf8 COMMENT='관리자정보';
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `user`
|
||||
--
|
||||
|
||||
LOCK TABLES `user` WRITE;
|
||||
/*!40000 ALTER TABLE `user` DISABLE KEYS */;
|
||||
INSERT INTO `user` VALUES (1,'choi.jh','$2y$10$.vl2FtwJsjMNFCJJm3ISDu7m3vBB85mZ5fRQxcfI0uK/2D1e8Xora','최준흠','choi.jh@prime-idc.jp','0434434327','manager,cloudflare,firewall,security,director,master','normal','2025-08-08 01:03:54','2023-03-23 06:50:04',NULL),(2,'cho.jh','$2y$10$ot/aUXR/W1n4Q3dZA2dZCOxQrpVb2Bq31Y7xFQS3G6D1gtImmyBjm','조준희','cho.jh@prime-idc.jp','','manager,cloudflare,security','normal','2025-08-08 01:03:41','2023-03-24 02:20:48',NULL),(4,'kimdy','$2y$10$18uyn94xdprzAnt.oYZ5weAvb8rRLhkz/SdQrjEK7yuGhCr9PlUCC','김동윤','kimdy@prime-idc.jp',NULL,'manager,cloudflare,security','normal','2025-06-24 01:10:17','2023-03-24 02:21:50',NULL),(5,'kimhy','$2y$10$.yEKVqY.F7HoSOZijl4uyeulUtfAQ4EDRiyR2JpgFYBuKw.mZoZvG','김효영','khy@prime-idc.jp',NULL,'manager,security,director','normal','2025-06-24 01:11:41','2023-03-24 02:23:18',NULL),(6,'kim.eh','$2y$10$YmwicI.Br4XNyGamfRADMOu.qlkwKd2fmnNkL7YIkNHGndvqYPnCq','김은혁','kim.eh@prime-idc.jp',NULL,'manager,cloudflare,security','normal','2025-06-24 01:09:38','2023-03-24 02:23:52',NULL),(7,'leeph','$2y$10$lR739WzJsW6rDLgchYs7buek4BYeTlKHTQY60RDqRms9Io7RSY3AC','이풍호','leeph@prime-idc.jp',NULL,'manager,cloudflare','normal','2023-05-29 16:32:52','2023-03-24 02:24:21',NULL),(8,'jinmingyu','$2y$10$PI8WA6d/z4hDE6hxJoUhbuMH3vTTWH0Ry2Z6fTLUUpwQGaE/9bEZa','김명옥','jinmingyu@idcjp.jp',NULL,'manager,cloudflare,security','normal','2025-06-24 01:09:47','2023-03-24 02:25:00',NULL),(9,'kangdh','$2y$10$gu9OS2DDQQ5H.Hh61t3BSOUp87l35q.xsduVSxvCcn8IgA4jrATgG','강동헌','kang.dh@idcjp.jp','','manager,cloudflare,security','normal','2025-08-08 01:06:54','2023-03-24 02:25:48',NULL),(10,'yoohs','$2y$10$TGASk98FuZ6Ux6FDquu1aO3rztA01MCle/Vs1.3iaEMQzakAbCzJy','유혜성','yoo.hs@idcjp.jp','','manager,cloudflare,security','normal','2025-08-08 01:08:08','2023-03-24 02:26:31',NULL),(11,'kim.yh','$2y$10$8GciQXpKYiR3TDWQfh9JjOQAQ.YWGoOSCL0a0/w4XACO0mUgjjbWy','김영환','kim.yh@idcjp.jp','','manager,cloudflare,firewall,security','normal','2025-08-08 01:08:02','2023-03-24 02:27:05',NULL),(12,'yunmuj','$2y$10$zkgwGVj2JSOVIsxLe8fePe1gvWWaCemfZMktzBlrN8oLb3CKydkZC','윤무정','yunmuj@idcjp.jp','','manager,cloudflare','normal','2025-08-08 01:07:57','2023-03-24 02:27:59',NULL),(13,'kim.mt','$2y$10$3dfkA0oq4LqiJOmjbBGKe.p0Dhj/MDqjoTdw11BOPF/H2qJqnEuHO','김문태','kim.mt@idcjp.jp','','manager,cloudflare,security','normal','2025-08-08 01:07:44','2023-03-24 02:28:31',NULL),(14,'shin.ms','$2y$10$.jaDkGtm/gZK3ZDF.fJUGOwMI7Zif5588X5AxSMvvk238RDI7spQ6','신민수','shin.ms@idcjp.jp',NULL,'manager,cloudflare','normal','2023-03-24 02:29:00','2023-03-24 02:29:00',NULL),(15,'park.sm','$2y$10$BwMxw0uvw2tAdQ0EZQ2/hu.Q7zYu7mbuBPPRTaa14bwG3VLf0cXfu','박선미','park.sm@idcjp.jp','','manager,cloudflare,security','normal','2025-08-08 01:07:33','2023-03-24 02:29:34',NULL),(24,'kobn','$2y$10$pWM/XFfSNeSng32sypbDX.WaR4UlM4EDkYKCQfFkYIOC7Ppg0nc5G','고병남','ko@prime-idc.jp',NULL,'manager,cloudflare,security','normal','2025-06-24 01:10:02','2024-10-29 06:30:19',NULL),(25,'jeong.sg','$2y$10$OzH6140JztiUEs4s/VHbPOxfxubFooqwqVhGpdFG8OJCGAFXNu546','정상구','jeong.sg@prime-idc.jp','','manager,cloudflare,security','normal','2025-08-08 01:07:26','2025-01-23 00:29:46',NULL),(43,'test1234','$2y$10$21wlqjmdfDlIr0vAjDzs6ubIchc1DwOG61GGkZUwY7gb9GMTxA96K','test1234','test@gmail.com','0434434327','manager,cloudflare','normal','2025-07-02 08:03:20','2025-07-01 06:05:11',NULL),(44,'test233332','$2y$10$9FqxChYQ3qlbGL0dFvHsQuEl3ELiH3R5kDytQqmFa2b2i9RYpjeQy','123423422','test2333@co.kr22','2343422','manager','normal','2025-07-11 07:24:04','2025-07-11 07:23:13',NULL),(45,'kim.jh','$2y$10$voCle9yFWWhGhQ0JrH46puLYySJYq6O41/BSrKxx0MHWyO8KDf97u','김준한','kim.jh@prime-idc.jp','','manager,cloudflare,security','normal',NULL,'2025-08-08 02:27:49',NULL);
|
||||
/*!40000 ALTER TABLE `user` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
-- Dump completed on 2025-08-14 18:16:36
|
||||
54
app/Entities/CommonEntity.php
Normal file
54
app/Entities/CommonEntity.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
|
||||
abstract class CommonEntity extends Entity
|
||||
{
|
||||
const DEFAULT_STATUS = "";
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
//사용법 : $client->created_at->format('Y-m-d')
|
||||
//비교방법 : if ($client->created_at < new \DateTime('2024-01-01')) {
|
||||
protected $casts = [];
|
||||
public function __construct(array|null $data = null)
|
||||
{
|
||||
parent::__construct($data);
|
||||
}
|
||||
|
||||
public function getPK(): int|string
|
||||
{
|
||||
$field = constant("static::PK");
|
||||
return $this->attributes[$field] ?? "";
|
||||
}
|
||||
public function getTitle(): string
|
||||
{
|
||||
$field = constant("static::TITLE");
|
||||
return $this->attributes[$field] ?? "";
|
||||
}
|
||||
public function getCustomTitle(): string
|
||||
{
|
||||
return $this->getTitle();
|
||||
}
|
||||
final public function getCode(): string
|
||||
{
|
||||
return $this->attributes['code'] ?? "";
|
||||
}
|
||||
public function getStatus(): string
|
||||
{
|
||||
return $this->attributes['status'] ?? "";
|
||||
}
|
||||
final public function getUpdatedAt(): string
|
||||
{
|
||||
return $this->attributes['updated_at'] ?? "";
|
||||
}
|
||||
final public function getCreatedAt(): string
|
||||
{
|
||||
return $this->attributes['created_at'] ?? "";
|
||||
}
|
||||
final public function getDeletedAt(): string
|
||||
{
|
||||
return $this->attributes['deleted_at'] ?? "";
|
||||
}
|
||||
}
|
||||
21
app/Entities/Customer/AccountEntity.php
Normal file
21
app/Entities/Customer/AccountEntity.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\AccountModel;
|
||||
|
||||
class AccountEntity extends CustomerEntity
|
||||
{
|
||||
const PK = AccountModel::PK;
|
||||
const TITLE = AccountModel::TITLE;
|
||||
const DEFAULT_STATUS = STATUS['DEPOSIT'];
|
||||
final public function getUserUID(): string
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
final public function getClientInfoUID(): string
|
||||
{
|
||||
return $this->attributes['clientinfo_uid'];
|
||||
}
|
||||
//기본기능
|
||||
}
|
||||
49
app/Entities/Customer/ClientEntity.php
Normal file
49
app/Entities/Customer/ClientEntity.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities\Customer;
|
||||
|
||||
use App\Models\Customer\ClientModel;
|
||||
|
||||
class ClientEntity extends CustomerEntity
|
||||
{
|
||||
const PK = ClientModel::PK;
|
||||
const TITLE = ClientModel::TITLE;
|
||||
const DEFAULT_STATUS = STATUS['AVAILABLE'];
|
||||
final public function getUserUID(): string
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
//기본기능
|
||||
public function getName(): string
|
||||
{
|
||||
return $this->attributes['name'] ?? "";
|
||||
}
|
||||
public function getSite(): string
|
||||
{
|
||||
return $this->attributes['site'] ?? "";
|
||||
}
|
||||
public function getRole(): string
|
||||
{
|
||||
return $this->attributes['role'] ?? "";
|
||||
}
|
||||
public function getSaleRate(): int
|
||||
{
|
||||
return $this->attributes['sale_rate'] ?? 0;
|
||||
}
|
||||
public function getAccountBalance(): int
|
||||
{
|
||||
return $this->attributes['account_balance'] ?? 0;
|
||||
}
|
||||
public function getCouponBalance(): int
|
||||
{
|
||||
return $this->attributes['coupon_balance'] ?? 0;
|
||||
}
|
||||
public function getPointBalance(): int
|
||||
{
|
||||
return $this->attributes['point_balance'] ?? 0;
|
||||
}
|
||||
public function getHistory(): string
|
||||
{
|
||||
return $this->attributes['history'] ?? "";
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user