cfmgrv4 init...1
This commit is contained in:
parent
36806b0c12
commit
2bbea6a4b0
@ -4,3 +4,7 @@
|
||||
<IfModule !authz_core_module>
|
||||
Deny from all
|
||||
</IfModule>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php/$1 [L]
|
||||
@ -22,15 +22,15 @@ $routes->group('cli', ['namespace' => 'App\CLI'], function ($routes) {
|
||||
$routes->cli('reload', 'Cloudflare::reload');
|
||||
});
|
||||
});
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($routes) {
|
||||
$routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:manager'], function ($routes) {
|
||||
$routes->get('/', 'Home::index');
|
||||
$routes->group('user', function ($routes) {
|
||||
$routes->get('/', 'UserController::index');
|
||||
$routes->get('create', 'UserController::create_form');
|
||||
$routes->post('create', 'UserController::create');
|
||||
$routes->get('create', 'UserController::create_form', ['filter' => 'authFilter:master']);
|
||||
$routes->post('create', 'UserController::create', ['filter' => 'authFilter:master']);
|
||||
$routes->get('modify/(:num)', 'UserController::modify_form/$1');
|
||||
$routes->post('modify/(:num)', 'UserController::modify/$1');
|
||||
$routes->get('delete/(:num)', 'UserController::delete/$1');
|
||||
$routes->get('delete/(:num)', 'UserController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:num)/(:any)', 'UserController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'UserController::batcjob');
|
||||
$routes->get('download/(:alpha)', 'UserController::download/$1');
|
||||
@ -52,7 +52,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
|
||||
$routes->get('create', 'AuthController::create_form');
|
||||
$routes->post('create', 'AuthController::create');
|
||||
$routes->get('modify/(:num)', 'AuthController::modify_form/$1');
|
||||
$routes->get('delete/(:num)', 'AuthController::delete/$1');
|
||||
$routes->get('delete/(:num)', 'AuthController::delete/$1', ['filter' => 'authFilter:master']);
|
||||
$routes->get('toggle/(:num)/(:any)', 'AuthController::toggle/$1/$2');
|
||||
$routes->post('batchjob', 'AuthController::batcjob');
|
||||
$routes->get('download/(:alpha)', 'AccountController::download/$1');
|
||||
|
||||
@ -14,6 +14,6 @@ abstract class AdminController extends MVController
|
||||
parent::initController($request, $response, $logger);
|
||||
$this->layout = "admin";
|
||||
$this->view_root .= "admin/";
|
||||
$this->action_form = FORMS['MODAL'];
|
||||
$this->action_form = FORMS['IFRAME'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class AccountController extends CloudflareController
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = ['typep', 'status'];
|
||||
$this->batchjob_fields = ['type', 'status'];
|
||||
return $this->list_procedure();
|
||||
}
|
||||
// Download
|
||||
@ -72,7 +72,7 @@ class AccountController extends CloudflareController
|
||||
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
|
||||
$this->filter_fields = [$this->getModel()::PARENT, 'type', 'status'];
|
||||
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
|
||||
$this->batchjob_fields = ['typep', 'status'];
|
||||
$this->batchjob_fields = ['type', 'status'];
|
||||
return $this->download_procedure($output_type, $uid);
|
||||
}
|
||||
//reload Account By Auth
|
||||
|
||||
@ -45,7 +45,7 @@ class AuthController extends CloudflareController
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->create_procedure($this->action_form);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정
|
||||
public function modify_form(string $uid): RedirectResponse|string
|
||||
@ -56,7 +56,7 @@ class AuthController extends CloudflareController
|
||||
public function modify(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->modify_procedure($uid, $this->action_form);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
|
||||
@ -59,10 +59,9 @@ abstract class CloudflareController extends AdminController
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->sync_process($uid);
|
||||
$message = "Sync 작업을 완료하였습니다.";
|
||||
log_message("notice", $message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $message);
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", $this->message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -80,10 +79,9 @@ abstract class CloudflareController extends AdminController
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->reload_process($uid);
|
||||
$message = "Reload 작업을 완료하였습니다.";
|
||||
log_message("notice", $message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $message);
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", $this->message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
|
||||
@ -110,11 +110,12 @@ class RecordController extends CloudflareController
|
||||
$entity = $this->getMyLibrary()->create($host, $this->formDatas['type'], $this->formDatas['content'], $this->formDatas['proxied']);
|
||||
log_message("debug", "Record:{$entity->getTitle()} 생성 작업을 완료하였습니다.");
|
||||
}
|
||||
$this->message = "Record {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
public function create(mixed $zone_uid = false): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->create_procedure($this->action_form);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
protected function modify_process(string $uid): void
|
||||
@ -136,15 +137,7 @@ class RecordController extends CloudflareController
|
||||
//Socket처리
|
||||
$entity = $this->getMyLibrary()->modify($this->entity, $this->formDatas);
|
||||
}
|
||||
log_message("debug", "Record:{$entity->getTitle()} 수정 작업을 완료하였습니다.");
|
||||
}
|
||||
//단일필드작업
|
||||
public function toggle(string $uid, string $field): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = [$field];
|
||||
$this->modify_process($uid);
|
||||
return $this->modify_procedure($uid);
|
||||
$this->message = "Record:{$entity->getTitle()} {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
@ -166,6 +159,7 @@ class RecordController extends CloudflareController
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->getMyLibrary()->sync($this->entity);
|
||||
$this->message = "Record:{$this->entity->getTitle()} {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
public function sync(string $uid): RedirectResponse
|
||||
{
|
||||
@ -184,6 +178,7 @@ class RecordController extends CloudflareController
|
||||
$this->_zone_entity = $this->getZoneModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
|
||||
//Cloudflare 삭제
|
||||
$this->getMyLibrary()->delete($this->entity);
|
||||
$this->message = "Record:{$this->entity->getTitle()} {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
|
||||
@ -153,11 +153,12 @@ class ZoneController extends CloudflareController
|
||||
log_message("debug", "Record:{$entity->getTitle()} 작업을 완료하였습니다.");
|
||||
}
|
||||
}
|
||||
$this->message = "Zone {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->create_procedure($this->action_form);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정 (modify,toggle,batchjob사용)
|
||||
protected function modify_process(string $uid): void
|
||||
@ -174,7 +175,7 @@ class ZoneController extends CloudflareController
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
|
||||
//Socket처리
|
||||
$entity = $this->getMyLibrary()->modify($this->entity, $this->formDatas);
|
||||
log_message("debug", "Zone:{$entity->getTitle()} 수정 작업을 완료하였습니다.");
|
||||
$this->message = "Zone:{$entity->getTitle()} {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
@ -196,6 +197,7 @@ class ZoneController extends CloudflareController
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->entity->getParent());
|
||||
//Socket처리
|
||||
$this->getMyLibrary()->sync($this->entity);
|
||||
$this->message = "Zone:{$this->entity->getTitle()} {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
public function sync(string $uid): RedirectResponse
|
||||
{
|
||||
@ -214,6 +216,7 @@ class ZoneController extends CloudflareController
|
||||
$this->_account_entity = $this->getAccountModel()->getEntityByPK($this->formDatas[$this->getModel()::PARENT]);
|
||||
//Cloudflare 삭제
|
||||
$this->getMyLibrary()->delete($this->entity);
|
||||
$this->message = "Zone:{$this->entity->getTitle()} {$this->action} 작업을 완료하였습니다.";
|
||||
}
|
||||
// 리스트
|
||||
public function index(): string
|
||||
|
||||
@ -86,7 +86,7 @@ class MapurlController extends AdminController
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->create_procedure($this->action_form);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정
|
||||
public function modify_form(string $uid): RedirectResponse|string
|
||||
@ -103,7 +103,7 @@ class MapurlController extends AdminController
|
||||
public function modify(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->modify_procedure($uid, $this->action_form);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
public function batcjob(): RedirectResponse
|
||||
|
||||
@ -85,7 +85,7 @@ class UserController extends AdminController
|
||||
public function create(): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->create_procedure($this->action_form);
|
||||
return $this->create_procedure();
|
||||
}
|
||||
//수정
|
||||
public function modify_form(string $uid): RedirectResponse|string
|
||||
@ -96,7 +96,7 @@ class UserController extends AdminController
|
||||
public function modify(string $uid): RedirectResponse|string
|
||||
{
|
||||
$this->init(__FUNCTION__);
|
||||
return $this->modify_procedure($uid, $this->action_form);
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄작업
|
||||
public function batcjob(): RedirectResponse
|
||||
|
||||
@ -111,9 +111,9 @@ abstract class MVController extends CommonController
|
||||
$this->create_validate($this->action, $this->fields);
|
||||
$this->formDatas = $this->getFormDatas();
|
||||
$this->entity = $this->getModel()->create(formDatas: $this->formDatas);
|
||||
$this->message = "입력작업이 완료되었습니다.";
|
||||
$this->message = "{$this->action} 작업이 완료되었습니다.";
|
||||
}
|
||||
final protected function create_procedure(string $action_form = "default"): RedirectResponse|string
|
||||
final protected function create_procedure(): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getModel()->transStart();
|
||||
@ -121,12 +121,12 @@ abstract class MVController extends CommonController
|
||||
$this->create_process();
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", __FUNCTION__ . $this->message);
|
||||
switch ($action_form) {
|
||||
switch ($this->action_form) {
|
||||
case FORMS['MODAL']:
|
||||
$result = view("templates/{$this->layout}/{$action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
$result = view("templates/{$this->layout}/{$action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||
@ -188,9 +188,9 @@ abstract class MVController extends CommonController
|
||||
throw new \Exception(__FUNCTION__, " => {$uid} 정보를 찾을수 없습니다.");
|
||||
}
|
||||
$this->entity = $this->getModel()->modify($this->entity, $this->formDatas);
|
||||
$this->message = "수정작업이 완료되었습니다.";
|
||||
$this->message = "{$this->action} 작업이 완료되었습니다.";
|
||||
}
|
||||
final protected function modify_procedure(string $uid, string $action_form = "default"): RedirectResponse|string
|
||||
final protected function modify_procedure(string $uid): RedirectResponse|string
|
||||
{
|
||||
//Transaction Start
|
||||
$this->getModel()->transStart();
|
||||
@ -198,12 +198,12 @@ abstract class MVController extends CommonController
|
||||
$this->modify_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", __FUNCTION__ . $this->message);
|
||||
switch ($action_form) {
|
||||
switch ($this->action_form) {
|
||||
case FORMS['MODAL']:
|
||||
$result = view("templates/{$this->layout}/{$action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
case FORMS['IFRAMEE']:
|
||||
$result = view("templates/{$this->layout}/{$action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
case FORMS['IFRAME']:
|
||||
$result = view("templates/{$this->layout}/{$this->action_form}_close", data: ['viewDatas' => $this->getViewDatas()]);
|
||||
break;
|
||||
default:
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||
@ -220,13 +220,6 @@ abstract class MVController extends CommonController
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
//단일필드작업
|
||||
public function toggle(string $uid, string $field): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = [$field];
|
||||
return $this->modify_procedure($uid);
|
||||
}
|
||||
//일괄처리작업
|
||||
final protected function batcjob_procedure(): RedirectResponse
|
||||
{
|
||||
@ -242,9 +235,30 @@ abstract class MVController extends CommonController
|
||||
$this->modify_process($uid);
|
||||
}
|
||||
$this->getModel()->transCommit();
|
||||
$message = "일괄처리 작업을 완료하였습니다.";
|
||||
log_message("notice", $message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $message);
|
||||
log_message("notice", $this->message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
$this->getModel()->transRollback();
|
||||
log_message("error", $e->getMessage());
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage());
|
||||
$this->session->keepFlashdata(SESSION_NAMES['RETURN_URL']);
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
//단일필드작업
|
||||
final public function toggle(string $uid, string $field): RedirectResponse
|
||||
{
|
||||
$this->action = __FUNCTION__;
|
||||
$this->fields = [$field];
|
||||
//Transaction Start
|
||||
$this->getModel()->transStart();
|
||||
try {
|
||||
$this->modify_process($uid);
|
||||
$this->getModel()->transCommit();
|
||||
log_message("notice", $this->message);
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_MSG'], $this->message);
|
||||
return redirect()->to($this->session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/");
|
||||
} catch (\Exception $e) {
|
||||
//Transaction Rollback
|
||||
@ -376,7 +390,7 @@ abstract class MVController extends CommonController
|
||||
//모델 처리
|
||||
$this->entitys = $this->list_entitys_process();
|
||||
//setting return_url to session flashdata
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->uri->getQuery() ?: "");
|
||||
$this->session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . $this->uri->getQuery() ? "?" . $this->uri->getQuery() : "");
|
||||
return view(
|
||||
$this->view_path . "/index",
|
||||
['viewDatas' => $this->getViewDatas()]
|
||||
|
||||
@ -41,7 +41,6 @@ class AuthFilter implements FilterInterface
|
||||
);
|
||||
}
|
||||
} else {
|
||||
dd(session()->get(SESSION_NAMES['AUTH']));
|
||||
session()->setFlashdata(SESSION_NAMES['RETURN_URL'], $request->getUri()->getPath() . '?' . $request->getUri()->getQuery());
|
||||
return redirect()->to(URLS['LOGIN'])->with('return_message', '로그인을하셔야합니다.');
|
||||
}
|
||||
|
||||
@ -144,44 +144,13 @@ function getListLabel_AccountHelper(string $field, array $viewDatas, array $extr
|
||||
}
|
||||
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
|
||||
}
|
||||
function getListButtonLabel_AccountHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$label = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
if ($action == 'create') {
|
||||
$label = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras,
|
||||
]);
|
||||
} else {
|
||||
$label = "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$label = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
function getListButton_AccountHelper(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '?' . $viewDatas['uri']->getQuery(['only' => AccountModel::PARENT]);
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = getListButtonLabel_AccountHelper($action, '입력', $viewDatas, $extras);
|
||||
$action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras);
|
||||
break;
|
||||
case 'sync':
|
||||
$action = $viewDatas['cnt'];
|
||||
|
||||
@ -111,44 +111,13 @@ function getListLabel_AuthHelper(string $field, array $viewDatas, array $extras
|
||||
}
|
||||
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
|
||||
}
|
||||
function getListButtonLabel_AuthHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$label = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
if ($action == 'create') {
|
||||
$label = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras,
|
||||
]);
|
||||
} else {
|
||||
$label = "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$label = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
function getListButton_AuthHelper(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action;
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = getListButtonLabel_AuthHelper($action, '입력', $viewDatas, $extras);
|
||||
$action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras);
|
||||
break;
|
||||
case 'modify':
|
||||
$pk = $viewDatas['entity']->getPK();
|
||||
@ -160,7 +129,7 @@ function getListButton_AuthHelper(string $action, array $viewDatas, array $extra
|
||||
"checked" => in_array($pk, old("batchjob_uids", []))
|
||||
]);
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
|
||||
$action = $checkbox . getListButtonLabel_AuthHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
|
||||
$action = $checkbox . getListButtonLabel_CommonHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
|
||||
break;
|
||||
case 'delete':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
|
||||
|
||||
@ -160,68 +160,13 @@ function getListLabel_RecordHelper(string $field, array $viewDatas, array $extra
|
||||
}
|
||||
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
|
||||
}
|
||||
function getListButtonLabel_RecordHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$value = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
$value = "";
|
||||
break;
|
||||
default:
|
||||
$value = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'modify':
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$value = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
$value = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
$value = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
function getListButton_RecordHelper(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '?' . $viewDatas['uri']->getQuery(['only' => RecordModel::PARENT]);
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = getListButtonLabel_RecordHelper($action, '입력', $viewDatas, $extras);
|
||||
$action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras);
|
||||
break;
|
||||
case 'sync':
|
||||
$checkbox = "";
|
||||
|
||||
@ -192,68 +192,13 @@ function getListLabel_ZoneHelper(string $field, array $viewDatas, array $extras
|
||||
}
|
||||
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
|
||||
}
|
||||
function getListButtonLabel_ZoneHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$value = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
$value = "";
|
||||
break;
|
||||
default:
|
||||
$value = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'modify':
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$value = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
$value = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
$value = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
function getListButton_ZoneHelper(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
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_ZoneHelper($action, '입력', $viewDatas, $extras);
|
||||
$action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras);
|
||||
break;
|
||||
case 'sync':
|
||||
$pk = $viewDatas['entity']->getPK();
|
||||
|
||||
@ -222,3 +222,31 @@ function form_dropdown_test($data = '', $options = [], $selected = [], $extra =
|
||||
|
||||
return $form . "</select>\n";
|
||||
}
|
||||
|
||||
function getListButtonLabel_CommonHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$label = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
$label = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras,
|
||||
]);
|
||||
break;
|
||||
default:
|
||||
$label = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
|
||||
@ -116,44 +116,13 @@ function getListLabel_MapurlHelper(string $field, array $viewDatas, array $extra
|
||||
}
|
||||
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
|
||||
}
|
||||
function getListButtonLabel_MapurlHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$label = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
if ($action == 'create') {
|
||||
$label = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras,
|
||||
]);
|
||||
} else {
|
||||
$label = "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$label = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
function getListButton_MapurlHelper(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action;
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = getListButtonLabel_MapurlHelper($action, '입력', $viewDatas, $extras);
|
||||
$action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras);
|
||||
break;
|
||||
case 'modify':
|
||||
$pk = $viewDatas['entity']->getPK();
|
||||
@ -165,7 +134,7 @@ function getListButton_MapurlHelper(string $action, array $viewDatas, array $ext
|
||||
"checked" => in_array($pk, old("batchjob_uids", []))
|
||||
]);
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
|
||||
$action = $checkbox . getListButtonLabel_MapurlHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
|
||||
$action = $checkbox . getListButtonLabel_CommonHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
|
||||
break;
|
||||
case 'delete':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
|
||||
|
||||
@ -142,44 +142,13 @@ function getListLabel_UserHelper(string $field, array $viewDatas, array $extras
|
||||
}
|
||||
return sprintf("<th %s>%s</th>", implode(" ", $extras), $label);
|
||||
}
|
||||
function getListButtonLabel_UserHelper(string $action, string $label, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($viewDatas['action_form']) {
|
||||
case FORMS['MODAL']:
|
||||
$label = form_label(
|
||||
$label,
|
||||
"",
|
||||
[
|
||||
"data-src" => $viewDatas['list_action_url'],
|
||||
"data-bs-toggle" => "modal",
|
||||
"data-bs-target" => "#index_action_form",
|
||||
...$extras
|
||||
]
|
||||
);
|
||||
break;
|
||||
case FORMS['IFRAME']:
|
||||
if ($action == 'create') {
|
||||
$label = form_label($label, "", [
|
||||
"onClick" => "changeIframe_src('{$viewDatas['list_action_url']}')",
|
||||
...$extras,
|
||||
]);
|
||||
} else {
|
||||
$label = "";
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$label = anchor($viewDatas['list_action_url'], $label, $extras);
|
||||
break;
|
||||
}
|
||||
return $label;
|
||||
}
|
||||
function getListButton_UserHelper(string $action, array $viewDatas, array $extras = []): string
|
||||
{
|
||||
switch ($action) {
|
||||
case 'create':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action;
|
||||
$extras = ["class" => "btn btn-outline btn-primary btn-circle", "target" => "_self", ...$extras];
|
||||
$action = getListButtonLabel_UserHelper($action, '입력', $viewDatas, $extras);
|
||||
$action = getListButtonLabel_CommonHelper($action, '입력', $viewDatas, $extras);
|
||||
break;
|
||||
case 'modify':
|
||||
$pk = $viewDatas['entity']->getPK();
|
||||
@ -190,9 +159,8 @@ function getListButton_UserHelper(string $action, array $viewDatas, array $extra
|
||||
"class" => "batchjobuids_checkboxs",
|
||||
"checked" => in_array($pk, old("batchjob_uids", []))
|
||||
]);
|
||||
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
|
||||
$action = $checkbox . getListButtonLabel_UserHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
|
||||
$action = $checkbox . getListButtonLabel_CommonHelper($action, $viewDatas['cnt'], $viewDatas, $extras);
|
||||
break;
|
||||
case 'delete':
|
||||
$viewDatas['list_action_url'] = current_url() . '/' . $action . '/' . $viewDatas['entity']->getPK();
|
||||
|
||||
@ -16,14 +16,11 @@ class CloudflareSocket extends MySocket
|
||||
parent::__construct([
|
||||
'base_uri' => 'https://api.cloudflare.com/client/v4/',
|
||||
'headers' => [
|
||||
'X-Auth-Email' => $auth_entity->getID(), // 인증 토큰 사용
|
||||
'X-Auth-Key' => $auth_entity->getAuthKey(), // 인증 토큰 사용
|
||||
'X-Auth-Email' => $auth_entity->getID(),
|
||||
'X-Auth-Key' => $auth_entity->getAuthKey(),
|
||||
'Content-Type' => 'application/json',
|
||||
]
|
||||
]);
|
||||
self::$_request_max = getenv("cfmgr.request.max") ?: 1000;
|
||||
self::$_request_perpage_max = getenv("cfmgr.request.perpage.max") ?: 700;
|
||||
self::$_request_timewait = getenv("cfmgr.request.timewait") ?: 60;
|
||||
}
|
||||
|
||||
final public function request(string $method, $uri = '', array $options = []): ResponseInterface
|
||||
|
||||
@ -22,19 +22,20 @@
|
||||
<ul class="nav justify-content-end">
|
||||
<li class="nav-item">
|
||||
<?php if ($viewDatas['session']->get(SESSION_NAMES['ISLOGIN'])): ?>
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<?= ICONS['LOGIN'] . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['name'] ?>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<b><?= ICONS['LOGIN'] . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['name'] ?></b>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item"
|
||||
href="/user/modify/<?= $viewDatas['session']->get(SESSION_NAMES['AUTH'])['uid'] ?>"><?= ICONS['SETUP'] ?>수정</a>
|
||||
</li>
|
||||
<?php $viewDatas['list_action_url'] = "/admin/user/modify/" . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['uid'] ?>
|
||||
<li><?= getListButtonLabel_CommonHelper("modify", ICONS['SETUP'] . "정보수정", $viewDatas, ["class" => "dropdown-item"]) ?></li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="<?= URLS['LOGOUT'] ?>"><?= ICONS['LOGOUT'] ?>Logout</a></li>
|
||||
</ul>
|
||||
<?php else: ?><a class="nav-link dropdown-toggle" href="<?= URLS['LOGIN'] ?>"
|
||||
role="button"><?= ICONS['LOGIN'] ?>Login</a><?php endif ?>
|
||||
</div>
|
||||
<?php else: ?><a class="nav-link dropdown-toggle" href="<?= URLS['LOGIN'] ?>" role="button"><?= ICONS['LOGIN'] ?>Login</a><?php endif ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@ -22,18 +22,19 @@
|
||||
<ul class="nav justify-content-end">
|
||||
<li class="nav-item">
|
||||
<?php if ($viewDatas['session']->get(SESSION_NAMES['ISLOGIN'])): ?>
|
||||
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<?= ICONS['LOGIN'] . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['name'] ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><a class="dropdown-item"
|
||||
href="/user/modify/<?= $viewDatas['session']->get(SESSION_NAMES['AUTH'])['uid'] ?>"><?= ICONS['SETUP'] ?>수정</a>
|
||||
</li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="<?= URLS['LOGOUT'] ?>"><?= ICONS['LOGOUT'] ?>Logout</a></li>
|
||||
</ul>
|
||||
<div class="btn-group">
|
||||
<button type="button" class="btn btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<b><?= ICONS['LOGIN'] . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['name'] ?></b>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<?php $viewDatas['list_action_url'] = "/admin/user/modify/" . $viewDatas['session']->get(SESSION_NAMES['AUTH'])['uid'] ?>
|
||||
<li><?= getListButtonLabel_CommonHelper("modify", ICONS['SETUP'] . "정보수정", $viewDatas, ["class" => "dropdown-item"]) ?></li>
|
||||
<li>
|
||||
<hr class="dropdown-divider">
|
||||
</li>
|
||||
<li><a class="dropdown-item" href="<?= URLS['LOGOUT'] ?>"><?= ICONS['LOGOUT'] ?>Logout</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php else: ?><a class="nav-link dropdown-toggle" href="<?= URLS['LOGIN'] ?>"
|
||||
role="button"><?= ICONS['LOGIN'] ?>Login</a><?php endif ?>
|
||||
</li>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user