servermgrv2 init...
This commit is contained in:
parent
d06029976e
commit
c2066abca2
136
.gitignore
vendored
Normal file
136
.gitignore
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
#-------------------------
|
||||
# Operating Specific Junk Files
|
||||
#-------------------------
|
||||
|
||||
# OS X
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# OS X Thumbnails
|
||||
._*
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
Desktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
|
||||
# Linux
|
||||
*~
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
#-------------------------
|
||||
# Environment Files
|
||||
#-------------------------
|
||||
# These should never be under version control,
|
||||
# as it poses a security risk.
|
||||
.env
|
||||
.vagrant
|
||||
Vagrantfile
|
||||
|
||||
#-------------------------
|
||||
# Temporary Files
|
||||
#-------------------------
|
||||
writable/cache/*
|
||||
!writable/cache/index.html
|
||||
|
||||
writable/logs/*
|
||||
!writable/logs/index.html
|
||||
|
||||
writable/session/*
|
||||
!writable/session/index.html
|
||||
|
||||
writable/uploads/*
|
||||
!writable/uploads/index.html
|
||||
|
||||
writable/debugbar/*
|
||||
|
||||
php_errors.log
|
||||
|
||||
writable/HPILO/*
|
||||
!writable/HPILO/index.html
|
||||
|
||||
writable/Excel/*
|
||||
!writable/Excel/index.html
|
||||
|
||||
#-------------------------
|
||||
# User Guide Temp Files
|
||||
#-------------------------
|
||||
user_guide_src/build/*
|
||||
user_guide_src/cilexer/build/*
|
||||
user_guide_src/cilexer/dist/*
|
||||
user_guide_src/cilexer/pycilexer.egg-info/*
|
||||
|
||||
#-------------------------
|
||||
# Test Files
|
||||
#-------------------------
|
||||
tests/coverage*
|
||||
|
||||
# Don't save phpunit under version control.
|
||||
phpunit
|
||||
|
||||
#-------------------------
|
||||
# Composer
|
||||
#-------------------------
|
||||
composer.lock
|
||||
vendor/
|
||||
|
||||
#-------------------------
|
||||
# IDE / Development Files
|
||||
#-------------------------
|
||||
|
||||
# Modules Testing
|
||||
_modules/*
|
||||
|
||||
# phpenv local config
|
||||
.php-version
|
||||
|
||||
# Jetbrains editors (PHPStorm, etc)
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# Netbeans
|
||||
nbproject/
|
||||
build/
|
||||
nbbuild/
|
||||
nbdist/
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
.nb-gradle/
|
||||
|
||||
# Sublime Text
|
||||
*.tmlanguage.cache
|
||||
*.tmPreferences.cache
|
||||
*.stTheme.cache
|
||||
*.sublime-workspace
|
||||
*.sublime-project
|
||||
.phpintel
|
||||
/api/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode/
|
||||
|
||||
/results/
|
||||
/phpunit*.xml
|
||||
/.phpunit.*.cache
|
||||
|
||||
#mapurl 결과물
|
||||
public/mapurl/index.html
|
||||
public/uploads/*
|
||||
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-2023 CodeIgniter Foundation
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
66
README.md
66
README.md
@ -1,2 +1,66 @@
|
||||
# servermgrv2
|
||||
#Tips
|
||||
vscode와 Git의 대소문자 구분시키기
|
||||
git config core.ignorecase false
|
||||
|
||||
# 1. CodeIgniter 4 Application Starter
|
||||
|
||||
`composer create-project codeigniter4/appstarter 프로젝트명`
|
||||
|
||||
## 2. Setup
|
||||
|
||||
php.ini에 extension=intl 필요
|
||||
apache의 DocumentRoot "패키지명/public" 수정 후 restart 필요
|
||||
Copy `env` to `.env` and tailor for your app, specifically the baseURL and any database settings.
|
||||
.env 수정
|
||||
CI_ENVIRONMENT = development
|
||||
|
||||
# 3. 필요한 추가 패키지
|
||||
|
||||
composer require saleh7/proxmox-ve_php_api
|
||||
|
||||
## 4. Running Development Server
|
||||
|
||||
php spark serve
|
||||
|
||||
## 5. Web접속
|
||||
|
||||
개발용 -> localhost:8080
|
||||
실서버 -> https://proxmox.idcjp.jp
|
||||
|
||||
## 6. new Controller추가시 Config\Routes.php에 Routing설정 필요
|
||||
|
||||
$routes->get('/ProxmoxAPI', 'ProxmoxAPI::index');
|
||||
|
||||
## 7. composer.json의 "psr-4" 수정시 reload
|
||||
|
||||
"psr-4": {
|
||||
"Tests\\Support\\": "tests/\_support"
|
||||
"APP\\": "app"
|
||||
}
|
||||
composer dump-autoload
|
||||
|
||||
## 8. php spark 사용법 (https://onlinewebtutorblog.com/how-to-work-with-codeigniter-4-model-and-entity-tutorial/)
|
||||
|
||||
- User Table 관련
|
||||
php spark migrate:create create_user_table --> table 생성
|
||||
php spark migrate --> table 적용
|
||||
php spark make:migration update_and_addfield_to_users_table --> 기존 table 내용변경없이 column변경시
|
||||
php spark migrate:refresh --> table 수정후 재생성
|
||||
php spark migrate:rollback
|
||||
php spark migrate:status --> 상태보기
|
||||
|
||||
- 초기 데이터 넣기
|
||||
php spark make:seeder user --suffix
|
||||
php spark db:seed UsersSeeder
|
||||
|
||||
- mvc 생성 --suffix 추가필요
|
||||
php spark make:model user --suffix
|
||||
php spark make:controller user --suffix
|
||||
php spark make:entity user --suffix
|
||||
|
||||
- auth용
|
||||
php spark make:filter AuthGuard
|
||||
|
||||
## 9. Login관련 참조
|
||||
|
||||
https://www.jurisic.org/post/2022/11/28/How-to-make-simple-Authentication-with-CodeIgniter-4
|
||||
|
||||
6
app/.htaccess
Normal file
6
app/.htaccess
Normal file
@ -0,0 +1,6 @@
|
||||
<IfModule authz_core_module>
|
||||
Require all denied
|
||||
</IfModule>
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
15
app/Common.php
Normal file
15
app/Common.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* The goal of this file is to allow developers a location
|
||||
* where they can overwrite core procedural functions and
|
||||
* replace them with their own. This file is loaded during
|
||||
* the bootstrap process and is called during the framework's
|
||||
* execution.
|
||||
*
|
||||
* This can be looked at as a `master helper` file that is
|
||||
* loaded early on, and may also contain additional functions
|
||||
* that you'd like to use throughout your entire application
|
||||
*
|
||||
* @see: https://codeigniter4.github.io/CodeIgniter4/
|
||||
*/
|
||||
450
app/Config/App.php
Normal file
450
app/Config/App.php
Normal file
@ -0,0 +1,450 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Session\Handlers\FileHandler;
|
||||
|
||||
class App extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Base Site URL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* URL to your CodeIgniter root. Typically this will be your base URL,
|
||||
* WITH a trailing slash:
|
||||
*
|
||||
* http://example.com/
|
||||
*
|
||||
* If this is not set then CodeIgniter will try guess the protocol, domain
|
||||
* and path to your installation. However, you should always configure this
|
||||
* explicitly and never rely on auto-guessing, especially in production
|
||||
* environments.
|
||||
*/
|
||||
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 string[]
|
||||
* @phpstan-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 are using mod_rewrite to remove the page set this
|
||||
* variable so that it is blank.
|
||||
*/
|
||||
//public string $indexPage = 'index.php';
|
||||
public string $indexPage = '';
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* URI PROTOCOL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* This item determines which server global should be used to retrieve the
|
||||
* URI string. The default setting of 'REQUEST_URI' works for most servers.
|
||||
* If your links do not seem to work, try one of the other delicious flavors:
|
||||
*
|
||||
* 'REQUEST_URI' Uses $_SERVER['REQUEST_URI']
|
||||
* 'QUERY_STRING' Uses $_SERVER['QUERY_STRING']
|
||||
* 'PATH_INFO' Uses $_SERVER['PATH_INFO']
|
||||
*
|
||||
* WARNING: If you set this to 'PATH_INFO', URIs will always be URL-decoded!
|
||||
*/
|
||||
public string $uriProtocol = 'REQUEST_URI';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Default Locale
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The Locale roughly represents the language and location that your visitor
|
||||
* is viewing the site from. It affects the language strings and other
|
||||
* strings (like currency markers, numbers, etc), that your program
|
||||
* should run under for this request.
|
||||
*/
|
||||
public string $defaultLocale = 'en';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Negotiate Locale
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If true, the current Request object will automatically determine the
|
||||
* language to use based on the value of the Accept-Language header.
|
||||
*
|
||||
* If false, no automatic detection will be performed.
|
||||
*/
|
||||
public bool $negotiateLocale = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Supported Locales
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If $negotiateLocale is true, this array lists the locales supported
|
||||
* by the application in descending order of priority. If no match is
|
||||
* found, the first locale will be used.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public array $supportedLocales = ['en'];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Application Timezone
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The default timezone that will be used in your application to display
|
||||
* dates with the date helper, and can be retrieved through app_timezone()
|
||||
*/
|
||||
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';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* URI PROTOCOL
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* If true, this will force every request made to this application to be
|
||||
* made via a secure connection (HTTPS). If the incoming request is not
|
||||
* secure, the user will be redirected to a secure version of the page
|
||||
* and the HTTP Strict Transport Security header will be set.
|
||||
*/
|
||||
public bool $forceGlobalSecureRequests = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Driver
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The session storage driver to use:
|
||||
* - `CodeIgniter\Session\Handlers\FileHandler`
|
||||
* - `CodeIgniter\Session\Handlers\DatabaseHandler`
|
||||
* - `CodeIgniter\Session\Handlers\MemcachedHandler`
|
||||
* - `CodeIgniter\Session\Handlers\RedisHandler`
|
||||
*
|
||||
* @deprecated use Config\Session::$driver instead.
|
||||
*/
|
||||
public string $sessionDriver = FileHandler::class;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Cookie Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The session cookie name, must contain only [0-9a-z_-] characters
|
||||
*
|
||||
* @deprecated use Config\Session::$cookieName instead.
|
||||
*/
|
||||
public string $sessionCookieName = '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.
|
||||
*
|
||||
* @deprecated use Config\Session::$expiration instead.
|
||||
*/
|
||||
public int $sessionExpiration = 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!
|
||||
*
|
||||
* @deprecated use Config\Session::$savePath instead.
|
||||
*/
|
||||
public string $sessionSavePath = 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.
|
||||
*
|
||||
* @deprecated use Config\Session::$matchIP instead.
|
||||
*/
|
||||
public bool $sessionMatchIP = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Time to Update
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* How many seconds between CI regenerating the session ID.
|
||||
*
|
||||
* @deprecated use Config\Session::$timeToUpdate instead.
|
||||
*/
|
||||
public int $sessionTimeToUpdate = 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.
|
||||
*
|
||||
* @deprecated use Config\Session::$regenerateDestroy instead.
|
||||
*/
|
||||
public bool $sessionRegenerateDestroy = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Session Database Group
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* DB Group for the database session.
|
||||
*
|
||||
* @deprecated use Config\Session::$DBGroup instead.
|
||||
*/
|
||||
public ?string $sessionDBGroup = null;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Prefix
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Set a cookie name prefix if you need to avoid collisions.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$prefix property instead.
|
||||
*/
|
||||
public string $cookiePrefix = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Domain
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Set to `.your-domain.com` for site-wide cookies.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$domain property instead.
|
||||
*/
|
||||
public string $cookieDomain = '';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Typically will be a forward slash.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$path property instead.
|
||||
*/
|
||||
public string $cookiePath = '/';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie Secure
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie will only be set if a secure HTTPS connection exists.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$secure property instead.
|
||||
*/
|
||||
public bool $cookieSecure = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cookie HttpOnly
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Cookie will only be accessible via HTTP(S) (no JavaScript).
|
||||
*
|
||||
* @deprecated use Config\Cookie::$httponly property instead.
|
||||
*/
|
||||
public bool $cookieHTTPOnly = 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`, `$cookieSecure` must also be set.
|
||||
*
|
||||
* @deprecated use Config\Cookie::$samesite property instead.
|
||||
*/
|
||||
public ?string $cookieSameSite = 'Lax';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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 = [];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Token Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The token name.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $tokenName property instead of using this property.
|
||||
*/
|
||||
public string $CSRFTokenName = 'csrf_test_name';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Header Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The header name.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $headerName property instead of using this property.
|
||||
*/
|
||||
public string $CSRFHeaderName = 'X-CSRF-TOKEN';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Cookie Name
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The cookie name.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $cookieName property instead of using this property.
|
||||
*/
|
||||
public string $CSRFCookieName = 'csrf_cookie_name';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Expire
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The number in seconds the token should expire.
|
||||
*
|
||||
* @deprecated Use `Config\Security` $expire property instead of using this property.
|
||||
*/
|
||||
public int $CSRFExpire = 7200;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Regenerate
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Regenerate token on every submission?
|
||||
*
|
||||
* @deprecated Use `Config\Security` $regenerate property instead of using this property.
|
||||
*/
|
||||
public bool $CSRFRegenerate = true;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF Redirect
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Redirect to previous page with error on failure?
|
||||
*
|
||||
* @deprecated Use `Config\Security` $redirect property instead of using this property.
|
||||
*/
|
||||
public bool $CSRFRedirect = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF SameSite
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Setting for CSRF SameSite cookie token. Allowed values are:
|
||||
* - None
|
||||
* - Lax
|
||||
* - Strict
|
||||
* - ''
|
||||
*
|
||||
* Defaults to `Lax` as recommended in this link:
|
||||
*
|
||||
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||
*
|
||||
* @deprecated `Config\Cookie` $samesite property is used.
|
||||
*/
|
||||
public string $CSRFSameSite = 'Lax';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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;
|
||||
}
|
||||
97
app/Config/Autoload.php
Normal file
97
app/Config/Autoload.php
Normal file
@ -0,0 +1,97 @@
|
||||
<?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.
|
||||
*/
|
||||
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 '/app' and '/system' directories 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.
|
||||
*
|
||||
* Prototype:
|
||||
* $psr4 = [
|
||||
* 'CodeIgniter' => SYSTEMPATH,
|
||||
* 'App' => APPPATH
|
||||
* ];
|
||||
*
|
||||
* @var array<string, array<int, string>|string>
|
||||
* @phpstan-var array<string, string|list<string>>
|
||||
*/
|
||||
public $psr4 = [
|
||||
APP_NAMESPACE => APPPATH, // For custom app namespace
|
||||
'Config' => APPPATH . 'Config',
|
||||
];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* 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 string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $files = [];
|
||||
|
||||
/**
|
||||
* -------------------------------------------------------------------
|
||||
* Helpers
|
||||
* -------------------------------------------------------------------
|
||||
* Prototype:
|
||||
* $helpers = [
|
||||
* 'form',
|
||||
* ];
|
||||
*
|
||||
* @var string[]
|
||||
* @phpstan-var list<string>
|
||||
*/
|
||||
public $helpers = [];
|
||||
}
|
||||
32
app/Config/Boot/development.php
Normal file
32
app/Config/Boot/development.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?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.
|
||||
*/
|
||||
error_reporting(-1);
|
||||
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);
|
||||
21
app/Config/Boot/production.php
Normal file
21
app/Config/Boot/production.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR DISPLAY
|
||||
|--------------------------------------------------------------------------
|
||||
| Don't show ANY in production environments. Instead, let the system catch
|
||||
| it and display a generic error message.
|
||||
*/
|
||||
ini_set('display_errors', '0');
|
||||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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);
|
||||
32
app/Config/Boot/testing.php
Normal file
32
app/Config/Boot/testing.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?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.
|
||||
*/
|
||||
error_reporting(-1);
|
||||
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 = true;
|
||||
}
|
||||
169
app/Config/Cache.php
Normal file
169
app/Config/Cache.php
Normal file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
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';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* Cache Directory Path
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* The path to where cache files should be stored, if using a file-based
|
||||
* system.
|
||||
*
|
||||
* @deprecated Use the driver-specific variant under $file
|
||||
*/
|
||||
public string $storePath = WRITEPATH . 'cache/';
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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.
|
||||
* array('q') = Enabled, but only take into account the specified list
|
||||
* of query parameters.
|
||||
*
|
||||
* @var bool|string[]
|
||||
*/
|
||||
public $cacheQueryString = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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<string, int|string|null>
|
||||
*/
|
||||
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<string, bool|int|string>
|
||||
*/
|
||||
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<string, int|string|null>
|
||||
*/
|
||||
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, string>
|
||||
*/
|
||||
public array $validHandlers = [
|
||||
'dummy' => DummyHandler::class,
|
||||
'file' => FileHandler::class,
|
||||
'memcached' => MemcachedHandler::class,
|
||||
'predis' => PredisHandler::class,
|
||||
'redis' => RedisHandler::class,
|
||||
'wincache' => WincacheHandler::class,
|
||||
];
|
||||
}
|
||||
202
app/Config/Constants.php
Normal file
202
app/Config/Constants.php
Normal file
@ -0,0 +1,202 @@
|
||||
<?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
|
||||
|
||||
/**
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_LOW instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_LOW', 200);
|
||||
|
||||
/**
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_NORMAL instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_NORMAL', 100);
|
||||
|
||||
/**
|
||||
* @deprecated Use \CodeIgniter\Events\Events::PRIORITY_HIGH instead.
|
||||
*/
|
||||
define('EVENT_PRIORITY_HIGH', 10);
|
||||
|
||||
define('LAYOUTS', [
|
||||
'empty' => [
|
||||
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty',
|
||||
'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">',
|
||||
],
|
||||
'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' => [
|
||||
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front',
|
||||
'stylesheets' => [
|
||||
'<link rel="icon" href="/favicon.ico">',
|
||||
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
|
||||
'<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
|
||||
'<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/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" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
|
||||
]
|
||||
],
|
||||
'admin' => [
|
||||
'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin',
|
||||
'stylesheets' => [
|
||||
'<link rel="icon" href="/favicon.ico">',
|
||||
'<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">',
|
||||
'<link href="//cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous">',
|
||||
'<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/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" integrity="sha384-geWF76RCwLtnZ8qwWowPQNguL3RmwHVBC9FhGdlKrxdiJJigb/j/68SIy3Te4Bkz" crossorigin="anonymous"></script>',
|
||||
]
|
||||
]
|
||||
]);
|
||||
|
||||
//Login 관련
|
||||
define('LOGINS', [
|
||||
'ISLOGIN' => getenv('login.islogin.name') ? getenv('login.islogin.name') : "isLoggedIn",
|
||||
'RETURN_URL' => getenv('login.return_url.name') ? getenv('login.return_url.name') : "return_url",
|
||||
]);
|
||||
|
||||
//인증 관련
|
||||
define('AUTHS', [
|
||||
'DEBUG' => getenv('auth.debug') == 'true' ? true : false,
|
||||
'ADAPTERS' => getenv('auth.adapters') ? implode(",", getenv('auth.adapters')) : ['Local', 'Google'],
|
||||
'GOOGLE' => [
|
||||
'ICON' => '<img src="/images/auth/google_login_button.png"/>',
|
||||
'CLIENT_ID' => getenv("auth.google.client.id"),
|
||||
'CLIENT_KEY' => getenv("auth.google.client.key"),
|
||||
'CALLBACK_URL' => getenv("auth.google.client.callback_url"),
|
||||
'TOKEN_NAME' => getenv('auth.google.client.token_name') ? getenv('auth.google.client.token_name') : "access_token",
|
||||
],
|
||||
]);
|
||||
|
||||
//SITE_Default 정의
|
||||
define('DEFAULTS', [
|
||||
'ROLE' => getenv('default.role') ? getenv('default.role') : "user",
|
||||
'STATUS' => getenv('default.status') ? getenv('default.status') : "use",
|
||||
'EMPTY' => getenv('default.empty') ? getenv('default.empty') : "",
|
||||
'PERPAGE' => getenv('default.perpage') ? getenv('default.perpage') : 20,
|
||||
'EXCEL_PATH' => getenv('default.excel_path') ? getenv('default.excel_path') : "../writable/Excel",
|
||||
]);
|
||||
if (!is_dir(DEFAULTS['EXCEL_PATH'])) {
|
||||
mkdir(DEFAULTS['EXCEL_PATH'], 0640);
|
||||
}
|
||||
|
||||
//Upload , Download 관련
|
||||
define('FILES', [
|
||||
'UPLOADS' => ['mode' => 0600, 'path' => 'uploads'],
|
||||
'DOWNLOADS' => ['mode' => 0600, 'path' => 'downloads'],
|
||||
]);
|
||||
|
||||
//아이콘 및 Sound관련
|
||||
define('ICONS', [
|
||||
'NEW' => '<i class="fa fa-paper-plane" aria-hidden="true"></i>',
|
||||
'DELETE' => '<i class="fa fa-trash-o"></i>',
|
||||
'RELOAD' => '<i class="fa fa-refresh" aria-hidden="true"></i>',
|
||||
'SETTING' => '<i class="fa fa-cogs" aria-hidden="true"></i>',
|
||||
'FLAG' => '<i class="fa fa-flag" aria-hidden="true"></i>',
|
||||
'EXCEL' => '<i class="fa fa-file-excel-o" style="font-size:24px"></i>',
|
||||
]);
|
||||
define('AUDIOS', [
|
||||
'Alram_GetEmail' => '<object width=0 height=0 data="/sound/jarvis_email.mp3" type="audio/mpeg"></object>',
|
||||
]);
|
||||
|
||||
//HPILO 관련
|
||||
define(
|
||||
'HPILOS',
|
||||
[
|
||||
'PATH' => getenv('hpilo.path') ? getenv('hpilo.path') : "../writable/HPILO",
|
||||
'ADAPTER' => getenv('hpilo.adapter') ? getenv('hpilo.adapter') : "\App\Libraries\Adapter\API\GuzzleAdapter",
|
||||
'DEBUG' => getenv('hpilo.debug') == 'true' ? true : false,
|
||||
'SSL' => getenv('hpilo.ssl') == 'true' ? true : false,
|
||||
'GUZZLE_COOKIE' => getenv('hpilo.guzzle.cookie') == 'true' ? true : false,
|
||||
'CURL_COOKIE_FILE' => getenv('hpilo.curl.cookie.file') ? getenv('hpilo.curl.cookie.file') : "/cookie.txt",
|
||||
'CURL_DEBUG_FILE' => getenv('hpilo.curl.debug.file') ? getenv('hpilo.curl.debug.file') : "/debug.txt",
|
||||
]
|
||||
);
|
||||
if (!is_dir(HPILOS['PATH'])) {
|
||||
mkdir(HPILOS['PATH'], 0640);
|
||||
}
|
||||
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 string|string[]|null
|
||||
*/
|
||||
public $defaultSrc;
|
||||
|
||||
/**
|
||||
* Lists allowed scripts' URLs.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $scriptSrc = 'self';
|
||||
|
||||
/**
|
||||
* Lists allowed stylesheets' URLs.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $styleSrc = 'self';
|
||||
|
||||
/**
|
||||
* Defines the origins from which images can be loaded.
|
||||
*
|
||||
* @var 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 string|string[]|null
|
||||
*/
|
||||
public $baseURI;
|
||||
|
||||
/**
|
||||
* Lists the URLs for workers and embedded frame contents
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $childSrc = 'self';
|
||||
|
||||
/**
|
||||
* Limits the origins that you can connect to (via XHR,
|
||||
* WebSockets, and EventSource).
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $connectSrc = 'self';
|
||||
|
||||
/**
|
||||
* Specifies the origins that can serve web fonts.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $fontSrc;
|
||||
|
||||
/**
|
||||
* Lists valid endpoints for submission from `<form>` tags.
|
||||
*
|
||||
* @var 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 string|string[]|null
|
||||
*/
|
||||
public $frameAncestors;
|
||||
|
||||
/**
|
||||
* The frame-src directive restricts the URLs which may
|
||||
* be loaded into nested browsing contexts.
|
||||
*
|
||||
* @var array|string|null
|
||||
*/
|
||||
public $frameSrc;
|
||||
|
||||
/**
|
||||
* Restricts the origins allowed to deliver video and audio.
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $mediaSrc;
|
||||
|
||||
/**
|
||||
* Allows control over Flash and other plugins.
|
||||
*
|
||||
* @var string|string[]
|
||||
*/
|
||||
public $objectSrc = 'self';
|
||||
|
||||
/**
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $manifestSrc;
|
||||
|
||||
/**
|
||||
* Limits the kinds of plugins a page may invoke.
|
||||
*
|
||||
* @var string|string[]|null
|
||||
*/
|
||||
public $pluginTypes;
|
||||
|
||||
/**
|
||||
* List of actions allowed.
|
||||
*
|
||||
* @var 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;
|
||||
}
|
||||
105
app/Config/Cookie.php
Normal file
105
app/Config/Cookie.php
Normal file
@ -0,0 +1,105 @@
|
||||
<?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.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
84
app/Config/Database.php
Normal file
84
app/Config/Database.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?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.
|
||||
*/
|
||||
public array $default = [
|
||||
'DSN' => '',
|
||||
'hostname' => 'localhost',
|
||||
'username' => '',
|
||||
'password' => '',
|
||||
'database' => '',
|
||||
'DBDriver' => 'MySQLi',
|
||||
'DBPrefix' => '',
|
||||
'pConnect' => false,
|
||||
'DBDebug' => true,
|
||||
'charset' => 'utf8',
|
||||
'DBCollat' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
];
|
||||
|
||||
/**
|
||||
* This database connection is used when
|
||||
* running PHPUnit database tests.
|
||||
*/
|
||||
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' => 'utf8_general_ci',
|
||||
'swapPre' => '',
|
||||
'encrypt' => false,
|
||||
'compress' => false,
|
||||
'strictOn' => false,
|
||||
'failover' => [],
|
||||
'port' => 3306,
|
||||
'foreignKeys' => true,
|
||||
'busyTimeout' => 1000,
|
||||
];
|
||||
|
||||
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;
|
||||
}
|
||||
117
app/Config/Email.php
Normal file
117
app/Config/Email.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?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 Address
|
||||
*/
|
||||
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. Either tls or ssl
|
||||
*/
|
||||
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;
|
||||
}
|
||||
83
app/Config/Encryption.php
Normal file
83
app/Config/Encryption.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?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 = '';
|
||||
}
|
||||
48
app/Config/Events.php
Normal file
48
app/Config/Events.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Events\Events;
|
||||
use CodeIgniter\Exceptions\FrameworkException;
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* 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 () {
|
||||
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');
|
||||
Services::toolbar()->respond();
|
||||
}
|
||||
});
|
||||
77
app/Config/Exceptions.php
Normal file
77
app/Config/Exceptions.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use Psr\Log\LogLevel;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
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']
|
||||
*/
|
||||
public array $sensitiveDataInTrace = [];
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* LOG DEPRECATIONS INSTEAD OF THROWING?
|
||||
* --------------------------------------------------------------------------
|
||||
* By default, CodeIgniter converts deprecations into exceptions. Also,
|
||||
* starting in PHP 8.1 will cause a lot of deprecated usage warnings.
|
||||
* Use this option to temporarily cease the warnings and instead log those.
|
||||
* 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;
|
||||
}
|
||||
30
app/Config/Feature.php
Normal file
30
app/Config/Feature.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
|
||||
/**
|
||||
* Enable/disable backward compatibility breaking features.
|
||||
*/
|
||||
class Feature extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* Enable multiple filters for a route or not.
|
||||
*
|
||||
* If you enable this:
|
||||
* - CodeIgniter\CodeIgniter::handleRequest() uses:
|
||||
* - CodeIgniter\Filters\Filters::enableFilters(), instead of enableFilter()
|
||||
* - CodeIgniter\CodeIgniter::tryToRouteIt() uses:
|
||||
* - CodeIgniter\Router\Router::getFilters(), instead of getFilter()
|
||||
* - CodeIgniter\Router\Router::handle() uses:
|
||||
* - property $filtersInfo, instead of $filterInfo
|
||||
* - CodeIgniter\Router\RouteCollection::getFiltersForRoute(), instead of getFilterForRoute()
|
||||
*/
|
||||
public bool $multipleFilters = false;
|
||||
|
||||
/**
|
||||
* Use improved new auto routing instead of the default legacy version.
|
||||
*/
|
||||
public bool $autoRoutesImproved = false;
|
||||
}
|
||||
65
app/Config/Filters.php
Normal file
65
app/Config/Filters.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Filters\CSRF;
|
||||
use CodeIgniter\Filters\DebugToolbar;
|
||||
use CodeIgniter\Filters\Honeypot;
|
||||
use CodeIgniter\Filters\InvalidChars;
|
||||
use CodeIgniter\Filters\SecureHeaders;
|
||||
|
||||
class Filters extends BaseConfig
|
||||
{
|
||||
/**
|
||||
* Configures aliases for Filter classes to
|
||||
* make reading things nicer and simpler.
|
||||
*/
|
||||
public array $aliases = [
|
||||
'csrf' => CSRF::class,
|
||||
'toolbar' => DebugToolbar::class,
|
||||
'honeypot' => Honeypot::class,
|
||||
'invalidchars' => InvalidChars::class,
|
||||
'secureheaders' => SecureHeaders::class,
|
||||
'authFilter' => \App\Filters\AuthFilter::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* List of filter aliases that are always
|
||||
* applied before and after every request.
|
||||
*/
|
||||
public array $globals = [
|
||||
'before' => [
|
||||
// 'honeypot',
|
||||
// 'csrf',
|
||||
// 'invalidchars',
|
||||
],
|
||||
'after' => [
|
||||
'toolbar',
|
||||
// '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.
|
||||
*/
|
||||
public array $methods = [];
|
||||
|
||||
/**
|
||||
* List of filter aliases that should run on any
|
||||
* before or after URI patterns.
|
||||
*
|
||||
* Example:
|
||||
* 'isLoggedIn' => ['before' => ['account/*', 'profiles/*']]
|
||||
*/
|
||||
public array $filters = [];
|
||||
}
|
||||
9
app/Config/ForeignCharacters.php
Normal file
9
app/Config/ForeignCharacters.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\ForeignCharacters as BaseForeignCharacters;
|
||||
|
||||
class ForeignCharacters extends BaseForeignCharacters
|
||||
{
|
||||
}
|
||||
77
app/Config/Format.php
Normal file
77
app/Config/Format.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Format\FormatterInterface;
|
||||
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 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,
|
||||
];
|
||||
|
||||
/**
|
||||
* A Factory method to return the appropriate formatter for the given mime type.
|
||||
*
|
||||
* @return FormatterInterface
|
||||
*
|
||||
* @deprecated This is an alias of `\CodeIgniter\Format\Format::getFormatter`. Use that instead.
|
||||
*/
|
||||
public function getFormatter(string $mime)
|
||||
{
|
||||
return Services::format()->getFormatter($mime);
|
||||
}
|
||||
}
|
||||
40
app/Config/Generators.php
Normal file
40
app/Config/Generators.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?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, string>
|
||||
*/
|
||||
public array $views = [
|
||||
'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,
|
||||
];
|
||||
}
|
||||
51
app/Config/Kint.php
Normal file
51
app/Config/Kint.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use Kint\Renderer\AbstractRenderer;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* 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 extends BaseConfig
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Global Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
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;
|
||||
public int $richSort = AbstractRenderer::SORT_FULL;
|
||||
public $richObjectPlugins;
|
||||
public $richTabPlugins;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| CLI Settings
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public bool $cliColors = true;
|
||||
public bool $cliForceUTF8 = false;
|
||||
public bool $cliDetectWidth = true;
|
||||
public int $cliMinWidth = 40;
|
||||
}
|
||||
150
app/Config/Logger.php
Normal file
150
app/Config/Logger.php
Normal file
@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseConfig;
|
||||
use CodeIgniter\Log\Handlers\FileHandler;
|
||||
|
||||
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 array|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.
|
||||
*/
|
||||
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,
|
||||
// ],
|
||||
];
|
||||
}
|
||||
52
app/Config/Migrations.php
Normal file
52
app/Config/Migrations.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?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
|
||||
* level the system is at. It then compares the migration level in this
|
||||
* table to the $config['migration_version'] if they are not the same it
|
||||
* will migrate up. This must be set.
|
||||
*/
|
||||
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_';
|
||||
}
|
||||
530
app/Config/Mimes.php
Normal file
530
app/Config/Mimes.php
Normal file
@ -0,0 +1,530 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
/**
|
||||
* Mimes
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
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/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',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
76
app/Config/Modules.php
Normal file
76
app/Config/Modules.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Modules\Modules as BaseModules;
|
||||
|
||||
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
|
||||
*/
|
||||
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 string[]
|
||||
*/
|
||||
public $aliases = [
|
||||
'events',
|
||||
'filters',
|
||||
'registrars',
|
||||
'routes',
|
||||
'services',
|
||||
];
|
||||
}
|
||||
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'.DIRECTORY_SEPARATOR .'Pager'.DIRECTORY_SEPARATOR .'Views'.DIRECTORY_SEPARATOR .'default_full',
|
||||
'default_simple' => 'CodeIgniter'.DIRECTORY_SEPARATOR .'Pager'.DIRECTORY_SEPARATOR .'Views'.DIRECTORY_SEPARATOR .'default_simple',
|
||||
'default_head' => 'CodeIgniter'.DIRECTORY_SEPARATOR .'Pager'.DIRECTORY_SEPARATOR .'Views'.DIRECTORY_SEPARATOR .'default_head',
|
||||
'bootstrap_full' => 'templates'.DIRECTORY_SEPARATOR .'Pagers'.DIRECTORY_SEPARATOR .'bootstrap_full',
|
||||
'bootstrap_simple' => 'templates'.DIRECTORY_SEPARATOR .'Pagers'.DIRECTORY_SEPARATOR .'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',
|
||||
];
|
||||
}
|
||||
103
app/Config/Routes.php
Normal file
103
app/Config/Routes.php
Normal file
@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
// Create a new instance of our RouteCollection class.
|
||||
$routes = Services::routes();
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Router Setup
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
$routes->setDefaultNamespace('App\Controllers');
|
||||
$routes->setDefaultController('Home');
|
||||
$routes->setDefaultMethod('index');
|
||||
$routes->setTranslateURIDashes(false);
|
||||
$routes->set404Override();
|
||||
$routes->setAutoRoute(false);
|
||||
// The Auto Routing (Legacy) is very dangerous. It is easy to create vulnerable apps
|
||||
// where controller filters or CSRF protection are bypassed.
|
||||
// If you don't want to define all routes, please use the Auto Routing (Improved).
|
||||
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
|
||||
// $routes->setAutoRoute(false);
|
||||
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Route Definitions
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
// We get a performance increase by specifying the default
|
||||
// route since we don't have to scan directories.
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->get('/login', 'Common\AuthController::login');
|
||||
$routes->post('/signin', 'Common\AuthController::signin/local');
|
||||
$routes->get('/signin/(:alpha)', 'Common\AuthController::signin/$1');
|
||||
$routes->get('/logout', 'Common\AuthController::logout');
|
||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||
$routes->cli('hpilo/hpilo4', 'HPILO\HPILO4::execute');
|
||||
});
|
||||
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
|
||||
$routes->get('/', 'FrontController::index');
|
||||
});
|
||||
// authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->group('user', static function ($routes) {
|
||||
$routes->get('', 'UserController::index');
|
||||
$routes->get('excel', 'UserController::excel');
|
||||
$routes->get('insert', 'UserController::insert_form', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('insert', 'UserController::insert', ['filter' => 'authFilter:master,director']);
|
||||
$routes->get('update/(:num)', 'UserController::update_form/$1');
|
||||
$routes->post('update/(:num)', 'UserController::update/$1');
|
||||
$routes->get('view/(:num)', 'UserController::view/$1');
|
||||
$routes->get('delete/(:num)', 'UserController::delete/$1', ['filter' => 'authFilter:master,director']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'UserController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('batchjob', 'UserController::batchjob', ['filter' => 'authFilter:master,director']);
|
||||
});
|
||||
$routes->group('usersns', static function ($routes) {
|
||||
$routes->get('', 'UserSNSController::index');
|
||||
$routes->get('excel', 'UserSNSController::excel');
|
||||
$routes->get('delete/(:num)', 'UserSNSController::delete/$1', ['filter' => 'authFilter:master,director']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'UserSNSController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
});
|
||||
$routes->group('logger', static function ($routes) {
|
||||
$routes->get('', 'LoggerController::index');
|
||||
$routes->get('excel', 'LoggerController::excel');
|
||||
$routes->get('view/(:num)', 'LoggerController::view/$1');
|
||||
$routes->get('delete/(:num)', 'LoggerController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'LoggerController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('batchjob', 'LoggerController::batchjob', ['filter' => 'authFilter:master']);
|
||||
});
|
||||
$routes->group('hpilo', static function ($routes) {
|
||||
$routes->get('', 'HPILOController::index');
|
||||
$routes->get('excel', 'HPILOController::excel');
|
||||
$routes->get('insert', 'HPILOController::insert_form', ['filter' => 'authFilter:master,director']);
|
||||
$routes->post('insert', 'HPILOController::insert', ['filter' => 'authFilter:master,director']);
|
||||
$routes->get('update/(:num)', 'HPILOController::update_form/$1');
|
||||
$routes->post('update/(:num)', 'HPILOController::update/$1');
|
||||
$routes->get('view/(:num)', 'HPILOController::view/$1');
|
||||
$routes->get('delete/(:num)', 'HPILOController::delete/$1', ['filter' => 'authFilter:master,director']);
|
||||
$routes->get('toggle/(:num)/(:hash)', 'HPILOController::toggle/$1/$2', ['filter' => 'authFilter:master,director']);
|
||||
$routes->get('console/(:num)', 'HPILOController::console/$1');
|
||||
$routes->get('reset/(:num)/(:alpha)', 'HPILOController::reset/$1/$2');
|
||||
$routes->get('reload/(:num)', 'HPILOController::reload/$1');
|
||||
});
|
||||
});
|
||||
/*
|
||||
* --------------------------------------------------------------------
|
||||
* Additional Routing
|
||||
* --------------------------------------------------------------------
|
||||
*
|
||||
* There will often be times that you need additional routing and you
|
||||
* need it to be able to override any defaults in this file. Environment
|
||||
* based routes is one such time. require() additional route files here
|
||||
* to make that happen.
|
||||
*
|
||||
* You will have access to the $routes object within that file without
|
||||
* needing to reload it.
|
||||
*/
|
||||
if (is_file(APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php')) {
|
||||
require APPPATH . 'Config/' . ENVIRONMENT . '/Routes.php';
|
||||
}
|
||||
101
app/Config/Security.php
Normal file
101
app/Config/Security.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?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.
|
||||
*/
|
||||
public bool $redirect = false;
|
||||
|
||||
/**
|
||||
* --------------------------------------------------------------------------
|
||||
* CSRF SameSite
|
||||
* --------------------------------------------------------------------------
|
||||
*
|
||||
* Setting for CSRF SameSite cookie token.
|
||||
*
|
||||
* Allowed values are: None - Lax - Strict - ''.
|
||||
*
|
||||
* Defaults to `Lax` as recommended in this link:
|
||||
*
|
||||
* @see https://portswigger.net/web-security/csrf/samesite-cookies
|
||||
*
|
||||
* @deprecated `Config\Cookie` $samesite property is used.
|
||||
*/
|
||||
public string $samesite = 'Lax';
|
||||
}
|
||||
32
app/Config/Services.php
Normal file
32
app/Config/Services.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\BaseService;
|
||||
|
||||
/**
|
||||
* Services Configuration file.
|
||||
*
|
||||
* Services are simply other classes/libraries that the system uses
|
||||
* to do its job. This is used by CodeIgniter to allow the core of the
|
||||
* framework to be swapped out easily without affecting the usage within
|
||||
* the rest of your application.
|
||||
*
|
||||
* This file holds any application-specific services, or service overrides
|
||||
* that you might need. An example has been included with the general
|
||||
* method format you should use for your service methods. For more examples,
|
||||
* see the core Services file at system/Config/Services.php.
|
||||
*/
|
||||
class Services extends BaseService
|
||||
{
|
||||
/*
|
||||
* public static function example($getShared = true)
|
||||
* {
|
||||
* if ($getShared) {
|
||||
* return static::getSharedInstance('example');
|
||||
* }
|
||||
*
|
||||
* return new \CodeIgniter\Example();
|
||||
* }
|
||||
*/
|
||||
}
|
||||
102
app/Config/Session.php
Normal file
102
app/Config/Session.php
Normal file
@ -0,0 +1,102 @@
|
||||
<?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`
|
||||
*
|
||||
* @phpstan-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;
|
||||
}
|
||||
91
app/Config/Toolbar.php
Normal file
91
app/Config/Toolbar.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?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 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 colleted. 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;
|
||||
}
|
||||
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 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
|
||||
// --------------------------------------------------------------------
|
||||
}
|
||||
56
app/Config/View.php
Normal file
56
app/Config/View.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace Config;
|
||||
|
||||
use CodeIgniter\Config\View as BaseView;
|
||||
use CodeIgniter\View\ViewDecoratorInterface;
|
||||
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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 class-string<ViewDecoratorInterface>[]
|
||||
*/
|
||||
public array $decorators = [];
|
||||
}
|
||||
19
app/Controllers/Admin/AdminController.php
Normal file
19
app/Controllers/Admin/AdminController.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AdminController extends \App\Controllers\Common\CommonController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_className .= 'Admin';
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['layout'] = LAYOUTS['admin'];
|
||||
$this->_viewDatas['title'] = "관리자";
|
||||
}
|
||||
}
|
||||
185
app/Controllers/Admin/HPILOController.php
Normal file
185
app/Controllers/Admin/HPILOController.php
Normal file
@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Libraries\Log\Log;
|
||||
use App\Models\HPILOModel;
|
||||
use App\Entities\HPILOEntity;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use App\Libraries\API\HPILO\HPILO4;
|
||||
|
||||
class HPILOController extends \App\Controllers\Admin\AdminController
|
||||
{
|
||||
private $_adapter = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_className .= '/HPILO';
|
||||
$this->_model = new HPILOModel();
|
||||
$this->_defines = [
|
||||
'insert' => [
|
||||
'fields' => ['customer', 'id', 'passwd', 'ip', 'port', 'status'],
|
||||
'fieldFilters' => ['status'],
|
||||
'fieldRules' => [
|
||||
'customer' => 'required|min_length[4]|max_length[100]',
|
||||
'id' => 'required|min_length[4]|max_length[20]',
|
||||
'passwd' => 'required|trim|min_length[4]|max_length[150]',
|
||||
'ip' => 'required|trim|min_length[4]|max_length[50]',
|
||||
'port' => 'required|min_length[2]|max_length[20]',
|
||||
]
|
||||
],
|
||||
'update' => [
|
||||
'fields' => ['customer', 'id', 'passwd', 'ip', 'port', 'status'],
|
||||
'fieldFilters' => ['status'],
|
||||
'fieldRules' => [
|
||||
'customer' => 'required|min_length[4]|max_length[100]',
|
||||
'id' => 'required|min_length[4]|max_length[20]',
|
||||
'passwd' => 'required|trim|min_length[4]|max_length[150]',
|
||||
'ip' => 'required|trim|min_length[4]|max_length[50]',
|
||||
'port' => 'required|min_length[2]|max_length[20]',
|
||||
]
|
||||
],
|
||||
'view' => [
|
||||
'fields' => ['customer', 'id', 'ip', 'port', 'model', 'processor', 'memory', 'health', 'power', 'detail', 'status', 'updated_at', 'created_at'],
|
||||
'fieldFilters' => ['status'],
|
||||
'fieldRules' => [],
|
||||
],
|
||||
'index' => [
|
||||
'fields' => ['customer', 'ip', 'port', 'model', 'processor', 'memory', 'health', 'power', 'status', 'created_at'],
|
||||
'fieldFilters' => ['power', 'status'],
|
||||
'batchjobFilters' => [],
|
||||
],
|
||||
'excel' => [
|
||||
'fields' => ['customer', 'ip', 'port', 'model', 'processor', 'memory', 'health', 'power', 'status', 'created_at'],
|
||||
'fieldFilters' => ['status'],
|
||||
],
|
||||
];
|
||||
helper($this->_className);
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
||||
$this->_viewDatas['className'] = $this->_className;
|
||||
}
|
||||
|
||||
private function getAdapter(HPILOEntity $entity)
|
||||
{
|
||||
if (is_null($this->_adapter)) {
|
||||
$adapterClass = HPILOS['ADAPTER'];
|
||||
$this->_adapter = new $adapterClass($entity, HPILOS['DEBUG']);
|
||||
}
|
||||
return $this->_adapter;
|
||||
}
|
||||
|
||||
//Insert관련
|
||||
protected function insert_validate()
|
||||
{
|
||||
parent::insert_validate();
|
||||
//IP형식 검사 모든 ip형식 사용가능
|
||||
if (!isIPAddress_CommonHelper($this->_viewDatas['fieldDatas']['ip'], 'all')) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 all, {$this->_viewDatas['fieldDatas']['ip']} 형식 오류");
|
||||
}
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
}
|
||||
//Update관련
|
||||
final public function update($uid)
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//Batchjob 관련
|
||||
final public function batchjob()
|
||||
{
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//Delete 관련
|
||||
final public function delete($uid)
|
||||
{
|
||||
return $this->delete_procedure($uid);
|
||||
}
|
||||
//View 관련
|
||||
final public function view($uid)
|
||||
{
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//Index 관련
|
||||
final public function index()
|
||||
{
|
||||
return $this->index_procedure();
|
||||
}
|
||||
//Excel 관련
|
||||
final public function excel()
|
||||
{
|
||||
return $this->excel_procedure();
|
||||
}
|
||||
////추가 Action
|
||||
final public function console(int $uid)
|
||||
{
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$ilo = new HPILO4($this->getAdapter($entity));
|
||||
$this->_viewDatas['SessionKey'] = $ilo->console();
|
||||
$this->_viewDatas['entity'] = $entity;
|
||||
return view($this->_viewPath . '/console_iframe', $this->_viewDatas);
|
||||
}
|
||||
private function refresh(HPILO4 $ilo, HPILOEntity $entity)
|
||||
{
|
||||
$entity = $ilo->refresh($entity);
|
||||
if ($entity->hasChanged()) {
|
||||
if (!$this->_model->save($entity)) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->_model->getLastQuery());
|
||||
Log::add("error", implode("\n", $this->_model->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->_model->errors(), true));
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
final public function reset(int $uid, string $type)
|
||||
{
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
if (!in_array($type, ["On", "Off", "Restart"])) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$type}은 기능은 없습니다.");
|
||||
}
|
||||
$ilo = new HPILO4($this->getAdapter($entity));
|
||||
$results = $ilo->reset($type);
|
||||
Log::add("warning", var_export($results, true));
|
||||
// sleep(DEFAULT_RERESH_WAITTIME);
|
||||
// $entity = $this->refresh($ilo, $entity);
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $message . "<br>\n{$e->getMessage()}");
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return alert_CommonHelper($message, 'back');
|
||||
}
|
||||
}
|
||||
final public function reload(int $uid)
|
||||
{
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$ilo = new HPILO4($this->getAdapter($entity));
|
||||
// throw new \Exception(var_export($ilo, true));
|
||||
$entity = $this->refresh($ilo, $entity);
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $message . "<br>\n{$e->getMessage()}");
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return alert_CommonHelper($message, 'back');
|
||||
}
|
||||
}
|
||||
}
|
||||
27
app/Controllers/Admin/Home.php
Normal file
27
app/Controllers/Admin/Home.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
class Home extends BaseController
|
||||
{
|
||||
protected $_viewDatas = array();
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
helper('Common');
|
||||
$this->_viewDatas = [
|
||||
'layout'=>LAYOUTS['admin'],
|
||||
'title'=>'관리자페이지',
|
||||
'session'=>session()
|
||||
];
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('admin/index',$this->_viewDatas);
|
||||
}
|
||||
}
|
||||
108
app/Controllers/Admin/LoggerController.php
Normal file
108
app/Controllers/Admin/LoggerController.php
Normal file
@ -0,0 +1,108 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Models\LoggerModel;
|
||||
use App\Models\UserModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class LoggerController extends \App\Controllers\Admin\AdminController
|
||||
{
|
||||
private $_userModel = null;
|
||||
private $_user_uids = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_className .= '/Logger';
|
||||
$this->_model = new LoggerModel();
|
||||
$this->_defines = [
|
||||
'view' => [
|
||||
'fields' => ['user_uid', 'title', 'content', 'status', 'created_at'],
|
||||
'fieldFilters' => ['user_uid', 'status'],
|
||||
'fieldRules' => [],
|
||||
],
|
||||
'index' => [
|
||||
'fields' => ['user_uid', 'title', 'status', 'created_at'],
|
||||
'fieldFilters' => ['user_uid', 'status'],
|
||||
'batchjobFilters' => [],
|
||||
],
|
||||
'excel' => [
|
||||
'fields' => ['user_uid', 'title', 'status', 'created_at'],
|
||||
'fieldFilters' => ['user_uid', 'status'],
|
||||
],
|
||||
];
|
||||
helper($this->_className);
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
||||
$this->_viewDatas['className'] = $this->_className;
|
||||
}
|
||||
|
||||
private function getUserModel(): UserModel
|
||||
{
|
||||
return is_null($this->_userModel) ? new UserModel() : $this->_userModel;
|
||||
}
|
||||
|
||||
//Field별 Form Option용
|
||||
protected function getFieldFormOption(string $field): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
if (is_null($this->_user_uids)) {
|
||||
//모든 필요한 FormOption등 조기화작업 필요
|
||||
$this->_user_uids = [DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'];
|
||||
foreach ($this->getUserModel()->findAll() as $user) {
|
||||
$this->_user_uids[$user['uid']] = $user['name'];
|
||||
}
|
||||
}
|
||||
return $this->_user_uids;
|
||||
break;
|
||||
default:
|
||||
return parent::getFieldFormOption($field);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
}
|
||||
//Update관련
|
||||
final public function update($uid)
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//Batchjob 관련
|
||||
// final public function batchjob()
|
||||
// {
|
||||
// return $this->batchjob_procedure();
|
||||
// }
|
||||
//Delete 관련
|
||||
// final public function delete($uid)
|
||||
// {
|
||||
// return $this->delete_procedure($uid);
|
||||
// }
|
||||
//View 관련
|
||||
final public function view($uid)
|
||||
{
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//Index 관련
|
||||
final public function index()
|
||||
{
|
||||
return $this->index_procedure();
|
||||
}
|
||||
//Excel 관련
|
||||
final public function excel()
|
||||
{
|
||||
return $this->excel_procedure();
|
||||
}
|
||||
}
|
||||
116
app/Controllers/Admin/UserController.php
Normal file
116
app/Controllers/Admin/UserController.php
Normal file
@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserController extends \App\Controllers\Admin\AdminController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_className .= '/User';
|
||||
$this->_model = new UserModel();
|
||||
$this->_defines = [
|
||||
'insert' => [
|
||||
'fields' => ['id', 'passwd', 'name', 'email', 'role', 'status'],
|
||||
'fieldFilters' => ['role', 'status'],
|
||||
'fieldRules' => [
|
||||
'id' => 'required|min_length[4]|max_length[20]|is_unique[user.id]',
|
||||
'passwd' => 'required|trim|min_length[4]|max_length[130]',
|
||||
'name' => 'required|min_length[2]|max_length[20]',
|
||||
'email' => 'required|valid_email',
|
||||
'role' => 'required|in_list[member,manager,cloudflare,director,master]',
|
||||
]
|
||||
],
|
||||
'update' => [
|
||||
'fields' => ['passwd', 'name', 'email', 'role', 'status'],
|
||||
'fieldFilters' => ['role', 'status'],
|
||||
'fieldRules' => [
|
||||
'passwd' => 'required|trim|min_length[4]|max_length[30]',
|
||||
'name' => 'required|min_length[2]|max_length[20]',
|
||||
'email' => 'required|valid_email',
|
||||
'role' => 'required|in_list[member,manager,cloudflare,director,master]',
|
||||
]
|
||||
],
|
||||
'view' => [
|
||||
'fields' => ['id', 'name', 'email', 'role', 'status', 'updated_at', 'created_at'],
|
||||
'fieldFilters' => ['role', 'status'],
|
||||
'fieldRules' => [],
|
||||
],
|
||||
'index' => [
|
||||
'fields' => ['id', 'name', 'email', 'role', 'status', 'created_at'],
|
||||
'fieldFilters' => ['role', 'status'],
|
||||
'batchjobFilters' => ['role', 'status'],
|
||||
],
|
||||
'excel' => [
|
||||
'fields' => ['id', 'name', 'email', 'role', 'status', 'created_at'],
|
||||
'fieldFilters' => ['role', 'status'],
|
||||
],
|
||||
];
|
||||
helper($this->_className);
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
||||
$this->_viewDatas['className'] = $this->_className;
|
||||
}
|
||||
|
||||
//Insert관련
|
||||
protected function insert_process()
|
||||
{
|
||||
//암호값 hash작업
|
||||
$this->_viewDatas['fieldDatas']['passwd'] = password_hash($this->_viewDatas['fieldDatas']['passwd'], PASSWORD_DEFAULT);
|
||||
return parent::insert_process();
|
||||
}
|
||||
//Update관련
|
||||
protected function update_process($entity)
|
||||
{
|
||||
//암호값 hash작업
|
||||
$entity->passwd = password_hash($entity->passwd, PASSWORD_DEFAULT);
|
||||
return parent::update_process($entity);
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
}
|
||||
//Update관련
|
||||
final public function update($uid)
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//Batchjob 관련
|
||||
final public function batchjob()
|
||||
{
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//Delete 관련
|
||||
final public function delete($uid)
|
||||
{
|
||||
return $this->delete_procedure($uid);
|
||||
}
|
||||
//View 관련
|
||||
final public function view($uid)
|
||||
{
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//Index 관련
|
||||
final public function index()
|
||||
{
|
||||
return $this->index_procedure();
|
||||
}
|
||||
//Excel 관련
|
||||
final public function excel()
|
||||
{
|
||||
return $this->excel_procedure();
|
||||
}
|
||||
}
|
||||
127
app/Controllers/Admin/UserSNSController.php
Normal file
127
app/Controllers/Admin/UserSNSController.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Admin;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\UserSNSModel;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class UserSNSController extends \App\Controllers\Admin\AdminController
|
||||
{
|
||||
private $_userModel = null;
|
||||
private $_user_uids = null;
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_className .= '/UserSNS';
|
||||
$this->_model = new UserSNSModel();
|
||||
$this->_defines = [
|
||||
'insert' => [
|
||||
'fields' => ['site', 'user_uid', 'name', 'email', 'status'],
|
||||
'fieldFilters' => ['status'],
|
||||
'fieldRules' => [
|
||||
'name' => 'required|min_length[2]|max_length[20]',
|
||||
'email' => 'required|valid_email',
|
||||
'status' => 'required|in_list[use,unuse]',
|
||||
]
|
||||
],
|
||||
'index' => [
|
||||
'fields' => ['site', 'user_uid', 'name', 'email', 'status', 'created_at'],
|
||||
'fieldFilters' => ['user_uid', 'status'],
|
||||
'batchjobFilters' => [],
|
||||
],
|
||||
'excel' => [
|
||||
'fields' => ['site', 'user_uid', 'name', 'email', 'status', 'created_at'],
|
||||
'fieldFilters' => ['user_uid', 'status'],
|
||||
],
|
||||
];
|
||||
helper($this->_className);
|
||||
$this->_viewPath = strtolower($this->_className);
|
||||
$this->_viewDatas['title'] = lang($this->_className . '.title');
|
||||
$this->_viewDatas['className'] = $this->_className;
|
||||
}
|
||||
|
||||
private function getUserModel(): UserModel
|
||||
{
|
||||
return is_null($this->_userModel) ? new UserModel() : $this->_userModel;
|
||||
}
|
||||
|
||||
//Field별 Form Option용
|
||||
protected function getFieldFormOption(string $field): array
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
if (is_null($this->_user_uids)) {
|
||||
//모든 필요한 FormOption등 조기화작업 필요
|
||||
$this->_user_uids = [DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'];
|
||||
foreach ($this->getUserModel()->findAll() as $user) {
|
||||
$this->_user_uids[$user['uid']] = $user['name'];
|
||||
}
|
||||
}
|
||||
return $this->_user_uids;
|
||||
break;
|
||||
default:
|
||||
return parent::getFieldFormOption($field);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Insert관련
|
||||
protected function insert_process()
|
||||
{
|
||||
//암호값 hash작업
|
||||
$this->_viewDatas['fieldDatas']['passwd'] = password_hash($this->_viewDatas['fieldDatas']['passwd'], PASSWORD_DEFAULT);
|
||||
return parent::insert_process();
|
||||
}
|
||||
//Update관련
|
||||
protected function update_process($entity)
|
||||
{
|
||||
//암호값 hash작업
|
||||
$entity->passwd = password_hash($entity->passwd, PASSWORD_DEFAULT);
|
||||
return parent::update_process($entity);
|
||||
}
|
||||
|
||||
////Action 모음
|
||||
//Insert관련
|
||||
final public function insert()
|
||||
{
|
||||
return $this->insert_procedure();
|
||||
}
|
||||
//Update관련
|
||||
final public function update($uid)
|
||||
{
|
||||
return $this->update_procedure($uid);
|
||||
}
|
||||
//Toggle관련
|
||||
final public function toggle($uid, string $field)
|
||||
{
|
||||
return $this->toggle_procedure($uid, $field);
|
||||
}
|
||||
//Batchjob 관련
|
||||
final public function batchjob()
|
||||
{
|
||||
return $this->batchjob_procedure();
|
||||
}
|
||||
//Delete 관련
|
||||
final public function delete($uid)
|
||||
{
|
||||
return $this->delete_procedure($uid);
|
||||
}
|
||||
//View 관련
|
||||
final public function view($uid)
|
||||
{
|
||||
return $this->view_procedure($uid);
|
||||
}
|
||||
//Index 관련
|
||||
final public function index()
|
||||
{
|
||||
return $this->index_procedure();
|
||||
}
|
||||
//Excel 관련
|
||||
final public function excel()
|
||||
{
|
||||
return $this->excel_procedure();
|
||||
}
|
||||
}
|
||||
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 array
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
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 = \Config\Services::session();
|
||||
}
|
||||
}
|
||||
52
app/Controllers/CLI/HPILO/HPILO4.php
Normal file
52
app/Controllers/CLI/HPILO/HPILO4.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\CLI\HPILO;
|
||||
|
||||
use App\Models\HPILOModel;
|
||||
use App\Entities\HPILOEntity;
|
||||
|
||||
class HPILO4
|
||||
{
|
||||
private $_adapter = null;
|
||||
private function getAdapter(HPILOEntity $entity)
|
||||
{
|
||||
if (is_null($this->_adapter)) {
|
||||
$adapterClass = getenv('hpilo.adapter');
|
||||
$this->_adapter[$entity->getPrimaryKey()] = new $adapterClass($entity);
|
||||
}
|
||||
return $this->_adapter[$entity->getPrimaryKey()];
|
||||
}
|
||||
|
||||
final public function execute()
|
||||
{
|
||||
try {
|
||||
$model = new HPILOModel();
|
||||
$entitys = $model->asObject(HPILOEntity::class)->where(['status' => 'use'])->findAll();
|
||||
//transation처리
|
||||
// $this->getAuthModel()->db->transBegin();
|
||||
foreach ($entitys as $entity) {
|
||||
$ilo = new \App\Libraries\HPILO\HPILO4($this->getAdapter($entity));
|
||||
$entity = $ilo->refresh($entity);
|
||||
if ($entity->hasChanged()) {
|
||||
if (!$model->save($entity)) {
|
||||
log_message("error", __FUNCTION__ . "에서 호출:" . $model->getLastQuery());
|
||||
log_message("error", implode("\n", $model->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($model->errors(), true));
|
||||
}
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
log_message("debug", $message);
|
||||
}
|
||||
}
|
||||
//transation 완료
|
||||
// $this->getAuthModel()->db->transCommit();
|
||||
$message = __METHOD__ . "에서 ILO4 Reload 총:" . count($entitys) . " 완료하였습니다.";
|
||||
echo $message;
|
||||
} catch (\Exception $e) {
|
||||
//transaction 오류복구
|
||||
// $this->getAuthModel()->db->transRollback();
|
||||
$message = __METHOD__ . "에서 ILO4 Reload 오류\n" . $e->getMessage();
|
||||
log_message("error", $message);
|
||||
echo $message;
|
||||
}
|
||||
}
|
||||
}
|
||||
80
app/Controllers/Common/AuthController.php
Normal file
80
app/Controllers/Common/AuthController.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Common;
|
||||
|
||||
use App\Controllers\BaseController;
|
||||
use App\Libraries\Adapter\Auth\Adapter;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class AuthController extends BaseController
|
||||
{
|
||||
private $_viewDatas = array();
|
||||
private $_adapters = array();
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
helper('Common');
|
||||
$this->_viewDatas = [
|
||||
'layout' => LAYOUTS['empty'],
|
||||
'title' => '로그인',
|
||||
'session' => session()
|
||||
];
|
||||
$this->initAdapters();
|
||||
}
|
||||
|
||||
private function initAdapters()
|
||||
{
|
||||
foreach (AUTHS['ADAPTERS'] as $adapter) {
|
||||
$this->getAdapter($adapter);
|
||||
}
|
||||
}
|
||||
private function getAdapter(string $adapter): Adapter
|
||||
{
|
||||
if (!array_key_exists($adapter, $this->_adapters)) {
|
||||
$adapterClass = sprintf("\App\Libraries\Adapter\Auth\%sAdapter", $adapter);
|
||||
$this->_adapters[$adapter] = new $adapterClass($adapter, AUTHS['DEBUG']);
|
||||
}
|
||||
return $this->_adapters[$adapter];
|
||||
}
|
||||
|
||||
public function login()
|
||||
{
|
||||
helper(['form']);
|
||||
$this->_viewDatas['forms'] = [
|
||||
'attributes' => ['method' => "post",],
|
||||
'hiddens' => [],
|
||||
];
|
||||
//RETURN_URL 존재하면 추가
|
||||
if (!is_null(session()->get(LOGINS['RETURN_URL']))) {
|
||||
$this->_viewDatas['forms']['hiddens'][LOGINS['RETURN_URL']] = session()->get(LOGINS['RETURN_URL']);
|
||||
}
|
||||
$this->_viewDatas['login_buttons'] = array();
|
||||
foreach ($this->_adapters as $key => $adapter) {
|
||||
$this->_viewDatas['login_buttons'][$key] = $adapter->getAuthButton();
|
||||
}
|
||||
return view('auth/login', $this->_viewDatas);
|
||||
}
|
||||
|
||||
public function signin(string $adapter)
|
||||
{
|
||||
try {
|
||||
//각 Adapter별 인층체크 후 Session에 인증정보 설정
|
||||
$this->getAdapter($adapter)->signin($this->request->getVar());
|
||||
$return_url = session()->get(LOGINS['RETURN_URL']) ? session()->get(LOGINS['RETURN_URL']) : "/";
|
||||
return redirect()->to($this->request->getVar(LOGINS['RETURN_URL']) ? $this->request->getVar(LOGINS['RETURN_URL']) : $return_url);
|
||||
} catch (\Exception $e) {
|
||||
session()->setFlashdata('error', $e->getMessage());
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
//Session에 Login 정보 삭제
|
||||
session()->set([LOGINS['ISLOGIN'] => false]);
|
||||
session_destroy();
|
||||
return redirect()->route('/');
|
||||
}
|
||||
}
|
||||
465
app/Controllers/Common/CommonController.php
Normal file
465
app/Controllers/Common/CommonController.php
Normal file
@ -0,0 +1,465 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Common;
|
||||
|
||||
use App\Libraries\Log\Log;
|
||||
use App\Controllers\BaseController;
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
class CommonController extends BaseController
|
||||
{
|
||||
use CommonTrait;
|
||||
|
||||
protected $_className = '';
|
||||
protected $_model = null;
|
||||
protected $_defines = array();
|
||||
protected $_viewPath = '';
|
||||
protected $_viewDatas = array();
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
helper('Common');
|
||||
$this->_viewDatas = [
|
||||
'layout' => LAYOUTS['empty'],
|
||||
'title' => '',
|
||||
'session' => session()
|
||||
];
|
||||
}
|
||||
|
||||
//Insert관련
|
||||
protected function insert_init()
|
||||
{
|
||||
$this->_viewDatas['fields'] = $this->_defines['insert']['fields'];;
|
||||
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $this->_defines['insert']['fieldRules']);
|
||||
}
|
||||
protected function insert_form_init()
|
||||
{
|
||||
$this->_viewDatas['fieldFilters'] = $this->_defines['insert']['fieldFilters'];
|
||||
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
|
||||
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
helper(['form']);
|
||||
}
|
||||
protected function insert_form_process()
|
||||
{
|
||||
}
|
||||
final public function insert_form()
|
||||
{
|
||||
try {
|
||||
$this->insert_init();
|
||||
$this->insert_form_init();
|
||||
$this->insert_form_process();
|
||||
return view($this->_viewPath . '/insert', $this->_viewDatas);
|
||||
} catch (\Exception $e) {
|
||||
return alert_CommonHelper($e->getMessage(), 'back');
|
||||
}
|
||||
}
|
||||
|
||||
protected function insert_validate()
|
||||
{
|
||||
//변경할 값 확인
|
||||
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
||||
}
|
||||
//변경된 값 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'][$field] = rtrim($this->request->getVar($field));
|
||||
Log::add("info", "{$field} : {$this->_viewDatas['fieldDatas'][$field]}");
|
||||
}
|
||||
}
|
||||
protected function insert_process()
|
||||
{
|
||||
return $this->_model->create($this->_viewDatas['fieldDatas']);
|
||||
}
|
||||
protected function insert_procedure()
|
||||
{
|
||||
$message = "";
|
||||
try {
|
||||
$this->insert_init();
|
||||
$this->insert_validate();
|
||||
$this->insert_process();
|
||||
$message = __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception($e->getMessage());
|
||||
$message = __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $e->getMessage());
|
||||
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return redirect()->back()->withInput()->with("error", $message . "<br>\n{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
//Update관련
|
||||
protected function update_init()
|
||||
{
|
||||
$this->_viewDatas['fields'] = $this->_defines['update']['fields'];;
|
||||
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $this->_defines['update']['fieldRules']);
|
||||
}
|
||||
protected function update_form_init()
|
||||
{
|
||||
$this->_viewDatas['fieldFilters'] = $this->_defines['update']['fieldFilters'];
|
||||
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
|
||||
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
helper(['form']);
|
||||
}
|
||||
protected function update_form_process($entity)
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
final public function update_form($uid)
|
||||
{
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->update_init();
|
||||
$this->update_form_init();
|
||||
$this->_viewDatas['entity'] = $this->update_form_process($entity);
|
||||
return view($this->_viewPath . '/update', $this->_viewDatas);
|
||||
} catch (\Exception $e) {
|
||||
return alert_CommonHelper($e->getMessage(), 'back');
|
||||
}
|
||||
}
|
||||
protected function update_validate($entity)
|
||||
{
|
||||
//변경할 값 확인
|
||||
if (!$this->validate($this->_viewDatas['fieldRules'])) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
||||
}
|
||||
//변경된 값 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'][$field] = rtrim($this->request->getVar($field));
|
||||
if ($entity->$field != $this->_viewDatas['fieldDatas'][$field]) {
|
||||
// 기존값을 DB에서 수정전까지 유지하기위해서
|
||||
// $entity->$field = $this->_viewDatas['fieldDatas'][$field];
|
||||
//암호는 보안상 log에 남지 않게하기 위함
|
||||
Log::add(
|
||||
$field == 'passwd' ? "debug" : "info",
|
||||
"{$field} : {$entity->$field} => {$this->_viewDatas['fieldDatas'][$field]}"
|
||||
);
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function update_process($entity)
|
||||
{
|
||||
return $this->_model->modify($entity, $this->_viewDatas['fieldDatas']);
|
||||
}
|
||||
protected function update_procedure($uid)
|
||||
{
|
||||
$message = "";
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->update_init();
|
||||
$entity = $this->update_validate($entity);
|
||||
$entity = $this->update_process($entity);
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $e->getMessage());
|
||||
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return redirect()->back()->withInput()->with("error", $message . "<br>\n{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
|
||||
//Toggle 관련
|
||||
protected function toggle_init($field)
|
||||
{
|
||||
$this->_viewDatas['fields'] = [$field];
|
||||
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], array());
|
||||
}
|
||||
protected function toggle_validate($entity)
|
||||
{
|
||||
return $this->update_validate($entity);
|
||||
}
|
||||
protected function toggle_process($entity)
|
||||
{
|
||||
return $this->update_process($entity);
|
||||
}
|
||||
protected function toggle_procedure($uid, string $field)
|
||||
{
|
||||
$message = "";
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->toggle_init($field);
|
||||
$entity = $this->toggle_validate($entity);
|
||||
$entity = $this->toggle_process($entity);
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $e->getMessage());
|
||||
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return alert_CommonHelper($message . "<br>\n{$e->getMessage()}", 'back');
|
||||
}
|
||||
}
|
||||
//Batchjob 관련
|
||||
protected function batchjob_init()
|
||||
{
|
||||
//fields 해당하는 field중 선택된 값이 있는경우만 fields로 정의
|
||||
$fields = array();
|
||||
foreach ($this->_defines['index']['batchjobFilters'] as $field) {
|
||||
if ($this->request->getVar($field)) {
|
||||
array_push($fields, $field);
|
||||
}
|
||||
}
|
||||
if (!is_array($fields) || count($fields) === 0) {
|
||||
throw new \Exception($this->_viewDatas['title'] . '에서 변경할 항목(field)이 선택되지 않았습니다.');
|
||||
}
|
||||
//Fields,FielRules재정의
|
||||
$this->_viewDatas['fields'] = $fields;
|
||||
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], array());
|
||||
}
|
||||
protected function batchjob_validate($entity)
|
||||
{
|
||||
return $this->update_validate($entity);
|
||||
}
|
||||
protected function batchjob_process($entity)
|
||||
{
|
||||
return $this->update_process($entity);
|
||||
}
|
||||
protected function batchjob_procedure()
|
||||
{
|
||||
$uids = $this->request->getVar('batchjob_uids');
|
||||
if (is_null($uids) || !is_array($uids) || !count($uids)) {
|
||||
return alert_CommonHelper($this->_viewDatas['title'] . '에서 변경할 항목(uid)이 선택되지 않았습니다.', 'back');
|
||||
}
|
||||
$message = "";
|
||||
try {
|
||||
$this->batchjob_init();
|
||||
$entitys = array();
|
||||
foreach ($uids as $uid) {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
try {
|
||||
$entity = $this->batchjob_validate($entity);
|
||||
array_push($entitys, $this->batchjob_process($entity));
|
||||
} catch (\Exception $e) {
|
||||
Log::add("warning", "{$entity->getTitle()}는 다음과 같은 이유로 수정되지 않았습니다.\n<br>" . $e->getMessage());
|
||||
}
|
||||
}
|
||||
$message = "총: " . count($entitys) . "개의 수정(Batchjob)을 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = "총: " . count($uids) . "개의 수정(Batchjob)을 실패하였습니다.";
|
||||
Log::add("warning", $e->getMessage());
|
||||
Log::add("warning", var_export($this->_viewDatas['fieldDatas'], true));
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return alert_CommonHelper($message . "<br>\n{$e->getMessage()}", 'back');
|
||||
}
|
||||
}
|
||||
|
||||
//Delete 관련
|
||||
protected function delete_process($entity)
|
||||
{
|
||||
if (!$this->_model->delete($entity->getPrimaryKey())) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->_model->getLastQuery());
|
||||
Log::add("error", implode("\n", $this->_model->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->_model->errors(), true));
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function delete_procedure($uid)
|
||||
{
|
||||
$message = "";
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->delete_process($entity);
|
||||
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
|
||||
Log::save("{$this->_viewDatas['title']} {$message}");
|
||||
return alert_CommonHelper($message, session()->get(LOGINS['RETURN_URL']));
|
||||
} catch (\Exception $e) {
|
||||
$message = __FUNCTION__ . " 실패하였습니다.";
|
||||
Log::add("warning", $e->getMessage());
|
||||
Log::save("{$this->_viewDatas['title']} {$message}", false);
|
||||
return alert_CommonHelper($message . "<br>\n{$e->getMessage()}", 'back');
|
||||
}
|
||||
}
|
||||
|
||||
//View 관련
|
||||
protected function view_init()
|
||||
{
|
||||
$this->_viewDatas['fields'] = $this->_defines['view']['fields'];
|
||||
$this->_viewDatas['fieldFilters'] = $this->_defines['view']['fieldFilters'];
|
||||
$this->_viewDatas['fieldRules'] = $this->getFieldRules($this->_viewDatas['fields'], $this->_defines['view']['fieldRules']);
|
||||
helper(['form']);
|
||||
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
|
||||
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
}
|
||||
protected function view_process($entity)
|
||||
{
|
||||
return $entity;
|
||||
}
|
||||
protected function view_procedure($uid)
|
||||
{
|
||||
try {
|
||||
$entity = $this->_model->getEntity($uid);
|
||||
$this->view_init();
|
||||
$this->_viewDatas['entity'] = $this->view_process($entity);
|
||||
return view($this->_viewPath . '/view', $this->_viewDatas);
|
||||
} catch (\Exception $e) {
|
||||
return alert_CommonHelper($e->getMessage(), 'back');
|
||||
}
|
||||
}
|
||||
|
||||
//Index 관련
|
||||
protected function index_init()
|
||||
{
|
||||
$this->_viewDatas['fields'] = $this->_defines['index']['fields'];
|
||||
$this->_viewDatas['fieldFilters'] = $this->_defines['index']['fieldFilters'];
|
||||
$this->_viewDatas['batchjobFilters'] = $this->_defines['index']['batchjobFilters'];
|
||||
helper(['form']);
|
||||
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
|
||||
$this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []];
|
||||
session()->set(LOGINS['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery());
|
||||
|
||||
foreach ($this->_viewDatas['fieldFilters'] as $field) {
|
||||
$this->_viewDatas[$field] = $this->request->getVar($field) ? $this->request->getVar($field) : DEFAULTS['EMPTY'];
|
||||
}
|
||||
$this->_viewDatas['word'] = $this->request->getVar('word') ? $this->request->getVar('word') : '';
|
||||
$this->_viewDatas['start'] = $this->request->getVar('start') ? $this->request->getVar('start') : '';
|
||||
$this->_viewDatas['end'] = $this->request->getVar('end') ? $this->request->getVar('end') : '';
|
||||
$this->_viewDatas['order_field'] = $this->request->getVar('order_field') ? $this->request->getVar('order_field') : 'uid';
|
||||
$this->_viewDatas['order_value'] = $this->request->getVar('order_value') ? $this->request->getVar('order_value') : 'DESC';
|
||||
$this->_viewDatas['page'] = $this->request->getVar('page') ? $this->request->getVar('page') : 1;
|
||||
$this->_viewDatas['per_page'] = $this->request->getVar('per_page') ? $this->request->getVar('per_page') : DEFAULTS['PERPAGE'];
|
||||
$this->_viewDatas['uri'] = $this->request->getUri();
|
||||
}
|
||||
//index 모델 전처리
|
||||
protected function index_setCondition()
|
||||
{
|
||||
foreach ($this->_viewDatas['fieldFilters'] as $field) {
|
||||
$value = $this->request->getVar($field) ? $this->request->getVar($field) : false;
|
||||
if ($value) {
|
||||
$this->_model->where($field, $value);
|
||||
}
|
||||
}
|
||||
$word = $this->request->getVar('word') ? $this->request->getVar('word') : '';
|
||||
if (isset($word) && $word !== '') {
|
||||
$this->_model->setIndexWordFilter($word);
|
||||
}
|
||||
$start = $this->request->getVar('start') ? $this->request->getVar('start') : '';
|
||||
$end = $this->request->getVar('end') ? $this->request->getVar('end') : '';
|
||||
if (isset($start) && $start !== '' && isset($end) && $end !== '') {
|
||||
$this->_model->setIndexDateFilter($start, $end);
|
||||
}
|
||||
}
|
||||
protected function index_getRows(int $page = 0, int $per_page = 0): array
|
||||
{
|
||||
//Totalcount 처리
|
||||
$this->index_setCondition();
|
||||
$this->_viewDatas['total_count'] = $this->_model->countAllResults();
|
||||
//Rows 처리
|
||||
$this->index_setCondition();
|
||||
//OrderBy
|
||||
$order_field = $this->request->getVar('order_field') ? $this->request->getVar('order_field') : 'uid';
|
||||
$order_value = $this->request->getVar('order_value') ? $this->request->getVar('order_value') : 'DESC';
|
||||
$this->_model->setIndexOrderBy($order_field, $order_value);
|
||||
//Limit
|
||||
$rows = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll();
|
||||
// log_message("debug", __METHOD__ . "에서 호출[{$per_page}:{$page}=>{$page}*{$per_page}-{$per_page}]\n" . $this->_model->getLastQuery());
|
||||
return $rows;
|
||||
}
|
||||
private function index_getPagination($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): string
|
||||
{
|
||||
// 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 = \Config\Services::pager();
|
||||
// $this->_model->paginate($this->_viewDatas['per_page'], $pager_group, $this->_viewDatas['page'], $segment);
|
||||
$pager->makeLinks(
|
||||
$this->_viewDatas['page'],
|
||||
$this->_viewDatas['per_page'],
|
||||
$this->_viewDatas['total_count'],
|
||||
$template,
|
||||
$segment,
|
||||
$pager_group
|
||||
);
|
||||
$this->_viewDatas['page'] = $pager->getCurrentPage($pager_group);
|
||||
$this->_viewDatas['total_page'] = $pager->getPageCount($pager_group);
|
||||
return $pager->links($pager_group, $template);
|
||||
}
|
||||
protected function index_process()
|
||||
{
|
||||
//모델 처리
|
||||
$this->_viewDatas['rows'] = $this->index_getRows((int)$this->_viewDatas['page'], (int)$this->_viewDatas['per_page']);
|
||||
//줄수 처리용
|
||||
$this->_viewDatas['pageOptions'] = array("" => "줄수선택");
|
||||
for ($i = 10; $i <= $this->_viewDatas['total_count'] + $this->_viewDatas['per_page']; $i += 10) {
|
||||
$this->_viewDatas['pageOptions'][$i] = $i;
|
||||
}
|
||||
//pagenation 처리
|
||||
$this->_viewDatas['pagination'] = $this->index_getPagination();
|
||||
}
|
||||
protected function index_procedure()
|
||||
{
|
||||
try {
|
||||
$this->index_init();
|
||||
$this->index_process();
|
||||
return view($this->_viewPath . '/index', $this->_viewDatas);
|
||||
} catch (\Exception $e) {
|
||||
return alert_CommonHelper($e->getMessage(), 'back');
|
||||
}
|
||||
}
|
||||
|
||||
//Excel 관련
|
||||
protected function excel_init()
|
||||
{
|
||||
$this->_viewDatas['fields'] = $this->_defines['excel']['fields'];
|
||||
$this->_viewDatas['fieldFilters'] = $this->_defines['excel']['fieldFilters'];
|
||||
$this->_viewDatas['fieldFormOptions'] = $this->getFieldFormOptions($this->_viewDatas['fieldFilters']);
|
||||
}
|
||||
private function excel_getSpreadSheet()
|
||||
{
|
||||
//Excepl 초기화
|
||||
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
$sheet = $spreadsheet->getActiveSheet();
|
||||
//Header용
|
||||
$column = 'A';
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$sheet->setCellValue($column++ . '1', lang($this->_className . '.label.' . $field));
|
||||
}
|
||||
//본문용
|
||||
$line = 2;
|
||||
foreach ($this->index_getRows() as $row) {
|
||||
$column = 'A';
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
// echo "\n<BR>".var_export($this->_fieldFilters,true)."\n<BR>".var_export($fieldFormOptions,true);exit;
|
||||
$value = in_array($field, $this->_viewDatas['fieldFilters']) ? $this->_viewDatas['fieldFormOptions'][$field][$row[$field]] : $row[$field];
|
||||
$sheet->setCellValue($column . $line, $value);
|
||||
$column++;
|
||||
}
|
||||
$line++;
|
||||
}
|
||||
return $spreadsheet;
|
||||
}
|
||||
protected function excel_process()
|
||||
{
|
||||
$fileName = date('Y-m-d_Hm') . '.xlsx';
|
||||
//파일저장 참고:https://teserre.tistory.com/19
|
||||
$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($this->excel_getSpreadSheet(), 'Xlsx');
|
||||
//파일저장용
|
||||
// $writer->save(Excel_FilePath . '/' . $fileName);
|
||||
//Download시
|
||||
header("Content-Type: application/vnd.ms-excel");
|
||||
header(sprintf("Content-Disposition: attachment; filename=%s", urlencode($fileName)));
|
||||
return $writer->save('php://output');
|
||||
}
|
||||
protected function excel_procedure()
|
||||
{
|
||||
try {
|
||||
$this->excel_init();
|
||||
return $this->excel_process();
|
||||
} catch (\Exception $e) {
|
||||
return alert_CommonHelper($e->getMessage(), 'back');
|
||||
}
|
||||
}
|
||||
}
|
||||
49
app/Controllers/Common/CommonTrait.php
Normal file
49
app/Controllers/Common/CommonTrait.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Common;
|
||||
|
||||
trait CommonTrait
|
||||
{
|
||||
//Field별 Form Option용
|
||||
protected function getFieldFormOption(string $field): array
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
$temps = lang($this->_className . '.' . strtoupper($field));
|
||||
if (!is_array($temps)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$field}의 데이터가 array가 아닙니다.\n" . var_export($temps, true));
|
||||
}
|
||||
return array_merge(
|
||||
[DEFAULTS['EMPTY'] => lang($this->_className . '.label.' . $field) . ' 선택'],
|
||||
lang($this->_className . '.' . strtoupper($field))
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//Field별 Form Option용
|
||||
final protected function getFieldFormOptions(array $fieldFilters): array
|
||||
{
|
||||
$fieldFormOptions = array();
|
||||
foreach ($fieldFilters as $field) {
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 field가 array 입니다.\n" . var_export($fieldFilters, true));
|
||||
}
|
||||
$fieldFormOptions[$field] = $this->getFieldFormOption($field);
|
||||
}
|
||||
return $fieldFormOptions;
|
||||
}
|
||||
//Field별 Form Rule용
|
||||
final protected function getFieldRules(array $fields, array $fieldRules): array
|
||||
{
|
||||
$tempRules = $this->_model->getValidationRules(['only' => $fields]);
|
||||
foreach ($fields as $field) {
|
||||
if (is_array($field)) {
|
||||
throw new \Exception(__FUNCTION__ . "에서 field가 array 입니다.\n" . var_export($fieldRules, true));
|
||||
}
|
||||
if (array_key_exists($field, $fieldRules)) {
|
||||
$tempRules[$field] = $fieldRules[$field];
|
||||
}
|
||||
}
|
||||
return $tempRules;
|
||||
}
|
||||
}
|
||||
17
app/Controllers/Front/FrontController.php
Normal file
17
app/Controllers/Front/FrontController.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controllers\Front;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
class FrontController extends \App\Controllers\Common\CommonController
|
||||
{
|
||||
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
|
||||
{
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->_viewPath = $this->_viewPath.'/front';
|
||||
$this->_viewDatas['layout'] = LAYOUTS['front'];
|
||||
$this->_viewDatas['title'] = "사용자페이지";
|
||||
}
|
||||
}
|
||||
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()
|
||||
{
|
||||
return view('welcome_message');
|
||||
}
|
||||
}
|
||||
0
app/Database/Migrations/.gitkeep
Normal file
0
app/Database/Migrations/.gitkeep
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Migrations;
|
||||
|
||||
use CodeIgniter\Database\Migration;
|
||||
use CodeIgniter\Database\RawSql;
|
||||
|
||||
class CreateUsersTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
$this->forge->addField([
|
||||
'uid' => [
|
||||
'type' => 'INT',
|
||||
'constraint' => 5,
|
||||
'unsigned' => true,
|
||||
'auto_increment' => true,
|
||||
],
|
||||
'id' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '20',
|
||||
'unique' => true,
|
||||
],
|
||||
'passwd' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '30',
|
||||
],
|
||||
'name' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '20',
|
||||
],
|
||||
'email' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => '50',
|
||||
'unique' => true,
|
||||
],
|
||||
'role' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 10,
|
||||
'default' => DEFAULT_ROLE,
|
||||
],
|
||||
'status' => [
|
||||
'type' => 'VARCHAR',
|
||||
'constraint' => 10,
|
||||
'default' => DEFAULT_STATUS,
|
||||
],
|
||||
'updated_at' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'default' => null,
|
||||
],
|
||||
'created_at' => [
|
||||
'type' => 'TIMESTAMP',
|
||||
'default' => new RawSql('CURRENT_TIMESTAMP'),
|
||||
],
|
||||
]);
|
||||
$this->forge->addPrimaryKey('uid');
|
||||
$this->forge->createTable('user');
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->forge->dropTable('user');
|
||||
}
|
||||
}
|
||||
0
app/Database/Seeds/.gitkeep
Normal file
0
app/Database/Seeds/.gitkeep
Normal file
41
app/Database/Seeds/UserSeeder.php
Normal file
41
app/Database/Seeds/UserSeeder.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Database\Seeds;
|
||||
|
||||
use CodeIgniter\Database\Seeder;
|
||||
use Faker\Factory;
|
||||
|
||||
class UserSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
$data = [
|
||||
'id' => 'choi.jh',
|
||||
'passwd' => password_hash('1234', PASSWORD_DEFAULT),
|
||||
'name' => '최준흠',
|
||||
'email' => 'choi.jh@prime-idc.jp',
|
||||
'role' => 'master',
|
||||
'status' => DEFAULT_STATUS,
|
||||
];
|
||||
// Using Query Builder
|
||||
$this->db->table('user')->insert($data);
|
||||
|
||||
$datas = array();
|
||||
for($i=0; $i<50; $i++){
|
||||
$datas[] = $this->generate_data();
|
||||
}
|
||||
// $this->db->table('user')->insertBatch($datas);
|
||||
}
|
||||
|
||||
public function generate_data(){
|
||||
$faker = Factory::create();
|
||||
return [
|
||||
"id" => $faker->userName(),
|
||||
"passwd" => $faker->password(4,10),
|
||||
"name" => $faker->name(),
|
||||
"email" => $faker->email(),
|
||||
"role" => $faker->randomElement(["guest","member","manager","cloudflare","director","master"]),
|
||||
"status" => $faker->randomElement(['use','unuse']),
|
||||
];
|
||||
}
|
||||
}
|
||||
69
app/Database/table.sql
Normal file
69
app/Database/table.sql
Normal file
@ -0,0 +1,69 @@
|
||||
DROP TABLE IF EXISTS user;
|
||||
|
||||
CREATE TABLE user (
|
||||
uid int(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
id varchar(20) NOT NULL,
|
||||
passwd varchar(30) NOT NULL,
|
||||
name varchar(20) NOT NULL,
|
||||
email varchar(50) NOT NULL,
|
||||
role varchar(10) NOT NULL DEFAULT 'user',
|
||||
status varchar(10) NOT NULL DEFAULT 'use',
|
||||
updated_at timestamp NULL DEFAULT NULL,
|
||||
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (uid),
|
||||
UNIQUE KEY id (id),
|
||||
UNIQUE KEY email (email)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT ='사용자 정보';
|
||||
|
||||
DROP TABLE IF EXISTS user_sns;
|
||||
|
||||
CREATE TABLE user_sns (
|
||||
uid varchar(255) NOT NULL,
|
||||
user_uid int(5) unsigned NULL COMMENT 'user_uid',
|
||||
site varchar(50) NOT NULL,
|
||||
name varchar(20) NOT NULL,
|
||||
email varchar(50) NOT NULL,
|
||||
updated_at timestamp NULL DEFAULT NULL,
|
||||
status varchar(10) NOT NULL DEFAULT 'use',
|
||||
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (uid),
|
||||
CONSTRAINT user_sns_ibfk_1 FOREIGN KEY (user_uid) REFERENCES user (uid) ON DELETE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT ='SNS 사용자 정보';
|
||||
|
||||
DROP TABLE IF EXISTS logger;
|
||||
|
||||
CREATE TABLE
|
||||
logger (
|
||||
uid int(5) unsigned NOT NULL AUTO_INCREMENT,
|
||||
user_uid int(5) unsigned NOT NULL COMMENT 'user_uid',
|
||||
title varchar(255) NOT NULL COMMENT 'title',
|
||||
content text NOT NULL COMMENT '내용',
|
||||
status varchar(10) NOT NULL DEFAULT 'use',
|
||||
updated_at timestamp NULL DEFAULT NULL,
|
||||
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (uid),
|
||||
CONSTRAINT logger_ibfk_1 FOREIGN KEY (user_uid) REFERENCES user (uid) ON DELETE CASCADE
|
||||
) ENGINE = MyISAM DEFAULT CHARSET = utf8 COMMENT = 'log 정보';
|
||||
|
||||
DROP TABLE IF EXISTS hpilo;
|
||||
|
||||
CREATE TABLE
|
||||
hpilo (
|
||||
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
customer varchar(100) NOT NULL COMMENT '고객정보',
|
||||
id varchar(20) NOT NULL DEFAULT 'Administrator' COMMENT 'API IP Address',
|
||||
passwd varchar(20) NOT NULL COMMENT 'Password',
|
||||
ip varchar(50) NOT NULL COMMENT 'API IP Address',
|
||||
port int(5) unsigned NOT NULL COMMENT 'API Port',
|
||||
model varchar(255) NOT NULL DEFAULT 'model' COMMENT 'model',
|
||||
processor varchar(255) NOT NULL DEFAULT 'none' COMMENT 'processor',
|
||||
memory int(4) unsigned NOT NULL DEFAULT '0' COMMENT 'memory',
|
||||
health varchar(10) NOT NULL DEFAULT 'OK' COMMENT 'All Device Health',
|
||||
power varchar(10) NOT NULL DEFAULT 'Off' COMMENT 'Power status',
|
||||
detail text NOT NULL DEFAULT '' COMMENT '상세내용',
|
||||
status varchar(10) NOT NULL DEFAULT 'use',
|
||||
updated_at timestamp NULL DEFAULT NULL,
|
||||
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
||||
PRIMARY KEY (uid),
|
||||
UNIQUE KEY hpilokey (ip,port)
|
||||
) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci COMMENT = 'hpilo 정보';
|
||||
14
app/Entities/CommonEntity.php
Normal file
14
app/Entities/CommonEntity.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use CodeIgniter\Entity\Entity;
|
||||
use JsonSerializable;
|
||||
|
||||
class CommonEntity extends Entity implements JsonSerializable
|
||||
{
|
||||
public function getTitle()
|
||||
{
|
||||
return "CommonEntity";
|
||||
}
|
||||
}
|
||||
41
app/Entities/HPILOEntity.php
Normal file
41
app/Entities/HPILOEntity.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
|
||||
class HPILOEntity extends CommonEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getID()
|
||||
{
|
||||
return $this->attributes['id'];
|
||||
}
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->attributes['passwd'];
|
||||
}
|
||||
public function getIP()
|
||||
{
|
||||
return $this->attributes['ip'];
|
||||
}
|
||||
public function getPort()
|
||||
{
|
||||
return $this->attributes['port'];
|
||||
}
|
||||
public function getTitle()
|
||||
{
|
||||
return "{$this->attributes['customer']} {$this->attributes['model']}";
|
||||
}
|
||||
public function __toString()
|
||||
{
|
||||
return "uid:{$this->attributes['uid']}|{$this->attributes['customer']}|{$this->attributes['model']}";
|
||||
}
|
||||
}
|
||||
18
app/Entities/LoggerEntity.php
Normal file
18
app/Entities/LoggerEntity.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
class LoggerEntity extends CommonEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function getPrimaryKey(){
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle(){
|
||||
return $this->attributes['title'];
|
||||
}
|
||||
}
|
||||
37
app/Entities/UserEntity.php
Normal file
37
app/Entities/UserEntity.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
|
||||
class UserEntity extends CommonEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
}
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->attributes['email'];
|
||||
}
|
||||
public function getRole()
|
||||
{
|
||||
return $this->attributes['role'];
|
||||
}
|
||||
public function getPassword()
|
||||
{
|
||||
return $this->attributes['passwd'];
|
||||
}
|
||||
public function setPassword(string $password)
|
||||
{
|
||||
$this->attributes['passwd'] = password_hash($password, PASSWORD_DEFAULT);
|
||||
}
|
||||
}
|
||||
37
app/Entities/UserSNSEntity.php
Normal file
37
app/Entities/UserSNSEntity.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Entities;
|
||||
|
||||
use App\Entities\CommonEntity;
|
||||
|
||||
class UserSNSEntity extends CommonEntity
|
||||
{
|
||||
protected $datamap = [];
|
||||
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
|
||||
protected $casts = [];
|
||||
|
||||
public function getPrimaryKey()
|
||||
{
|
||||
return $this->attributes['uid'];
|
||||
}
|
||||
public function getUserUID()
|
||||
{
|
||||
return $this->attributes['user_uid'];
|
||||
}
|
||||
public function getSite()
|
||||
{
|
||||
return $this->attributes['site'];
|
||||
}
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->attributes['name'];
|
||||
}
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->attributes['email'];
|
||||
}
|
||||
public function getStatus()
|
||||
{
|
||||
return $this->attributes['status'];
|
||||
}
|
||||
}
|
||||
0
app/Filters/.gitkeep
Normal file
0
app/Filters/.gitkeep
Normal file
64
app/Filters/AuthFilter.php
Normal file
64
app/Filters/AuthFilter.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filters;
|
||||
|
||||
use CodeIgniter\HTTP\RequestInterface;
|
||||
use CodeIgniter\HTTP\ResponseInterface;
|
||||
use CodeIgniter\Filters\FilterInterface;
|
||||
|
||||
class AuthFilter implements FilterInterface
|
||||
{
|
||||
/**
|
||||
* Do whatever processing this filter needs to do.
|
||||
* By default it should not return anything during
|
||||
* normal execution. However, when an abnormal state
|
||||
* is found, it should return an instance of
|
||||
* CodeIgniter\HTTP\Response. If it does, script
|
||||
* execution will end and that Response will be
|
||||
* sent back to the client, allowing for error pages,
|
||||
* redirects, etc.
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param array|null $arguments
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function before(RequestInterface $request, $arguments = null)
|
||||
{
|
||||
//dd($request);exit;
|
||||
if (!session()->get(LOGINS['ISLOGIN'])) {
|
||||
session()->set(LOGINS['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
|
||||
$error = session()->getFlashdata('error') ? session()->getFlashdata('error') : '먼저 로그인을하셔야합니다.';
|
||||
return redirect()->to('/login')->with('error', $error);
|
||||
}
|
||||
|
||||
if (!in_array(session()->get('role'), $arguments)) {
|
||||
return redirect()->to('/login')->with(
|
||||
'error',
|
||||
sprintf(
|
||||
"%s 회원님은 %s로서 접속에 필요한 권한[%s]이 없습니다. ",
|
||||
session()->get('name'),
|
||||
session()->get('role'),
|
||||
implode(",", $arguments)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows After filters to inspect and modify the response
|
||||
* object as needed. This method does not allow any way
|
||||
* to stop execution of other after filters, short of
|
||||
* throwing an Exception or Error.
|
||||
*
|
||||
* @param RequestInterface $request
|
||||
* @param ResponseInterface $response
|
||||
* @param array|null $arguments
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function after(RequestInterface $request, ResponseInterface $response, $arguments = null)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
0
app/Helpers/.gitkeep
Normal file
0
app/Helpers/.gitkeep
Normal file
101
app/Helpers/Admin/HPILO_helper.php
Normal file
101
app/Helpers/Admin/HPILO_helper.php
Normal file
@ -0,0 +1,101 @@
|
||||
<?php
|
||||
function getFieldLabel_HPILOHelper($field, array $fieldRules, array $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
if (strpos($fieldRules[$field], 'required') !== false) {
|
||||
array_push($attributes, 'style="color:red";');
|
||||
}
|
||||
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/HPILO.label.{$field}"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//header.php에서 getFieldForm_Helper사용
|
||||
function getFieldForm_HPILOHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
case 'status':
|
||||
case 'power':
|
||||
return form_dropdown($field, $formOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'passwd':
|
||||
case 'confirmpassword':
|
||||
return form_password($field, DEFAULTS['EMPTY'], $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$attributes["class"] = !array_key_exists("class", $attributes) ? "calender" : $attributes["class"] . " calender";
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
default:
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldView_HPILOHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
|
||||
{
|
||||
switch ($field) {
|
||||
case 'status':
|
||||
return lang("Admin/HPILO." . strtoupper($field) . "." . $entity->$field);
|
||||
break;
|
||||
case 'memory':
|
||||
return $entity->$field . "GB";
|
||||
break;
|
||||
case 'detail':
|
||||
return nl2br($entity->$field);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
return getFieldForm_HPILOHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field;
|
||||
return $entity->$field;
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_HPILOHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/HPILO.label.{$field}");
|
||||
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $order_value == 'ASC' ? "up" : "down") : $label;
|
||||
$order_value = $order_value == 'DESC' ? "ASC" : "DESC";
|
||||
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes);
|
||||
} //
|
||||
|
||||
function getFieldIndex_Row_HPILOHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'customer':
|
||||
return sprintf(
|
||||
"%s %s %s",
|
||||
anchor(base_url() . '/admin/hpilo/reload/' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]),
|
||||
anchor(base_url() . '/admin/hpilo/console/' . $row['uid'], ' ', ["class" => "btn btn-sm btn-warning btn-circle fa fa-desktop", "target" => "_self"]),
|
||||
$row[$field]
|
||||
);
|
||||
break;
|
||||
case 'model':
|
||||
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]);
|
||||
break;
|
||||
case 'memory':
|
||||
return $row[$field] . "GB";
|
||||
break;
|
||||
case 'power':
|
||||
$attributes["onChange"] = sprintf('location.href="%s/reset/%s/"+this.options[this.selectedIndex].value', current_url(), $row['uid']);
|
||||
return getFieldForm_HPILOHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_HPILOHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
}
|
||||
} //
|
||||
86
app/Helpers/Admin/Logger_helper.php
Normal file
86
app/Helpers/Admin/Logger_helper.php
Normal file
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
function getFieldLabel_LoggerHelper($field, array $fieldRules, array $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
if (strpos($fieldRules[$field], 'required') !== false) {
|
||||
array_push($attributes, 'style="color:red";');
|
||||
}
|
||||
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/Logger.label.{$field}"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//header.php에서 getFieldForm_Helper사용
|
||||
function getFieldForm_LoggerHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
case 'status':
|
||||
return form_dropdown($field, $formOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$attributes["class"] = !array_key_exists("class", $attributes) ? "calender" : $attributes["class"] . " calender";
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
default:
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldView_LoggerHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
|
||||
{
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
return $fieldFormOptions[$field][$entity->$field];
|
||||
break;
|
||||
case 'status':
|
||||
return lang("Admin/Logger." . strtoupper($field) . "." . $entity->$field);
|
||||
break;
|
||||
case 'content':
|
||||
return nl2br($entity->$field);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
return getFieldForm_LoggerHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field;
|
||||
return $entity->$field;
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_LoggerHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/Logger.label.{$field}");
|
||||
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $order_value == 'ASC' ? "up" : "down") : $label;
|
||||
$order_value = $order_value == 'DESC' ? "ASC" : "DESC";
|
||||
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes);
|
||||
} //
|
||||
|
||||
function getFieldIndex_Row_LoggerHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'title':
|
||||
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]);
|
||||
break;
|
||||
case 'user_uid':
|
||||
case 'status':
|
||||
return $fieldFormOptions[$field][$row[$field]];
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_LoggerHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
}
|
||||
} //
|
||||
76
app/Helpers/Admin/UserSNS_helper.php
Normal file
76
app/Helpers/Admin/UserSNS_helper.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
function getFieldLabel_UserSNSHelper($field, array $fieldRules, array $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
if (strpos($fieldRules[$field], 'required') !== false) {
|
||||
array_push($attributes, 'style="color:red";');
|
||||
}
|
||||
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/UserSNS.label.{$field}"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//header.php에서 getFieldForm_Helper사용
|
||||
function getFieldForm_UserSNSHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
case 'user_uid':
|
||||
case 'status':
|
||||
return form_dropdown($field, $formOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$attributes["class"] = !array_key_exists("class", $attributes) ? "calender" : $attributes["class"] . " calender";
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
default:
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
|
||||
{
|
||||
switch ($field) {
|
||||
case 'status':
|
||||
return lang("Admin/UserSNS." . strtoupper($field) . "." . $entity->$field);
|
||||
break;
|
||||
case 'content':
|
||||
return nl2br($entity->$field);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return !isset($entity->$field) ? "{$field}:{$entity->uid}" : $entity->$field;
|
||||
return $entity->$field;
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_UserSNSHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/UserSNS.label.{$field}");
|
||||
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $order_value == 'ASC' ? "up" : "down") : $label;
|
||||
$order_value = $order_value == 'DESC' ? "ASC" : "DESC";
|
||||
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes);
|
||||
} //
|
||||
|
||||
function getFieldIndex_Row_UserSNSHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_UserSNSHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
}
|
||||
} //
|
||||
80
app/Helpers/Admin/User_helper.php
Normal file
80
app/Helpers/Admin/User_helper.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
function getFieldLabel_UserHelper($field, array $fieldRules, array $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
default:
|
||||
if (strpos($fieldRules[$field], 'required') !== false) {
|
||||
array_push($attributes, 'style="color:red";');
|
||||
}
|
||||
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/User.label.{$field}"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//header.php에서 getFieldForm_Helper사용
|
||||
function getFieldForm_UserHelper($field, $value, array $formOptions, array $attributes = array())
|
||||
{
|
||||
$value = is_null($value) ? DEFAULTS['EMPTY'] : $value;
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
case 'status':
|
||||
return form_dropdown($field, $formOptions[$field], $value, $attributes);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
$attributes["class"] = !array_key_exists("class", $attributes) ? "calender" : $attributes["class"] . " calender";
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
case 'passwd':
|
||||
case 'confirmpassword':
|
||||
return form_password($field, DEFAULTS['EMPTY'], $attributes);
|
||||
break;
|
||||
default:
|
||||
return form_input($field, $value, $attributes);
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
|
||||
{
|
||||
switch ($field) {
|
||||
case 'role':
|
||||
case 'status':
|
||||
return lang("Admin/User." . strtoupper($field) . "." . $entity->$field);
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $entity->$field;
|
||||
break;
|
||||
}
|
||||
} //
|
||||
|
||||
function getFieldIndex_Column_UserHelper($field, $order_field, $order_value, array $attributes = array())
|
||||
{
|
||||
$label = lang("Admin/User.label.{$field}");
|
||||
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $label, $order_value == 'ASC' ? "up" : "down") : $label;
|
||||
$order_value = $order_value == 'DESC' ? "ASC" : "DESC";
|
||||
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes);
|
||||
} //
|
||||
|
||||
function getFieldIndex_Row_UserHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
|
||||
{
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]);
|
||||
break;
|
||||
case 'updated_at':
|
||||
case 'created_at':
|
||||
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
|
||||
break;
|
||||
default:
|
||||
if (in_array($field, $fieldFilters)) {
|
||||
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
|
||||
return getFieldForm_UserHelper($field, $row[$field], $fieldFormOptions, $attributes);
|
||||
}
|
||||
return $row[$field];
|
||||
break;
|
||||
}
|
||||
} //
|
||||
146
app/Helpers/Common_helper.php
Normal file
146
app/Helpers/Common_helper.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
function getValueByKey_CommonHelper($key, array $attributes)
|
||||
{
|
||||
$options = array();
|
||||
$replace_attributes = array();
|
||||
foreach ($attributes as $idx => $value) {
|
||||
if ($idx == $key) {
|
||||
$replace_attributes[$idx] = $value;
|
||||
} else {
|
||||
array_push($options, $value);
|
||||
}
|
||||
}
|
||||
return array($replace_attributes, $options);
|
||||
}
|
||||
|
||||
function getRandomString_CommonHelper($length = 10, $characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
|
||||
{
|
||||
return substr(str_shuffle($characters), 0, $length);
|
||||
}
|
||||
function getPasswordString_CommonHelper($length = 8)
|
||||
{
|
||||
return getRandomString_CommonHelper($length, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?");
|
||||
} //
|
||||
|
||||
//byte값을 알아보기 쉽게 변환
|
||||
function getSizeForHuman_CommonHelper($bytes)
|
||||
{
|
||||
$ext = array('B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB');
|
||||
$unitCount = 0;
|
||||
for (; $bytes > 1024; $unitCount++) {
|
||||
$bytes /= 1024;
|
||||
}
|
||||
return floor($bytes) . $ext[$unitCount];
|
||||
} //
|
||||
|
||||
//Proxy등을 통하여 Client_IP가 알수없는경우 실제사용자의 IP를 가져오기 위한것
|
||||
function getClientIP_CommonHelper($clientIP = false)
|
||||
{
|
||||
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
|
||||
$clientIP = $_SERVER['HTTP_CLIENT_IP'];
|
||||
} else if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
} else if (isset($_SERVER['HTTP_X_FORWARDED'])) {
|
||||
$clientIP = $_SERVER['HTTP_X_FORWARDED'];
|
||||
} else if (isset($_SERVER['HTTP_FORWARDED_FOR'])) {
|
||||
$clientIP = $_SERVER['HTTP_FORWARDED_FOR'];
|
||||
} else if (isset($_SERVER['HTTP_FORWARDED'])) {
|
||||
$clientIP = $_SERVER['HTTP_FORWARDED'];
|
||||
} else if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
$clientIP = $_SERVER['REMOTE_ADDR'];
|
||||
}
|
||||
return $clientIP;
|
||||
} //
|
||||
|
||||
function isDomain_CommonHelper(string $domain): bool
|
||||
{
|
||||
$parttern_validation = '/((http|https)\:\/\/)?[a-zA-Z0-9\.\/\?\:@\-_=#]+\.([a-zA-Z0-9\&\.\/\?\:@\-_=#])*/';
|
||||
return preg_match("$parttern_validation", $domain);
|
||||
}
|
||||
|
||||
function isIPAddress_CommonHelper(string $ip, $type = false): bool
|
||||
{
|
||||
switch ($type) {
|
||||
case 'ipv4':
|
||||
return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4);
|
||||
break;
|
||||
case 'ipv6':
|
||||
return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6);
|
||||
break;
|
||||
case 'all':
|
||||
return filter_var($ip, FILTER_VALIDATE_IP);
|
||||
break;
|
||||
default:
|
||||
return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function isHost_CommonHelper(string $host): bool
|
||||
{
|
||||
$parttern_validation = '/[a-zA-Z0-9\.\/\?\:@\*\-_=#]/';
|
||||
return preg_match($parttern_validation, $host);
|
||||
}
|
||||
//(EX:192.168.1.0 -> 192.168.001.000)
|
||||
function convertIPV4toCIDR_CommonHelper($cidr)
|
||||
{
|
||||
$temps = explode(".", $cidr);
|
||||
return sprintf("%03d.%03d.%03d.%03d", $temps[0], $temps[1], $temps[2], $temps[3]);
|
||||
} //
|
||||
//(EX:192.168.001.0000 -> 192.168.1.0)
|
||||
function convertCIDRtoIPV4_CommonHelper($ipv4)
|
||||
{
|
||||
$temps = explode(".", $ipv4);
|
||||
return sprintf("%d.%d.%d.%d", $temps[0], $temps[1], $temps[2], $temps[3]);
|
||||
} //
|
||||
function isMobile_CommonHelper()
|
||||
{
|
||||
// Check the server headers to see if they're mobile friendly
|
||||
if (isset($_SERVER["HTTP_X_WAP_PROFILE"])) {
|
||||
return true;
|
||||
}
|
||||
// If the http_accept header supports wap then it's a mobile too
|
||||
if (preg_match("/wap\.|\.wap/i", $_SERVER["HTTP_ACCEPT"])) {
|
||||
return true;
|
||||
}
|
||||
// Still no luck? Let's have a look at the user agent on the browser. If it contains
|
||||
// any of the following, it's probably a mobile device. Kappow!
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"])) {
|
||||
$user_agents = array("midp", "j2me", "avantg", "docomo", "novarra", "palmos", "palmsource", "240x320", "opwv", "chtml", "pda", "windows\ ce", "mmp\/", "blackberry", "mib\/", "symbian", "wireless", "nokia", "hand", "mobi", "phone", "cdm", "up\.b", "audio", "SIE\-", "SEC\-", "samsung", "HTC", "mot\-", "mitsu", "sagem", "sony", "alcatel", "lg", "erics", "vx", "NEC", "philips", "mmm", "xx", "panasonic", "sharp", "wap", "sch", "rover", "pocket", "benq", "java", "pt", "pg", "vox", "amoi", "bird", "compal", "kg", "voda", "sany", "kdd", "dbt", "sendo", "sgh", "gradi", "jb", "\d\d\di", "moto");
|
||||
foreach ($user_agents as $user_string) {
|
||||
if (preg_match("/" . $user_string . "/i", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Let's NOT return "mobile" if it's an iPhone, because the iPhone can render normal pages quite well.
|
||||
if (preg_match("/iphone/i", $_SERVER["HTTP_USER_AGENT"])) {
|
||||
return false;
|
||||
}
|
||||
// None of the above? Then it's probably not a mobile device.
|
||||
return false;
|
||||
} //
|
||||
|
||||
function alert_CommonHelper($msg, $url = false)
|
||||
{
|
||||
if (!$msg) {
|
||||
$msg = '오류가 발생하였습니다';
|
||||
}
|
||||
$msg = preg_replace("/\r/", "\\r", $msg);
|
||||
$msg = preg_replace("/\n/", "\\n", $msg);
|
||||
$msg = preg_replace("/\'/", "\'", $msg);
|
||||
$msg = preg_replace("/\"/", "\'", $msg);
|
||||
$msg = sprintf('alert("%s");', $msg);
|
||||
switch ($url) {
|
||||
case 'close':
|
||||
$msg .= "window.close();";
|
||||
break;
|
||||
case 'back':
|
||||
$msg .= "history.back();";
|
||||
break;
|
||||
default:
|
||||
$msg .= !$url ? '' : 'window.location.href="' . $url . '";';
|
||||
break;
|
||||
}
|
||||
return '<script type="text/javascript">' . $msg . '</script>';
|
||||
}//
|
||||
0
app/Language/.gitkeep
Normal file
0
app/Language/.gitkeep
Normal file
30
app/Language/en/Admin/HPILO.php
Normal file
30
app/Language/en/Admin/HPILO.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "HP Server 정보",
|
||||
'label' => [
|
||||
'uid' => "번호",
|
||||
'customer' => "고객",
|
||||
'id' => "계정",
|
||||
'passwd' => "암호",
|
||||
'ip' => "IP",
|
||||
'port' => "Port",
|
||||
'model' => "Model",
|
||||
'processor' => "CPU",
|
||||
'memory' => "Memory",
|
||||
'health' => "기타장비상태",
|
||||
'power' => "전원",
|
||||
'detail' => "상세내용",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
],
|
||||
"POWER" => [
|
||||
"On" => "On",
|
||||
"Off" => "Off",
|
||||
"Restart" => "Restart",
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"unuse" => "사용않함",
|
||||
]
|
||||
];
|
||||
18
app/Language/en/Admin/Logger.php
Normal file
18
app/Language/en/Admin/Logger.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "Logger 정보",
|
||||
'label' => [
|
||||
'uid' => "번호",
|
||||
'user_uid' => "사용자명",
|
||||
'title' => "제목",
|
||||
'content' => "내용",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
],
|
||||
"USER_UID" => [],
|
||||
"STATUS" => [
|
||||
"use" => "정상",
|
||||
"unuse" => "오류",
|
||||
]
|
||||
];
|
||||
27
app/Language/en/Admin/User.php
Normal file
27
app/Language/en/Admin/User.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "계정정보",
|
||||
'label' => [
|
||||
'uid' => "번호",
|
||||
'id' => "계정",
|
||||
'passwd' => "암호",
|
||||
'confirmpassword' => "암호확인",
|
||||
'email' => "메일",
|
||||
'role' => "권한",
|
||||
'name' => "이름",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
],
|
||||
"ROLE" => [
|
||||
"user" => "회원",
|
||||
"manager" => "관리자",
|
||||
"cloudflare" => "Cloudflare관리자",
|
||||
"director" => "감독자",
|
||||
"master" => "마스터"
|
||||
],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"unuse" => "사용않함",
|
||||
]
|
||||
];
|
||||
20
app/Language/en/Admin/UserSNS.php
Normal file
20
app/Language/en/Admin/UserSNS.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
return [
|
||||
'title' => "SNS 계정정보",
|
||||
'label' => [
|
||||
'uid' => "인증번호",
|
||||
'user_uid' => "사용자",
|
||||
'site' => "SNS명",
|
||||
'name' => "이름",
|
||||
'email' => "메일",
|
||||
'status' => "상태",
|
||||
'updated_at' => "수정일",
|
||||
'created_at' => "작성일"
|
||||
],
|
||||
"USER_UID" => [],
|
||||
"STATUS" => [
|
||||
"use" => "사용",
|
||||
"unuse" => "사용않함",
|
||||
"standby" => "승인대기",
|
||||
]
|
||||
];
|
||||
4
app/Language/en/Admin/Validation.php
Normal file
4
app/Language/en/Admin/Validation.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php
|
||||
|
||||
// override core en language system validation or define your own en language validation message
|
||||
return [];
|
||||
0
app/Libraries/.gitkeep
Normal file
0
app/Libraries/.gitkeep
Normal file
167
app/Libraries/API/HPILO/HPILO4.php
Normal file
167
app/Libraries/API/HPILO/HPILO4.php
Normal file
@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\API\HPILO;
|
||||
|
||||
use App\Entities\HPILOEntity;
|
||||
use App\Libraries\Adapter\API\Adapter;
|
||||
|
||||
class HPILO4
|
||||
{
|
||||
private $_adapter = null;
|
||||
private $_system = array();
|
||||
protected $_base_url = "/redfish/v1";
|
||||
public function __construct(Adapter $adapter)
|
||||
{
|
||||
$this->_adapter = $adapter;
|
||||
}
|
||||
private function getSystemInfo()
|
||||
{
|
||||
$results = $this->_adapter->get($this->_base_url . "/Systems/1/");
|
||||
$this->_system['model'] = sprintf("%s %s", $results->Model, $results->BiosVersion);
|
||||
$this->_system['processor'] = trim($results->Processors->ProcessorFamily) . " * " . $results->Processors->Count;
|
||||
$this->_system['memory'] = $results->Memory->TotalSystemMemoryGB;
|
||||
$this->_system['health'] = 'OK';
|
||||
$this->_system['power'] = $results->Power;
|
||||
$this->_system['detail'] = '';
|
||||
}
|
||||
|
||||
private function getMemoryInfo($url)
|
||||
{
|
||||
//url에서 맨앞의 /를 없애야함(substr사용)
|
||||
$results = $this->_adapter->get($url);
|
||||
//오류체크
|
||||
if ($results->DIMMStatus != "GoodInUse") {
|
||||
$this->_system['health'] = "ERROR";
|
||||
}
|
||||
return sprintf(
|
||||
"%s: %s %sMhz %sMB => %s",
|
||||
$results->SocketLocator,
|
||||
$results->DIMMType,
|
||||
$results->MaximumFrequencyMHz,
|
||||
$results->SizeMB,
|
||||
$results->DIMMStatus
|
||||
);
|
||||
}
|
||||
private function getMemoryInfos(): array
|
||||
{
|
||||
$results = $this->_adapter->get($this->_base_url . "/Systems/1/Memory/");
|
||||
$memorys = array("\n------Memory------");
|
||||
foreach ($results->links->Member as $link) {
|
||||
array_push($memorys, $this->getMemoryInfo($link->href));
|
||||
}
|
||||
return $memorys;
|
||||
}
|
||||
|
||||
private function getPhysicalDiskInfo($url)
|
||||
{
|
||||
//url에서 맨앞의 /를 없애야함(substr사용)
|
||||
$info = $this->_adapter->get($url);
|
||||
//오류체크
|
||||
if ($info->Status->Health != "OK") {
|
||||
$this->_system['health'] = "ERROR";
|
||||
}
|
||||
return sprintf(
|
||||
"%s %s %sGB => %s",
|
||||
$info->MediaType,
|
||||
$info->Model,
|
||||
$info->CapacityGB,
|
||||
$info->Status->Health
|
||||
);
|
||||
}
|
||||
private function getPhysicalDiskInfos(): array
|
||||
{
|
||||
$results = $this->_adapter->get($this->_base_url . "/Systems/1/SmartStorage/ArrayControllers/0/DiskDrives/");
|
||||
$disks = array("\n------Physical Disk------");
|
||||
if (isset($results->links->Member)) {
|
||||
foreach ($results->links->Member as $link) {
|
||||
array_push($disks, $this->getPhysicalDiskInfo($link->href));
|
||||
}
|
||||
}
|
||||
return $disks;
|
||||
}
|
||||
|
||||
private function getLogicalDiskInfo($url)
|
||||
{
|
||||
//url에서 맨앞의 /를 없애야함(substr사용)
|
||||
$info = $this->_adapter->get($url);
|
||||
//오류체크
|
||||
if ($info->Status->Health != "OK") {
|
||||
$this->_system['health'] = "ERROR";
|
||||
}
|
||||
return sprintf(
|
||||
"%s Raid:%s %s_%s %sMB => %s",
|
||||
$info->LogicalDriveType,
|
||||
$info->Raid,
|
||||
$info->Name,
|
||||
$info->Id,
|
||||
number_format($info->CapacityMiB),
|
||||
$info->Status->Health
|
||||
);
|
||||
}
|
||||
private function getLogicalDiskInfos(): array
|
||||
{
|
||||
$results = $this->_adapter->get($this->_base_url . "/Systems/1/SmartStorage/ArrayControllers/0/LogicalDrives/");
|
||||
$disks = array("\n------Logical Disk------");
|
||||
if (isset($results->links->Member)) {
|
||||
foreach ($results->links->Member as $link) {
|
||||
array_push($disks, $this->getLogicalDiskInfo($link->href));
|
||||
}
|
||||
}
|
||||
return $disks;
|
||||
}
|
||||
|
||||
private function getFanInfos(): array
|
||||
{
|
||||
$results = $this->_adapter->get($this->_base_url . "/Chassis/1/Thermal/");
|
||||
$fans = array("\n------Fan------");
|
||||
foreach ($results->Fans as $fan) {
|
||||
//오류체크
|
||||
if ($fan->Status->Health != "OK") {
|
||||
$this->_system['health'] = "ERROR";
|
||||
}
|
||||
array_push($fans, sprintf("%s => %s", $fan->FanName, $fan->Status->Health));
|
||||
}
|
||||
return $fans;
|
||||
}
|
||||
|
||||
public function console()
|
||||
{
|
||||
// Oem / Hp / Privileges / RemoteConsolePriv
|
||||
$results = $this->_adapter->get($this->_base_url . "/Sessions/");
|
||||
return $results->Items[0]->Id;
|
||||
// return $this->_adapter->get($results->Oem->Hp->links->MySession->href);
|
||||
}
|
||||
|
||||
public function reset(string $type)
|
||||
{
|
||||
//resetType : "On","ForceOff","ForceRestart","Nmi","PushPowerButton"
|
||||
switch ($type) {
|
||||
case 'On':
|
||||
$resetType = 'On';
|
||||
break;
|
||||
case 'Off':
|
||||
$resetType = 'ForceOff';
|
||||
break;
|
||||
case 'Restart':
|
||||
$resetType = 'ForceRestart';
|
||||
break;
|
||||
default:
|
||||
throw new \Exception(__FUNCTION__ . "에서 {$type}은 기능은 없습니다.");
|
||||
break;
|
||||
}
|
||||
return $this->_adapter->post($this->_base_url . "/Systems/1", array("Action" => 'Reset', "ResetType" => $resetType));
|
||||
}
|
||||
|
||||
public function refresh(HPILOEntity $entity): HPILOEntity
|
||||
{
|
||||
$this->getSystemInfo();
|
||||
$this->_system['detail'] .= implode("\n", $this->getMemoryInfos());
|
||||
$this->_system['detail'] .= implode("\n", $this->getPhysicalDiskInfos());
|
||||
$this->_system['detail'] .= implode("\n", $this->getLogicalDiskInfos());
|
||||
$this->_system['detail'] .= implode("\n", $this->getFanInfos());
|
||||
foreach ($this->_system as $field => $value) {
|
||||
$entity->$field = $value;
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
82
app/Libraries/Adapter/API/Adapter.php
Normal file
82
app/Libraries/Adapter/API/Adapter.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Adapter\API;
|
||||
|
||||
use \App\Entities\HPILOEntity;
|
||||
|
||||
// 참고:https://github.com/SyntaxPhoenix/iloclient
|
||||
class Adapter
|
||||
{
|
||||
private $_entity = null;
|
||||
protected $_client = null;
|
||||
protected $_debug = false;
|
||||
public function __construct($entity, $debug = false)
|
||||
{
|
||||
$this->_entity = $entity;
|
||||
$this->_debug = $debug;
|
||||
}
|
||||
protected function getEntity(): HPILOEntity
|
||||
{
|
||||
return $this->_entity;
|
||||
}
|
||||
protected function getServerInfo($scheme = "https://", $delimeter = ":"): string
|
||||
{
|
||||
return $scheme . $this->getEntity()->getIP() . $delimeter . $this->getEntity()->getPort();
|
||||
}
|
||||
protected function getAccountInfo($type = 'basic'): array
|
||||
{
|
||||
//type: basic , digest
|
||||
return array($this->getEntity()->getID(), $this->getEntity()->getPassword(), $type);
|
||||
}
|
||||
final public function get(string $url): object
|
||||
{
|
||||
return $this->requestURL($url, 'GET');
|
||||
}
|
||||
final public function post(string $url, array $datas): object
|
||||
{
|
||||
return $this->requestURL($url, 'POST', $datas);
|
||||
}
|
||||
|
||||
protected function getClient()
|
||||
{
|
||||
if (is_null($this->_client)) {
|
||||
// 참조:https://www.codeigniter.com/user_guide/libraries/curlrequest.html?highlight=curl#
|
||||
// ex:)$options = [ 'baseURI' => 'http://www.foo.com/1.0/', 'timeout' => 0, 'allow_redirects' => false, 'proxy' => '192.168.16.1:10' ]
|
||||
$options = [
|
||||
'baseURI' => $this->getServerInfo(),
|
||||
'auth' => $this->getAccountInfo(),
|
||||
'verify' => getenv('hpilo.verify') == 'true' ? true : false,
|
||||
'cookie' => HPILOS['PATH'] . getenv('hpilo.cookie.file'),
|
||||
];
|
||||
if ($this->_debug) {
|
||||
$options['debug'] = HPILOS['PATH'] . getenv('hpilo.debug.file'); //or true
|
||||
}
|
||||
$this->_client = \Config\Services::curlrequest($options);
|
||||
}
|
||||
return $this->_client;
|
||||
}
|
||||
protected function requestURL(string $url, string $method, array $datas = []): object
|
||||
{
|
||||
// dd($this->getClient());
|
||||
$options = array();
|
||||
switch ($method) {
|
||||
case 'POST':
|
||||
$response = $this->getClient()->setBody($datas)->request($method, $url, $options);
|
||||
break;
|
||||
case 'HEAD':
|
||||
break;
|
||||
default:
|
||||
$response = $this->getClient()->request($method, $url, $options);
|
||||
break;
|
||||
}
|
||||
dd($response);
|
||||
if ($response->getStatusCode() != 200) {
|
||||
throw new \Exception(sprintf(
|
||||
"오류가 발생하였습니다.\n%s\n%s",
|
||||
$response->getHeaderLine('content-type'),
|
||||
$response->getBody()
|
||||
));
|
||||
}
|
||||
return json_decode($response->getBody());
|
||||
}
|
||||
}
|
||||
204
app/Libraries/Adapter/API/CurlAdapter.php
Normal file
204
app/Libraries/Adapter/API/CurlAdapter.php
Normal file
@ -0,0 +1,204 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Adapter\API;
|
||||
|
||||
// 참고:
|
||||
// https://techhub.hpe.com/eginfolib/servers/docs/HPRestfultool/iLo4/data_model_reference.html
|
||||
// https://github.com/SyntaxPhoenix/iloclient
|
||||
class CurlAdapter extends Adapter
|
||||
{
|
||||
public function __construct(\App\Entities\HPILOEntity $entity, $debug = false)
|
||||
{
|
||||
parent::__construct($entity, $debug);
|
||||
}
|
||||
private function debug($ch, $response, array $datas = array())
|
||||
{
|
||||
if (!$this->_debug) {
|
||||
return false;
|
||||
}
|
||||
if ($response === false) {
|
||||
log_message('error', curl_error($ch));
|
||||
}
|
||||
$info = curl_getinfo($ch);
|
||||
log_message('debug', var_export($info, true));
|
||||
log_message('debug', var_export($datas, true));
|
||||
log_message('debug', "{$info['total_time']}초, url:{$info['url']}, return:{$info['http_code']}");
|
||||
switch ($info['http_code']) {
|
||||
case 100:
|
||||
log_message('debug', "{$info['http_code']} Continue");
|
||||
break;
|
||||
case 101:
|
||||
log_message('debug', "{$info['http_code']} Switching Protocols");
|
||||
break;
|
||||
case 200:
|
||||
log_message('debug', "{$info['http_code']} OK");
|
||||
break;
|
||||
case 201:
|
||||
log_message('debug', "{$info['http_code']} Created");
|
||||
break;
|
||||
case 202:
|
||||
log_message('debug', "{$info['http_code']} Accepted");
|
||||
break;
|
||||
case 203:
|
||||
log_message('debug', "{$info['http_code']} Non-Authoritative Information");
|
||||
break;
|
||||
case 204:
|
||||
log_message('debug', "{$info['http_code']} No Content");
|
||||
break;
|
||||
case 205:
|
||||
log_message('debug', "{$info['http_code']} Reset Content");
|
||||
break;
|
||||
case 206:
|
||||
log_message('debug', "{$info['http_code']} Partial Content");
|
||||
break;
|
||||
case 300:
|
||||
log_message('debug', "{$info['http_code']} Multiple Choices");
|
||||
break;
|
||||
case 301:
|
||||
log_message('debug', "{$info['http_code']} Moved Permanently");
|
||||
break;
|
||||
case 302:
|
||||
log_message('debug', "{$info['http_code']} Found");
|
||||
break;
|
||||
case 303:
|
||||
log_message('debug', "{$info['http_code']} See Other");
|
||||
break;
|
||||
case 304:
|
||||
log_message('debug', "{$info['http_code']} Not Modified");
|
||||
break;
|
||||
case 305:
|
||||
log_message('debug', "{$info['http_code']} Use Proxy");
|
||||
break;
|
||||
case 306:
|
||||
log_message('debug', "{$info['http_code']} (Unused)");
|
||||
break;
|
||||
case 307:
|
||||
log_message('debug', "{$info['http_code']} Temporary Redirect");
|
||||
break;
|
||||
case 400:
|
||||
log_message('debug', "{$info['http_code']} Bad Request");
|
||||
break;
|
||||
case 401:
|
||||
log_message('debug', "{$info['http_code']} Unauthorized");
|
||||
break;
|
||||
case 402:
|
||||
log_message('debug', "{$info['http_code']} Payment Required");
|
||||
break;
|
||||
case 403:
|
||||
log_message('debug', "{$info['http_code']} Forbidden");
|
||||
break;
|
||||
case 404:
|
||||
log_message('debug', "{$info['http_code']} Not Found");
|
||||
break;
|
||||
case 405:
|
||||
log_message('debug', "{$info['http_code']} Method Not Allowed");
|
||||
break;
|
||||
case 406:
|
||||
log_message('debug', "{$info['http_code']} Not Acceptable");
|
||||
break;
|
||||
case 407:
|
||||
log_message('debug', "{$info['http_code']} Proxy Authentication Required");
|
||||
break;
|
||||
case 408:
|
||||
log_message('debug', "{$info['http_code']} Request Timeout");
|
||||
break;
|
||||
case 409:
|
||||
log_message('debug', "{$info['http_code']} Conflict");
|
||||
break;
|
||||
case 410:
|
||||
log_message('debug', "{$info['http_code']} Gone");
|
||||
break;
|
||||
case 411:
|
||||
log_message('debug', "{$info['http_code']} Length Required");
|
||||
break;
|
||||
case 412:
|
||||
log_message('debug', "{$info['http_code']} Precondition Failed");
|
||||
break;
|
||||
case 413:
|
||||
log_message('debug', "{$info['http_code']} Request Entity Too Large");
|
||||
break;
|
||||
case 414:
|
||||
log_message('debug', "{$info['http_code']} Request-URI Too Long");
|
||||
break;
|
||||
case 415:
|
||||
log_message('debug', "{$info['http_code']} Unsupported Media Type");
|
||||
break;
|
||||
case 416:
|
||||
log_message('debug', "{$info['http_code']} Requested Range Not Satisfiable");
|
||||
break;
|
||||
case 417:
|
||||
log_message('debug', "{$info['http_code']} Expectation Failed");
|
||||
break;
|
||||
case 500:
|
||||
log_message('debug', "{$info['http_code']} Internal Server Error");
|
||||
break;
|
||||
case 501:
|
||||
log_message('debug', "{$info['http_code']} Not Implemented");
|
||||
break;
|
||||
case 502:
|
||||
log_message('debug', "{$info['http_code']} Bad Gateway");
|
||||
break;
|
||||
case 503:
|
||||
log_message('debug', "{$info['http_code']} Service Unavailable");
|
||||
break;
|
||||
case 504:
|
||||
log_message('debug', "{$info['http_code']} Gateway Timeout");
|
||||
break;
|
||||
case 505:
|
||||
log_message('debug', "{$info['http_code']} HTTP Version Not Supported");
|
||||
break;
|
||||
default:
|
||||
log_message('debug', "Return Code : {$info['http_code']}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
protected function requestURL(string $url, string $method, array $datas = []): object
|
||||
{
|
||||
$ch = curl_init($this->getServerInfo() . $url);
|
||||
switch ($method) {
|
||||
case 'POST':
|
||||
curl_setopt($ch, CURLOPT_POST, TRUE);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($datas));
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
|
||||
//cookie값 파일저장용
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, HPILOS['CURL_COOKIE_FILE']);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, HPILOS['CURL_COOKIE_FILE']);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//cookie값 전달용
|
||||
foreach (curl_getinfo($ch, CURLINFO_COOKIELIST) as $cookie_line) {
|
||||
curl_setopt($ch, CURLOPT_COOKIELIST, $cookie_line);
|
||||
}
|
||||
//SSL 확인여부용
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, HPILOS['SSL']);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, HPILOS['SSL']);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, implode(":", $this->getAccountInfo()));
|
||||
//header값 전달용
|
||||
$headers = [];
|
||||
curl_setopt(
|
||||
$ch,
|
||||
CURLOPT_HEADERFUNCTION,
|
||||
function ($curl, $header) use (&$headers) {
|
||||
$length = strlen($header);
|
||||
$header = explode(':', $header, 2);
|
||||
if (count($header) < 2) { // ignore invalid headers
|
||||
return $length;
|
||||
}
|
||||
$headers[strtolower(trim($header[0]))][] = trim($header[1]);
|
||||
return $length;
|
||||
}
|
||||
);
|
||||
$response = curl_exec($ch);
|
||||
$this->debug($ch, $response);
|
||||
curl_close($ch);
|
||||
if (is_null($response)) {
|
||||
throw new \Exception("해당서버[{$this->getServerInfo()}]의 ILO접속 오류가 발생하였습니다.");
|
||||
}
|
||||
return json_decode($response);
|
||||
}
|
||||
}
|
||||
83
app/Libraries/Adapter/API/GuzzleAdapter.php
Normal file
83
app/Libraries/Adapter/API/GuzzleAdapter.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Adapter\API;
|
||||
|
||||
use GuzzleHttp\Psr7;
|
||||
use GuzzleHttp\Exception\ClientException;
|
||||
// 참고:https://github.com/SyntaxPhoenix/iloclient
|
||||
class GuzzleAdapter extends Adapter
|
||||
{
|
||||
private $_jar = null;
|
||||
public function __construct(\App\Entities\HPILOEntity $entity, $debug = false)
|
||||
{
|
||||
parent::__construct($entity, $debug);
|
||||
}
|
||||
private function getCookieJar(): \GuzzleHttp\Cookie\CookieJar
|
||||
{
|
||||
if (is_null($this->_jar)) {
|
||||
$this->_jar = new \GuzzleHttp\Cookie\CookieJar();
|
||||
}
|
||||
return $this->_jar;
|
||||
}
|
||||
protected function setLocalCookie(): void
|
||||
{
|
||||
// dd($this->getCookieJar(), true);
|
||||
foreach (['Key', 'Lang', 'Url'] as $key) {
|
||||
log_message('debug', var_export($this->getCookieJar()->getCookieByName('session' . $key), true));
|
||||
}
|
||||
}
|
||||
protected function getClient()
|
||||
{
|
||||
if (is_null($this->_client)) {
|
||||
// 참조:https://docs.guzzlephp.org/en/stable/request-options.html
|
||||
// ex:)$options = [ 'base_uri' => 'http://www.foo.com/1.0/', 'timeout' => 0, 'allow_redirects' => false, 'proxy' => '192.168.16.1:10' ]
|
||||
$options = [
|
||||
'base_uri' => $this->getServerInfo(),
|
||||
'auth' => $this->getAccountInfo(),
|
||||
'verify' => HPILOS['SSL'],
|
||||
'cookie' => HPILOS['GUZZLE_COOKIE'],
|
||||
// \GuzzleHttp\RequestOptions::ALLOW_REDIRECTS => [
|
||||
// 'max' => 10, // allow at most 10 redirects.
|
||||
// 'strict' => true, // use "strict" RFC compliant redirects.
|
||||
// 'referer' => true, // add a Referer header
|
||||
// 'track_redirects' => true,
|
||||
// ],
|
||||
];
|
||||
$this->_client = new \GuzzleHttp\Client($options);
|
||||
}
|
||||
return $this->_client;
|
||||
}
|
||||
protected function requestURL(string $url, string $method, array $datas = []): object
|
||||
{
|
||||
try {
|
||||
$options = array();
|
||||
if ($this->_debug) {
|
||||
$options['debug'] = fopen('php://stderr', 'w'); //or true
|
||||
}
|
||||
switch ($method) {
|
||||
case 'POST':
|
||||
$options['json'] = $datas;
|
||||
break;
|
||||
case 'HEAD':
|
||||
break;
|
||||
}
|
||||
$response = $this->getClient()->request($method, $url, $options);
|
||||
if ($response->getStatusCode() != 200) {
|
||||
throw new \Exception(sprintf(
|
||||
"오류가 발생하였습니다.\n%s\n%s",
|
||||
$response->getHeaderLine('content-type'),
|
||||
$response->getBody()
|
||||
));
|
||||
}
|
||||
$this->setLocalCookie($url);
|
||||
// echo $response->getHeaderLine('content-type'); // 'application/json; charset=utf8'
|
||||
// echo $response->getBody()=>'{"id": 1420053, "name": "guzzle", ...}
|
||||
return json_decode($response->getBody()->getContents());
|
||||
} catch (ClientException $e) {
|
||||
throw new \Exception(
|
||||
Psr7\Message::toString($e->getRequest()) . "\n" .
|
||||
Psr7\Message::toString($e->getResponse())
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
65
app/Libraries/Adapter/Auth/Adapter.php
Normal file
65
app/Libraries/Adapter/Auth/Adapter.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Adapter\Auth;
|
||||
|
||||
use App\Models\UserModel;
|
||||
use App\Models\UserSNSModel;
|
||||
use App\Entities\UserEntity;
|
||||
|
||||
// 참고:https://github.com/SyntaxPhoenix/iloclient
|
||||
abstract class Adapter
|
||||
{
|
||||
private $_site = null;
|
||||
private $_userModel = null;
|
||||
private $_userSNSModel = null;
|
||||
protected $_debug = false;
|
||||
protected function __construct(string $site, $debug = false)
|
||||
{
|
||||
$this->_site = $site;
|
||||
$this->_debug = $debug;
|
||||
}
|
||||
final public function getSiteName(): string
|
||||
{
|
||||
if (is_null($this->_site)) {
|
||||
throw new \Exception("Auth Adpater Site명이 정의 되지 않았습니다.");
|
||||
}
|
||||
return strtoupper($this->_site);
|
||||
}
|
||||
abstract public function getAuthButton();
|
||||
abstract public function signin(array $formDatas): UserEntity;
|
||||
|
||||
final protected function getUserModel(): UserModel
|
||||
{
|
||||
if (is_null($this->_userModel)) {
|
||||
$this->_userModel = new UserModel();
|
||||
}
|
||||
return $this->_userModel;
|
||||
}
|
||||
|
||||
final protected function getUserSNSModel(): UserSNSModel
|
||||
{
|
||||
if (is_null($this->_userSNSModel)) {
|
||||
$this->_userSNSModel = new UserSNSModel();
|
||||
}
|
||||
return $this->_userSNSModel;
|
||||
}
|
||||
|
||||
protected function setSessionInfo(UserEntity $entity, array $authrizedDatas = array()): void
|
||||
{
|
||||
$authrizedDatas[LOGINS['ISLOGIN']] = true;
|
||||
$authrizedDatas['uid'] = $entity->getPrimaryKey();
|
||||
$authrizedDatas['name'] = $entity->getTitle();
|
||||
$authrizedDatas['email'] = $entity->getEmail();
|
||||
$authrizedDatas['role'] = $entity->getRole();
|
||||
session()->set($authrizedDatas);
|
||||
}
|
||||
public function getSessionInfo(array $authrizedDatas = array()): array
|
||||
{
|
||||
$authrizedDatas[LOGINS['ISLOGIN']] = session()->get(LOGINS['ISLOGIN']);
|
||||
$authrizedDatas['uid'] = session()->get('uid');
|
||||
$authrizedDatas['name'] = session()->get('name');
|
||||
$authrizedDatas['email'] = session()->get('email');
|
||||
$authrizedDatas['role'] = session()->get('role');
|
||||
return $authrizedDatas;
|
||||
}
|
||||
}
|
||||
123
app/Libraries/Adapter/Auth/GoogleAdapter.php
Normal file
123
app/Libraries/Adapter/Auth/GoogleAdapter.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Adapter\Auth;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
use App\Entities\UserSNSEntity;
|
||||
|
||||
class GoogleAdapter extends Adapter
|
||||
{
|
||||
private $_client = null;
|
||||
public function __construct(string $site, $debug = false)
|
||||
{
|
||||
parent::__construct($site, $debug);
|
||||
}
|
||||
private function getClient(): \Google_Client
|
||||
{
|
||||
if (is_null($this->_client)) {
|
||||
$this->_client = new \Google_Client();
|
||||
$this->_client->setClientId(AUTHS[$this->getSiteName()]['CLIENT_ID']);
|
||||
$this->_client->setClientSecret(AUTHS[$this->getSiteName()]['CLIENT_KEY']);
|
||||
// throw new \Exception("URL:" . base_url() . AUTHS[$this->getSiteName()]['CALLBACK_URL']);
|
||||
$this->_client->setRedirectUri(base_url() . AUTHS[$this->getSiteName()]['CALLBACK_URL']);
|
||||
$this->_client->addScope('email');
|
||||
$this->_client->addScope('profile');
|
||||
}
|
||||
return $this->_client;
|
||||
}
|
||||
|
||||
private function setAccessToken(array $formDatas)
|
||||
{
|
||||
//1. Google 로그인후 인증코드 확인
|
||||
if (!isset($formDatas['code']) || !$formDatas['code']) {
|
||||
throw new \Exception($this->getSiteName() . " 인증 CallBack Code가 필요합니다.");
|
||||
}
|
||||
//2.토큰정보 가져오기
|
||||
$tokenInfo = $this->getClient()->fetchAccessTokenWithAuthCode($formDatas['code']);
|
||||
if (isset($tokenInfo['error'])) {
|
||||
throw new \Exception($tokenInfo['error']);
|
||||
}
|
||||
$token = $tokenInfo[AUTHS[$this->getSiteName()]['TOKEN_NAME']];
|
||||
//3. Google Service에 접근하기위해 Access Token을 설정
|
||||
$this->getClient()->setAccessToken($token);
|
||||
|
||||
//4. Google에 로그인이 했으므로 세션에 Token값 설정
|
||||
session()->set(AUTHS[$this->getSiteName()]['TOKEN_NAME'], $token);
|
||||
}
|
||||
private function getAccessToken(): ?string
|
||||
{
|
||||
return session()->get(AUTHS[$this->getSiteName()]['TOKEN_NAME']);
|
||||
}
|
||||
|
||||
public function getAuthButton()
|
||||
{
|
||||
$button = "";
|
||||
if (!$this->getAccessToken()) {
|
||||
$button = anchor($this->getClient()->createAuthUrl(), AUTHS[$this->getSiteName()]['ICON'], ["target" => "_self"]);
|
||||
}
|
||||
return $button;
|
||||
}
|
||||
|
||||
public function signin(array $formDatas): UserEntity
|
||||
{
|
||||
try {
|
||||
//Google 접근 권한 설정.
|
||||
$this->setAccessToken($formDatas);
|
||||
//Google 서비스 설정
|
||||
$service = new \Google\Service\Oauth2($this->getClient());
|
||||
$result = (array)$service->userinfo->get();
|
||||
if ($this->_debug) {
|
||||
log_message("debug", var_export($result, true));
|
||||
}
|
||||
// throw new \Exception(__METHOD__ . "에서 데이터 처리 필요");
|
||||
// DEBUG - 2023-07-13 12:54:51 --> \Google\Service\Oauth2\Userinfo::__set_state(array(
|
||||
// 'internal_gapi_mappings' =>
|
||||
// array (
|
||||
// 'familyName' => 'family_name',
|
||||
// 'givenName' => 'given_name',
|
||||
// 'verifiedEmail' => 'verified_email',
|
||||
// ),
|
||||
// 'modelData' =>
|
||||
// array (
|
||||
// 'verified_email' => true,
|
||||
// 'given_name' => '이름',
|
||||
// 'family_name' => '성',
|
||||
// ),
|
||||
// 'processed' =>
|
||||
// array (
|
||||
// ),
|
||||
// 'email' => 'twsdfsew342s@gmail.com',
|
||||
// 'familyName' => '성',
|
||||
// 'gender' => NULL,
|
||||
// 'givenName' => '이름',
|
||||
// 'hd' => NULL,
|
||||
// 'id' => '103667492432234234236838324',
|
||||
// 'link' => NULL,
|
||||
// 'locale' => 'ko',
|
||||
// 'name' => '성이름',
|
||||
// 'picture' => 'https://lh3.googleusercontent.com/a/AAcHTteFSgefsdfsdRJBkJA2tBEmg4PQrvI1Ta_5IXu5=s96-c',
|
||||
// 'verifiedEmail' => true,
|
||||
// ))
|
||||
//조건에 해당하는 사용자가 있는지 검사
|
||||
$snsEntity = $this->getUserModel()->asObject(UserSNSEntity::class)->where(
|
||||
array("site" => $this->getSiteName(), "uid" => $result['id'])
|
||||
)->first();
|
||||
if (is_null($snsEntity)) {
|
||||
$snsEntity = $this->getUserSNSModel()->create($result);
|
||||
}
|
||||
if (is_null($snsEntity->getUserUID())) {
|
||||
throw new \Exception($this->getSiteName() . "의{$result['email']}:{$result['name']}님은 아직 사용자 지정이 되지 않았습니다.");
|
||||
}
|
||||
if ($snsEntity->getStatus() !== DEFAULTS['STATUS']) {
|
||||
throw new \Exception($this->getSiteName() . "의{$result['email']}:{$result['name']}님은 " . lang("Admin/UserSNS.label." . $snsEntity->getStatus()) . "입니다");
|
||||
}
|
||||
//인증된 사용자 정보를 가져온후 세션 정보 처리
|
||||
$entity = $this->getUserModel()->getEntity($snsEntity->getUserUID());
|
||||
//Session에 인증정보 설정
|
||||
$this->setSessionInfo($entity);
|
||||
return $entity;
|
||||
} catch (\Exception $e) {
|
||||
throw new \Exception("관리자에게 문의하시기 바랍니다.<BR>{$e->getMessage()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
35
app/Libraries/Adapter/Auth/LocalAdapter.php
Normal file
35
app/Libraries/Adapter/Auth/LocalAdapter.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Adapter\Auth;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
|
||||
class LocalAdapter extends Adapter
|
||||
{
|
||||
public function __construct(string $site, $debug = false)
|
||||
{
|
||||
parent::__construct($site, $debug);
|
||||
}
|
||||
public function getAuthButton()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public function signin(array $formDatas): UserEntity
|
||||
{
|
||||
if (!isset($formDatas['id']) || !$formDatas['id'] || !isset($formDatas['passwd']) || !$formDatas['passwd']) {
|
||||
throw new \Exception("ID 나 암호의 값이 없습니다.");
|
||||
}
|
||||
|
||||
$entity = $this->getUserModel()->getEntityByField('id', $formDatas['id']);
|
||||
if (is_null($entity)) {
|
||||
throw new \Exception("사용자ID: {$formDatas['id']}가 존재하지 않습니다.");
|
||||
}
|
||||
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
|
||||
throw new \Exception("암호가 맞지않습니다.");
|
||||
}
|
||||
//Session에 인증정보 설정
|
||||
$this->setSessionInfo($entity);
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
23
app/Libraries/Log/DataBase.php
Normal file
23
app/Libraries/Log/DataBase.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Log;
|
||||
|
||||
use \App\Models\LoggerModel;
|
||||
|
||||
class DataBase
|
||||
{
|
||||
private $_model = null;
|
||||
public function __construct()
|
||||
{
|
||||
$this->_model = new LoggerModel();
|
||||
}
|
||||
public function save(string $title, bool $status, array $logs)
|
||||
{
|
||||
$datas = array(
|
||||
'title' => $title,
|
||||
'status' => $status ? 'use' : 'unuse',
|
||||
'content' => implode("\n", $logs)
|
||||
);
|
||||
return $this->_model->create($datas);
|
||||
}
|
||||
}
|
||||
28
app/Libraries/Log/Log.php
Normal file
28
app/Libraries/Log/Log.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App\Libraries\Log;
|
||||
|
||||
class Log
|
||||
{
|
||||
private static $_logs = array();
|
||||
private static $_dbInstance = null;
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
final static public function add(string $level, string $content)
|
||||
{
|
||||
$content = date("H:i:s") . "-[{$level}]:{$content}";
|
||||
if ($level !== "debug") {
|
||||
array_push(self::$_logs, $content);
|
||||
}
|
||||
log_message($level, $content);
|
||||
}
|
||||
final static public function save(string $title, bool $status = true)
|
||||
{
|
||||
if (self::$_dbInstance === null) {
|
||||
self::$_dbInstance = new \App\Libraries\Log\DataBase();
|
||||
}
|
||||
self::$_dbInstance->save($title, $status, self::$_logs);
|
||||
self::$_logs = array();
|
||||
}
|
||||
}
|
||||
0
app/Models/.gitkeep
Normal file
0
app/Models/.gitkeep
Normal file
58
app/Models/CommonModel.php
Normal file
58
app/Models/CommonModel.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Libraries\Log\Log;
|
||||
use CodeIgniter\Model;
|
||||
|
||||
class CommonModel extends Model
|
||||
{
|
||||
// use CommonTrait;
|
||||
|
||||
protected $DBGroup = 'default';
|
||||
// protected $table = 'user';
|
||||
protected $primaryKey = 'uid';
|
||||
protected $useAutoIncrement = true;
|
||||
protected $insertID = 0;
|
||||
protected $returnType = 'array'; //object,array,entity명::class
|
||||
protected $useSoftDeletes = false;
|
||||
protected $protectFields = true;
|
||||
protected $allowedFields = [];
|
||||
|
||||
// Dates
|
||||
protected $useTimestamps = true;
|
||||
protected $dateFormat = 'datetime';
|
||||
protected $createdField = 'created_at';
|
||||
protected $updatedField = 'updated_at';
|
||||
protected $deletedField = 'deleted_at';
|
||||
|
||||
protected $validationRules = [];
|
||||
protected $validationMessages = [];
|
||||
protected $skipValidation = false;
|
||||
protected $cleanValidationRules = true;
|
||||
|
||||
// Callbacks
|
||||
protected $allowCallbacks = true;
|
||||
protected $beforeInsert = [];
|
||||
protected $afterInsert = [];
|
||||
protected $beforeUpdate = [];
|
||||
protected $afterUpdate = [];
|
||||
protected $beforeFind = [];
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
}
|
||||
public function setIndexDateFilterTrit($start, $end)
|
||||
{
|
||||
$this->where('created_at >=', $start);
|
||||
$this->where('created_at <=', $end);
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = 'ASC')
|
||||
{
|
||||
$this->orderBy($field, $order);
|
||||
}
|
||||
}
|
||||
41
app/Models/CommonTrait.php
Normal file
41
app/Models/CommonTrait.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Libraries\Log\Log;
|
||||
|
||||
trait CommonTrait
|
||||
{
|
||||
private function setEntityDatas_CommonTrait($entity, array $datas)
|
||||
{
|
||||
foreach ($this->allowedFields as $field) {
|
||||
if ($entity->$field != $datas[$field]) {
|
||||
$entity->$field = $datas[$field];
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
protected function create_CommonTrait($entity, array $datas)
|
||||
{
|
||||
$entity = $this->setEntityDatas_CommonTrait($entity, $datas);
|
||||
if (!$this->save($entity)) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getLastQuery());
|
||||
Log::add("error", implode("\n", $this->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->errors(), true));
|
||||
}
|
||||
$entity->$this->primaryKey = $this->insertID();
|
||||
return $entity;
|
||||
}
|
||||
protected function modify_CommonTrait($entity, array $datas)
|
||||
{
|
||||
$entity = $this->setEntityDatas_CommonTrait($entity, $datas);
|
||||
if ($entity->hasChanged()) {
|
||||
if (!$this->save($entity)) {
|
||||
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getLastQuery());
|
||||
Log::add("error", implode("\n", $this->errors()));
|
||||
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->errors(), true));
|
||||
}
|
||||
}
|
||||
return $entity;
|
||||
}
|
||||
}
|
||||
58
app/Models/HPILOModel.php
Normal file
58
app/Models/HPILOModel.php
Normal file
@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Entities\HPILOEntity;
|
||||
|
||||
class HPILOModel extends CommonModel
|
||||
{
|
||||
protected $table = 'hpilo';
|
||||
// protected $primaryKey = 'uid';
|
||||
// protected $useAutoIncrement = true;
|
||||
protected $allowedFields = ['customer', 'ip', 'port', 'id', 'passwd', 'model', 'processor', 'memory', 'health', 'power', 'detail', 'status', 'created_at'];
|
||||
protected $validationRules = [
|
||||
'uid' => 'if_exist|numeric',
|
||||
'customer' => 'if_exist|string',
|
||||
'id' => 'if_exist|string',
|
||||
'passwd' => 'if_exist|string',
|
||||
'ip' => 'if_exist|string',
|
||||
'port' => 'if_exist|numeric',
|
||||
'model' => 'if_exist|string',
|
||||
'processor' => 'if_exist|string',
|
||||
'memory' => 'if_exist|numeric',
|
||||
'health' => 'if_exist|string',
|
||||
'power' => 'if_exist|string',
|
||||
'detail' => 'if_exist|string',
|
||||
'status' => 'if_exist|in_list[use,unuse]',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
];
|
||||
public function getEntityByField($field, $value): ?HPILOEntity
|
||||
{
|
||||
return $this->asObject(HPILOEntity::class)->where($field, $value)->first();
|
||||
}
|
||||
public function getEntity(int $uid): ?HPILOEntity
|
||||
{
|
||||
return $this->getEntityByField($this->primaryKey, $uid);
|
||||
}
|
||||
public function create(array $datas): HPILOEntity
|
||||
{
|
||||
return $this->create_CommonTrait(new HPILOEntity($datas), $datas);
|
||||
}
|
||||
public function modify(HPILOEntity $entity, array $datas): HPILOEntity
|
||||
{
|
||||
return $this->modify_CommonTrait($entity, $datas);
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike('customer', $word, 'both');
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = 'ASC')
|
||||
{
|
||||
$this->orderBy("health", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
}
|
||||
}
|
||||
48
app/Models/LoggerModel.php
Normal file
48
app/Models/LoggerModel.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Entities\LoggerEntity;
|
||||
|
||||
class LoggerModel extends CommonModel
|
||||
{
|
||||
protected $table = 'logger';
|
||||
// protected $primaryKey = 'uid';
|
||||
// protected $useAutoIncrement = true;
|
||||
protected $allowedFields = ['user_uid', 'title', 'content', 'status', 'created_at'];
|
||||
protected $validationRules = [
|
||||
'uid' => 'if_exist|numeric',
|
||||
'user_uid' => 'if_exist|numeric',
|
||||
'title' => 'if_exist|string',
|
||||
'content' => 'if_exist|string',
|
||||
'status' => 'if_exist|in_list[use,unuse]',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
];
|
||||
|
||||
public function getEntityByField($field, $value): ?LoggerEntity
|
||||
{
|
||||
return $this->asObject(LoggerEntity::class)->where($field, $value)->first();
|
||||
}
|
||||
public function getEntity(int $uid): ?LoggerEntity
|
||||
{
|
||||
return $this->getEntityByField($this->primaryKey, $uid);
|
||||
}
|
||||
public function create(array $datas): LoggerEntity
|
||||
{
|
||||
$datas['user_uid'] = session()->get('uid');
|
||||
return $this->create_CommonTrait(new LoggerEntity($datas), $datas);
|
||||
}
|
||||
public function modify(LoggerEntity $entity, array $datas): LoggerEntity
|
||||
{
|
||||
return $this->modify_CommonTrait($entity, $datas);
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike('title', $word, 'both');
|
||||
$this->orLike('content', $word, 'both'); //befor , after , both
|
||||
}
|
||||
}
|
||||
56
app/Models/UserModel.php
Normal file
56
app/Models/UserModel.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Entities\UserEntity;
|
||||
|
||||
class UserModel extends CommonModel
|
||||
{
|
||||
protected $table = 'user';
|
||||
// protected $primaryKey = 'uid';
|
||||
// protected $useAutoIncrement = true;
|
||||
protected $allowedFields = ['id', 'passwd', 'name', 'email', 'role', 'oauth_id', 'status', 'updated_at', 'created_at'];
|
||||
protected $validationRules = [
|
||||
'uid' => 'if_exist|numeric',
|
||||
'id' => 'if_exist|min_length[4]|max_length[20]',
|
||||
'passwd' => 'if_exist|trim|min_length[4]|max_length[150]',
|
||||
'confirmpassword' => 'if_exist|trim|matches[passwd]',
|
||||
'name' => 'if_exist|min_length[2]|max_length[20]',
|
||||
'email' => 'if_exist|valid_email',
|
||||
'role' => 'if_exist|in_list[user,manager,cloudflare,director,master]',
|
||||
'oauth_id' => 'if_exist|trim|min_length[4]',
|
||||
'status' => 'if_exist|in_list[use,unuse,standby]',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
];
|
||||
|
||||
public function getEntityByField($field, $value): ?UserEntity
|
||||
{
|
||||
return $this->asObject(UserEntity::class)->where($field, $value)->first();
|
||||
}
|
||||
public function getEntity(int $uid): ?UserEntity
|
||||
{
|
||||
return $this->getEntityByField($this->primaryKey, $uid);
|
||||
}
|
||||
public function create(array $datas): UserEntity
|
||||
{
|
||||
return $this->create_CommonTrait(new UserEntity($datas), $datas);
|
||||
}
|
||||
public function modify(UserEntity $entity, array $datas): UserEntity
|
||||
{
|
||||
return $this->modify_CommonTrait($entity, $datas);
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike('id', $word, 'both');
|
||||
$this->orLike('name', $word, 'both'); //befor , after , both
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = 'ASC')
|
||||
{
|
||||
$this->orderBy("name", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
}
|
||||
}
|
||||
59
app/Models/UserSNSModel.php
Normal file
59
app/Models/UserSNSModel.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Entities\UserSNSEntity;
|
||||
|
||||
class UserSNSModel extends CommonModel
|
||||
{
|
||||
protected $table = 'user_sns';
|
||||
// protected $primaryKey = 'uid';
|
||||
protected $useAutoIncrement = false;
|
||||
protected $allowedFields = ['uid', 'user_uid', 'site', 'name', 'email', 'status', 'updated_at', 'created_at'];
|
||||
protected $validationRules = [
|
||||
'uid' => 'if_exist|min_length[4]|max_length[250]',
|
||||
'user_uid' => 'if_exist|numeric',
|
||||
'site' => 'if_exist|min_length[4]',
|
||||
'name' => 'if_exist|min_length[2]|max_length[20]',
|
||||
'email' => 'if_exist|valid_email',
|
||||
'status' => 'if_exist|in_list[use,unuse,standby]',
|
||||
'updated_at' => 'if_exist|valid_date',
|
||||
'created_at' => 'if_exist|valid_date',
|
||||
];
|
||||
|
||||
public function getEntityByField($field, $value): ?UserSNSEntity
|
||||
{
|
||||
return $this->asObject(UserSNSEntity::class)->where($field, $value)->first();
|
||||
}
|
||||
public function getEntity(int $uid): ?UserSNSEntity
|
||||
{
|
||||
return $this->getEntityByField($this->primaryKey, $uid);
|
||||
}
|
||||
public function create(array $datas): UserSNSEntity
|
||||
{
|
||||
$entity = new UserSNSEntity();
|
||||
$entity->uid = $datas['id'];
|
||||
$entity->site = $this->getSiteName();
|
||||
$entity->name = $datas['name'];
|
||||
$entity->email = $datas['email'];
|
||||
$entity->status = "standby";
|
||||
return $this->create_CommonTrait($entity, $datas);
|
||||
}
|
||||
public function modify(UserSNSEntity $entity, array $datas): UserSNSEntity
|
||||
{
|
||||
return $this->modify_CommonTrait($entity, $datas);
|
||||
}
|
||||
|
||||
//Index관련
|
||||
public function setIndexWordFilter(string $word)
|
||||
{
|
||||
parent::setIndexWordFilter($word);
|
||||
$this->orLike('name', $word, 'both');
|
||||
$this->orLike('email', $word, 'both'); //befor , after , both
|
||||
}
|
||||
public function setIndexOrderBy($field, $order = 'ASC')
|
||||
{
|
||||
$this->orderBy("name", "ASC");
|
||||
parent::setIndexOrderBy($field, $order);
|
||||
}
|
||||
}
|
||||
0
app/ThirdParty/.gitkeep
vendored
Normal file
0
app/ThirdParty/.gitkeep
vendored
Normal file
17
app/Views/admin/hpilo/console_applet.php
Normal file
17
app/Views/admin/hpilo/console_applet.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<jnlp spec="1.0+" codebase="https://27.125.207.60:40021/" href="">
|
||||
<information><title>Integrated Remote Console</title>
|
||||
<vendor>HPE</vendor>
|
||||
<offline-allowed></offline-allowed>
|
||||
</information>
|
||||
<security>
|
||||
<all-permissions></all-permissions>
|
||||
</security>
|
||||
<resources>
|
||||
<j2se version="1.5+" href="http://java.sun.com/products/autodl/j2se"></j2se>
|
||||
<jar href="https://27.125.207.60:40021/html/intgapp4_232.jar" main="false"></jar>
|
||||
</resources>
|
||||
<property name="deployment.trace.level property" value="basic"></property>
|
||||
<applet-desc main-class="com.hp.ilo2.intgapp.intgapp" name="iLOJIRC" documentbase="https://27.125.207.60:40021/html/java_irc.html" width="1" height="1"><param name="RCINFO1" value="12a4c69ff9867d010cfcc816fcddbe7f"></param><param name="RCINFOLANG" value="en"></param><param name="INFO0" value="7AC3BDEBC9AC64E85734454B53BB73CE"></param><param name="INFO1" value="17988"></param><param name="INFO2" value="composite"></param></applet-desc>
|
||||
<update check="background"></update>
|
||||
</jnlp>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user