From 79e58dcad2cc64c61bb9e01f8faf6d84e35d5b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=B5=9C=EC=A4=80=ED=9D=A0?= Date: Sun, 6 Oct 2024 18:37:13 +0900 Subject: [PATCH] cfmgrv4 init...1 --- app/Config/Constants.php | 139 +++++++++--------- .../Admin/Cloudflare/ZoneController.php | 42 +++--- app/Helpers/Cloudflare/Zone_helper.php | 14 +- 3 files changed, 96 insertions(+), 99 deletions(-) diff --git a/app/Config/Constants.php b/app/Config/Constants.php index c5d1ad0..1839d88 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -95,21 +95,21 @@ define('EVENT_PRIORITY_HIGH', 10); //Default값 정의 define('DEFAULTS', [ - 'ROLE' => "guest", - 'STATUS' => "use", - 'EMPTY' => "", + 'ROLE' => "guest", + 'STATUS' => "use", + 'EMPTY' => "", 'DELIMITER_FILE' => "||", 'DELIMITER_ROLE' => ",", ]); //FORM define('FORMS', [ - 'MODAL' => 'modal_form', + 'MODAL' => 'modal_form', 'IFRAME' => 'iframe_form', 'DIRECT' => 'direct_form', ]); //URL define('URLS', [ - 'LOGIN' => '/user/login', + 'LOGIN' => '/user/login', 'SIGNUP' => '/user/signup', 'LOGOUT' => '/user/logout', ]); @@ -127,78 +127,78 @@ define('ROLES', [ define('SESSION_NAMES', [ 'RETURN_URL' => "return_url", 'RETURN_MSG' => "return_message", - 'ISLOGIN' => "islogined", - 'AUTH' => 'auth', + 'ISLOGIN' => "islogined", + 'AUTH' => 'auth', ]); //메신저 관련 define("MESSENGERS", [ - "skype" => [ - "url" => "//join.skype.com/invite/uKUgXfZThSQC", + "skype" => [ + "url" => "//join.skype.com/invite/uKUgXfZThSQC", "icon" => '스카이프', - "id" => '', + "id" => '', ], - "discord" => [ - "url" => "//discord.gg/k6nQg84N", + "discord" => [ + "url" => "//discord.gg/k6nQg84N", "icon" => '디스코드', - "id" => '', + "id" => '', ], - "telegram" => [ - "url" => "//t.me/daemonidc", + "telegram" => [ + "url" => "//t.me/daemonidc", "icon" => '텔레그램', - "id" => '@daemonidc', + "id" => '@daemonidc', ], "kakaotalk" => [ - "url" => "//t.me/daemonidc", + "url" => "//t.me/daemonidc", "icon" => '카카오톡', - "id" => '', + "id" => '', ], ]); //아이콘 및 Sound관련 define('ICONS', [ - 'LOGO' => '', - 'EXCEL' => '', - 'PDF' => '', - 'MEMBER' => '', - 'LOGIN' => '', - 'LOGOUT' => '', - 'HOME' => '', - 'MENU' => '', - 'NEW' => '', - 'REPLY' => '', - 'DATABASE' => '', - 'DELETE' => '', - 'REBOOT' => '', - 'RELOAD' => '', - 'SETUP' => '', - 'FLAG' => '', - 'SEARCH' => '', - 'PLAY' => '', - 'CART' => '', - 'CARD' => '', - 'DEPOSIT' => '', - 'DESKTOP' => '', - 'UP' => '', - 'DOWN' => '', - 'LEFT' => '', - 'RIGHT' => '', + 'LOGO' => '', + 'EXCEL' => '', + 'PDF' => '', + 'MEMBER' => '', + 'LOGIN' => '', + 'LOGOUT' => '', + 'HOME' => '', + 'MENU' => '', + 'NEW' => '', + 'REPLY' => '', + 'DATABASE' => '', + 'DELETE' => '', + 'REBOOT' => '', + 'RELOAD' => '', + 'SETUP' => '', + 'FLAG' => '', + 'SEARCH' => '', + 'PLAY' => '', + 'CART' => '', + 'CARD' => '', + 'DEPOSIT' => '', + 'DESKTOP' => '', + 'UP' => '', + 'DOWN' => '', + 'LEFT' => '', + 'RIGHT' => '', 'IMAGE_FILE' => '', - 'GOOGLE' => '', - 'CLOUD' => '', - 'SIGNPOST' => '', - 'LOCK' => '', - 'UNLOCK' => '', - 'BOX' => '', - 'BOXS' => '', + 'GOOGLE' => '', + 'CLOUD' => '', + 'SIGNPOST' => '', + 'LOCK' => '', + 'UNLOCK' => '', + 'BOX' => '', + 'BOXS' => '', ]); //배너관련 define('TOP_BANNER', [ - 'default' => '', - 'aboutus' => '', - 'member' => '', - 'hosting' => '', + 'default' => '', + 'aboutus' => '', + 'member' => '', + 'hosting' => '', 'serverdevice' => '', - 'service' => '', - 'support' => '', + 'service' => '', + 'support' => '', ]); //소리관련 define('AUDIOS', [ @@ -208,9 +208,9 @@ define('AUDIOS', [ define('KEYWORD', '일본IDC 일본서버 일본 서버 일본호스팅 서버호스팅 디도스 공격 해외 호스팅 DDOS 방어 ddos 의뢰 디도스 보안 일본 단독서버 가상서버'); define('LAYOUTS', [ 'empty' => [ - 'title' => KEYWORD, - 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty', - 'metas' => [ + 'title' => KEYWORD, + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'empty', + 'metas' => [ '', '', '', @@ -231,10 +231,10 @@ define('LAYOUTS', [ ], ], 'front' => [ - 'title' => KEYWORD, - 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front', - 'topmenus' => ['aboutus', 'hosting', 'service', 'support'], - 'metas' => [ + 'title' => KEYWORD, + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'front', + 'topmenus' => ['aboutus', 'hosting', 'service', 'support'], + 'metas' => [ '', '', '', @@ -253,7 +253,6 @@ define('LAYOUTS', [ '', '', '', - '', '', ], 'javascripts' => [ @@ -265,9 +264,9 @@ define('LAYOUTS', [ ], ], 'admin' => [ - 'title' => '관리자화면', - 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin', - 'metas' => [ + 'title' => '관리자화면', + 'path' => 'layouts' . DIRECTORY_SEPARATOR . 'admin', + 'metas' => [ '', '', '', @@ -285,8 +284,6 @@ define('LAYOUTS', [ '', '', '', - '', - '', '', ], 'javascripts' => [ @@ -294,7 +291,7 @@ define('LAYOUTS', [ '', '', '', - '', + '', ], ], ]); diff --git a/app/Controllers/Admin/Cloudflare/ZoneController.php b/app/Controllers/Admin/Cloudflare/ZoneController.php index 06014ca..e17aa5b 100644 --- a/app/Controllers/Admin/Cloudflare/ZoneController.php +++ b/app/Controllers/Admin/Cloudflare/ZoneController.php @@ -22,7 +22,7 @@ class ZoneController extends CloudflareController $this->class_name .= "Zone"; $this->class_path .= $this->class_name; $this->view_path = strtolower($this->view_root . $this->class_name); - $this->title = lang("{$this->class_path}.title"); + $this->title = lang("{$this->class_path}.title"); helper($this->class_path); } final protected function getModel(): ZoneModel @@ -51,7 +51,7 @@ class ZoneController extends CloudflareController break; case 'type': case 'proxied': - $options[$field] = lang($this->root . 'Record.' . strtoupper($field)); + $options[$field] = lang('Cloudflare/Record.' . strtoupper($field)); break; default: $options = parent::getFormFieldOption($field, $options); @@ -82,11 +82,11 @@ class ZoneController extends CloudflareController } private function init(string $action): void { - $this->action = $action; - $this->fields = [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']; - $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); - $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; - $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->action = $action; + $this->fields = [$this->getModel()::PARENT, 'domains', 'hosts', 'type', 'content', 'proxied']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = [$this->getModel()::PARENT, 'type', 'proxied']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); } //생성 public function create_form(): RedirectResponse|string @@ -149,7 +149,7 @@ class ZoneController extends CloudflareController foreach ($zone_entitys as $zone_entity) { $record = new Record($zone_entity); foreach ($this->formDatas['hosts'] as $host) { - $entity = $record->create($host, $this->formDatas['type'], $this->formDatas['content'], $this->formDatas['proxied']); + $entity = $record->create($host, $this->formDatas['type'], $this->formDatas['content'], $this->formDatas['proxied']); log_message("debug", "Record:{$entity->getTitle()} 작업을 완료하였습니다."); } } @@ -180,9 +180,9 @@ class ZoneController extends CloudflareController //일괄처리작업 public function batcjob(): RedirectResponse { - $this->action = __FUNCTION__; - $this->fields = ['development_mode', 'ipv6', 'security_level']; - $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->action = __FUNCTION__; + $this->fields = ['development_mode', 'ipv6', 'security_level']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); return $this->batcjob_procedure(); } //Sync작업 @@ -221,22 +221,22 @@ class ZoneController extends CloudflareController // 리스트 public function index(): string { - $this->action = __FUNCTION__; - $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at']; - $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); - $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level']; - $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->action = __FUNCTION__; + $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->batchjob_fields = ['development_mode', 'ipv6', 'security_level']; return $this->list_procedure(); } // Download public function download(string $output_type, $uid = false): DownloadResponse|string { - $this->action = __FUNCTION__; - $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at']; - $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); - $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level']; - $this->field_options = $this->getFormFieldOptions($this->filter_fields); + $this->action = __FUNCTION__; + $this->fields = [$this->getModel()::PARENT, $this->getModel()::TITLE, 'name_servers', 'original_name_servers', 'plan', 'development_mode', 'ipv6', 'security_level', 'status', 'updated_at', 'created_at']; + $this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields); + $this->filter_fields = [$this->getModel()::PARENT, 'development_mode', 'ipv6', 'security_level']; + $this->field_options = $this->getFormFieldOptions($this->filter_fields); $this->batchjob_fields = ['development_mode', 'ipv6', 'security_level']; return $this->download_procedure($output_type, $uid); } diff --git a/app/Helpers/Cloudflare/Zone_helper.php b/app/Helpers/Cloudflare/Zone_helper.php index 0ad7d80..6dba563 100644 --- a/app/Helpers/Cloudflare/Zone_helper.php +++ b/app/Helpers/Cloudflare/Zone_helper.php @@ -36,7 +36,7 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas, $form = form_input($field, $value, [ "placeholder" => "예)exmaple.com", "style" => - "width:100%; ::placeholder{color:silver; opacity: 1;}", + "width:100%; ::placeholder{color:silver; opacity: 1;}", "class" => "form-control", (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? "required" : "" ]); @@ -59,7 +59,7 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas, $form = form_input($field, $value, [ "placeholder" => "예)123.123.123.123", "style" => - "width:200px; ::placeholder{color:silver; opacity: 1;}", + "width:200px; ::placeholder{color:silver; opacity: 1;}", "class" => "form-control", (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? "required" : "" ]); @@ -76,7 +76,7 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas, case 'type': //A,AAA... case 'proxied': //CDN사용여부 $form = form_dropdown($field, [ - "" => lang('Admin/Cloudflare/Record.label.' . $field) . ' 선택', + "" => lang('Cloudflare/Record.label.' . $field) . ' 선택', ...$viewDatas['field_options'][$field] ], $value, $extras); break; @@ -90,7 +90,7 @@ function getFieldForm_ZoneHelper(string $field, mixed $value, array $viewDatas, default: $form = form_input($field, $value, [ "style" => - "width:100%;", + "width:100%;", "class" => "form-control", (strpos($viewDatas['field_rules'][$field], 'required') !== false) ? "required" : "" ]); @@ -128,7 +128,7 @@ function getFieldView_ZoneHelper(string $field, array $viewDatas, array $extras ] ) . " " . anchor( - base_url() . $viewDatas['view_root'] . "record?zone_uid=" . $viewDatas['entity']->getPK(), + base_url() . $viewDatas['view_root'] . "record?zone_uid=" . $viewDatas['entity']->getPK(), ICONS["FLAG"], [ "class" => "btn btn-sm btn-primary btn-circle", @@ -181,7 +181,7 @@ function getListLabel_ZoneHelper(string $field, array $viewDatas, array $extras $order_value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; $viewDatas['uri']->addQuery('order_field', $field); $viewDatas['uri']->addQuery('order_value', $order_value); - $label = anchor((string)$viewDatas['uri'], $label); + $label = anchor((string) $viewDatas['uri'], $label); } switch ($field) { case ZoneModel::PARENT: @@ -198,7 +198,7 @@ function getListButton_ZoneHelper(string $action, array $viewDatas, array $extra case 'create': $viewDatas['list_action_url'] = current_url() . '/' . $action . '?' . $viewDatas['uri']->getQuery(['only' => ZoneModel::PARENT]); $extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras]; - $action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras); + $action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras); break; case 'sync': $pk = $viewDatas['entity']->getPK();