cfmgrv3 init...1

This commit is contained in:
최준흠 2023-06-19 13:06:49 +09:00
parent 17c74db221
commit e6665d0305
1186 changed files with 13939 additions and 1 deletions

130
.gitignore vendored Normal file
View File

@ -0,0 +1,130 @@
#-------------------------
# 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
#-------------------------
# 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
View 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.

View File

@ -1,2 +1,66 @@
# cfmgrv3
#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
View 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
View File

@ -0,0 +1,15 @@
<?php
/**
* The goal of this file is to allow developers a location
* where they can overwrite core procedural functions and
* replace them with their own. This file is loaded during
* the bootstrap process and is called during the framework's
* execution.
*
* This can be looked at as a `master helper` file that is
* loaded early on, and may also contain additional functions
* that you'd like to use throughout your entire application
*
* @see: https://codeigniter4.github.io/CodeIgniter4/
*/

450
app/Config/App.php Normal file
View 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
View 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 = [];
}

View 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);

View 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);

View 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);

View 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
View 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,
];
}

177
app/Config/Constants.php Normal file
View File

@ -0,0 +1,177 @@
<?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 관련
defined('ISLOGIN') || define('ISLOGIN', "isLoggedIn");
defined('RETURN_URL') || define('RETURN_URL', "return_url");
//Default 정의
defined('DEFAULT_ROLE') || define('DEFAULT_ROLE', 'user');
defined('DEFAULT_STATUS') || define('DEFAULT_STATUS', 'use');
defined('DEFAULT_EMPTY') || define('DEFAULT_EMPTY', '');
defined('DEFAULT_PERPAGE') || define('DEFAULT_PERPAGE', 20);
defined('Excel_FilePath') || define('Excel_FilePath', "../writable/Excel");
if (!is_dir(Excel_FilePath)) {
mkdir(Excel_FilePath, 0640);
}
//Cloudflare CLI MAX_PER_PAGE정의
defined('CF_REQUEST_MAX') || define('CF_REQUEST_MAX', 1000);
defined('CF_REQUEST_WAITTIME') || define('CF_REQUEST_WAITTIME', 60); //Default 60
defined('CF_ADAPTER_PERPAGE_MAX') || define('CF_ADAPTER_PERPAGE_MAX', 700); //Default 700
defined('CF_DEFAULT_RELOADING_OPTIONS') || define('CF_DEFAULT_RELOADING_OPTIONS', ['page_limit' => 0, 'child' => 'off', 'cfsetting' => 'off']);
defined('CF_DEFAULT_HOSTS') || define('CF_DEFAULT_HOSTS', ['@', '*', 'm', 'www']);
defined('CF_FilePath') || define('CF_FilePath', "../writable/Cloudflare");
if (!is_dir(CF_FilePath)) {
mkdir(CF_FilePath);
}
//Upload , Download 관려
define('FILES', [
'UPLOADS' => ['mode' => 0600, 'path' => 'uploads'],
'DOWNLOADS' => ['mode' => 0600, 'path' => 'downloads'],
]);
//아이콘 및 Sound관련
//'EXCEL' => '<i class="fa fa-file-excel-o" aria-hidden="true"></i>',
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>',
'AUDIO_Alram_GetEmail' => '<object width=0 height=0 data="/sound/jarvis_email.mp3" type="audio/mpeg"></object>'
]);

View 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
View 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
View 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
View File

@ -0,0 +1,43 @@
<?php
namespace Config;
class DocTypes
{
/**
* List of valid document types.
*
* @var array<string, string>
*/
public array $list = [
'xhtml11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">',
'xhtml1-strict' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">',
'xhtml1-trans' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
'xhtml1-frame' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">',
'xhtml-basic11' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">',
'html5' => '<!DOCTYPE html>',
'html4-strict' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">',
'html4-trans' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
'html4-frame' => '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">',
'mathml1' => '<!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd">',
'mathml2' => '<!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">',
'svg10' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">',
'svg11' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">',
'svg11-basic' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd">',
'svg11-tiny' => '<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">',
'xhtml-math-svg-xh' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-math-svg-sh' => '<!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">',
'xhtml-rdfa-1' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">',
'xhtml-rdfa-2' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">',
];
/**
* Whether to remove the solidus (`/`) character for void HTML elements (e.g. `<input>`)
* for HTML5 compatibility.
*
* Set to:
* `true` - to be HTML5 compatible
* `false` - to be XHTML compatible
*/
public bool $html5 = true;
}

117
app/Config/Email.php Normal file
View 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
View 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
View 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
View 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
View 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
View 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 dont 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 = [];
}

View 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
View 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
View 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
View File

@ -0,0 +1,42 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
class Honeypot extends BaseConfig
{
/**
* Makes Honeypot visible or not to human
*/
public bool $hidden = true;
/**
* Honeypot Label Content
*/
public string $label = 'Fill This Field';
/**
* Honeypot Field Name
*/
public string $name = 'honeypot';
/**
* Honeypot HTML Template
*/
public string $template = '<label>{label}</label><input type="text" name="{name}" value="">';
/**
* Honeypot container
*
* If you enabled CSP, you can remove `style="display:none"`.
*/
public string $container = '<div style="display:none">{template}</div>';
/**
* The id attribute for Honeypot container tag
*
* Used when CSP is enabled.
*/
public string $containerId = 'hpc';
}

31
app/Config/Images.php Normal file
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View File

@ -0,0 +1,28 @@
<?php
namespace Config;
use CodeIgniter\Config\Publisher as BasePublisher;
/**
* Publisher Configuration
*
* Defines basic security restrictions for the Publisher class
* to prevent abuse by injecting malicious files into a project.
*/
class Publisher extends BasePublisher
{
/**
* A list of allowed destinations with a (pseudo-)regex
* of allowed files for each destination.
* Attempts to publish to directories not in this list will
* result in a PublisherException. Files that do no fit the
* pattern will cause copy/merge to fail.
*
* @var array<string,string>
*/
public $restrictions = [
ROOTPATH => '*',
FCPATH => '#\.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i',
];
}

144
app/Config/Routes.php Normal file
View File

@ -0,0 +1,144 @@
<?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');
$routes->get('/logout', 'Common\AuthController::logout');
$routes->group('cli', ['namespace' => 'App\Controllers\CLI\Cloudflare'], function ($routes) {
$routes->cli('cloudflare/auth', 'Auth::execute');
$routes->cli('cloudflare/account/(:any)', 'Account::execute/$1');
$routes->cli('cloudflare/zone/record/(:any)', 'Zone::record/$1');
$routes->cli('cloudflare/zone/firewall/(:any)', 'Zone::firewall/$1');
});
$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('cloudflare/auth', ['namespace' => 'App\Controllers\Admin\Cloudflare', 'filter' => 'authFilter:master,director,cloudflare'], static function ($routes) {
$routes->get('', 'AuthController::index');
$routes->get('excel', 'AuthController::excel');
$routes->get('insert', 'AuthController::insert_form');
$routes->post('insert', 'AuthController::insert');
$routes->get('update/(:num)', 'AuthController::update_form/$1');
$routes->post('update/(:num)', 'AuthController::update/$1');
$routes->get('view/(:num)', 'AuthController::view/$1');
$routes->get('delete/(:num)', 'AuthController::delete/$1');
$routes->get('toggle/(:num)/(:hash)', 'AuthController::toggle/$1/$2');
$routes->post('batchjob', 'AuthController::batchjob', ['filter' => 'authFilter:master,director,cloudflare']);
$routes->get('reload/(:num)', 'AuthController::reload/$1');
});
$routes->group('cloudflare/account', ['namespace' => 'App\Controllers\Admin\Cloudflare', 'filter' => 'authFilter:master,director,cloudflare'], static function ($routes) {
$routes->get('', 'AccountController::index');
$routes->get('excel', 'AccountController::excel');
$routes->get('selectkey', 'AccountController::selectkey');
$routes->get('reload/(:hash)', 'AccountController::reload/$1');
});
$routes->group('cloudflare/zone', ['namespace' => 'App\Controllers\Admin\Cloudflare'], static function ($routes) {
$routes->get('', 'ZoneController::index');
$routes->post('insert', 'ZoneController::insert');
$routes->get('excel', 'ZoneController::excel');
$routes->get('delete/(:hash)', 'ZoneController::delete/$1');
$routes->get('toggle/(:hash)/(:any)', 'ZoneController::toggle/$1/$2');
$routes->post('batchjob', 'ZoneController::batchjob', ['filter' => 'authFilter:master,director,cloudflare']);
$routes->post('batchjob_delete', 'ZoneController::batchjob_delete', ['filter' => 'authFilter:master,director,cloudflare']);
$routes->get('sync/(:hash)', 'ZoneController::sync/$1');
$routes->get('reload/(:hash)', 'ZoneController::reload/$1');
});
$routes->group('cloudflare/record', ['namespace' => 'App\Controllers\Admin\Cloudflare'], static function ($routes) {
$routes->get('', 'RecordController::index');
$routes->post('insert', 'RecordController::insert');
$routes->get('excel', 'RecordController::excel');
$routes->get('delete/(:hash)', 'RecordController::delete/$1');
$routes->get('toggle/(:hash)/(:hash)', 'RecordController::toggle/$1/$2');
$routes->post('batchjob', 'RecordController::batchjob', ['filter' => 'authFilter:master,director,cloudflare']);
$routes->get('sync/(:hash)', 'RecordController::sync/$1');
$routes->get('cdnToggle/(:hash)', 'RecordController::cdnToggle/$1');
});
$routes->group('cloudflare/firewall', ['namespace' => 'App\Controllers\Admin\Cloudflare'], static function ($routes) {
$routes->get('', 'FirewallController::index');
$routes->get('excel', 'FirewallController::excel');
$routes->get('toggle/(:hash)/(:hash)', 'FirewallController::toggle/$1/$2');
$routes->get('sync/(:hash)', 'FirewallController::sync/$1');
$routes->get('reload/(:hash)/(:any)', 'FirewallController::reload/$1/$2');
});
$routes->group('mapurl', static function ($routes) {
$routes->get('', 'MapurlController::index');
$routes->get('excel', 'MapurlController::excel');
$routes->get('insert', 'MapurlController::insert_form');
$routes->post('insert', 'MapurlController::insert');
$routes->get('update/(:num)', 'MapurlController::update_form/$1');
$routes->post('update/(:num)', 'MapurlController::update/$1');
$routes->get('view/(:num)', 'MapurlController::view/$1');
$routes->get('delete/(:num)', 'MapurlController::delete/$1');
$routes->get('toggle/(:num)/(:hash)', 'MapurlController::toggle/$1/$2');
$routes->post('batchjob', 'MapurlController::batchjob');
});
$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('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']);
});
});
/*
* --------------------------------------------------------------------
* 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
View 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
View File

@ -0,0 +1,32 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseService;
/**
* Services Configuration file.
*
* Services are simply other classes/libraries that the system uses
* to do its job. This is used by CodeIgniter to allow the core of the
* framework to be swapped out easily without affecting the usage within
* the rest of your application.
*
* This file holds any application-specific services, or service overrides
* that you might need. An example has been included with the general
* method format you should use for your service methods. For more examples,
* see the core Services file at system/Config/Services.php.
*/
class Services extends BaseService
{
/*
* public static function example($getShared = true)
* {
* if ($getShared) {
* return static::getSharedInstance('example');
* }
*
* return new \CodeIgniter\Example();
* }
*/
}

102
app/Config/Session.php Normal file
View 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
View 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
View 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
View File

@ -0,0 +1,44 @@
<?php
namespace Config;
use CodeIgniter\Config\BaseConfig;
use CodeIgniter\Validation\StrictRules\CreditCardRules;
use CodeIgniter\Validation\StrictRules\FileRules;
use CodeIgniter\Validation\StrictRules\FormatRules;
use CodeIgniter\Validation\StrictRules\Rules;
class Validation extends BaseConfig
{
// --------------------------------------------------------------------
// Setup
// --------------------------------------------------------------------
/**
* Stores the classes that contain the
* rules that are available.
*
* @var 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
View 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 = [];
}

View File

@ -0,0 +1,18 @@
<?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->_viewPath = $this->_viewPath.'/admin';
$this->_viewDatas['layout'] = LAYOUTS['admin'];
$this->_viewDatas['title'] = "관리자페이지";
}
}

View File

@ -0,0 +1,66 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Models\Cloudflare\AccountModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class AccountController extends CloudflareController
{
private $_auth_uids = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = $this->_className . '/Account';
$this->_model = new AccountModel();
$this->_defines = [
'index' => [
'fields' => ['auth_uid', 'title', 'type', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['auth_uid', 'type', 'status'],
'batchjobFilters' => [],
],
'excel' => [
'fields' => ['auth_uid', 'title', 'type', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['auth_uid', 'type', 'status'],
],
];
helper('Cloudflare/Account');
$this->_viewPath = $this->_viewPath . '/account';
$this->_viewDatas['title'] = lang($this->_className . '.title');
}
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
case 'auth_uid':
if (is_null($this->_auth_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_auth_uids = [DEFAULT_EMPTY => lang($this->_className . '.label.' . $field) . ' 선택'];
foreach ($this->getAuthModel()->where('status', 'use')->orderBy('id', 'asc')->findAll() as $auth) {
$this->_auth_uids[$auth['uid']] = $auth['id'];
}
}
return $this->_auth_uids;
break;
default:
return parent::getFieldFormOption($field);
break;
}
}
//Reload관련
final public function reload($uid)
{
try {
$entity = $this->_model->getEntity($uid);
$zoneApi = new \App\Libraries\Cloudflare\API\Zone($entity);
$zoneApi->reload();
return alert_CommonHelper("{$this->_viewDatas['title']} " . __FUNCTION__ . " 완료하였습니다.", session()->get(RETURN_URL));
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), 'back');
}
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Models\Cloudflare\AuthModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class AuthController extends CloudflareController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = $this->_className . '/Auth';
$this->_model = new AuthModel();
$this->_defines = [
'insert' => [
'fields' => ['id', 'authkey', 'status'],
'fieldFilters' => ['status'],
'fieldRules' => [
'id' => 'required|valid_email|is_unique[auth.id]',
'authkey' => 'required|min_length[10]|max_length[200]',
'status' => 'required|in_list[use,unuse]',
],
],
'update' => [
'fields' => ['id', 'authkey', 'status'],
'fieldFilters' => ['status'],
'fieldRules' => [
'id' => 'required|valid_email',
'authkey' => 'required|min_length[10]|max_length[200]',
'status' => 'required|in_list[use,unuse]',
],
],
'view' => [
'fields' => ['id', 'authkey', 'oldkey', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['status'],
'fieldRules' => [],
],
'index' => [
'fields' => ['id', 'oldkey', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['status'],
'batchjobFilters' => ['status'],
],
'excel' => [
'fields' => ['id', 'oldkey', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['status'],
],
];
helper('Cloudflare/Auth');
$this->_viewPath = $this->_viewPath . '/auth';
$this->_viewDatas['title'] = lang($this->_className . '.title');
}
//Insert관련
protected function insert_process()
{
//oldkey임시생성
$this->_viewDatas['fieldDatas']['oldkey'] = uniqid();
return parent::insert_process();
}
//Update관련
protected function update_process($entity)
{
//기존 AuthKey를 OldKey로 백업
$entity->oldkey = $entity->authkey;
//Auth에 속해있는 Account의 상태 Syn작업
$this->getAccountModel()->setStatusByAuth($entity->getPrimaryKey(), $this->_viewDatas['fieldDatas']['status']);
return parent::update_process($entity);
}
//Toggle 관련
protected function toggle_process($entity)
{
//Auth에 속해있는 Account의 상태 Syn작업
$this->getAccountModel()->setStatusByAuth($entity->getPrimaryKey(), $this->_viewDatas['fieldDatas']['status']);
return parent::toggle_process($entity);
}
//Batchjob 관련
protected function batchjob_process($entity)
{
//Auth에 속해있는 Account의 상태 Syn작업
$this->getAccountModel()->setStatusByAuth($entity->getPrimaryKey(), $this->_viewDatas['fieldDatas']['status']);
return parent::batchjob_process($entity);
}
//Reload관련
final public function reload($uid)
{
try {
$entity = $this->_model->getEntity($uid);
$accountApi = new \App\Libraries\Cloudflare\API\Account($entity);
$accountApi->reload();
return alert_CommonHelper("{$this->_viewDatas['title']} " . __FUNCTION__ . " 완료하였습니다.", session()->get(RETURN_URL));
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), 'back');
}
}
}

View File

@ -0,0 +1,98 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Libraries\Log\Log;
use App\Models\Cloudflare\AccountModel;
use App\Models\Cloudflare\AuthModel;
use App\Models\Cloudflare\ZoneModel;
use App\Models\Cloudflare\RecordModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class CloudflareController extends \App\Controllers\Admin\AdminController
{
private $_authModel = null;
private $_accountModel = null;
private $_zoneModel = null;
private $_recordModel = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = 'Cloudflare';
$this->_viewPath = $this->_viewPath . '/cloudflare';
}
final protected function getAuthModel(): AuthModel
{
return is_null($this->_authModel) ? new AuthModel() : $this->_authModel;
}
final protected function getAccountModel(): AccountModel
{
return is_null($this->_accountModel) ? new AccountModel() : $this->_accountModel;
}
final protected function getZoneModel(): ZoneModel
{
return is_null($this->_zoneModel) ? new ZoneModel() : $this->_zoneModel;
}
final protected function getRecordModel(): RecordModel
{
return is_null($this->_recordModel) ? new RecordModel() : $this->_recordModel;
}
//Zone입력
final protected function insert_Zone(string $account_uid, string $domain): \App\Entities\Cloudflare\ZoneEntity
{
$fieldDatas = array('account_uid' => $account_uid, 'domain' => $domain);
$api = new \App\Libraries\Cloudflare\API\Zone();
$zone = $api->insert($fieldDatas);
if (!$this->getZoneModel()->save($zone)) {
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getZoneModel()->getLastQuery());
Log::add("error", implode("\n", $this->getZoneModel()->errors()));
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->getZoneModel()->errors(), true));
}
Log::add("info", "Zone: {$zone->getTitle()} 등록");
return $zone;
}
//Record입력
final protected function insert_Host(
string $zone_uid,
string $host,
string $type,
string $content,
string $proxied
): \App\Entities\Cloudflare\RecordEntity {
$fieldDatas = array('zone_uid' => $zone_uid, 'host' => $host);
$fieldDatas['type'] = $type;
$fieldDatas['content'] = $content;
$fieldDatas['proxied'] = $proxied;
$api = new \App\Libraries\Cloudflare\API\Record();
$record = $api->insert($fieldDatas);
$record->fixed = 'off'; //초기값
if (!$this->getRecordModel()->save($record)) {
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getRecordModel()->getLastQuery());
Log::add("error", implode("\n", $this->getRecordModel()->errors()));
throw new \Exception(__FUNCTION__ . " 오류 발생.\n" . var_export($this->getRecordModel()->errors(), true));
}
Log::add("info", "Host: {$record->getTitle()} 등록");
return $record;
}
//Sync관련
protected function sync_process($entity)
{
return $entity;
}
final public function sync($uid)
{
try {
$entity = $this->_model->getEntity($uid);
$entity = $this->sync_process($entity);
return alert_CommonHelper("{$this->_viewDatas['title']} " . __FUNCTION__ . " 완료하였습니다.", session()->get(RETURN_URL));
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), 'back');
}
}
}

View File

@ -0,0 +1,87 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Models\Cloudflare\FirewallModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class FirewallController extends CloudflareController
{
private $_zone_uids = null;
private $_api = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = $this->_className . '/Firewall';
$this->_model = new FirewallModel();
$this->_defines = [
'index' => [
'fields' => ['zone_uid', 'description', 'action', 'paused', 'updated_at', 'created_at'],
'fieldFilters' => ['zone_uid', 'action', 'paused'],
'batchjobFilters' => ['action', 'paused'],
],
'excel' => [
'fields' => ['zone_uid', 'description', 'action', 'paused', 'updated_at', 'created_at'],
'fieldFilters' => ['zone_uid', 'action', 'paused',],
],
];
helper('Cloudflare/Firewall');
$this->_viewPath = $this->_viewPath . '/firewall';
$this->_viewDatas['title'] = lang($this->_className . '.title');
$this->_api = new \App\Libraries\Cloudflare\API\Firewall();
}
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
case 'zone_uid':
if (is_null($this->_zone_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_zone_uids = [DEFAULT_EMPTY => lang($this->_className . '.label.' . $field) . ' 선택'];
foreach ($this->getZoneModel()->orderBy('domain', 'asc')->findAll() as $zone) {
$this->_zone_uids[$zone['uid']] = $zone['domain'];
}
}
return $this->_zone_uids;
break;
default:
return parent::getFieldFormOption($field);
break;
}
}
//Update관련
protected function update_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::update_process($entity);
}
//Toggle관련
protected function toggle_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::toggle_process($entity);
}
//Batchjob관련
protected function batchjob_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::batchjob_process($entity);
}
//Sync관련
protected function sync_process($entity)
{
$entity = $this->_api->sync($entity);
return parent::sync_process($entity);
}
//Index관련
protected function index_process()
{
$this->_model->orderBy('zone_uid', 'ASC');
$this->_model->orderBy('description', 'ASC');
return parent::index_process();
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class AllowListController extends CloudflareController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = $this->_className . '/Ddos';
$this->_model = new \App\Models\Cloudflare\Magictransit\AllowListModel();
$this->_defines = [
'index' => [
'fields' => ['account_uid', 'domain', 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'],
'feildFilters' => ['account_uid', 'development_mode', 'ipv6', 'security_level', 'status'],
],
'excel' => [
'fields' => ['account_uid', 'domain', 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'],
'feildFilters' => ['account_uid', 'development_mode', 'ipv6', 'security_level', 'status'],
],
];
helper('Cloudflare/ddos');
$this->_viewPath = $this->_viewPath . '/ddos';
$this->_viewDatas['title'] = lang($this->_className . '.title');
}
protected function getIndexFeildFilterForm(string $field, $value, array $feildFilters): string
{
switch ($field) {
default:
return getFieldForm_DdosHelper($field, $value, $this->getFeildFilterFormOptions($feildFilters));
break;
}
}
protected function getExcelFileName(): string
{
return sprintf("Ddos_%s.xlsx", date('Y-m-d_HH_mm'));
}
}

View File

@ -0,0 +1,169 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Libraries\Log\Log;
use App\Models\Cloudflare\RecordModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class RecordController extends CloudflareController
{
private $_zone_uids = null;
private $_api = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = $this->_className . '/Record';
$this->_model = new RecordModel();
$this->_defines = [
'insert' => [
'fields' => ['zone_uid', 'type', 'content', 'proxied', 'hosts'],
'fieldFilters' => [],
'fieldRules' => [
'zone_uid' => 'required|min_length[10]|max_length[200]',
'type' => 'required|in_list[A,CNAME,MX,SPF,TXT,NS,INFO]',
'content' => 'required|trim|min_length[4]',
'proxied' => 'required|string',
'hosts' => 'required|trim|string',
]
],
'index' => [
'fields' => ['zone_uid', 'host', 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'],
'fieldFilters' => ['zone_uid', 'type', 'fixed', 'proxied', 'locked'],
'batchjobFilters' => ['content', 'proxied'],
],
'excel' => [
'fields' => ['zone_uid', 'host', 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'],
'fieldFilters' => ['zone_uid', 'type', 'proxied', 'locked'],
],
];
helper('Cloudflare/Record');
$this->_viewPath = $this->_viewPath . '/record';
$this->_viewDatas['title'] = lang($this->_className . '.title');
$this->_api = new \App\Libraries\Cloudflare\API\Record();
}
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
case 'zone_uid':
if (is_null($this->_zone_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_zone_uids = [DEFAULT_EMPTY => lang($this->_className . '.label.' . $field) . ' 선택'];
foreach ($this->getZoneModel()->orderBy('domain', 'asc')->findAll() as $zone) {
$this->_zone_uids[$zone['uid']] = $zone['domain'];
}
}
return $this->_zone_uids;
break;
default:
return parent::getFieldFormOption($field);
break;
}
}
//Insert관련
protected function insert_validate()
{
parent::insert_validate();
//Content 검증 Type이 A 인경우 IP형식 검사
if ($this->_viewDatas['fieldDatas']['type'] === 'A') {
if (!isIPAddress_CommonHelper($this->_viewDatas['fieldDatas']['content'], $this->_viewDatas['fieldDatas']['type'])) {
throw new \Exception("{$this->_viewDatas['title']}{$this->_viewDatas['fieldDatas']['type']}, {$this->_viewDatas['fieldDatas']['content']} 형식 오류[사설IP 않됨]");
}
}
//Host 검증
$this->_viewDatas['fieldDatas']['hosts'] = explode("\n", $this->_viewDatas['fieldDatas']['hosts']);
$cnt = 1;
foreach ($this->_viewDatas['fieldDatas']['hosts'] as $host) {
if (!isHost_CommonHelper($host)) {
throw new \Exception("{$this->_viewDatas['title']}{$cnt}번째 {$host} 호스트명 형식 오류");
}
if (!$this->_model->isUniqueHost($this->_viewDatas['fieldDatas'][$this->_model::PARENT_FIELD], $host, $this->_viewDatas['fieldDatas']['content'])) {
throw new \Exception("{$this->_viewDatas['title']}{$cnt}번째 {$host}:{$this->_viewDatas['fieldDatas']['content']}은 이미 등록된 호스트입니다.");
}
$cnt++;
}
}
protected function insert_process()
{
foreach ($this->_viewDatas['fieldDatas']['hosts'] as $host) {
$this->insert_Host(
$this->_viewDatas['fieldDatas'][$this->_model::PARENT_FIELD],
$host,
$this->_viewDatas['fieldDatas']['type'],
$this->_viewDatas['fieldDatas']['content'],
$this->_viewDatas['fieldDatas']['proxied']
);
}
}
//Update관련
protected function update_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::update_process($entity);
}
//Toggle관련
protected function toggle_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::toggle_process($entity);
}
//Batchjob관련
protected function batchjob_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::batchjob_process($entity);
}
//Delete 관련
protected function delete_process($entity)
{
$this->_api->delete($entity);
return parent::delete_process($entity);
}
//Sync관련
protected function sync_process($entity)
{
$entity = $this->_api->sync($entity);
return parent::sync_process($entity);
}
//Index관련
protected function index_process()
{
$this->_model->orderBy('zone_uid', 'ASC');
$this->_model->orderBy('host', 'ASC');
return parent::index_process();
}
//CDN고정관련
final public function cdnToggle(string $uid)
{
try {
$entity = $this->_model->getEntity($uid);
$fixedRecordModel = new \App\Models\Cloudflare\FixedRecordModel();
if ($entity->fixed == 'on') {
$entity->fixed = "off";
$this->_model->save($entity);
$fixedRecordModel->where('host', $entity->host)->delete();
Log::add("info", "{$entity->getTitle()}의 fixed : on=>off");
} else {
$entity->fixed = "on";
$this->_model->save($entity);
//throw new \Exception($entity);
$fixedRecordModel->insert(['host' => $entity->host]);
Log::add("info", "{$entity->getTitle()}의 fixed : off=>on");
}
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
Log::save("{$this->_viewDatas['title']} {$message}");
return alert_CommonHelper($message, session()->get(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');
}
}
}

View File

@ -0,0 +1,192 @@
<?php
namespace App\Controllers\Admin\Cloudflare;
use App\Libraries\Log\Log;
use App\Models\Cloudflare\ZoneModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class ZoneController extends CloudflareController
{
private $_account_uids = null;
private $_api = null;
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = $this->_className . '/Zone';
$this->_model = new ZoneModel();
$this->_defines = [
'insert' => [
'fields' => ['account_uid', 'type', 'content', 'domains', 'proxied'],
'fieldFilters' => [],
'fieldRules' => [
'account_uid' => 'required|min_length[10]|max_length[200]',
'type' => 'required|in_list[A,CNAME,MX,SPF,TXT,NS,INFO]',
'content' => 'required|trim|min_length[4]',
'domains' => 'required|trim|min_length[4]',
'proxied' => 'required|string',
]
],
'index' => [
'fields' => ['account_uid', 'domain', 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['account_uid', 'development_mode', 'ipv6', 'security_level', 'status'],
'batchjobFilters' => ['development_mode', 'ipv6', 'security_level'],
],
'excel' => [
'fields' => ['account_uid', 'domain', 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['account_uid', 'development_mode', 'ipv6', 'security_level', 'status'],
],
];
helper('Cloudflare/Zone');
$this->_viewPath = $this->_viewPath . '/zone';
$this->_viewDatas['title'] = lang($this->_className . '.title');
$this->_api = new \App\Libraries\Cloudflare\API\Zone();
}
//Field별 Form Option용
protected function getFieldFormOption(string $field): array
{
switch ($field) {
case 'account_uid':
if (is_null($this->_account_uids)) {
//모든 필요한 FormOption등 조기화작업 필요
$this->_account_uids = [DEFAULT_EMPTY => lang($this->_className . '.label.' . $field) . ' 선택'];
foreach ($this->getAccountModel()->where('status', 'use')->orderBy('title', 'asc')->findAll() as $account) {
$this->_account_uids[$account['uid']] = $account['title'];
}
}
return $this->_account_uids;
break;
default:
return parent::getFieldFormOption($field);
break;
}
}
//Insert관련
protected function insert_validate()
{
parent::insert_validate();
//Content 검증 Type이 A 인경우 IP형식 검사
if ($this->_viewDatas['fieldDatas']['type'] === 'A') {
if (!isIPAddress_CommonHelper($this->_viewDatas['fieldDatas']['content'], $this->_viewDatas['fieldDatas']['type'])) {
throw new \Exception("{$this->_viewDatas['title']}{$this->_viewDatas['fieldDatas']['type']}, {$this->_viewDatas['fieldDatas']['content']} 형식 오류[사설IP 않됨]");
}
}
//Domain검증
$this->_viewDatas['fieldDatas']['domains'] = explode("\n", $this->_viewDatas['fieldDatas']['domains']);
$cnt = 1;
foreach ($this->_viewDatas['fieldDatas']['domains'] as $domain) {
if (!isDomain_CommonHelper($domain)) {
throw new \Exception("{$this->_viewDatas['title']}{$cnt}번째 {$domain} 형식 오류");
}
if (!$this->_model->isUniqueDomain($this->_viewDatas['fieldDatas'][$this->_model::PARENT_FIELD], $domain)) {
throw new \Exception("{$this->_viewDatas['title']}{$cnt}번째 {$domain}은 이미 등록된 도메인입니다.");
}
$cnt++;
}
//Host검증
$this->_viewDatas['fieldDatas']['hosts'] = $this->request->getVar('hosts');
if (!is_array($this->_viewDatas['fieldDatas']['hosts']) || count($this->_viewDatas['fieldDatas']['hosts']) === 0) {
throw new \Exception($this->_viewDatas['title'] . '가 호스트명이 선택되지 않았습니다.');
}
$cnt = 1;
foreach ($this->_viewDatas['fieldDatas']['hosts'] as $host) {
if (!isHost_CommonHelper($host)) {
throw new \Exception("{$this->_viewDatas['title']}{$cnt}번째 {$host} 호스트명 형식 오류");
}
$cnt++;
}
}
protected function insert_process()
{
foreach ($this->_viewDatas['fieldDatas']['domains'] as $domain) {
$zone = $this->insert_Zone($this->_viewDatas['fieldDatas'][$this->_model::PARENT_FIELD], $domain);
foreach ($this->_viewDatas['fieldDatas']['hosts'] as $host) {
$this->insert_Host(
$zone->getPrimaryKey(),
$host,
$this->_viewDatas['fieldDatas']['type'],
$this->_viewDatas['fieldDatas']['content'],
$this->_viewDatas['fieldDatas']['proxied']
);
}
}
}
//Update관련
protected function update_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::update_process($entity);
}
//Toggle관련
protected function toggle_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::toggle_process($entity);
}
//Batchjob관련
protected function batchjob_process($entity)
{
$entity = $this->_api->update($entity, $this->_viewDatas['fieldDatas']);
return parent::batchjob_process($entity);
}
//Delete 관련
protected function delete_process($entity)
{
$this->_api->delete($entity);
return parent::delete_process($entity);
}
//Sync관련
protected function sync_process($entity)
{
$entity = $this->_api->sync($entity);
return parent::sync_process($entity);
}
//Index관련
protected function index_process()
{
$this->_model->orderBy('account_uid', 'ASC');
$this->_model->orderBy('domain', 'ASC');
return parent::index_process();
}
//Reload관련
final public function reload($uid)
{
try {
$entity = $this->_model->getEntity($uid);
$recordApi = new \App\Libraries\Cloudflare\API\Record($entity);
$recordApi->reload();
//Firewall Reload
// $firewallApi = new \App\Libraries\Cloudflare\API\Firewall($entity);
// $firewallApi->reload();
return alert_CommonHelper("{$this->_viewDatas['title']} " . __FUNCTION__ . " 완료하였습니다.", session()->get(RETURN_URL));
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), 'back');
}
}
//일괄삭제관련
final public function batchjob_delete()
{
$message = "";
try {
$uids = $this->request->getVar('batchjob_uids');
if (!is_array($uids) || count($uids) === 0) {
throw new \Exception($this->_viewDatas['title'] . '가 uid가 선택되지 않았습니다.');
}
foreach ($uids as $uid) {
$this->delete_process($this->_model->getEntity($uid));
}
$message = "총:" . count($uids) . "개의 삭제 완료하였습니다.";
Log::save("{$this->_viewDatas['title']} {$message}");
return alert_CommonHelper($message, session()->get(RETURN_URL));
} catch (\Exception $e) {
$message = "삭제 실패하였습니다.";
Log::add("warning", $message . "\n" . $e->getMessage());
Log::save("{$this->_viewDatas['title']} {$message}", false);
return alert_CommonHelper($message . "\n" . $e->getMessage(), 'back');
}
}
}

View 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);
}
}

View File

@ -0,0 +1,67 @@
<?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('Logger');
$this->_viewPath = $this->_viewPath . '/logger';
$this->_viewDatas['title'] = lang($this->_className . '.title');
//모든 필요한 FormOption등 조기화작업 필요
}
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 = [DEFAULT_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;
}
}
}

View File

@ -0,0 +1,121 @@
<?php
namespace App\Controllers\Admin;
use App\Models\MapurlModel;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class MapurlController extends \App\Controllers\Admin\AdminController
{
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
parent::initController($request, $response, $logger);
$this->_className = 'Mapurl';
$this->_model = new MapurlModel();
$this->_defines = [
'insert' => [
'fields' => ['oldurl', 'newurl', 'status'],
'fieldFilters' => ['status'],
'fieldRules' => [
'oldurl' => 'required|valid_url_strict|is_unique[mapurl.oldurl]',
'newurl' => 'required|valid_url_strict',
'status' => 'required|in_list[use,unuse]',
]
],
'update' => [
'fields' => ['oldurl', 'newurl', 'status'],
'fieldFilters' => ['status'],
'fieldRules' => [
'oldurl' => 'required|valid_url_strict',
'newurl' => 'required|valid_url_strict',
'status' => 'required|in_list[use,unuse]',
]
],
'view' => [
'fields' => ['oldurl', 'newurl', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['status'],
'fieldRules' => [],
],
'index' => [
'fields' => ['oldurl', 'newurl', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['status'],
'batchjobFilters' => ['newurl', 'status'],
],
'excel' => [
'fields' => ['oldurl', 'newurl', 'status', 'updated_at', 'created_at'],
'fieldFilters' => ['status'],
],
];
helper('Mapurl');
$this->_viewPath = $this->_viewPath . '/mapurl';
$this->_viewDatas['title'] = lang($this->_className . '.title');
//모든 필요한 FormOption등 조기화작업 필요
}
private function remapurl()
{
//모든 필요한 FormOption등 조기화작업 필요
$rows = $this->_model->where('status', 'use')->orderBy('oldurl', 'asc')->findAll();
//html의 case문 설정
$urls = array("");
foreach ($rows as $row) {
$temp_oldurl = sprintf("case '%s':", trim($row['oldurl']));
//한글을 포함하고 있는지 체크
if (preg_match("/[\xE0-\xFF][\x80-\xFF][\x80-\xFF]/", $row['oldurl'])) {
//도메인 URL 분리
preg_match("/^(https?:\/\/)(.*)/", $row['oldurl'], $matches);
$temp_oldurl = sprintf("case '%s%s':\ncase '%s':", $matches[1], idn_to_ascii($matches[2]), trim($row['oldurl']));
}
array_push($urls, sprintf("\t\t\t%s\n \t\t\twindow.location.href='%s';\n \t\tbreak;", $temp_oldurl, trim($row['newurl'])));
}
$remapPage = view($this->_viewPath . '/' . __FUNCTION__, array("urls" => $urls));
//디렉토리 생성 여부 확인
$path = 'mapurl';
if (!is_dir($path)) {
mkdir($path, 0755, true);
}
//htmlBuild용
if (!file_put_contents($path . '/index.html', $remapPage)) {
throw new \Exception(__FUNCTION__ . "에서 " . $path . "/index.html Write 실패");
}
}
//Insert관련
protected function insert_process()
{
parent::insert_process();
$this->remapurl(); //MapURL용 index.html 생성
}
//Update관련
protected function update_process($entity)
{
$entity = parent::update_process($entity);
$this->remapurl(); //MapURL용 index.html 생성
return $entity;
}
//Toggle관련
protected function toggle_process($entity)
{
$entity = parent::toggle_process($entity);
$this->remapurl(); //MapURL용 index.html 생성
return $entity;
}
//Batchjob관련
protected function batchjob_process($entity)
{
$entity = parent::batchjob_process($entity);
$this->remapurl(); //MapURL용 index.html 생성
return $entity;
}
//Delete관련
protected function delete_process($entity)
{
$entity = parent::delete_process($entity);
$this->remapurl(); //MapURL용 index.html 생성
}
}

View File

@ -0,0 +1,75 @@
<?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[150]',
'name' => 'required|min_length[2]|max_length[20]',
'email' => 'required|valid_email',
'role' => 'required|in_list[member,manager,cloudflare,director,master]',
'status' => 'required|in_list[use,unuse]',
]
],
'update' => [
'fields' => ['passwd', 'name', 'email', 'role', 'status'],
'fieldFilters' => ['role', 'status'],
'fieldRules' => [
'passwd' => 'required|trim|min_length[4]|max_length[150]',
'name' => 'required|min_length[2]|max_length[20]',
'email' => 'required|valid_email',
'role' => 'required|in_list[member,manager,cloudflare,director,master]',
'status' => 'required|in_list[use,unuse]',
]
],
'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('User');
$this->_viewPath = $this->_viewPath . '/user';
$this->_viewDatas['title'] = lang($this->_className . '.title');
}
//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);
}
}

View 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();
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace App\Controllers\CLI\Cloudflare;
use App\Entities\Cloudflare\AccountEntity;
class Account extends Cloudflare
{
private function getAccounts(int $auth_uid): array
{
if ($auth_uid) {
$entitys = $this->getAccountModel()->asObject(AccountEntity::class)
->where(['status' => 'use', 'auth_uid' => $auth_uid])
->findAll();
} else {
$entitys = $this->getAccountModel()->asObject(AccountEntity::class)
->where('status', 'use')
->findAll();
}
echo __FUNCTION__ . "에서 호출:" . $this->getAccountModel()->getLastQuery();
return $entitys;
}
final public function execute($page_limit = 0, int $auth_uid = 0)
{
try {
//transation처리
// $this->getAccountModel()->db->transBegin();
//Zone 처리
foreach ($this->getAccounts($auth_uid) as $entity) {
$api = new \App\Libraries\Cloudflare\API\Zone($entity, true);
$api->reload((int)$page_limit);
}
//transation 완료
// $this->getAccountModel()->db->transCommit();
echo __METHOD__ . "에서 Zone Reload 완료";
} catch (\Exception $e) {
// transaction 오류복구
// $this->getAccountModel()->db->transRollback();
$message = __METHOD__ . "에서 Zone Reload 오류\n" . $e->getMessage();
log_message("error", $message);
echo $message;
}
}
}

View File

@ -0,0 +1,30 @@
<?php
namespace App\Controllers\CLI\Cloudflare;
use App\Entities\Cloudflare\AuthEntity;
class Auth extends Cloudflare
{
final public function execute()
{
try {
$entitys = $this->getAuthModel()->asObject(AuthEntity::class)->where(['status' => 'use'])->findAll();
//transation처리
// $this->getAuthModel()->db->transBegin();
foreach ($entitys as $entity) {
$api = new \App\Libraries\Cloudflare\API\Account($entity);
$api->reload();
}
//transation 완료
// $this->getAuthModel()->db->transCommit();
echo __METHOD__ . "에서 Account Reload 완료";
} catch (\Exception $e) {
//transaction 오류복구
// $this->getAuthModel()->db->transRollback();
$message = __METHOD__ . "에서 Account Reload 오류\n" . $e->getMessage();
log_message("error", $message);
echo $message;
}
}
}

View File

@ -0,0 +1,34 @@
<?php
namespace App\Controllers\CLI\Cloudflare;
use App\Controllers\BaseController;
use App\Models\Cloudflare\AuthModel;
use App\Models\Cloudflare\AccountModel;
use App\Models\Cloudflare\ZoneModel;
use App\Models\Cloudflare\RecordModel;
class Cloudflare extends BaseController
{
private $_authModel = null;
private $_accountModel = null;
private $_zoneModel = null;
private $_recordModel = null;
final protected function getAuthModel()
{
return is_null($this->_authModel) ? new AuthModel() : $this->_authModel;
}
final protected function getAccountModel()
{
return is_null($this->_accountModel) ? new AccountModel() : $this->_accountModel;
}
final protected function getZoneModel()
{
return is_null($this->_zoneModel) ? new ZoneModel() : $this->_zoneModel;
}
final protected function getRecordModel()
{
return is_null($this->_recordModel) ? new RecordModel() : $this->_recordModel;
}
}

View File

@ -0,0 +1,60 @@
<?php
namespace App\Controllers\CLI;
use App\Libraries\Cloudflare\Adapters\DdosAdapter;
use App\Libraries\Cloudflare\DdosLibrary;
use App\Libraries\Cloudflare\CloudflareLibrary;
use App\Models\Cloudflare\AccountModel;
use App\Entities\Cloudflare\AccountEntity;
use CodeIgniter\Controller;
class Cloudflare extends Controller
{
public function __constract(){}
final protected function getAuthKey(AccountEntity $account)
{
return new \Cloudflare\API\Auth\APIKey($account->id,$account->authkey);
}
public function executeddos(string $account_uid,int $page_limit=0){
try {
$accountModel = new AccountModel();
$account = $accountModel->getEntity($account_uid);
if(is_null($account)){
echo __FUNCTION__." 해당하는 정보가 없습니다.";
return false;
}
$adapter = new DdosAdapter($this->getAuthKey($account));
$library = new DdosLibrary($adapter);
$datas = $library->reload($page_limit);
echo var_export($datas,true);
CloudflareLibrary::save_logs("Cloudflare 전체 DDOS Reloading 작업 완료");
echo "완료";
} catch(\Exception $e) {
CloudflareLibrary::save_logs("Cloudflare 전체 DDOS Reloading 작업 오류\n".$e->getMessage());
echo "오류\n".$e->getMessage();
}
}
//전체 가져오기
public function execute(int $page_limit=0)
{
try {
CloudflareLibrary::add_logs("notice","Cloudflare 전체 Reloading 작업 시작");
//해당 Account별 Zone처리용
$accountModel = new AccountModel();
$accounts = $accountModel->asObject(AccountEntity::class)->where('status','use')->findAll();
foreach($accounts as $account){
$this->executezone($account->uid);
}
CloudflareLibrary::save_logs("Cloudflare 전체 Reloading 작업 완료");
echo "완료";
} catch(\Exception $e) {
CloudflareLibrary::save_logs("Cloudflare 전체 Reloading 작업 오류\n".$e->getMessage());
echo "오류\n".$e->getMessage();
}
}
}

View File

@ -0,0 +1,71 @@
<?php
namespace App\Controllers\CLI\Cloudflare;
use App\Entities\Cloudflare\ZoneEntity;
use App\Libraries\Log\Log;
class Zone extends Cloudflare
{
private function getZones(string $account_uid): array
{
if ($account_uid) {
$entitys = $this->getZoneModel()->asObject(ZoneEntity::class)
->where(['status' => 'active', 'account_uid' => $account_uid])
->findAll();
} else {
$entitys = $this->getZoneModel()->asObject(ZoneEntity::class)
->where('status', 'active')
->findAll();
}
Log::add("error", __FUNCTION__ . "에서 호출:" . $this->getZoneModel()->getLastQuery());
return $entitys;
}
final public function record(int $page_limit = 0, string $account_uid = '')
{
try {
//transation처리
// $this->getZoneModel()->db->transBegin();
//Record
echo __METHOD__ . "에서 Record Reload 시작\n";
foreach ($this->getZones($account_uid) as $entity) {
$api = new \App\Libraries\Cloudflare\API\Record($entity);
$api->reload((int)$page_limit);
}
//CDN값 수정 못하는 고정 Record 처리
$fixedRecordModel = new \App\Models\Cloudflare\FixedRecordModel();
$this->getRecordModel()->setFixedCDNRecord($fixedRecordModel->findColumn("host"));
echo __METHOD__ . "에서 Record Reload 완료\n";
//transation 완료
// $this->getZoneModel()->db->transCommit();
} catch (\Exception $e) {
//transaction 오류복구
// $this->getZoneModel()->db->transRollback();
$message = __METHOD__ . "에서 Record Reload 오류\n" . $e->getMessage();
log_message("error", $message);
echo $message;
}
}
final public function firewall(int $page_limit = 0, string $account_uid = '')
{
try {
//transation처리
// $this->getZoneModel()->db->transBegin();
//Firewall
echo __METHOD__ . "에서 Firewall Reload 시작\n";
foreach ($this->getZones($account_uid) as $entity) {
$api = new \App\Libraries\Cloudflare\API\Firewall($entity);
$api->reload((int)$page_limit);
}
echo __METHOD__ . "에서 Firewall Reload 완료\n";
//transation 완료
// $this->getZoneModel()->db->transCommit();
} catch (\Exception $e) {
//transaction 오류복구
// $this->getZoneModel()->db->transRollback();
$message = __METHOD__ . "에서 Firewall Reload 오류\n" . $e->getMessage();
log_message("error", $message);
echo $message;
}
}
}

View File

@ -0,0 +1,59 @@
<?php
namespace App\Controllers\Common;
use App\Controllers\BaseController;
use App\Entities\UserEntity;
use App\Models\UserModel;
class AuthController extends BaseController
{
public function login()
{
helper(['form']);
$viewDatas = [
'layout' => LAYOUTS['empty'],
'title' => '로그인',
'forms' => [
'attributes' => ['action' => 'post', 'class' => 'row g-3'],
'hiddens' => [RETURN_URL => session()->get(RETURN_URL)],
]
];
return view('auth/login', $viewDatas);
}
public function signin()
{
$id = $this->request->getVar('id');
$passwd = $this->request->getVar('passwd');
$model = new UserModel();
$user = $model->asObject(UserEntity::class)->where('id', $id)->first();
if (is_null($user) || !isset($user->passwd)) {
session()->setFlashdata('error', "사용자ID: {$id}가 존재하지 않습니다.");
return redirect()->back()->withInput();
}
if (password_verify($passwd, $user->passwd)) {
//Session에 Login 정보전달
$authData = [
'uid' => $user->uid,
'name' => $user->name,
'email' => $user->email,
'role' => $user->role,
ISLOGIN => true
];
session()->set($authData);
return redirect()->to($this->request->getVar(RETURN_URL) ? $this->request->getVar(RETURN_URL) : "/");
} else {
session()->setFlashdata('error', '암호가 맞지 않습니다.');
return redirect()->back()->withInput();
}
}
public function logout()
{
//Session에 Login 정보 삭제
session()->set([ISLOGIN => false]);
session_destroy();
return redirect()->route('/');
}
}

View File

@ -0,0 +1,551 @@
<?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
{
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()
];
if (is_null(session()->get('uid'))) {
redirect()->to('/login')->with('error', '로그인을하셔야합니다.');
}
}
//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(
[DEFAULT_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;
}
//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->update_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_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()
{
//변경된 값 적용
$fieldDatas = array();
foreach ($this->_viewDatas['fields'] as $field) {
$fieldDatas[$field] = $this->request->getVar($field);
}
$this->_viewDatas['fieldDatas'] = $fieldDatas;
//변경할 값 확인
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
}
protected function insert_process()
{
if (!$this->_model->save($this->_viewDatas['fieldDatas'])) {
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));
}
}
final public function insert()
{
$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(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()}");
}
}
//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->update_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_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)
{
//변경된 값 적용
$fieldDatas = array();
foreach ($this->_viewDatas['fields'] as $field) {
$fieldDatas[$field] = $this->request->getVar($field);
Log::add("info", "{$entity->getTitle()}{$field} : {$entity->$field}=>{$fieldDatas[$field]}");
$entity->$field = $fieldDatas[$field];
}
$this->_viewDatas['fieldDatas'] = $fieldDatas;
//변경할 값 확인
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
return $entity;
}
protected function update_process($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));
}
} else {
throw new \Exception(__FUNCTION__ . " 변경된값 없음.\n" . var_export($entity, true));
}
return $entity;
}
final public function update($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(RETURN_URL));
} catch (\Exception $e) {
$message = "{$entity->getTitle()} " . __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)
{
//변경된 값 적용
$fieldDatas = array();
foreach ($this->_viewDatas['fields'] as $field) {
$fieldDatas[$field] = $this->request->getVar($field);
Log::add("info", "{$entity->getTitle()}{$field} : {$entity->$field}=>{$fieldDatas[$field]}");
$entity->$field = $fieldDatas[$field];
}
$this->_viewDatas['fieldDatas'] = $fieldDatas;
//변경할 값 확인
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
return $entity;
}
protected function toggle_process($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));
}
} else {
throw new \Exception(__FUNCTION__ . " 변경된값 없음.\n" . var_export($entity, true));
}
return $entity;
}
public function toggle($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(RETURN_URL));
} catch (\Exception $e) {
$message = "{$entity->getTitle()} " . __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)
{
//변경된 값 적용
$fieldDatas = array();
foreach ($this->_viewDatas['fields'] as $field) {
$fieldDatas[$field] = $this->request->getVar($field);
Log::add("info", "{$entity->getTitle()}{$field} : {$entity->$field}=>{$fieldDatas[$field]}");
$entity->$field = $fieldDatas[$field];
}
$this->_viewDatas['fieldDatas'] = $fieldDatas;
//변경할 값 확인
if (!$this->validate($this->_viewDatas['fieldRules'])) {
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
}
return $entity;
}
protected function batchjob_process($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));
}
} else {
throw new \Exception(__FUNCTION__ . " 변경된값 없음.\n" . var_export($entity, true));
}
return $entity;
}
final public function batchjob()
{
$message = "";
$uids = array();
try {
$uids = $this->request->getVar('batchjob_uids');
if (!is_array($uids) || count($uids) === 0) {
throw new \Exception($this->_viewDatas['title'] . '가 uid가 선택되지 않았습니다.');
}
$this->batchjob_init();
foreach ($uids as $uid) {
$entity = $this->_model->getEntity($uid);
$entity = $this->batchjob_validate($entity);
$entity = $this->batchjob_process($entity);
}
$message = "총: " . implode(",", $uids) . "의 수정(Batchjob)을 완료하였습니다.";
Log::save("{$this->_viewDatas['title']} {$message}");
return alert_CommonHelper($message, session()->get(RETURN_URL));
} catch (\Exception $e) {
$message = "총: " . implode(",", $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)
{
$this->_model->delete($entity->getPrimaryKey());
return $entity;
}
final public function delete($uid)
{
$message = "";
try {
$entity = $this->_model->getEntity($uid);
$entity = $this->delete_process($entity);
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
Log::save("{$this->_viewDatas['title']} {$message}");
return alert_CommonHelper($message, session()->get(RETURN_URL));
} catch (\Exception $e) {
$message = "{$entity->getTitle()} " . __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;
}
final public function view($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(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) : DEFAULT_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') : DEFAULT_PERPAGE;
$this->_viewDatas['uri'] = $this->request->getUri();
}
//index 모델 전처리
private 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') : '';
$start = $this->request->getVar('end') ? $this->request->getVar('end') : '';
if (isset($start) && $start !== '' && isset($end) && $end !== '') {
$this->_model->setIndexDateFilter($start, $end);
}
}
private function index_getRows(int $page = 0, int $per_page = 0): array
{
//모델 조건절 처리작업
$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->orderBy($order_field, $order_value);
$rows = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll();
Log::add("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->index_setCondition();
//Totalcount 처리
$total_count = $this->_model->countAllResults();
$this->_viewDatas['total_count'] = $total_count;
//Log::add("debug",__METHOD__."에서 호출:".$this->_model->getLastQuery());
//줄수 처리용
$this->_viewDatas['pageOptions'] = array("" => "줄수선택");
for ($i = 10; $i <= $this->_viewDatas['total_count'] + $this->_viewDatas['per_page']; $i += 10) {
$this->_viewDatas['pageOptions'][$i] = $i;
}
//모델 처리
$this->_viewDatas['rows'] = $this->index_getRows((int)$this->_viewDatas['page'], (int)$this->_viewDatas['per_page']);
//pagenation 처리
$this->_viewDatas['pagination'] = $this->index_getPagination();
}
final public function index()
{
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');
}
final public function excel()
{
try {
$this->excel_init();
return $this->excel_process();
} catch (\Exception $e) {
return alert_CommonHelper($e->getMessage(), 'back');
}
}
}

View 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
View File

@ -0,0 +1,11 @@
<?php
namespace App\Controllers;
class Home extends BaseController
{
public function index()
{
return view('welcome_message');
}
}

View File

View File

@ -0,0 +1,63 @@
<?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' => '150',
],
'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');
}
}

View File

View 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']),
];
}
}

127
app/Database/table.sql Normal file
View File

@ -0,0 +1,127 @@
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 mapurl;
CREATE TABLE
mapurl (
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
oldurl varchar(255) NOT NULL COMMENT '기존 URL',
newurl varchar(255) NOT NULL COMMENT '신규 URL',
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 oldurl (oldurl)
) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci COMMENT = 'MapURL 정보';
DROP TABLE IF EXISTS cloudflareauth;
CREATE TABLE
cloudflareauth (
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
id varchar(50) NOT NULL COMMENT 'CloudFlare 계정ID',
authkey varchar(255) NOT NULL COMMENT '인증키',
oldkey varchar(255) DEFAULT 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),
UNIQUE KEY authkey (authkey)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci COMMENT = 'cloudflare 인증 정보';
DROP TABLE IF EXISTS cloudflareaccount;
CREATE TABLE
cloudflareaccount (
uid varchar(255) NOT NULL COMMENT 'apikey',
auth_uid int(10) unsigned NOT NULL,
title varchar(150) NOT NULL COMMENT 'CloudFlare 계정ID',
type varchar(20) NOT NULL DEFAULT 'standard' 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 cloudflareaccount_ibfk_1 FOREIGN KEY (auth_uid) REFERENCES cloudflareauth (uid)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci COMMENT = 'cloudflare 계정 정보';
DROP TABLE IF EXISTS cloudflarezone;
CREATE TABLE
cloudflarezone (
uid varchar(255) NOT NULL COMMENT 'apikey',
account_uid varchar(255) NOT NULL COMMENT 'account_uid',
domain varchar(30) NOT NULL COMMENT 'zone Domin Name',
name_servers varchar(60) DEFAULT NULL COMMENT 'Name Servers',
original_name_servers varchar(60) DEFAULT NULL COMMENT 'Origin Name Servers',
plan varchar(80) NOT NULL DEFAULT 'free',
development_mode varchar(30) NOT NULL DEFAULT 'off',
ipv6 varchar(20) NOT NULL DEFAULT 'off',
security_level varchar(20) NOT NULL DEFAULT 'off' COMMENT '공격방어',
status varchar(10) NOT NULL DEFAULT 'active' COMMENT '서비스',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (uid),
UNIQUE KEY domainbyaccount (account_uid, domain),
CONSTRAINT cloudflarezone_ibfk_1 FOREIGN KEY (account_uid) REFERENCES cloudflareaccount (uid)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'cloudflare zone 정보';
DROP TABLE IF EXISTS cloudflarerecord;
CREATE TABLE
cloudflarerecord (
uid varchar(255) NOT NULL COMMENT 'apikey',
zone_uid varchar(255) NOT NULL COMMENT 'zone_uid',
type varchar(10) NOT NULL DEFAULT 'A' NULL COMMENT 'DNS TYPE',
host varchar(60) NOT NULL COMMENT 'record Name',
content varchar(255) NOT NULL COMMENT 'IP 또는 내용',
ttl int(5) NOT NULL DEFAULT 1 COMMENT 'TTL 시간',
proxiable varchar(20) NOT NULL DEFAULT 'off' COMMENT 'CDN기능여부',
proxied varchar(20) NOT NULL DEFAULT 'off' COMMENT 'CDN기능여부2',
fixed varchar(20) NOT NULL DEFAULT 'off' COMMENT 'Fixed CDN',
locked varchar(20) NOT NULL DEFAULT 'off' COMMENT '서비스',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (uid),
CONSTRAINT cloudflarerecord_ibfk_1 FOREIGN KEY (zone_uid) REFERENCES cloudflarezone (uid) ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'cloudflare record정보';
DROP TABLE IF EXISTS cloudflarefixedrecord;
CREATE TABLE
cloudflarefixedrecord (
uid int(10) unsigned NOT NULL AUTO_INCREMENT,
host varchar(60) NOT NULL COMMENT 'record Name',
updated_at timestamp NULL DEFAULT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp(),
PRIMARY KEY (uid)
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'cloudflare fixed record정보';
DROP TABLE IF EXISTS cloudflarefirewall;
CREATE TABLE
cloudflarefirewall (
uid varchar(255) NOT NULL COMMENT 'rule_id',
zone_uid varchar(255) NOT NULL COMMENT 'zone_uid',
description varchar(255) NOT NULL COMMENT '내용',
filter_id varchar(255) NOT NULL COMMENT 'Filter ID',
filter_expression text NOT NULL COMMENT 'Filter RULE',
filter_paused varchar(10) NOT NULL DEFAULT 'off' COMMENT 'Filter true/false',
paused varchar(10) NOT NULL DEFAULT 'on' COMMENT '실제 false/true',
action varchar(20) NOT NULL DEFAULT 'log' COMMENT 'block|allow|challenge|js_challenge|log',
updated_at timestamp NULL DEFAULT NULL COMMENT 'modified_on',
created_at timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'created_on',
PRIMARY KEY (uid),
CONSTRAINT cloudflarerecord_ibfk_2 FOREIGN KEY (zone_uid) REFERENCES cloudflarezone (uid) ON DELETE CASCADE
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COMMENT = 'cloudflare firewall정보';

View File

@ -0,0 +1,24 @@
<?php
namespace App\Entities\Cloudflare;
use App\Entities\Cloudflare\CloudflareEntity;
class AccountEntity extends CloudflareEntity
{
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'];
}
public function __toString()
{
return "uid:{$this->attributes['uid']}|auth_uid:{$this->attributes['auth_uid']}|{$this->attributes['title']} | {$this->attributes['type']} | {$this->attributes['status']}";
}
public function getParentField():string{
return "auth_uid";
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace App\Entities\Cloudflare;
use App\Entities\CommonEntity;
class AuthEntity 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['id'];
}
public function getAuthId(){
return $this->attributes['id'];
}
public function getAuthKey(){
return $this->attributes['authkey'];
}
public function __toString()
{
return "{$this->attributes['id']} | {$this->attributes['authkey']} | {$this->attributes['status']}";
}
}

View File

@ -0,0 +1,14 @@
<?php
namespace App\Entities\Cloudflare;
use App\Entities\CommonEntity;
abstract class CloudflareEntity extends CommonEntity
{
abstract public function getParentField():string;
final public function getParentFieldData(){
$field = $this->getParentField();
return $this->$field;
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Entities\Cloudflare;
use App\Entities\Cloudflare\CloudflareEntity;
class FirewallEntity extends CloudflareEntity
{
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['description'];
}
public function __toString()
{
return "uid:{$this->attributes['uid']}|zone_uid:{$this->attributes['zone_uid']}|host:{$this->attributes['description']}|content:{$this->attributes['action']}";
}
public function getParentField():string{
return "zone_uid";
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Entities\Cloudflare;
use App\Entities\Cloudflare\CloudflareEntity;
class RecordEntity extends CloudflareEntity
{
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['host']}-{$this->attributes['content']}";
}
public function __toString()
{
return "uid:{$this->attributes['uid']}|zone_uid:{$this->attributes['zone_uid']}|host:{$this->attributes['host']}|content:{$this->attributes['content']}|proxied:{$this->attributes['proxied']}|fixed:{$this->attributes['fixed']}|locked:{$this->attributes['locked']}";
}
public function getParentField(): string
{
return "zone_uid";
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace App\Entities\Cloudflare;
use App\Entities\Cloudflare\CloudflareEntity;
class ZoneEntity extends CloudflareEntity
{
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['domain'];
}
public function __toString()
{
return "uid:{$this->attributes['uid']}|account_uid:{$this->attributes['account_uid']}|domain:{$this->attributes['domain']}|{$this->attributes['development_mode']}|{$this->attributes['ipv6']}|{$this->attributes['security_level']}";
}
public function getParentField():string{
return "account_uid";
}
}

View File

@ -0,0 +1,11 @@
<?php
namespace App\Entities;
use CodeIgniter\Entity\Entity;
abstract class CommonEntity extends Entity
{
abstract public function getPrimaryKey();
abstract public function getTitle();
}

View 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'];
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace App\Entities\Cloudflare\Magictransit;
use App\Entities\Cloudflare\CloudflareEntity;
class AllowListEntity extends CloudflareEntity
{
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['domain'];
}
public function __toString()
{
return "uid:{$this->attributes['uid']}|account_uid:{$this->attributes['account_uid']}|domain:{$this->attributes['domain']}|{$this->attributes['development_mode']}|{$this->attributes['ipv6']}|{$this->attributes['security_level']}";
}
public function getParentField(): string
{
return "account_uid";
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace App\Entities;
use App\Entities\CommonEntity;
class MapurlEntity 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['oldurl'];
}
}

View File

@ -0,0 +1,20 @@
<?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'];
}
protected function setPassword(string $password){
$this->attributes['passwd'] = password_hash($password,PASSWORD_DEFAULT);
}
}

0
app/Filters/.gitkeep Normal file
View File

View File

@ -0,0 +1,63 @@
<?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(ISLOGIN)) {
session()->set(RETURN_URL, $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
return redirect()->to('/login')->with('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
View File

View File

@ -0,0 +1,94 @@
<?php
function getFieldLabel_AccountHelper($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('Cloudflare/Account.label.' . $field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_AccountHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY : $value;
switch ($field) {
case 'auth_uid':
return form_dropdown($field, $formOptions[$field], $value, ['class' => "selectbox"]);
break;
case 'type':
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_AccountHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array())
{
switch ($field) {
default:
if (in_array($field, $fieldFilters)) {
return $fieldFormOptions[$field][$entity->$field];
}
return $entity->$field;
break;
}
} //
function getFieldIndex_Column_AccountHelper($field, $order_field, $order_value, array $attributes = array())
{
$label = lang('Cloudflare/Account.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_AccountHelper($field, array $row, array $fieldFilters, array $fieldFormOptions, array $attributes = array(), string $old_auth_uid = ''): string
{
switch ($field) {
case 'auth_uid':
$temp = '';
if ($old_auth_uid !== $row[$field]) {
$temp = sprintf(
'<div style="text-align:left;">%s</div>',
$fieldFormOptions[$field][$row[$field]]
);
}
return $temp;
break;
case 'title':
return sprintf(
'<div style="text-align:left;">%s %s %s</div>',
anchor(base_url() . '/admin/cloudflare/zone?account_uid=' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-flag", "target" => "_self"]),
anchor(base_url() . '/admin/cloudflare/account/reload/' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]),
$row[$field]
);
break;
case 'type':
case 'status':
return $row[$field];
break;
case 'updated_at':
case 'created_at':
return 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_AccountHelper($field, $row[$field], $fieldFormOptions, $attributes);
}
return $row[$field];
break;
}
} //

View File

@ -0,0 +1,81 @@
<?php
function getFieldLabel_AuthHelper($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('Cloudflare/Auth.label.'.$field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_AuthHelper($field,$value,array $formOptions,array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY:$value;
switch($field){
case 'uid':
$attributes['id'] = "uid_select";
return sprintf("%s %s",
form_dropdown($field,$formOptions[$field],$value,$attributes),
'<button id="selectKey" type="button" class="btn btn-info btn-circle fa fa-refresh">Auth선택</button>');
break;
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_AuthHelper($field,$entity,array $fieldFilters,$fieldFormOptions,$attributes=array())
{
switch($field){
default:
if(in_array($field,$fieldFilters)){
return $fieldFormOptions[$field][$entity->$field];
}
return $entity->$field;
break;
}
} //
function getFieldIndex_Column_AuthHelper($field,$order_field,$order_value,array $attributes = array())
{
$label = lang('Cloudflare/Auth.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_AuthHelper($field,array $row,array $fieldFilters,array $fieldFormOptions,array $attributes=array()): string
{
switch($field){
case 'id':
return sprintf('<div style="text-align:left; padding-left:30px;">%s %s %s</div>',
anchor(base_url().'/admin/cloudflare/auth/reload/'.$row['uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-refresh","target" => "_self"]),
anchor(base_url().'/admin/cloudflare/account?auth_uid='.$row['uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-flag","target" => "_self"]),
anchor(current_url().'/view/'.$row['uid'],$row[$field],["target"=>"_self"]),
);
break;
case 'updated_at':
case 'created_at':
return 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_AuthHelper($field,$row[$field],$fieldFormOptions,$attributes);
}
return $row[$field];
break;
}
} //

View File

@ -0,0 +1,86 @@
<?php
function getFieldLabel_FirewallHelper($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('Cloudflare/Firewall.label.'.$field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_FirewallHelper($field,$value,array $formOptions,array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY:$value;
switch($field){
case 'zone_uid':
return form_dropdown($field,$formOptions[$field],$value,['class'=> "select-field form-select-sm"]);
break;
case 'action':
case 'filter_paused':
case 'paused':
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_FirewallHelper($field,array $fieldDatas,array $fieldFilters,array $fieldFormOptions,array $attributes=array())
{
switch($field){
default:
if(in_array($field,$fieldFilters)){
return getFieldForm_FirewallHelper($field,$fieldDatas[$field],$fieldFormOptions,$attributes);
}
return $fieldDatas[$field];
break;
}
} //
function getFieldIndex_Column_FirewallHelper($field,$order_field,$order_value,array $attributes = array())
{
$label = lang('Cloudflare/Firewall.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_FirewallHelper($field,array $row,array $fieldFilters,$fieldFormOptions,$attributes=array(),string $old_zone_uid=''): string
{
switch($field){
case 'zone_uid':
$temp = '';
if($old_zone_uid !== $row[$field]){
$temp = sprintf('<div style="text-align:left;">%s %s</div>',
anchor(base_url().'/admin/cloudflare/zone/firewall/'.$row['zone_uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-refresh","target" => "_self"]),
$fieldFormOptions[$field][$row[$field]]);
}
return $temp;
break;
case 'description':
return sprintf('<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="%s">%s</button>',
preg_replace('/"/', "'",$row['filter_expression']),$row[$field]);
break;
case 'updated_at':
case 'created_at':
return 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_FirewallHelper($field,$row[$field],$fieldFormOptions,$attributes);
}
return $row[$field];
break;
}
} //

View File

@ -0,0 +1,123 @@
<?php
function getFieldLabel_RecordHelper($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('Cloudflare/Record.label.' . $field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_RecordHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY : $value;
switch ($field) {
case 'zone_uid':
return form_dropdown($field, $formOptions[$field], $value, ['class' => "select-field form-select-sm"]);
break;
case 'type':
case 'proxiable':
case 'proxied':
case 'locked':
case 'fixed':
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_RecordHelper($field, array $fieldDatas, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
switch ($field) {
case 'locked':
return lang(sprintf("Record.%s.%s", strtoupper($field), $fieldDatas[$field]));
break;
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_RecordHelper($field, $fieldDatas[$field], $fieldFormOptions, $attributes);
}
return $fieldDatas[$field];
break;
}
} //
function getFieldIndex_Column_RecordHelper($field, $order_field, $order_value, array $attributes = array())
{
switch ($field) {
case 'zone_uid':
$label = lang('Cloudflare/Record.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) .
"<button onClick=\"getElementsByClassNameCopyToClipboard('label_zones'); return false;\" class=\"btn btn-sm btn-danger btn-circle\">Copy Zones</buttion>";
break;
case 'host':
$label = lang('Cloudflare/Record.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) .
"<button onClick=\"getElementsByClassNameCopyToClipboard('label_hosts'); return false;\" class=\"btn btn-sm btn-danger btn-circle\">Copy Hosts</buttion>";
break;
default:
$label = lang('Cloudflare/Record.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);
break;
}
} //
function getFieldIndex_Row_RecordHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array(), string $old_zone_uid = ''): string
{
switch ($field) {
case 'zone_uid':
$temp = '';
if ($old_zone_uid !== $row[$field]) {
$temp = sprintf(
'<div style="text-align:left;">%s <label class="label_zones">%s</label></div>',
anchor(base_url() . '/admin/cloudflare/zone/reload/' . $row['zone_uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]),
$fieldFormOptions[$field][$row[$field]]
);
}
return $temp;
break;
case 'host':
return sprintf(
'<div style="text-align:left; padding-left:20px;"><B><label class="label_hosts">%s</label></B></div>',
anchor(base_url() . '/admin/cloudflare/record/cdnToggle/' . $row['uid'], $row[$field], ["class" => $row['fixed'] == 'on' ? 'btn btn-outline-secondary fa fa-lock' : '', "target" => "_self"])
);
break;
case 'type':
case 'fixed':
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
return getFieldForm_RecordHelper($field, $row[$field], $fieldFormOptions, $attributes);
break;
case 'proxied':
if ($row['fixed'] == 'on') {
return $fieldFormOptions[$field][$row[$field]];
}
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
return getFieldForm_RecordHelper($field, $row[$field], $fieldFormOptions, $attributes);
case 'locked':
return $fieldFormOptions[$field][$row[$field]];
break;
case 'updated_at':
case 'created_at':
return str_split($row[$field], 10)[0];
break;
default:
return $row[$field];
break;
}
} //

View File

@ -0,0 +1,110 @@
<?php
function getFieldLabel_ZoneHelper($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('Cloudflare/Zone.label.' . $field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_ZoneHelper($field, $value, array $formOptions, array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY : $value;
switch ($field) {
case 'account_uid':
case 'development_mode':
case 'ipv6':
case 'security_level':
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_ZoneHelper($field, array $fieldDatas, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
switch ($field) {
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_ZoneHelper($field, $fieldDatas[$field], $fieldFormOptions, $attributes);
}
return $fieldDatas[$field];
break;
}
} //
function getFieldIndex_Column_ZoneHelper($field, $order_field, $order_value, array $attributes = array())
{
switch ($field) {
case 'domain':
$label = lang('Cloudflare/Zone.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) .
"<button onClick=\"getElementsByClassNameCopyToClipboard('label_domains'); return false;\" class=\"btn btn-sm btn-danger btn-circle\">Copy Domains</buttion>";
break;
default:
$label = lang('Cloudflare/Zone.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);
break;
}
} //
function getFieldIndex_Row_ZoneHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array(), string $old_account_uid = ''): string
{
switch ($field) {
case 'account_uid':
$temp = '';
if ($old_account_uid !== $row[$field]) {
$temp = sprintf(
'<div style="text-align:left;">%s %s</div>',
anchor(base_url() . '/admin/cloudflare/account/reload/' . $row['account_uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]),
preg_replace("/(\w+)@(.+)/", "$1", $fieldFormOptions[$field][$row[$field]])
);
}
return $temp;
break;
case 'domain':
return sprintf(
'<div style="text-align:left;">%s %s<B><label class="label_domains">%s</label></B></div>',
anchor(current_url() . '/reload/' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]),
anchor(base_url() . '/admin/cloudflare/record?zone_uid=' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-flag", "target" => "_self"]),
$row[$field]
);
break;
case 'name_servers':
case 'original_name_servers':
return str_replace(",", "<BR>", $row[$field]);
break;
case 'status':
return $row[$field];
break;
case 'updated_at':
case 'created_at':
return 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_ZoneHelper($field, $row[$field], $fieldFormOptions, $attributes);
}
return $row[$field];
break;
}
} //

View 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>';
}//

View 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('Logger.label.'.$field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_LoggerHelper($field,$value,array $formOptions,array $attributes = array())
{
$value = is_null($value) ? DEFAULT_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(sprintf("Logger.%s.%s",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('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 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;
}
} //

View File

@ -0,0 +1,96 @@
<?php
function getFieldLabel_DdosHelper($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('Cloudflare/Ddos.label.'.$field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_DdosHelper($field,$value,array $formOptions,array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY:$value;
switch($field){
case 'account_uid':
case 'development_mode':
case 'ipv6':
case 'security_level':
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_DdosHelper($field,array $fieldDatas,array $fieldFilters,array $fieldFormOptions,array $attributes=array())
{
switch($field){
default:
if(in_array($field,$fieldFilters)){
return getFieldForm_DdosHelper($field,$fieldDatas[$field],$fieldFormOptions,$attributes);
}
return $fieldDatas[$field];
break;
}
} //
function getFieldIndex_Column_DdosHelper($field,$order_field,$order_value,\CodeIgniter\HTTP\URI $uri,array $attributes = array())
{
$label = lang('Cloudflare/Ddos.label.'.$field);
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>',$label,$order_value == 'ASC' ? "up":"down"):$label;
$uri->addQuery('order_field',$field);
$uri->addQuery('order_value' ,$order_value == 'DESC' ? "ASC":"DESC");
return anchor($uri->getPath().'?'.$uri->getQuery(),$label,$attributes);
} //
function getFieldIndex_Row_DdosHelper($field,array $row,array $fieldFilters,$fieldFormOptions,$attributes=array(),string $old_account_uid=''): string
{
switch($field){
case 'account_uid':
$temp = '';
if($old_account_uid !== $row[$field]){
$temp = sprintf('<div style="text-align:left;">%s %s</div>',
anchor(base_url().'/admin/cloudflare/account/reload/'.$row['account_uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-refresh","target" => "_self"]),
$fieldFormOptions[$field][$row[$field]]);
}
return $temp;
break;
case 'domain':
return sprintf('<div style="text-align:left; padding-left:20px;">%s %s <B>%s</B></div>',
anchor(base_url().'/admin/cloudflare/record?zone_uid='.$row['uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-flag","target" => "_self"]),
anchor(current_url().'/reload/'.$row['uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-refresh","target" => "_self"]),
$row[$field]);
break;
case 'name_servers':
case 'original_name_servers':
return str_replace(",","<BR>",$row[$field]);
break;
case 'status':
return $row[$field];
break;
case 'updated_at':
case 'created_at':
return str_split($row[$field],10)[0];
break;
default:
if(in_array($field,$fieldFilters)){
$attributes["onChange"]=sprintf('location.href="%s/toggle/%s/%s/"+this.options[this.selectedIndex].value',current_url(),$row['uid'],$field);
return getFieldForm_DdosHelper($field,$row[$field],$fieldFormOptions,$attributes);
}
return $row[$field];
break;
}
} //

View File

@ -0,0 +1,78 @@
<?php
function getFieldLabel_MapurlHelper($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('Mapurl.label.'.$field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_MapurlHelper($field,$value,array $formOptions,array $attributes = array())
{
$value = is_null($value) ? DEFAULT_EMPTY:$value;
switch($field){
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_MapurlHelper($field,$entity,array $fieldFilters,array $fieldFormOptions,array $attributes=array())
{
switch($field){
case 'status':
return lang(sprintf("Mapurl.%s.%s",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_MapurlHelper($field,$order_field,$order_value,array $attributes = array())
{
$label = lang('Mapurl.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_MapurlHelper($field,array $row,array $fieldFilters,$fieldFormOptions,$attributes=array()): string
{
switch($field){
case 'oldurl':
return sprintf('<div style="text-align:left;">%s</div>',anchor(current_url().'/view/'.$row['uid'],$row[$field],["target"=>"_self"]));
break;
case 'newurl':
return sprintf('<div style="text-align:left;">%s</div>',$row[$field]);
break;
case 'updated_at':
case 'created_at':
return 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_MapurlHelper($field,$row[$field],$fieldFormOptions,$attributes);
}
return $row[$field];
break;
}
} //

View 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('User.label.'.$field));
break;
}
}
//header.php에서 getFieldForm_Helper사용
function getFieldForm_UserHelper($field,$value,array $formOptions,array $attributes = array())
{
$value = is_null($value) ? DEFAULT_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,DEFAULT_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(sprintf("User.%s.%s",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('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 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;
}
} //

0
app/Language/.gitkeep Normal file
View File

View File

@ -0,0 +1,23 @@
<?php
return [
'title' => "Account정보",
'label' => [
'uid' => "번호",
'auth_uid' => "인증번호",
'title' => "Title",
'type' => "Type",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"AUTH_UID" => [
],
"TYPE" => [
"standard" => "standard",
"enterprise" => "enterprise"
],
"STATUS" => [
"use" => "사용",
"unuse" => "사용않함",
]
];

View File

@ -0,0 +1,19 @@
<?php
return [
'title' => "Auth정보",
'label' => [
'uid' => "번호",
'id' => "인증ID",
'authkey' => "인증Key",
'oldkey' => "이전인증Key",
'status' => "상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"UID" => [
],
"STATUS" => [
"use" => "사용",
"unuse" => "사용않함",
]
];

View File

@ -0,0 +1,33 @@
<?php
return [
'title' => "Record정보",
'label' => [
'uid' => "번호",
'zone_uid' => "도메인",
'description' => "내용",
'filter_id' => "filterId",
'filter_expression' => "filterRule",
'filter_paused' => "Filter상태",
'action' => "Action",
'paused' => "방어상태",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"ZONE_UID" => [
],
"ACTION" => [
"block" => "block",
"allow" => "allow",
"challenge" => "challenge",
"js_challenge" => "js_challenge",
"log" => "log",
],
"FILTER_PAUSED" => [
"on" => "사용중",
"off" => "사용않함",
],
"PAUSED" => [
"on" => "사용중",
"off" => "사용않함",
],
];

View File

@ -0,0 +1,38 @@
<?php
return [
'title' => "Ddos정보",
'label' => [
'uid' => "번호",
'account_uid' => "계정",
'domain' => "도메인",
'name_servers' => "네임서버",
'original_name_servers' => "이전네임서버",
'plan' => "plan",
'development_mode' => "개발모드",
'ipv6' => "ipv6",
'security_level' => "공격방어",
'status' => "서비스",
'updated_at' => "수정일",
'created_at' => "작성일"
],
"ACCOUNT_UID" => [
],
"DEVELOPMENT_MODE" => [
"on" => "사용",
"off" => "사용않함",
],
"IPV6" => [
"on" => "사용",
"off" => "사용않함",
],
"SECURITY_LEVEL" => [
"under_attack" => "under_attack",
"medium" => "medium",
"low" => "low",
"essentially_off" => "essentially_off"
],
"STATUS" => [
"active" => "active",
"pending" => "pending",
],
];

Some files were not shown because too many files have changed in this diff Show More