cfmgrv4 init...1

This commit is contained in:
최준흠 2024-10-03 16:15:28 +09:00
parent cf0d205f75
commit 2b5c8de10a
18 changed files with 243 additions and 45 deletions

View File

@ -62,7 +62,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
$routes->group('zone', function ($routes) {
$routes->get('/', 'ZoneController::index');
$routes->get('create', 'ZoneController::create_form');
$routes->post('create/(:uuid)', 'ZoneController::create/$1');
$routes->post('create', 'ZoneController::create');
$routes->get('delete/(:uuid)', 'ZoneController::delete/$1');
$routes->get('toggle/(:uuid)/(:alpha)', 'ZoneController::toggle/$1/$2');
$routes->post('batchjob', 'ZoneController::batcjob');
@ -72,7 +72,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin'], function ($rou
$routes->group('record', function ($routes) {
$routes->get('/', 'RecordController::index');
$routes->get('create', 'RecordController::create_form');
$routes->post('create/(:uuid)', 'RecordController::create/$1');
$routes->post('create)', 'RecordController::create');
$routes->get('delete/(:uuid)', 'RecordController::delete/$1');
$routes->get('toggle/(:uuid)/(:alpha)', 'RecordController::toggle/$1/$2');
$routes->post('batchjob', 'RecordController::batcjob');

View File

@ -2,13 +2,14 @@
namespace App\Controllers\Admin\Cloudflare;
use Psr\Log\LoggerInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\RedirectResponse;
use App\Models\Cloudflare\AccountModel;
use App\Libraries\MySocket\Cloudflare\ZoneSocket;
use App\Libraries\MySocket\Cloudflare\AccountSocket;
use App\Libraries\MySocket\Cloudflare\ZoneSocket;
use App\Models\Cloudflare\AccountModel;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class AccountController extends CloudflareController
{
@ -63,6 +64,17 @@ class AccountController extends CloudflareController
$this->batchjob_fields = ['typep', 'status'];
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, 'type', 'status', 'updated_at', 'created_at'];
$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'];
return $this->download_procedure($output_type, $uid);
}
//Zone Reload By Account
protected function reload_process(): void
{

View File

@ -2,12 +2,13 @@
namespace App\Controllers\Admin\Cloudflare;
use Psr\Log\LoggerInterface;
use CodeIgniter\HTTP\ResponseInterface;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\RedirectResponse;
use App\Models\Cloudflare\AuthModel;
use App\Libraries\MySocket\Cloudflare\AccountSocket;
use App\Models\Cloudflare\AuthModel;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
class AuthController extends CloudflareController
{
@ -30,7 +31,7 @@ class AuthController extends CloudflareController
private function init(string $action): void
{
$this->action = $action;
$this->fields = [$this->getModel()::TITLE, 'authkey'];
$this->fields = [$this->getModel()::TITLE, 'authkey', 'status'];
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = ['status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
@ -76,6 +77,17 @@ class AuthController extends CloudflareController
$this->batchjob_fields = ['status'];
return $this->list_procedure();
}
// Download
public function download(string $output_type, $uid = false): DownloadResponse|string
{
$this->action = __FUNCTION__;
$this->fields = [$this->getModel()::TITLE, 'oldkey', 'status', 'updated_at', 'created_at'];
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = ['status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = ['status'];
return $this->download_procedure($output_type, $uid);
}
//Account Reload by Auth
protected function reload_process(): void
{

View File

@ -4,6 +4,7 @@ namespace App\Controllers\Admin\Cloudflare;
use App\Libraries\MySocket\Cloudflare\RecordSocket;
use App\Models\Cloudflare\RecordModel;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -158,4 +159,15 @@ class RecordController extends CloudflareController
$this->batchjob_fields = ['proxied'];
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, 'type', 'content', 'ttl', 'proxied', 'locked', 'updated_at', 'created_at'];
$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->batchjob_fields = ['proxied'];
return $this->download_procedure($output_type, $uid);
}
}

View File

@ -5,6 +5,7 @@ namespace App\Controllers\Admin\Cloudflare;
use App\Libraries\MySocket\Cloudflare\RecordSocket;
use App\Libraries\MySocket\Cloudflare\ZoneSocket;
use App\Models\Cloudflare\ZoneModel;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
@ -201,6 +202,17 @@ class ZoneController extends CloudflareController
$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->batchjob_fields = ['development_mode', 'ipv6', 'security_level'];
return $this->download_procedure($output_type, $uid);
}
//reload Record By Zone
protected function reload_process(): void
{

View File

@ -3,8 +3,9 @@
namespace App\Controllers\Admin;
use App\Models\MapurlModel;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\DownloadResponse;
use CodeIgniter\HTTP\RedirectResponse;
use CodeIgniter\HTTP\RequestInterface;
use CodeIgniter\HTTP\ResponseInterface;
use Psr\Log\LoggerInterface;
@ -128,4 +129,16 @@ class MapurlController extends AdminController
$this->batchjob_fields = ['status'];
return $this->list_procedure();
}
// Download
public function download(string $output_type, $uid = false): DownloadResponse|string
{
$this->action = __FUNCTION__;
$this->fields = [$this->getModel()::TITLE, 'newurl', 'status'];
$this->field_rules = $this->getModel()->getFieldRules($this->action, $this->fields);
$this->filter_fields = ['status'];
$this->field_options = $this->getFormFieldOptions($this->filter_fields);
$this->batchjob_fields = ['status'];
return $this->download_procedure($output_type, $uid);
}
}

View File

@ -429,7 +429,7 @@ abstract class MVController extends CommonController
// string buffer에서 읽어오는 경우
$this->entitys = $this->list_entitys_process();
$html = view(
strtolower($this->class_path) . DIRECTORY_SEPARATOR . $this->action,
'templates' . DIRECTORY_SEPARATOR . $this->action,
['viewDatas' => $this->getViewDatas()]
);
//data loading

View File

@ -106,16 +106,16 @@ function getFieldView_AccountHelper(string $field, AccountEntity $entity, array
$value = $value ? date("Y-m-d", strtotime($value)) : "";
break;
default:
if (in_array($field, $viewDatas['filter_fields']) && $value) {
$extras["onChange"] = sprintf(
'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
current_url(),
$entity->getPK(),
$field,
$field
);
$value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras);
}
// if (in_array($field, $viewDatas['filter_fields']) && $value) {
// $extras["onChange"] = sprintf(
// 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value',
// current_url(),
// $entity->getPK(),
// $field,
// $field
// );
// $value = getFieldForm_AccountHelper($field, $entity->$field, $viewDatas, $extras);
// }
break;
}
return $value;

View File

@ -88,6 +88,53 @@ function getFieldView_AuthHelper(string $field, AuthEntity $entity, array $viewD
}
return $value;
} //
function getListAction_AuthHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$cnt,
"",
[
"data-src" => $url,
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($cnt, "", [
"onClick" => "changeIframe_src('{$url}')",
...$extras
]);
break;
default:
$value = anchor($url, $cnt, $extras);
break;
}
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_AuthHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_AuthHelper($field, $viewDatas, $extras);

View File

@ -118,6 +118,34 @@ function getFieldView_RecordHelper(string $field, RecordEntity $entity, array $v
}
return $value;
} //
function getListAction_RecordHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'sync':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = "";
if ($entity->fixed == 'off' && $entity->type == 'A') {
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs",
]);
}
$url = current_url() . '/' . $action . '/' . $entity->getPK();
$value = anchor($url, $cnt, $extras);
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_RecordHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_RecordHelper($field, $viewDatas, $extras);

View File

@ -146,6 +146,31 @@ function getFieldView_ZoneHelper(string $field, ZoneEntity $entity, array $viewD
}
return $value;
} //
function getListAction_ZoneHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'sync':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs",
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
$value = anchor($url, $cnt, $extras);
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_ZoneHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_ZoneHelper($field, $viewDatas, $extras);

View File

@ -82,6 +82,53 @@ function getFieldView_MapurlHelper(string $field, MapurlEntity $entity, array $v
}
return $value;
} //
function getListAction_MapurlHelper(string $action, $entity, array $viewDatas, array $extras = []): string
{
switch ($action) {
case 'modify':
$cnt = $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $extras['cnt']);
$checkbox = form_checkbox([
"id" => "checkbox_uid_{$entity->getPK()}",
"name" => "batchjob_uids[]",
"value" => $entity->getPK(),
"class" => "batchjobuids_checkboxs"
]);
$url = current_url() . '/' . $action . '/' . $entity->getPK();
switch ($viewDatas['action_form']) {
case FORMS['MODAL']:
$value = form_label(
$cnt,
"",
[
"data-src" => $url,
"data-bs-toggle" => "modal",
"data-bs-target" => "#index_action_form",
...$extras
]
);
break;
case FORMS['IFRAME']:
$value = form_label($cnt, "", [
"onClick" => "changeIframe_src('{$url}')",
...$extras
]);
break;
default:
$value = anchor($url, $cnt, $extras);
break;
}
$result = $checkbox . $value;
break;
case 'delete':
$result = anchor(
current_url() . '/delete/' . $entity->getPK(),
ICONS['DELETE'],
["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self", ...$extras]
);
break;
}
return $result;
}
function getListColumns_MapurlHelper(string $field, array $viewDatas, array $extras = []): string
{
$label = getFieldLabel_MapurlHelper($field, $viewDatas, $extras);

View File

@ -19,16 +19,13 @@
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<span data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/modify/' . $entity->getPK() ?>" style="cursor:pointer;">
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</span>
<?= getListAction_AuthHelper('modify', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_AuthHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?= getListAction_AuthHelper('delete', $entity, $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>

View File

@ -20,16 +20,13 @@
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->locked != 'on' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap">
<?php if ($entity->fixed == 'off' && $entity->type == 'A') : ?>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?php endif ?>
<?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<?= getListAction_RecordHelper('sync', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_RecordHelper($field, $entity, $viewDatas, ['old_zone' => $old_zone]) ?></td>
<?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?= getListAction_RecordHelper('delete', $entity, $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>

View File

@ -20,14 +20,13 @@
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != 'active' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/sync/' . $entity->getPK(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?>
<?= getListAction_ZoneHelper('sync', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_ZoneHelper($field, $entity, $viewDatas, ['old_account' => $old_account]) ?></td>
<?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?= getListAction_ZoneHelper('delete', $entity, $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>

View File

@ -19,16 +19,13 @@
<?php foreach ($viewDatas['entitys'] as $entity): ?>
<tr id="<?= $entity->getPK() ?>" <?= $entity->status != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?>>
<td class="text-center text-wrap">
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPK()}", "name" => "batchjob_uids[]", "value" => $entity->getPK(), "class" => "batchjobuids_checkboxs"]); ?>
<span data-bs-toggle="modal" data-bs-target="#index_action_form" data-src="<?= current_url() . '/modify/' . $entity->getPK() ?>" style="cursor:pointer;">
<?= $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt) ?>
</span>
<?= getListAction_MapurlHelper('modify', $entity, $viewDatas, ["cnt" => $cnt, "style" => "cursor:pointer"]) ?>
</td>
<?php foreach ($viewDatas['fields'] as $field): ?>
<td><?= getFieldView_MapurlHelper($field, $entity, $viewDatas) ?></td>
<?php endforeach ?>
<td>
<?= anchor(current_url() . '/delete/' . $entity->getPK(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
<?= getListAction_MapurlHelper('delete', $entity, $viewDatas) ?>
</td>
</tr>
<?php $cnt++ ?>

View File

@ -263,7 +263,7 @@ case 'http://19hey.com': window.location.href='http://1004eve.com'; break;
case 'http://19hun.com': window.location.href='http://1004eve.com'; break;
case 'http://19hunt.com': window.location.href='https://twitter.com/_19hunter'; break;
case 'http://19hunter.com': window.location.href='https://twitter.com/_19hunter'; break;
case 'http://19hunters.com': window.location.href='https://twitter.com/_19hunter'; break;
case 'http://19hunters.com': window.location.href='https://twitter.com/_19hunter333'; break;
case 'http://19hunts.com': window.location.href='https://twitter.com/_19hunter'; break;
case 'http://19kor.com': window.location.href='https://twitter.com/_19hunter'; break;
case 'http://19mini.com': window.location.href='https://twitter.com/_19hunter'; break;