This commit is contained in:
Dennis Eichhorn 2022-12-10 22:17:54 +01:00
parent 59a4a3271c
commit bf5eb7afe5
11 changed files with 59 additions and 29 deletions

View File

@ -19,7 +19,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Groups", "name": "Groups",
"uri": "{/prefix}admin/group/list", "uri": "{/lang}/{/app}/admin/group/list",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 2, "order": 2,
@ -33,7 +33,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "List", "name": "List",
"uri": "{/prefix}admin/group/list", "uri": "{/lang}/{/app}/admin/group/list",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -48,7 +48,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Create", "name": "Create",
"uri": "{/prefix}admin/group/create?{?}", "uri": "{/lang}/{/app}/admin/group/create?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -65,7 +65,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Accounts", "name": "Accounts",
"uri": "{/prefix}admin/account/list", "uri": "{/lang}/{/app}/admin/account/list",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 4, "order": 4,
@ -79,7 +79,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "List", "name": "List",
"uri": "{/prefix}admin/account/list", "uri": "{/lang}/{/app}/admin/account/list",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -94,7 +94,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Create", "name": "Create",
"uri": "{/prefix}admin/account/create?{?}", "uri": "{/lang}/{/app}/admin/account/create?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -111,7 +111,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Modules", "name": "Modules",
"uri": "{/prefix}admin/module/list", "uri": "{/lang}/{/app}/admin/module/list",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -125,7 +125,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Info", "name": "Info",
"uri": "{/prefix}admin/module/info?{?}", "uri": "{/lang}/{/app}/admin/module/info?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -140,7 +140,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Settings", "name": "Settings",
"uri": "{/prefix}admin/module/settings?{?}", "uri": "{/lang}/{/app}/admin/module/settings?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -155,7 +155,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Routes", "name": "Routes",
"uri": "{/prefix}admin/module/route/list?{?}", "uri": "{/lang}/{/app}/admin/module/route/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 15, "order": 15,
@ -170,7 +170,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Hooks", "name": "Hooks",
"uri": "{/prefix}admin/module/hook/list?{?}", "uri": "{/lang}/{/app}/admin/module/hook/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 15, "order": 15,
@ -185,7 +185,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Log", "name": "Log",
"uri": "{/prefix}admin/module/log?{?}", "uri": "{/lang}/{/app}/admin/module/log?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 20, "order": 20,

View File

@ -69,7 +69,9 @@ use phpOMS\System\SystemType;
use phpOMS\System\SystemUtils; use phpOMS\System\SystemUtils;
use phpOMS\Uri\HttpUri; use phpOMS\Uri\HttpUri;
use phpOMS\Uri\UriFactory; use phpOMS\Uri\UriFactory;
use phpOMS\Utils\ArrayUtils;
use phpOMS\Utils\Parser\Markdown\Markdown; use phpOMS\Utils\Parser\Markdown\Markdown;
use phpOMS\Utils\Parser\Php\ArrayParser;
use phpOMS\Utils\RnG\StringUtils as StringRng; use phpOMS\Utils\RnG\StringUtils as StringRng;
use phpOMS\Utils\StringUtils; use phpOMS\Utils\StringUtils;
use phpOMS\Validation\Network\Email as EmailValidator; use phpOMS\Validation\Network\Email as EmailValidator;
@ -227,7 +229,7 @@ final class ApiController extends Controller
$token = (string) \random_bytes(64); $token = (string) \random_bytes(64);
$handler = $this->setUpServerMailHandler(); $handler = $this->setUpServerMailHandler();
$resetLink = UriFactory::build('{/backend}reset?user=' . $account->getId() . '&token=' . $token); $resetLink = UriFactory::build('{/lang}/{/app}/{/backend}reset?user=' . $account->getId() . '&token=' . $token);
$mail = new Email(); $mail = new Email();
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR], 'Karaka'); $mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR], 'Karaka');
@ -336,7 +338,7 @@ final class ApiController extends Controller
); );
$handler = $this->setUpServerMailHandler(); $handler = $this->setUpServerMailHandler();
$loginLink = UriFactory::build('{/backend}'); $loginLink = UriFactory::build('{/lang}/{/app}/{/backend}');
$mail = new Email(); $mail = new Email();
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR], 'Karaka'); $mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR], 'Karaka');
@ -417,6 +419,34 @@ final class ApiController extends Controller
); );
} }
/**
* Set app config
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiAppConfigSet(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
$dataSettings = $request->getDataJson('settings');
$config = include __DIR__ . '/../../../config.php';
foreach ($dataSettings as $data) {
$config = ArrayUtils::setArray($data['path'], $config, $data['value'], '/', true);
}
\file_put_contents(__DIR__ . '/../../../config.php', "<?php\ndeclare(strict_types=1);\nreturn " . ArrayParser::serializeArray($config) . ';');
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Config', 'Config successfully modified', $dataSettings);
}
/** /**
* Api method for modifying settings * Api method for modifying settings
* *
@ -1048,7 +1078,7 @@ final class ApiController extends Controller
NotificationLevel::OK, NotificationLevel::OK,
'Account', 'Account',
'Account successfully created. Link: <a href="' 'Account successfully created. Link: <a href="'
. (UriFactory::build('admin/account/settings?{?}&id=' . $account->getId())) . (UriFactory::build('{/lang}/{/app}/admin/account/settings?{?}&id=' . $account->getId()))
. '">Account</a>', . '">Account</a>',
$account $account
); );

View File

@ -6,9 +6,9 @@
{ {
"key": 1, "listener": "click", "action": [ "key": 1, "listener": "click", "action": [
{"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"}, {"key": 1, "type": "dom.popup", "selector": "#group-selector-tpl", "aniIn": "fadeIn", "id": "<?= $this->getId(); ?>"},
{"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 2, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/lang}/{/app}/admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}, {"key": 3, "type": "dom.table.append", "id": "acc-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1},
{"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"}, {"key": 4, "type": "message.request", "uri": "<?= \phpOMS\Uri\UriFactory::build('{/lang}/{/app}/admin/group?filter=some&limit=10'); ?>", "method": "GET", "request_type": "json"},
{"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1} {"key": 5, "type": "dom.table.append", "id": "grp-table", "aniIn": "fadeIn", "data": [], "bindings": {"id": "id", "name": "name/0"}, "position": -1}
] ]
} }

View File

@ -86,7 +86,7 @@ echo $this->getData('nav')->render(); ?>
<?php <?php
$c = 0; $c = 0;
foreach ($accounts as $key => $value) : ++$c; foreach ($accounts as $key => $value) : ++$c;
$url = UriFactory::build('admin/account/settings?{?}&id=' . $value->getId()); $url = UriFactory::build('{/lang}/{/app}/admin/account/settings?{?}&id=' . $value->getId());
$color = 'darkred'; $color = 'darkred';
if ($value->getStatus() === AccountStatus::ACTIVE) { $color = 'green'; } if ($value->getStatus() === AccountStatus::ACTIVE) { $color = 'green'; }

View File

@ -190,7 +190,7 @@ echo $this->getData('nav')->render(); ?>
$c = 0; $c = 0;
$groups = $account->getGroups(); $groups = $account->getGroups();
foreach ($groups as $key => $value) : ++$c; foreach ($groups as $key => $value) : ++$c;
$url = UriFactory::build('admin/group/settings?{?}&id=' . $value->getId()); $url = UriFactory::build('{/lang}/{/app}/admin/group/settings?{?}&id=' . $value->getId());
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a> <td><a href="#"><i class="fa fa-times"></i></a>
@ -827,7 +827,7 @@ echo $this->getData('nav')->render(); ?>
<tbody> <tbody>
<?php $count = 0; <?php $count = 0;
foreach ($audits as $key => $audit) : ++$count; foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('admin/audit/single?{?}&id=' . $audit->getId()); $url = UriFactory::build('{/lang}/{/app}/admin/audit/single?{?}&id=' . $audit->getId());
?> ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?> <td><?= $audit->getId(); ?>

View File

@ -85,7 +85,7 @@ echo $this->getData('nav')->render(); ?>
<tbody> <tbody>
<?php $c = 0; <?php $c = 0;
foreach ($groups as $key => $value) : ++$c; foreach ($groups as $key => $value) : ++$c;
$url = UriFactory::build('admin/group/settings?{?}&id=' . $value->getId()); $url = UriFactory::build('{/lang}/{/app}/admin/group/settings?{?}&id=' . $value->getId());
$color = 'darkred'; $color = 'darkred';
if ($value->getStatus() === GroupStatus::ACTIVE) { $color = 'green'; } if ($value->getStatus() === GroupStatus::ACTIVE) { $color = 'green'; }

View File

@ -118,7 +118,7 @@ echo $this->getData('nav')->render(); ?>
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i> <td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i> <td class="wf-100"><?= $this->getHtml('Name'); ?><i class="sort-asc fa fa-chevron-up"></i><i class="sort-desc fa fa-chevron-down"></i>
<tbody> <tbody>
<?php $c = 0; foreach ($accounts as $key => $value) : ++$c; $url = UriFactory::build('admin/account/settings?{?}&id=' . $value->getId()); ?> <?php $c = 0; foreach ($accounts as $key => $value) : ++$c; $url = UriFactory::build('{/lang}/{/app}/admin/account/settings?{?}&id=' . $value->getId()); ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td><a href="#"><i class="fa fa-times"></i></a> <td><a href="#"><i class="fa fa-times"></i></a>
<td><a href="<?= $url; ?>"><?= $value->name1; ?> <?= $value->name2; ?></a> <td><a href="<?= $url; ?>"><?= $value->name1; ?> <?= $value->name2; ?></a>
@ -320,7 +320,7 @@ echo $this->getData('nav')->render(); ?>
<td><?= $this->getHtml('Date', 'Auditor'); ?> <td><?= $this->getHtml('Date', 'Auditor'); ?>
<tbody> <tbody>
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count; <?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('admin/audit/single?{?}&id=' . $audit->getId()); ?> $url = UriFactory::build('{/lang}/{/app}/admin/audit/single?{?}&id=' . $audit->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?> <td><?= $audit->getId(); ?>
<td><?= $this->printHtml($audit->getModule()); ?> <td><?= $this->printHtml($audit->getModule()); ?>

View File

@ -75,7 +75,7 @@ $tableView->setObjects($modules);
<tbody> <tbody>
<?php $count = 0; <?php $count = 0;
foreach ($modules as $key => $module) : ++$count; foreach ($modules as $key => $module) : ++$count;
$url = UriFactory::build('admin/module/info?{?}&id=' . $module->getInternalName()); $url = UriFactory::build('{/lang}/{/app}/admin/module/info?{?}&id=' . $module->getInternalName());
if (isset($active[$module->getInternalName()])) { if (isset($active[$module->getInternalName()])) {
$status = ModuleStatus::ACTIVE; $status = ModuleStatus::ACTIVE;

View File

@ -54,7 +54,7 @@ echo $this->getData('nav')->render();
<td><?= $this->getHtml('Date', 'Auditor'); ?> <td><?= $this->getHtml('Date', 'Auditor'); ?>
<tbody> <tbody>
<?php $count = 0; foreach ($audits as $key => $audit) : ++$count; <?php $count = 0; foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('admin/audit/single?{?}&id=' . $audit->getId()); ?> $url = UriFactory::build('{/lang}/{/app}/admin/audit/single?{?}&id=' . $audit->getId()); ?>
<tr tabindex="0" data-href="<?= $url; ?>"> <tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?> <td><?= $audit->getId(); ?>
<td><?= $this->printHtml($audit->getModule()); ?> <td><?= $this->printHtml($audit->getModule()); ?>

View File

@ -21,8 +21,8 @@ use phpOMS\Uri\UriFactory;
*/ */
$pages = $this->getData('pages') ?? []; $pages = $this->getData('pages') ?? [];
$previous = empty($pages) ? 'admin/page/list' : 'admin/page/list?{?}&id=' . \reset($pages)->getId() . '&ptype=p'; $previous = empty($pages) ? 'admin/page/list' : '{/lang}/{/app}/admin/page/list?{?}&id=' . \reset($pages)->getId() . '&ptype=p';
$next = empty($pages) ? 'admin/page/list' : 'admin/page/list?{?}&id=' . \end($pages)->getId() . '&ptype=n'; $next = empty($pages) ? 'admin/page/list' : '{/lang}/{/app}/admin/page/list?{?}&id=' . \end($pages)->getId() . '&ptype=n';
echo $this->getData('nav')->render(); ?> echo $this->getData('nav')->render(); ?>
@ -90,7 +90,7 @@ echo $this->getData('nav')->render(); ?>
</label> </label>
<tbody> <tbody>
<?php $c = 0; foreach ($accounts as $key => $value) : ++$c; <?php $c = 0; foreach ($accounts as $key => $value) : ++$c;
$url = UriFactory::build('admin/account/settings?{?}&id=' . $value->getId()); $url = UriFactory::build('{/lang}/{/app}/admin/account/settings?{?}&id=' . $value->getId());
$color = 'darkred'; $color = 'darkred';
if ($value->getStatus() === AccountStatus::ACTIVE) { $color = 'green'; } if ($value->getStatus() === AccountStatus::ACTIVE) { $color = 'green'; }
elseif ($value->getStatus() === AccountStatus::INACTIVE) { $color = 'darkblue'; } elseif ($value->getStatus() === AccountStatus::INACTIVE) { $color = 'darkblue'; }

View File

@ -12,7 +12,7 @@
}, },
"creator": { "creator": {
"name": "Karaka", "name": "Karaka",
"website": "www.spl1nes.com" "website": "jingga.app"
}, },
"description": "The administration module.", "description": "The administration module.",
"directory": "Admin", "directory": "Admin",