too many changes

This commit is contained in:
Dennis Eichhorn 2023-03-11 23:38:16 +01:00
parent 1457a74d03
commit 68e98a308a
37 changed files with 971 additions and 255 deletions

View File

@ -62,6 +62,7 @@
"virtualPath": "/Modules/Admin/Templates/Global",
"user": 1
},
{
"type": "upload",
"create_collection": true,
@ -76,44 +77,13 @@
{
"type": "upload",
"create_collection": true,
"name": "Pdf Default Template",
"name": "Default Templates",
"virtualPath": "/Modules/Admin/Templates/Global/Helper",
"path": "/Modules/Admin/Templates/Global/Helper/Pdf Default Template",
"path": "/Modules/Admin/Templates/Global/Helper/Default Templates",
"files": [
"/Modules/Admin/Admin/Install/Media/PdfDefaultTemplate"
],
"user": 1
},
{
"type": "upload",
"create_collection": true,
"name": "Word Default Template",
"virtualPath": "/Modules/Admin/Templates/Global/Helper",
"path": "/Modules/Admin/Templates/Global/Helper/Word Default Template",
"files": [
"/Modules/Admin/Admin/Install/Media/WordDefaultTemplate"
],
"user": 1
},
{
"type": "upload",
"create_collection": true,
"name": "Word Plain Template",
"virtualPath": "/Modules/Admin/Templates/Global/Helper",
"path": "/Modules/Admin/Templates/Global/Helper/Word Plain Template",
"files": [
"/Modules/Admin/Admin/Install/Media/WordPlainTemplate"
],
"user": 1
},
{
"type": "upload",
"create_collection": true,
"name": "Excel Default Template",
"virtualPath": "/Modules/Admin/Templates/Global/Helper",
"path": "/Modules/Admin/Templates/Global/Helper/Excel Default Template",
"files": [
"/Modules/Admin/Admin/Install/Media/ExcelDefaultTemplate"
"/Modules/Admin/Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php",
"/Modules/Admin/Admin/Install/Media/WordDefaultTemplate/docTemplate.doc.php",
"/Modules/Admin/Admin/Install/Media/ExcelDefaultTemplate/spreadsheetTemplate.xls.php"
],
"user": 1
},
@ -184,65 +154,5 @@
"/Modules/Admin/Admin/Install/Media/EmailExporter"
],
"user": 1
},
{
"type": "reference",
"name": "Assets",
"from": "/Modules/Admin/Templates/Global/Helper/Pdf Default Template",
"to": "/Modules/Admin/Templates/Global/Helper/Assets",
"user": 1
},
{
"type": "reference",
"name": "Assets",
"from": "/Modules/Admin/Templates/Global/Helper/Word Default Template",
"to": "/Modules/Admin/Templates/Global/Helper/Assets",
"user": 1
},
{
"type": "reference",
"name": "Assets",
"from": "/Modules/Admin/Templates/Global/Helper/Word Plain Template",
"to": "/Modules/Admin/Templates/Global/Helper/Assets",
"user": 1
},
{
"type": "reference",
"name": "Assets",
"from": "/Modules/Admin/Templates/Global/Helper/Excel Default Template",
"to": "/Modules/Admin/Templates/Global/Helper/Assets",
"user": 1
},
{
"type": "reference",
"name": "Helper",
"from": "/Modules/Admin/Templates/Global/Lists/Pdf List Exporter",
"to": "/Modules/Admin/Templates/Global/Helper/Pdf Default Template",
"user": 1
},
{
"type": "reference",
"name": "Helper",
"from": "/Modules/Admin/Templates/Global/Lists/Word List Exporter",
"to": "/Modules/Admin/Templates/Global/Helper/Word Default Template",
"user": 1
},
{
"type": "reference",
"name": "Helper",
"from": "/Modules/Admin/Templates/Global/Lists/Excel List Exporter",
"to": "/Modules/Admin/Templates/Global/Helper/Excel Default Template",
"user": 1
},
{
"type": "reference",
"name": "Helper",
"from": "/Modules/Admin/Templates/Global/Letters/Word Letter Exporter",
"to": "/Modules/Admin/Templates/Global/Helper/Word Default Template",
"user": 1
}
]

View File

@ -49,7 +49,6 @@ class Media
SettingsEnum::DEFAULT_LIST_EXPORTS,
(string) $media['collection'][4]['id'],
'\\d+',
unit: 1,
module: 'Admin'
)
);
@ -60,7 +59,26 @@ class Media
SettingsEnum::DEFAULT_LETTERS,
(string) $media['collection'][5]['id'],
'\\d+',
unit: 1,
module: 'Admin'
)
);
SettingMapper::create()->execute(
new Setting(
0,
SettingsEnum::DEFAULT_ASSETS,
(string) $media['upload'][0]['id'],
'\\d+',
module: 'Admin'
)
);
SettingMapper::create()->execute(
new Setting(
0,
SettingsEnum::DEFAULT_TEMPLATES,
(string) $media['upload'][1]['id'],
'\\d+',
module: 'Admin'
)
);

View File

@ -1,15 +1,10 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../phpOMS/Autoloader.php';
use phpOMS\Autoloader;
Autoloader::addPath(__DIR__ . '/../Resources');
use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter;
use PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing;
use PhpOffice\PhpSpreadsheet\Worksheet\PageSetup;
use phpOMS\Autoloader;
class DefaultExcel extends \PhpOffice\PhpSpreadsheet\Spreadsheet
{

View File

@ -2,13 +2,6 @@
declare(strict_types=1);
require_once __DIR__ . '/../phpOMS/Autoloader.php';
use phpOMS\Autoloader;
Autoloader::addPath(__DIR__ . '/../Resources');
require_once __DIR__ . '/../Resources/tcpdf/tcpdf.php';
class DefaultPdf extends TCPDF
{
public string $fontName = '';
@ -21,7 +14,7 @@ class DefaultPdf extends TCPDF
$this->header_xobjid = $this->startTemplate($this->w, 0);
// Set Logo
$image_file = __DIR__ . '/../Web/Backend/img/logo.png';
$image_file = '/home/spl1nes/Orange-Management/Web/Backend/img/logo.png';
$this->Image($image_file, 15, 15, 15, 15, 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
// Set Title

View File

@ -1,11 +1,6 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../phpOMS/Autoloader.php';
use phpOMS\Autoloader;
Autoloader::addPath(__DIR__ . '/../Resources');
class DefaultWord extends \PhpOffice\PhpWord\PhpWord {
public function __construct()
{

View File

@ -541,6 +541,14 @@
"default": null,
"null": true
},
"unit_address": {
"name": "unit_address",
"type": "INT",
"default": null,
"null": true,
"foreignTable": "address",
"foreignKey": "address_id"
},
"unit_parent": {
"name": "unit_parent",
"type": "INT",
@ -557,6 +565,261 @@
}
}
},
"unit_address_rel": {
"name": "unit_address_rel",
"fields": {
"unit_address_rel_id": {
"name": "unit_address_rel_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_address_rel_unit": {
"name": "unit_address_rel_unit",
"type": "INT",
"null": false,
"foreignTable": "unit",
"foreignKey": "unit_id"
},
"unit_address_rel_address": {
"name": "unit_address_rel_address",
"type": "INT",
"null": false,
"foreignTable": "address",
"foreignKey": "address_id"
}
}
},
"unit_attr_type": {
"name": "unit_attr_type",
"fields": {
"unit_attr_type_id": {
"name": "unit_attr_type_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_attr_type_name": {
"name": "unit_attr_type_name",
"type": "VARCHAR(255)",
"null": false,
"unique": true
},
"unit_attr_type_datatype": {
"name": "unit_attr_type_datatype",
"type": "INT(11)",
"null": false
},
"unit_attr_type_fields": {
"name": "unit_attr_type_fields",
"type": "INT(11)",
"null": false
},
"unit_attr_type_custom": {
"name": "unit_attr_type_custom",
"type": "TINYINT(1)",
"null": false
},
"unit_attr_type_required": {
"description": "Every item must have this attribute type if set to true.",
"name": "unit_attr_type_required",
"type": "TINYINT(1)",
"null": false
},
"unit_attr_type_pattern": {
"description": "This is a regex validation pattern.",
"name": "unit_attr_type_pattern",
"type": "VARCHAR(255)",
"null": false
}
}
},
"unit_attr_type_l11n": {
"name": "unit_attr_type_l11n",
"fields": {
"unit_attr_type_l11n_id": {
"name": "unit_attr_type_l11n_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_attr_type_l11n_title": {
"name": "unit_attr_type_l11n_title",
"type": "VARCHAR(255)",
"null": false
},
"unit_attr_type_l11n_type": {
"name": "unit_attr_type_l11n_type",
"type": "INT(11)",
"null": false,
"foreignTable": "unit_attr_type",
"foreignKey": "unit_attr_type_id"
},
"unit_attr_type_l11n_lang": {
"name": "unit_attr_type_l11n_lang",
"type": "VARCHAR(2)",
"null": false,
"foreignTable": "language",
"foreignKey": "language_639_1"
}
}
},
"unit_attr_value": {
"name": "unit_attr_value",
"fields": {
"unit_attr_value_id": {
"name": "unit_attr_value_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_attr_value_default": {
"name": "unit_attr_value_default",
"type": "TINYINT(1)",
"null": false
},
"unit_attr_value_valueStr": {
"name": "unit_attr_value_valueStr",
"type": "VARCHAR(255)",
"null": true,
"default": null
},
"unit_attr_value_valueInt": {
"name": "unit_attr_value_valueInt",
"type": "INT(11)",
"null": true,
"default": null
},
"unit_attr_value_valueDec": {
"name": "unit_attr_value_valueDec",
"type": "DECIMAL(19,5)",
"null": true,
"default": null
},
"unit_attr_value_valueDat": {
"name": "unit_attr_value_valueDat",
"type": "DATETIME",
"null": true,
"default": null
},
"unit_attr_value_unit": {
"name": "unit_attr_value_unit",
"type": "VARCHAR(255)",
"null": false
},
"unit_attr_value_deptype": {
"name": "unit_attr_value_deptype",
"type": "INT(11)",
"null": true,
"default": null,
"foreignTable": "unit_attr_type",
"foreignKey": "unit_attr_type_id"
},
"unit_attr_value_depvalue": {
"name": "unit_attr_value_depvalue",
"type": "INT(11)",
"null": true,
"default": null,
"foreignTable": "unit_attr_value",
"foreignKey": "unit_attr_value_id"
}
}
},
"unit_attr_value_l11n": {
"name": "unit_attr_value_l11n",
"fields": {
"unit_attr_value_l11n_id": {
"name": "unit_attr_value_l11n_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_attr_value_l11n_title": {
"name": "unit_attr_value_l11n_title",
"type": "VARCHAR(255)",
"null": false
},
"unit_attr_value_l11n_value": {
"name": "unit_attr_value_l11n_value",
"type": "INT(11)",
"null": false,
"foreignTable": "unit_attr_value",
"foreignKey": "unit_attr_value_id"
},
"unit_attr_value_l11n_lang": {
"name": "unit_attr_value_l11n_lang",
"type": "VARCHAR(2)",
"null": false,
"foreignTable": "language",
"foreignKey": "language_639_1"
}
}
},
"unit_attr_default": {
"name": "unit_attr_default",
"fields": {
"unit_attr_default_id": {
"name": "unit_attr_default_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_attr_default_type": {
"name": "unit_attr_default_type",
"type": "INT(11)",
"null": false,
"foreignTable": "unit_attr_type",
"foreignKey": "unit_attr_type_id"
},
"unit_attr_default_value": {
"name": "unit_attr_default_value",
"type": "INT(11)",
"null": false,
"foreignTable": "unit_attr_value",
"foreignKey": "unit_attr_value_id"
}
}
},
"unit_attr": {
"name": "unit_attr",
"fields": {
"unit_attr_id": {
"name": "unit_attr_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"unit_attr_unit": {
"name": "unit_attr_unit",
"type": "INT(11)",
"null": false,
"foreignTable": "unit",
"foreignKey": "unit_id"
},
"unit_attr_type": {
"name": "unit_attr_type",
"type": "INT(11)",
"null": false,
"foreignTable": "unit_attr_type",
"foreignKey": "unit_attr_type_id"
},
"unit_attr_value": {
"name": "unit_attr_value",
"type": "INT(11)",
"null": true,
"default": null,
"foreignTable": "unit_attr_value",
"foreignKey": "unit_attr_value_id"
}
}
},
"app": {
"name": "app",
"fields": {
@ -829,6 +1092,55 @@
}
}
},
"account_external": {
"name": "account_external",
"fields": {
"account_external_id": {
"name": "account_external_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"account_external_status": {
"name": "account_external_status",
"type": "TINYINT",
"null": false
},
"account_external_type": {
"name": "account_external_type",
"type": "INT",
"null": false
},
"account_external_subtype": {
"name": "account_external_subtype",
"type": "INT",
"null": false
},
"account_external_key": {
"name": "account_external_key",
"type": "VARCHAR(255)",
"null": false
},
"account_external_name": {
"name": "account_external_name",
"type": "VARCHAR(255)",
"null": false
},
"account_external_auth": {
"name": "account_external_auth",
"type": "VARCHAR(255)",
"null": false
},
"account_external_account": {
"name": "account_external_account",
"type": "INT",
"null": false,
"foreignTable": "account",
"foreignKey": "account_id"
}
}
},
"account_contact": {
"name": "account_contact",
"fields": {
@ -1168,13 +1480,12 @@
},
"data_change_type": {
"name": "data_change_type",
"type": "VARCHAR(65)",
"null": false,
"unique": true
"type": "VARCHAR(64)",
"null": false
},
"data_change_hash": {
"name": "data_change_hash",
"type": "VARCHAR(65)",
"type": "VARCHAR(32)",
"null": false,
"unique": true
},

View File

@ -78,21 +78,28 @@ final class Installer extends InstallerAbstract
**/
private static function installDefaultSettings() : void
{
SettingMapper::create()->execute(new Setting(0, SettingsEnum::PASSWORD_PATTERN, '^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_TRIES, '3', '\\d+', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_TIMEOUT, '3', '\\d+', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::PASSWORD_INTERVAL, '90', '\\d+', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::PASSWORD_HISTORY, '3', '\\d+', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGGING_STATUS, '1', '[0-3]', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::PASSWORD_PATTERN, '/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_TRIES, '3', pattern: '/\\d+/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_TIMEOUT, '3', pattern: '/\\d+/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::PASSWORD_INTERVAL, '90', pattern: '/\\d+/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::PASSWORD_HISTORY, '3', pattern: '/\\d+/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGGING_STATUS, '1', pattern: '/[0-3]/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGGING_PATH, '', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::DEFAULT_UNIT, '1', '\\d+', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::DEFAULT_UNIT, '1', pattern: '/\\d+/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_STATUS, '1', '[0-3]', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_STATUS, '1', pattern: '/[0-3]', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_MAIL_REGISTRATION_TEMPLATE, '', pattern: '/\\d*/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_MAIL_FORGOT_PASSWORD_TEMPLATE, '', pattern: '/\\d*/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::LOGIN_MAIL_FAILED_TEMPLATE, '', pattern: '/\\d*/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::DEFAULT_LOCALIZATION, '1', '\\d+', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::DEFAULT_LOCALIZATION, '1', pattern: '/\\d+/', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_ADDR, 'admin@jingga.app', "(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])", module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_OUT, '', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_PORT_OUT, '', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_IN, '', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_PORT_IN, '', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_ADDR, '', pattern: "/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|\"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/", module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_TYPE, SubmitType::MAIL, module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_USER, '', module: 'Admin'));
SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_PASS, '', module: 'Admin'));
@ -107,7 +114,7 @@ final class Installer extends InstallerAbstract
(OperatingSystem::getSystem() === SystemType::WIN
? 'php.exe'
: 'php'
) .' cli.php -v'
) . ' ' . __DIR__ . '/../../../../Cli/cli.php -v'
);
$cmdResult = $cmdResult === null || $cmdResult === false ? '' : $cmdResult;

View File

@ -18,6 +18,15 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/admin/worker(\?.*|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiDataChange',
'verb' => RouteVerb::ANY,
'permission' => [
],
],
],
'^.*/login(\?.*|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiLogin',
@ -26,6 +35,14 @@ return [
],
],
],
'^.*/signup(\?.*|$)' => [
[
'dest' => '\Modules\Admin\Controller\ApiController:apiAccountRegister',
'verb' => RouteVerb::SET,
'permission' => [
],
],
],
'^.*/logout(\?.*|$)' => [
[

View File

@ -63,7 +63,7 @@ echo $this->getData('nav')->render();
<div class="form-group">
<label for="iOname"><?= $this->getHtml('OrganizationName'); ?></label>
<select id="iOname" name="settings_1000000009">
<?php $unit = UnitMapper::get()->where('id', (int) $generalSettings[1000000009]->content)->execute(); ?>
<?php $unit = UnitMapper::get()->where('id', 1)->execute(); ?>
<option value="<?= $unit->getId(); ?>"><?= $this->printHtml($unit->name); ?>
</select>
</div>
@ -103,7 +103,7 @@ echo $this->getData('nav')->render();
<i class="tooltip" data-tooltip="<?= $this->getHtml('i:PasswordRegex'); ?>"><i class="fa fa-info-circle"></i></i>
</label>
<input id="iPassword" name="settings_1000000001" type="text" value="<?= $this->printHtml($generalSettings['1000000001']->content); ?>" placeholder="&#xf023; ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&;:\(\)\[\]=\{\}\+\-])[A-Za-z\d$@$!%*?&;:\(\)\[\]=\{\}\+\-]{8,}">
<input id="iPassword" name="settings_1000000001" type="text" value="<?= $this->printHtml($generalSettings['1000000001:::Admin']->content); ?>" placeholder="&#xf023; ^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[$@$!%*?&;:\(\)\[\]=\{\}\+\-])[A-Za-z\d$@$!%*?&;:\(\)\[\]=\{\}\+\-]{8,}">
</div>
<div class="form-group">
@ -112,7 +112,7 @@ echo $this->getData('nav')->render();
<i class="tooltip" data-tooltip="<?= $this->getHtml('i:LoginRetries'); ?>"><i class="fa fa-info-circle"></i></i>
</label>
<input id="iLoginRetries" name="settings_1000000005" type="number" value="<?= $this->printHtml($generalSettings['1000000005']->content); ?>" min="-1">
<input id="iLoginRetries" name="settings_1000000005" type="number" value="<?= $this->printHtml($generalSettings['1000000005:::Admin']->content); ?>" min="-1">
</div>
<div class="form-group">
@ -121,7 +121,7 @@ echo $this->getData('nav')->render();
<i class="tooltip" data-tooltip="<?= $this->getHtml('i:TimeoutPeriod'); ?>"><i class="fa fa-info-circle"></i></i>
</label>
<input id="iTimeoutPeriod" name="settings_1000000002" type="number" value="<?= $this->printHtml($generalSettings['1000000002']->content); ?>">
<input id="iTimeoutPeriod" name="settings_1000000002" type="number" value="<?= $this->printHtml($generalSettings['1000000002:::Admin']->content); ?>">
</div>
<div class="form-group">
@ -130,7 +130,7 @@ echo $this->getData('nav')->render();
<i class="tooltip" data-tooltip="<?= $this->getHtml('i:PasswordChangeInterval'); ?>"><i class="fa fa-info-circle"></i></i>
</label>
<input id="iPasswordChangeInterval" name="settings_1000000003" type="number" value="<?= $this->printHtml($generalSettings['1000000003']->content); ?>">
<input id="iPasswordChangeInterval" name="settings_1000000003" type="number" value="<?= $this->printHtml($generalSettings['1000000003:::Admin']->content); ?>">
</div>
<div class="form-group">
@ -139,7 +139,7 @@ echo $this->getData('nav')->render();
<i class="tooltip" data-tooltip="<?= $this->getHtml('i:PasswordHistory'); ?>"><i class="fa fa-info-circle"></i></i>
</label>
<input id="iPasswordHistory" name="settings_1000000004" type="number" value="<?= $this->printHtml($generalSettings['1000000004']->content); ?>">
<input id="iPasswordHistory" name="settings_1000000004" type="number" value="<?= $this->printHtml($generalSettings['1000000004:::Admin']->content); ?>">
</div>
</div>
@ -167,7 +167,7 @@ echo $this->getData('nav')->render();
<div class="form-group">
<label for="iLogPath"><?= $this->getHtml('LogPath'); ?></label>
<input id="iLogPath" name="settings_1000000007" type="text" value="<?= $this->printHtml($generalSettings['1000000007']->content); ?>" placeholder="&#xf040; /Logs">
<input id="iLogPath" name="settings_1000000007" type="text" value="<?= $this->printHtml($generalSettings['1000000007:::Admin']->content); ?>" placeholder="&#xf040; /Logs">
</div>
</div>
<div class="portlet-foot">
@ -728,6 +728,30 @@ echo $this->getData('nav')->render();
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Value'); ?>
<td><?= $this->getHtml('Unit'); ?>
<label for="settingsList-sort-5">
<input type="radio" name="settingsList-sort" id="settingsList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="settingsList-sort-6">
<input type="radio" name="settingsList-sort" id="settingsList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('App'); ?>
<label for="settingsList-sort-5">
<input type="radio" name="settingsList-sort" id="settingsList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="settingsList-sort-6">
<input type="radio" name="settingsList-sort" id="settingsList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Module'); ?>
<label for="settingsList-sort-5">
<input type="radio" name="settingsList-sort" id="settingsList-sort-5">
@ -774,14 +798,28 @@ echo $this->getData('nav')->render();
<tr tabindex="0">
<td><i class="fa fa-cogs"></i>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->getId(); ?>
<td data-label="<?= $this->getHtml('Name'); ?>"><?= $this->printHtml($setting->name); ?>
<td data-label="<?= $this->getHtml('Value'); ?>"><?= $this->printHtml($setting->content); ?>
<td data-label="<?= $this->getHtml('Name'); ?>">
<?php
$name = $setting->name;
if ($this->getData('settings_class') !== null) {
$name = $this->getData('settings_class')::getName($setting->name);
if (!\is_string($name)) {
$name= $setting->name;
}
}
?>
<?= $this->printHtml($name); ?>
<td data-label="<?= $this->getHtml('Value'); ?>"><?= $this->printHtml((string) $setting->content); ?>
<td data-label="<?= $this->getHtml('Unit'); ?>"><?= $this->printHtml((string) $setting->unit); ?>
<td data-label="<?= $this->getHtml('App'); ?>"><?= $this->printHtml((string) $setting->app); ?>
<td data-label="<?= $this->getHtml('Module'); ?>"><?= $this->printHtml($setting->module); ?>
<td data-label="<?= $this->getHtml('Group'); ?>"><?= $this->printHtml((string) $setting->group); ?>
<td data-label="<?= $this->getHtml('Account'); ?>"><?= $this->printHtml((string) $setting->account); ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="7" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
@ -794,11 +832,3 @@ echo $this->getData('nav')->render();
</div>
</div>
</div>
asdf
// login status (normal, read_only, disabled)
// default email settings for server (e.g. for forgot password)
// some default pages (e.g. legal pages)
// other settings defined during the installation (e.g. default unit ...)
// maybe combine page Admin/Settings and the module settings into one page. Maybe make them reference each other or maybe completely remove the Admin/Settings page because it is available in the module settings!

View File

@ -116,7 +116,10 @@ final class ApiController extends Controller
{
$response->header->set('Content-Type', MimeType::M_JSON . '; charset=utf-8', true);
$login = AccountMapper::login((string) ($request->getData('user') ?? ''), (string) ($request->getData('pass') ?? ''));
$login = AccountMapper::login(
(string) ($request->getData('user') ?? ''),
(string) ($request->getData('pass') ?? '')
);
if ($login >= LoginReturnType::OK) {
$this->app->sessionManager->set('UID', $login, true);
@ -181,26 +184,34 @@ final class ApiController extends Controller
/** @var \Model\Setting[] $emailSettings */
$emailSettings = $this->app->appSettings->get(
names: [
SettingsEnum::MAIL_SERVER_ADDR,
SettingsEnum::MAIL_SERVER_OUT,
SettingsEnum::MAIL_SERVER_PORT_OUT,
SettingsEnum::MAIL_SERVER_TYPE,
SettingsEnum::MAIL_SERVER_USER,
SettingsEnum::MAIL_SERVER_PASS,
SettingsEnum::MAIL_SERVER_TLS,
],
module: self::NAME
module: 'Admin'
);
$handler = new MailHandler();
$handler->setMailer($emailSettings[SettingsEnum::MAIL_SERVER_TYPE . '::' . self::NAME]->content ?? SubmitType::MAIL);
$handler->useAutoTLS = (bool) ($emailSettings[SettingsEnum::MAIL_SERVER_TLS . '::' . self::NAME]->content ?? false);
$handler->setMailer($emailSettings[SettingsEnum::MAIL_SERVER_TYPE . ':::Admin']->content ?? SubmitType::MAIL);
$handler->useAutoTLS = (bool) ($emailSettings[SettingsEnum::MAIL_SERVER_TLS . ':::Admin']->content ?? false);
if ((int) ($emailSettings[SettingsEnum::MAIL_SERVER_TYPE . '::' . self::NAME]->content ?? SubmitType::MAIL) === SubmitType::SMTP) {
if (($emailSettings[SettingsEnum::MAIL_SERVER_TYPE . ':::Admin']->content ?? SubmitType::MAIL) === SubmitType::SMTP) {
$smtp = new Smtp();
$handler->smtp = $smtp;
$handler->useSMTPAuth = true;
}
$handler->username = $emailSettings[SettingsEnum::MAIL_SERVER_USER . '::' . self::NAME]->content ?? '';
$handler->password = $emailSettings[SettingsEnum::MAIL_SERVER_PASS . '::' . self::NAME]->content ?? '';
if (!empty($port = $emailSettings[SettingsEnum::MAIL_SERVER_PORT_OUT . ':::Admin']->content)) {
$handler->port = (int) $port;
}
$handler->host = $emailSettings[SettingsEnum::MAIL_SERVER_OUT . ':::Admin']->content ?? 'localhost';
$handler->hostname = $emailSettings[SettingsEnum::MAIL_SERVER_OUT . ':::Admin']->content ?? '';
$handler->username = $emailSettings[SettingsEnum::MAIL_SERVER_USER . ':::Admin']->content ?? '';
$handler->password = $emailSettings[SettingsEnum::MAIL_SERVER_PASS . ':::Admin']->content ?? '';
return $handler;
}
@ -221,7 +232,9 @@ final class ApiController extends Controller
public function apiForgot(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
/** @var \Modules\Admin\Models\Account $account */
$account = AccountMapper::get()->where('login', (string) $request->getData('login'))->execute();
$account = !empty($request->getData('login'))
? AccountMapper::get()->where('login', (string) $request->getData('login'))->execute()
: AccountMapper::get()->where('email', (string) $request->getData('email'))->execute();
/** @var \Model\Setting[] $forgotten */
$forgotten = $this->app->appSettings->get(
@ -254,12 +267,12 @@ final class ApiController extends Controller
$token = (string) \random_bytes(64);
$handler = $this->setUpServerMailHandler();
$resetLink = UriFactory::build('{/lang}/{/app}/{/backend}reset?user=' . $account->getId() . '&token=' . $token);
$resetLink = UriFactory::build('{/lang}/{/app}/reset?user=' . $account->getId() . '&token=' . $token);
$mail = new Email();
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content, 'Karaka');
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content, 'Jingga');
$mail->addTo($account->getEmail(), \trim($account->name1 . ' ' . $account->name2 . ' ' . $account->name3));
$mail->subject = 'Karaka: Forgot Password';
$mail->subject = 'Jingga: Forgot Password';
$mail->body = '';
$mail->msgHTML('Please reset your password at: <a href="' . $resetLink . '">' . $resetLink . '</a>');
@ -368,9 +381,9 @@ final class ApiController extends Controller
$loginLink = UriFactory::build('{/lang}/{/app}/{/backend}');
$mail = new Email();
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content, 'Karaka');
$mail->setFrom($emailSettings[SettingsEnum::MAIL_SERVER_ADDR]->content, 'Jingga');
$mail->addTo($account->getEmail(), \trim($account->name1 . ' ' . $account->name2 . ' ' . $account->name3));
$mail->subject = 'Karaka: Password reset';
$mail->subject = 'Jingga: Password reset';
$mail->body = '';
$mail->msgHTML('Your new password: <a href="' . $loginLink . '">' . $pass . '</a>'
. "\n\n"
@ -530,7 +543,7 @@ final class ApiController extends Controller
]
], false);
$this->updateModel($request->header->account, $old, $new, SettingMapper::class, 'settings',$request->getOrigin());
$this->updateModel($request->header->account, $old, $new, SettingMapper::class, 'settings', $request->getOrigin());
}
$this->fillJsonResponse(
@ -1391,7 +1404,6 @@ final class ApiController extends Controller
$this->createModel($request->header->account, $collection, CollectionMapper::class, 'collection', $request->getOrigin());
// find default groups and create them
$defaultGroups = [];
$defaultGroupIds = [];
if ($request->hasData('app')) {
@ -1402,7 +1414,7 @@ final class ApiController extends Controller
module: 'Admin'
);
$defaultGroups = \array_merge($defaultGroups, \json_decode($defaultGroupSettings->content, true));
$defaultGroupIds = \array_merge($defaultGroupIds, \json_decode($defaultGroupSettings->content, true));
}
if ($request->hasData('unit')) {
@ -1413,11 +1425,7 @@ final class ApiController extends Controller
module: 'Admin'
);
$defaultGroups = \array_merge($defaultGroups, \json_decode($defaultGroupSettings->content, true));
}
foreach ($defaultGroups as $group) {
$defaultGroupIds[] = $group->getId();
$defaultGroupIds = \array_merge($defaultGroupIds, \json_decode($defaultGroupSettings->content, true));
}
if (!empty($defaultGroupIds)) {
@ -1461,6 +1469,10 @@ final class ApiController extends Controller
*/
public function apiAccountRegister(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : void
{
if ($request->header->account === 0) {
$request->header->account = 1;
}
if (!empty($val = $this->validateRegistration($request))) {
$response->set('account_registration', new FormValidation($val));
$response->header->status = RequestStatusCode::R_400;
@ -1468,6 +1480,10 @@ final class ApiController extends Controller
return;
}
$app = AppMapper::get()
->where('id', (int) $request->getData('app'))
->execute();
/** @var \Model\Setting $allowed */
$allowed = $this->app->appSettings->get(
names: [SettingsEnum::REGISTRATION_ALLOWED],
@ -1565,33 +1581,28 @@ final class ApiController extends Controller
$account = $loginAccount;
}
$defaultGroups = [];
$defaultGroupIds = [];
/** @var \Model\Setting $defaultGroupSettings */
$defaultGroupSettings = $this->app->appSettings->get(
names: SettingsEnum::APP_DEFAULT_GROUPS,
app: (int) $request->getData('app'),
module: 'Admin'
);
$defaultGroups = \array_merge($defaultGroups, \json_decode($defaultGroupSettings->content, true));
/** @var \Model\Setting $defaultGroupSettings */
$defaultGroupSettings = $this->app->appSettings->get(
names: SettingsEnum::UNIT_DEFAULT_GROUPS,
unit: (int) $request->getData('unit'),
module: 'Admin'
);
$defaultGroups = \array_merge($defaultGroups, \json_decode($defaultGroupSettings->content, true));
foreach ($defaultGroups as $group) {
$defaultGroupIds[] = $group->getId();
}
// Already registered
if ($account !== null) {
$defaultGroupIds = [];
/** @var \Model\Setting $defaultGroupSettings */
$defaultGroupSettings = $this->app->appSettings->get(
names: SettingsEnum::APP_DEFAULT_GROUPS,
app: (int) $request->getData('app'),
module: 'Admin'
);
$defaultGroupIds = \array_merge($defaultGroupIds, \json_decode($defaultGroupSettings->content, true));
/** @var \Model\Setting $defaultGroupSettings */
$defaultGroupSettings = $this->app->appSettings->get(
names: SettingsEnum::UNIT_DEFAULT_GROUPS,
unit: (int) $request->getData('unit'),
module: 'Admin'
);
$defaultGroupIds = \array_merge($defaultGroupIds, \json_decode($defaultGroupSettings->content, true));
/** @var Account $account */
$account = AccountMapper::get()
->with('groups')
@ -1607,6 +1618,7 @@ final class ApiController extends Controller
if (empty($defaultGroupIds)
&& $account->getStatus() === AccountStatus::ACTIVE
) {
// Already set up
$this->fillJsonResponse(
$request,
$response,
@ -1622,6 +1634,7 @@ final class ApiController extends Controller
} elseif (empty($defaultGroupIds)
&& $account->getStatus() === AccountStatus::INACTIVE
) {
// Account not active
$this->fillJsonResponse(
$request,
$response,
@ -1639,6 +1652,7 @@ final class ApiController extends Controller
// Create missing account / group relationships
$this->createModelRelation($account->getId(), $account->getId(), $defaultGroupIds, AccountMapper::class, 'groups', 'registration', $request->getOrigin());
} else {
// New account
$request->setData('status', AccountStatus::INACTIVE);
$request->setData('type', AccountType::USER);
$request->setData('name1', !$request->hasData('name1')
@ -1668,8 +1682,45 @@ final class ApiController extends Controller
} while ($dataChange->getId() === 0 && $tries < 5);
}
// Create client
if ($request->hasData('client')) {
$internalRequest = new HttpRequest();
$internalResponse = new HttpResponse();
$internalRequest->header->account = $account->getId();
$internalRequest->setData('account', $account->getId());
$internalRequest->setData('number', 100000 + $account->getId());
$internalRequest->setData('address', $request->getData('address') ?? '');
$internalRequest->setData('postal', $request->getData('postal') ?? '');
$internalRequest->setData('city', $request->getData('city') ?? '');
$internalRequest->setData('country', $request->getData('country') ?? '');
$internalRequest->setData('state', $request->getData('state') ?? '');
$this->app->moduleManager->get('ClientManagement')->apiClientCreate($internalRequest, $internalResponse);
}
// Create confirmation email
// @todo: send email for activation
// @todo: adjust
// load base template for app
// load text content for login
// replace placeholders
// send email
$handler = $this->setUpServerMailHandler();
$emailSettings = $this->app->appSettings->get(
names: SettingsEnum::MAIL_SERVER_ADDR,
module: 'Admin'
);
$mail = new Email();
$mail->setFrom($emailSettings->content);
$mail->addTo((string) $request->getData('email'));
$mail->subject = 'Registration';
$mail->body = "Hello,\nThank you very much for using our services at Jingga. Please click the following link to confirm your registration:\n\n" . UriFactory::build('{/base}/{/lang}/' . \strtolower($app->name) . '/signup/confirmation?hash=' . $dataChange->getHash()) . "\n\nBest regards,\nJingga";
$mail->bodyAlt = $mail->body;
$handler->send($mail);
$this->fillJsonResponse(
$request,
@ -2130,8 +2181,9 @@ final class ApiController extends Controller
$request->header->account,
$old, $new,
StringUtils::intHash(ModuleMapper::class), 'module-status',
$module,
self::NAME,
$module,
'',
$request->getOrigin(),
]
);

View File

@ -25,6 +25,7 @@ use Modules\Admin\Models\SettingsEnum;
use Modules\Auditor\Models\AuditMapper;
use Modules\Media\Models\MediaMapper;
use phpOMS\Asset\AssetType;
use phpOMS\Autoloader;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\OrderType;
use phpOMS\Localization\NullLocalization;
@ -562,13 +563,17 @@ final class BackendController extends Controller
$id = (string) ($request->getData('id') ?? '');
$queryMapper = AuditMapper::getAll()
->with('createdBy')
->where('module', $id);
// audit log
if ($request->getData('ptype') === 'p') {
$view->setData('auditlogs', AuditMapper::getAll()->where('module', $id)->where('id', (int) $request->getData('audit'), '<')->limit(25)->execute());
$view->setData('auditlogs',$queryMapper->where('id', (int) $request->getData('audit'), '<')->limit(25)->execute());
} elseif ($request->getData('ptype') === 'n') {
$view->setData('auditlogs', AuditMapper::getAll()->where('module', $id)->where('id', (int) $request->getData('audit'), '>')->limit(25)->execute());
$view->setData('auditlogs',$queryMapper->where('id', (int) $request->getData('audit'), '>')->limit(25)->execute());
} else {
$view->setData('auditlogs', AuditMapper::getAll()->where('module', $id)->where('id', 0, '>')->limit(25)->execute());
$view->setData('auditlogs',$queryMapper->where('id', 0, '>')->limit(25)->execute());
}
return $view;
@ -696,6 +701,13 @@ final class BackendController extends Controller
$view->setData('settings', !\is_array($settings) ? [$settings] : $settings);
}
$class = '\\Modules\\' . $request->getData('id') . '\\Models\\SettingsEnum';
if (!Autoloader::exists($class)) {
$class = null;
}
$view->setData('settings_class', $class);
if ($request->getData('id') === 'Admin') {
$view->setTemplate('/Modules/' . $request->getData('id') . '/Admin/Settings/Theme/Backend/settings');
} elseif (\is_file(__DIR__ . '/../../' . ($request->getData('id') ?? '') . '/Admin/Settings/Theme/Backend/settings.tpl.php')) {
@ -715,7 +727,7 @@ final class BackendController extends Controller
);
$view->setData('generalSettings', $generalSettings);
$view->setData('defaultlocalization', LocalizationMapper::get()->where('id', (int) $generalSettings[SettingsEnum::DEFAULT_LOCALIZATION . '::Admin']->content)->execute());
$view->setData('defaultlocalization', LocalizationMapper::get()->where('id', (int) $generalSettings[SettingsEnum::DEFAULT_LOCALIZATION . ':::Admin']->content)->execute());
return $view;
}

View File

@ -0,0 +1,96 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
/**
* Account external class.
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
class AccountExternal
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
protected int $id = 0;
/**
* External type.
*
* @var int
* @since 1.0.0
*/
private int $type = AccountExternalType::PAYMENT;
/**
* External subtype.
*
* @var int
* @since 1.0.0
*/
private int $subtype = AccountExternalSubtype::STRIPE;
/**
* External status.
*
* @var int
* @since 1.0.0
*/
private int $status = AccountExternalStatus::ACTIVATE;
/**
* External key
*
* (e.g. user id on the external platform).
*
* @var string
* @since 1.0.0
*/
public string $key = '';
/**
* External name
*
* (e.g. user name on the external platform).
*
* @var string
* @since 1.0.0
*/
public string $name = '';
/**
* External auth
*
* (e.g. user authentication on the external platform such as password or api key).
*
* @var string
* @since 1.0.0
*/
public string $auth = '';
/**
* Belongs to.
*
* @var Account
* @since 1.0.0
*/
public Account $account;
}

View File

@ -0,0 +1,72 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
use phpOMS\Account\AccountStatus;
use phpOMS\Auth\LoginReturnType;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\DataStorage\Database\Query\Builder;
/**
* Account mapper class.
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
class AccountMapper extends DataMapperFactory
{
/**
* Columns.
*
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
* @since 1.0.0
*/
public const COLUMNS = [
'account_external_id' => ['name' => 'account_external_id', 'type' => 'int', 'internal' => 'id'],
'account_external_status' => ['name' => 'account_external_status', 'type' => 'int', 'internal' => 'status'],
'account_external_type' => ['name' => 'account_external_type', 'type' => 'int', 'internal' => 'type'],
'account_external_subtype' => ['name' => 'account_external_subtype', 'type' => 'int', 'internal' => 'subtype',],
'account_external_key' => ['name' => 'account_external_key', 'type' => 'string', 'internal' => 'key'],
'account_external_name' => ['name' => 'account_external_name', 'type' => 'string', 'internal' => 'name'],
'account_external_auth' => ['name' => 'account_external_auth', 'type' => 'string', 'internal' => 'auth', ],
'account_external_account' => ['name' => 'account_external_account', 'type' => 'int', 'internal' => 'account'],
];
/**
* Model to use by the mapper.
*
* @var class-string
* @since 1.0.0
*/
public const MODEL = AccountExternal::class;
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'account_external';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'account_external_id';
}

View File

@ -0,0 +1,32 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Status for external references
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class AccountExternalStatus extends Enum
{
public const ACTIVATE = 1;
public const INACTIVE = 2;
}

View File

@ -0,0 +1,34 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Type for external references
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class AccountExternalSubtype extends Enum
{
public const STRIPE = 1;
public const PAYPAL = 2;
public const GOOGLE_PAY = 3;
public const AMAZON_PAY = 4;
public const VENMO = 5;
}

View File

@ -0,0 +1,30 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
use phpOMS\Stdlib\Base\Enum;
/**
* Type for external references
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
abstract class AccountExternalType extends Enum
{
public const PAYMENT = 1;
}

View File

@ -118,7 +118,7 @@ class AccountMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='account_id';
public const PRIMARYFIELD = 'account_id';
/**
* Created at column

View File

@ -71,5 +71,5 @@ final class AccountPermissionMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='account_permission_id';
public const PRIMARYFIELD = 'account_permission_id';
}

View File

@ -75,5 +75,5 @@ final class AddressMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='address_id';
public const PRIMARYFIELD = 'address_id';
}

View File

@ -65,7 +65,7 @@ class ApiKeyMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='account_api_id';
public const PRIMARYFIELD = 'account_api_id';
/**
* Created at column

View File

@ -62,5 +62,5 @@ final class AppMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='app_id';
public const PRIMARYFIELD = 'app_id';
}

View File

@ -56,5 +56,5 @@ final class ContactMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='account_contact_id';
public const PRIMARYFIELD = 'account_contact_id';
}

View File

@ -104,7 +104,7 @@ class DataChange
*/
public function reHash() : void
{
$this->hash = \random_bytes(64);
$this->hash = \bin2hex(\random_bytes(16));
}
/**

View File

@ -63,5 +63,5 @@ final class DataChangeMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='data_change_id';
public const PRIMARYFIELD = 'data_change_id';
}

View File

@ -64,7 +64,7 @@ final class GroupMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='group_id';
public const PRIMARYFIELD = 'group_id';
/**
* Created at column

View File

@ -71,5 +71,5 @@ final class GroupPermissionMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='group_permission_id';
public const PRIMARYFIELD = 'group_permission_id';
}

View File

@ -130,7 +130,7 @@ final class LocalizationMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='l11n_id';
public const PRIMARYFIELD = 'l11n_id';
/**
* Model to use by the mapper.

View File

@ -55,7 +55,7 @@ final class ModuleMapper extends DataMapperFactory
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD ='module_id';
public const PRIMARYFIELD = 'module_id';
public const AUTOINCREMENT = false;
}

46
Models/NullAccountExternal.php Executable file
View File

@ -0,0 +1,46 @@
<?php
/**
* Karaka
*
* PHP Version 8.1
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Admin\Models;
/**
* Null model
*
* @package Modules\Admin\Models
* @license OMS License 1.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullAccountExternal extends AccountExternal
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -46,47 +46,67 @@ abstract class SettingsEnum extends Enum
public const UNIT_DEFAULT_GROUPS = '1000000009';
/* Login settings */
public const LOGIN_FORGOTTEN_COUNT = '1000000010';
public const LOGIN_FORGOTTEN_DATE = '1000000011';
public const LOGIN_FORGOTTEN_TOKEN = '1000000012';
public const LOGIN_STATUS = '1000000013';
/* Localization settings */
public const DEFAULT_LOCALIZATION = '1000000014';
/* Mail settings */
public const MAIL_SERVER_ADDR = '1000000015';
public const MAIL_SERVER_TYPE = '1000000016';
public const MAIL_SERVER_USER = '1000000017';
public const MAIL_SERVER_PASS = '1000000018';
public const MAIL_SERVER_CERT = '1000000019';
public const MAIL_SERVER_KEY = '1000000020';
public const MAIL_SERVER_KEYPASS = '1000000021';
public const MAIL_SERVER_TLS = '1000000022';
public const DEFAULT_LOCALIZATION = '1000000010';
/* Cli settings */
public const CLI_ACTIVE = '1000000023';
public const CLI_ACTIVE = '1000000011';
/* Login settings */
public const LOGIN_FORGOTTEN_COUNT = '1000000101';
public const LOGIN_FORGOTTEN_DATE = '1000000102';
public const LOGIN_FORGOTTEN_TOKEN = '1000000103';
public const LOGIN_STATUS = '1000000104';
public const LOGIN_MAIL = '....';
public const LOGIN_MAIL_REGISTRATION_TEMPLATE = '1000000106';
public const LOGIN_MAIL_FORGOT_PASSWORD_TEMPLATE = '1000000107';
public const LOGIN_MAIL_FAILED_TEMPLATE = '1000000108';
/* Mail server settings */
public const MAIL_SERVER_OUT = '1000000201';
public const MAIL_SERVER_PORT_OUT = '1000000202';
public const MAIL_SERVER_IN = '1000000203';
public const MAIL_SERVER_PORT_IN = '1000000204';
public const MAIL_SERVER_ADDR = '1000000205';
public const MAIL_SERVER_TYPE = '1000000206';
public const MAIL_SERVER_USER = '1000000207';
public const MAIL_SERVER_PASS = '1000000208';
public const MAIL_SERVER_CERT = '1000000209';
public const MAIL_SERVER_KEY = '1000000200';
public const MAIL_SERVER_KEYPASS = '1000000210';
public const MAIL_SERVER_TLS = '1000000211';
/* Global default templates */
public const DEFAULT_LIST_EXPORTS = '1000000024';
public const DEFAULT_LIST_EXPORTS = '1000000301';
public const DEFAULT_LETTERS = '1000000025';
public const DEFAULT_LETTERS = '1000000302';
public const DEFAULT_TEMPLATES = '1000000303';
public const DEFAULT_ASSETS = '1000000304';
/* App settings */
public const REGISTRATION_ALLOWED = '1000000029';
public const REGISTRATION_ALLOWED = '1000000401';
public const GROUP_GENERATE_AUTOMATICALLY_APP = '1000000030';
public const GROUP_GENERATE_AUTOMATICALLY_APP = '1000000402';
public const APP_DEFAULT_GROUPS = '1000000031';
public const APP_DEFAULT_GROUPS = '1000000403';
}

View File

@ -29,5 +29,6 @@ return ['Navigation' => [
'Pages' => 'Pages',
'Permissions' => 'Permissions',
'Routes' => 'Routes',
'Hooks' => 'Hooks',
'Settings' => 'Settings',
]];

View File

@ -125,6 +125,8 @@ return ['Admin' => [
'Reset' => 'Reset',
'Route' => 'Route',
'Routes' => 'Routes',
'Hook' => 'Hook',
'Hooks' => 'Hooks',
'Running' => 'Running',
'Sea' => 'Sea',
'Search' => 'Search',
@ -177,6 +179,11 @@ return ['Admin' => [
'Website' => 'Website',
'Weight' => 'Weight',
'Zip' => 'Zip',
'Trigger' => 'Trigger',
'ServerStatus' => 'Server Status',
'ServerMode-1' => 'Normal',
'ServerMode-2' => 'Read Only',
'ServerMode-3' => 'Disabled',
'i:LoginRetries' => 'Amount of allowed retries (-1 = unlimited)',
'i:PasswordChangeInterval' => 'Interval in which passwards need to be changed (-1 = never)',
'i:PasswordHistory' => 'New password has to be different from the last N passwords',

View File

@ -832,7 +832,7 @@ echo $this->getData('nav')->render(); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?>
<td><?= $this->printHtml($audit->module); ?>
<td><?= $audit->getType(); ?>
<td><?= $audit->type; ?>
<td><?= $this->printHtml($audit->trigger); ?>
<td><?= $this->printHtml($audit->createdBy->login); ?>
<td><?= $this->printHtml($audit->ref); ?>

View File

@ -58,11 +58,11 @@ echo $this->getData('nav')->render();
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->getId(); ?>
<td><?= $this->printHtml($audit->module); ?>
<td><?= $audit->getType(); ?>
<td><?= $audit->type; ?>
<td><?= $this->printHtml($audit->trigger); ?>
<td><?= $this->printHtml($audit->content); ?>
<td><?= $this->printHtml((string) $audit->content); ?>
<td><?= $this->printHtml($audit->createdBy->login); ?>
<td><?= $this->printHtml($audit->ref); ?>
<td><?= $this->printHtml((string) $audit->ref); ?>
<td><?= $audit->createdAt->format('Y-m-d H:i'); ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>

View File

@ -58,6 +58,30 @@ else : ?>
<i class="filter fa fa-filter"></i>
</label>
<td class="wf-100"><?= $this->getHtml('Value'); ?>
<td><?= $this->getHtml('Unit'); ?>
<label for="settingsList-sort-5">
<input type="radio" name="settingsList-sort" id="settingsList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="settingsList-sort-6">
<input type="radio" name="settingsList-sort" id="settingsList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('App'); ?>
<label for="settingsList-sort-5">
<input type="radio" name="settingsList-sort" id="settingsList-sort-5">
<i class="sort-asc fa fa-chevron-up"></i>
</label>
<label for="settingsList-sort-6">
<input type="radio" name="settingsList-sort" id="settingsList-sort-6">
<i class="sort-desc fa fa-chevron-down"></i>
</label>
<label>
<i class="filter fa fa-filter"></i>
</label>
<td><?= $this->getHtml('Group'); ?>
<label for="settingsList-sort-7">
<input type="radio" name="settingsList-sort" id="settingsList-sort-7">
@ -89,8 +113,22 @@ else : ?>
<tr tabindex="0">
<td><i class="fa fa-cogs"></i>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><?= $setting->getId(); ?>
<td data-label="<?= $this->getHtml('Name'); ?>"><?= $this->printHtml($setting->name); ?>
<td data-label="<?= $this->getHtml('Name'); ?>">
<?php
$name = $setting->name;
if ($this->getData('settings_class') !== null) {
$name = $this->getData('settings_class')::getName($setting->name);
if (!\is_string($name)) {
$name= $setting->name;
}
}
?>
<?= $this->printHtml($name); ?>
<td data-label="<?= $this->getHtml('Value'); ?>"><?= $this->printHtml($setting->content); ?>
<td data-label="<?= $this->getHtml('Unit'); ?>"><?= $this->printHtml((string) $setting->unit); ?>
<td data-label="<?= $this->getHtml('App'); ?>"><?= $this->printHtml((string) $setting->app); ?>
<td data-label="<?= $this->getHtml('Group'); ?>"><?= $this->printHtml($setting->group); ?>
<td data-label="<?= $this->getHtml('Account'); ?>"><?= $this->printHtml($setting->account); ?>
<?php endforeach; ?>

View File

@ -1,6 +1,6 @@
{
"name": "karaka/module",
"description": "Module for Karaka.",
"description": "Module for Jingga.",
"authors": [
{
"name": "Dennis Eichhorn",

View File

@ -11,7 +11,7 @@
"phpOMS-db": "1.0.0"
},
"creator": {
"name": "Karaka",
"name": "Jingga",
"website": "jingga.app"
},
"description": "The administration module.",