diff --git a/Admin/Hooks/Web/Api.php b/Admin/Hooks/Web/Api.php
index 0080889..b2a8833 100755
--- a/Admin/Hooks/Web/Api.php
+++ b/Admin/Hooks/Web/Api.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media.php b/Admin/Install/Media.php
index d7c47d7..cd69acc 100755
--- a/Admin/Install/Media.php
+++ b/Admin/Install/Media.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin\Admin\Install
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@@ -23,7 +23,7 @@ use phpOMS\Application\ApplicationAbstract;
* Media class.
*
* @package Modules\Admin\Admin\Install
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
@@ -43,44 +43,35 @@ class Media
{
$media = \Modules\Media\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Media.install.json']);
- SettingMapper::create()->execute(
- new Setting(
- 0,
- SettingsEnum::DEFAULT_LIST_EXPORTS,
- (string) $media['collection'][4]['id'],
- '\\d+',
- module: 'Admin'
- )
- );
-
- SettingMapper::create()->execute(
- new Setting(
- 0,
- SettingsEnum::DEFAULT_LETTERS,
- (string) $media['collection'][5]['id'],
- '\\d+',
- 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'
- )
+ \Modules\Admin\Admin\Installer::installExternal($app,
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::DEFAULT_LIST_EXPORTS,
+ 'content' => (string) $media['collection'][4]['id'],
+ 'pattern' => '\\d+',
+ 'module' => 'Admin'
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::DEFAULT_LETTERS,
+ 'content' => (string) $media['collection'][5]['id'],
+ 'pattern' => '\\d+',
+ 'module' => 'Admin'
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::DEFAULT_ASSETS,
+ 'content' => (string) $media['upload'][0]['id'],
+ 'pattern' => '\\d+',
+ 'module' => 'Admin'
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::DEFAULT_TEMPLATES,
+ 'content' => (string) $media['upload'][1]['id'],
+ 'pattern' => '\\d+',
+ 'module' => 'Admin'
+ ]
);
}
}
diff --git a/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php b/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php
index 2be87ca..8920498 100755
--- a/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php
+++ b/Admin/Install/Media/CsvListExporter/defaultCsvExporter.csv.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media/EmailExporter/defaultEmailExporter.mail.php b/Admin/Install/Media/EmailExporter/defaultEmailExporter.mail.php
index 0da7105..78ec92d 100755
--- a/Admin/Install/Media/EmailExporter/defaultEmailExporter.mail.php
+++ b/Admin/Install/Media/EmailExporter/defaultEmailExporter.mail.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php b/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php
index 1f321d6..6bcafef 100755
--- a/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php
+++ b/Admin/Install/Media/ExcelListExporter/defaultExcelExporter.xls.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php b/Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php
index dd89cf4..b9b5fb0 100644
--- a/Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php
+++ b/Admin/Install/Media/PdfDefaultTemplate/pdfTemplate.pdf.php
@@ -1,15 +1,94 @@
SetCreator("Jingga");
+
+ // set default header data
+ $this->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Jingga', 'Business solutions made simple.');
+
+ // set header and footer fonts
+ $this->SetHeaderFont([PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN]);
+ $this->SetFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA]);
+
+ // set default monospaced font
+ $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ $this->SetMargins(15, 30, 15);
+
+ // set auto page breaks
+ $this->SetAutoPageBreak(true, 25);
+
+ // set image scale factor
+ $this->SetImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // add a page
+ $this->AddPage();
+ }
+
+ /**
+ * Create header
+ *
+ * @return void
+ *
+ * @since 1.0.0
+ */
+ public function Header() : void
+ {
if ($this->header_xobjid === false) {
$this->header_xobjid = $this->startTemplate($this->w, 0);
@@ -50,8 +129,15 @@ class DefaultPdf extends TCPDF
}
}
- // Page footer
- public function Footer() {
+ /**
+ * Create footer
+ *
+ * @return void
+ *
+ * @since 1.0.0
+ */
+ public function Footer() : void
+ {
$this->SetY(-25);
$this->SetFont('helvetica', 'I', 7);
@@ -76,35 +162,6 @@ class DefaultPdf extends TCPDF
$this->SetXY(25 + 45 + 35 + 15 + 40, -15, true);
$this->MultiCell(35, 0, "www.jingga.app\ninfo@jingga.app\n+49 0152 ???????", 0, 'L', false, 1, null, null, true, 0, false, true, 0, 'B');
}
-
- public function __construct()
- {
- parent::__construct('P', 'mm', 'A4', true, 'UTF-8', false);
-
- $this->SetCreator("Jingga");
-
- // set default header data
- $this->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, 'Jingga', 'Business solutions made simple.');
-
- // set header and footer fonts
- $this->SetHeaderFont([PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN]);
- $this->SetFooterFont([PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA]);
-
- // set default monospaced font
- $this->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
-
- // set margins
- $this->SetMargins(15, 30, 15);
-
- // set auto page breaks
- $this->SetAutoPageBreak(true, 25);
-
- // set image scale factor
- $this->SetImageScale(PDF_IMAGE_SCALE_RATIO);
-
- // add a page
- $this->AddPage();
- }
}
/*
diff --git a/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php b/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php
index 5e64938..ee708b2 100755
--- a/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php
+++ b/Admin/Install/Media/PdfListExporter/defaultPdfListExporter.pdf.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php b/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php
index c79b819..98d3687 100644
--- a/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php
+++ b/Admin/Install/Media/WordLetterExporter/defaultWordLetterExporter.doc.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php b/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php
index e2ece94..ed5f4d5 100755
--- a/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php
+++ b/Admin/Install/Media/WordListExporter/defaultWordListExporter.doc.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php b/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php
index c79b819..99b8bd1 100644
--- a/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php
+++ b/Admin/Install/Media/WordPlainTemplate/defaultWordExporter.doc.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@@ -15,6 +15,7 @@ declare(strict_types=1);
require_once __DIR__ . '/../phpOMS/Autoloader.php';
use phpOMS\Autoloader;
+
Autoloader::addPath(__DIR__ . '/../Resources');
$media = $this->getData('media');
@@ -22,7 +23,7 @@ $data = $this->getData('data') ?? [];
include $media->getSourceByName('template.php')->getAbsolutePath();
-$word = new DefaultWord();
+$word = new DefaultWord();
$section = $word->createFirstPage();
$file = \tempnam(\sys_get_temp_dir(), 'oms_');
@@ -30,4 +31,4 @@ $writer->save($file);
echo \file_get_contents($file);
-\unlink($file);
\ No newline at end of file
+\unlink($file);
diff --git a/Admin/Install/Messages.install.json b/Admin/Install/Messages.install.json
new file mode 100644
index 0000000..31bf6bc
--- /dev/null
+++ b/Admin/Install/Messages.install.json
@@ -0,0 +1,38 @@
+[
+ {
+ "type": "email_template",
+ "from": "",
+ "to": "",
+ "cc": "",
+ "bcc": "",
+ "subject": "Registration confirmation",
+ "ishtml": true,
+ "body": "
Registration ConfirmationRegistration ConfirmationDear {user_name}, Thank you for registering for our service. Your account has been successfully created. Your username is: {user_name} To get started, please click on the following confirmation link: Confirm |
|
",
+ "bodyalt": "Dear {user_name},\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: {user_name}\n\nTo get started, please click on the following confirmation link: {confirmation_link}.\n\nThank you,\n\n[Your Company]",
+ "send": false
+ },
+ {
+ "type": "email_template",
+ "from": "",
+ "to": "",
+ "cc": "",
+ "bcc": "",
+ "subject": "Account recovery",
+ "ishtml": true,
+ "body": "Registration ConfirmationRegistration ConfirmationDear [Name], Thank you for registering for our service. Your account has been successfully created. Your username is: [Username] To get started, please click on the following confirmation link: Confirm |
|
",
+ "bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\nThank you,\n\n[Your Company]",
+ "send": false
+ },
+ {
+ "type": "email_template",
+ "from": "",
+ "to": "",
+ "cc": "",
+ "bcc": "",
+ "subject": "Failed login",
+ "ishtml": true,
+ "body": "Registration ConfirmationRegistration ConfirmationDear [Name], Thank you for registering for our service. Your account has been successfully created. Your username is: [Username] To get started, please click on the following confirmation link: Confirm |
|
",
+ "bodyalt": "Dear [Name],\n\nThank you for registering for our service. Your account has been successfully created.\n\nYour username is: [Username]\n\nTo get started, please click on the following confirmation link: [Login Link].\n\nThank you,\n\n[Your Company]",
+ "send": false
+ }
+]
\ No newline at end of file
diff --git a/Admin/Install/Messages.php b/Admin/Install/Messages.php
new file mode 100644
index 0000000..2b1e3cd
--- /dev/null
+++ b/Admin/Install/Messages.php
@@ -0,0 +1,81 @@
+ __DIR__ . '/Messages.install.json']);
+
+ /** @var \Modules\Admin\Controller\ApiController $module */
+ $module = $app->moduleManager->get('Admin');
+
+ $settings = [
+ [
+ 'id' => null,
+ 'name' => SettingsEnum::LOGIN_MAIL_REGISTRATION_TEMPLATE,
+ 'content' => (string) $messages['email_template'][0]['id'],
+ 'module' => 'Admin',
+ ],
+ [
+ 'id' => null,
+ 'name' => SettingsEnum::LOGIN_MAIL_FORGOT_PASSWORD_TEMPLATE,
+ 'content' => (string) $messages['email_template'][1]['id'],
+ 'module' => 'Admin',
+ ],
+ [
+ 'id' => null,
+ 'name' => SettingsEnum::LOGIN_MAIL_FAILED_TEMPLATE,
+ 'content' => (string) $messages['email_template'][2]['id'],
+ 'module' => 'Admin',
+ ],
+ ];
+
+ $response = new HttpResponse();
+ $request = new HttpRequest(new HttpUri(''));
+
+ $request->header->account = 1;
+ $request->setData('settings', \json_encode($settings));
+
+ $module->apiSettingsSet($request, $response);
+ }
+}
diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json
index 9102ad1..f90074a 100755
--- a/Admin/Install/Navigation.install.json
+++ b/Admin/Install/Navigation.install.json
@@ -19,7 +19,7 @@
"type": 2,
"subtype": 1,
"name": "Groups",
- "uri": "{/lang}/{/app}/admin/group/list",
+ "uri": "{/base}/admin/group/list",
"target": "self",
"icon": null,
"order": 2,
@@ -33,7 +33,7 @@
"type": 3,
"subtype": 1,
"name": "List",
- "uri": "{/lang}/{/app}/admin/group/list",
+ "uri": "{/base}/admin/group/list",
"target": "self",
"icon": null,
"order": 1,
@@ -48,7 +48,7 @@
"type": 3,
"subtype": 1,
"name": "Create",
- "uri": "{/lang}/{/app}/admin/group/create?{?}",
+ "uri": "{/base}/admin/group/create?{?}",
"target": "self",
"icon": null,
"order": 5,
@@ -65,7 +65,7 @@
"type": 2,
"subtype": 1,
"name": "Accounts",
- "uri": "{/lang}/{/app}/admin/account/list",
+ "uri": "{/base}/admin/account/list",
"target": "self",
"icon": null,
"order": 4,
@@ -79,7 +79,7 @@
"type": 3,
"subtype": 1,
"name": "List",
- "uri": "{/lang}/{/app}/admin/account/list",
+ "uri": "{/base}/admin/account/list",
"target": "self",
"icon": null,
"order": 1,
@@ -94,7 +94,7 @@
"type": 3,
"subtype": 1,
"name": "Create",
- "uri": "{/lang}/{/app}/admin/account/create?{?}",
+ "uri": "{/base}/admin/account/create?{?}",
"target": "self",
"icon": null,
"order": 5,
@@ -111,7 +111,7 @@
"type": 2,
"subtype": 1,
"name": "Modules",
- "uri": "{/lang}/{/app}/admin/module/list",
+ "uri": "{/base}/admin/module/list",
"target": "self",
"icon": null,
"order": 6,
@@ -125,7 +125,7 @@
"type": 3,
"subtype": 1,
"name": "Info",
- "uri": "{/lang}/{/app}/admin/module/info?{?}",
+ "uri": "{/base}/admin/module/info?{?}",
"target": "self",
"icon": null,
"order": 1,
@@ -140,7 +140,7 @@
"type": 3,
"subtype": 1,
"name": "Settings",
- "uri": "{/lang}/{/app}/admin/module/settings?{?}",
+ "uri": "{/base}/admin/module/settings?{?}",
"target": "self",
"icon": null,
"order": 5,
@@ -155,7 +155,7 @@
"type": 3,
"subtype": 1,
"name": "Routes",
- "uri": "{/lang}/{/app}/admin/module/route/list?{?}",
+ "uri": "{/base}/admin/module/route/list?{?}",
"target": "self",
"icon": null,
"order": 15,
@@ -170,7 +170,7 @@
"type": 3,
"subtype": 1,
"name": "Hooks",
- "uri": "{/lang}/{/app}/admin/module/hook/list?{?}",
+ "uri": "{/base}/admin/module/hook/list?{?}",
"target": "self",
"icon": null,
"order": 15,
@@ -185,7 +185,7 @@
"type": 3,
"subtype": 1,
"name": "Log",
- "uri": "{/lang}/{/app}/admin/module/log?{?}",
+ "uri": "{/base}/admin/module/log?{?}",
"target": "self",
"icon": null,
"order": 20,
diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php
index 86b4819..fdefa2e 100755
--- a/Admin/Install/Navigation.php
+++ b/Admin/Install/Navigation.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin\Admin\Install
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@@ -20,7 +20,7 @@ use phpOMS\Application\ApplicationAbstract;
* Navigation class.
*
* @package Modules\Admin\Admin\Install
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
diff --git a/Admin/Install/settings.php b/Admin/Install/settings.php
new file mode 100644
index 0000000..2f6d6ef
--- /dev/null
+++ b/Admin/Install/settings.php
@@ -0,0 +1,170 @@
+ 'setting',
+ 'name' => SettingsEnum::PASSWORD_PATTERN,
+ 'content' => '/^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[.,\/\(\)\{\}\[\]#?!@$%^&*+=\':"-]).{8,}$/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGIN_TRIES,
+ 'content' => '3',
+ 'pattern' => '/\\d+/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::PASSWORD_INTERVAL,
+ 'content' => '90',
+ 'pattern' => '/\\d+/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::PASSWORD_HISTORY,
+ 'content' => '3',
+ 'pattern' => '/\\d+/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGGING_STATUS,
+ 'content' => '1',
+ 'pattern' => '/[0-3]/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGGING_PATH,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::DEFAULT_UNIT,
+ 'content' => '1',
+ 'pattern' => '/\\d+/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGIN_STATUS,
+ 'content' => '1',
+ 'pattern' => '/[0-3]/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGIN_MAIL_REGISTRATION_TEMPLATE,
+ 'content' => '',
+ 'pattern' => '/\\d*/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGIN_MAIL_FORGOT_PASSWORD_TEMPLATE,
+ 'content' => '',
+ 'pattern' => '/\\d*/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::LOGIN_MAIL_FAILED_TEMPLATE,
+ 'content' => '',
+ 'pattern' => '/\\d*/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::DEFAULT_LOCALIZATION,
+ 'content' => '1',
+ 'pattern' => '/\\d+/',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_OUT,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_PORT_OUT,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_IN,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_PORT_IN,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_ADDR,
+ 'content' => '',
+ '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',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_TYPE,
+ 'content' => SubmitType::MAIL,
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_USER,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_PASS,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_CERT,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_KEY,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_KEYPASS,
+ 'content' => '',
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::MAIL_SERVER_TLS,
+ 'content' => (string) false,
+ 'module' => 'Admin',
+ ],
+ [
+ 'type' => 'setting',
+ 'name' => SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_APP,
+ 'content' => (string) true,
+ 'module' => 'Admin',
+ ],
+];
\ No newline at end of file
diff --git a/Admin/InstallType.php b/Admin/InstallType.php
index 9088717..81eb38a 100755
--- a/Admin/InstallType.php
+++ b/Admin/InstallType.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@@ -20,7 +20,7 @@ use phpOMS\Stdlib\Base\Enum;
* Install type enum.
*
* @package Modules\Admin\Admin
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
diff --git a/Admin/Installer.php b/Admin/Installer.php
index f97ba74..cf95526 100755
--- a/Admin/Installer.php
+++ b/Admin/Installer.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin\Admin
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@@ -24,18 +24,20 @@ use phpOMS\DataStorage\Database\Connection\SQLiteConnection;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Localization\Localization;
-use phpOMS\Message\Mail\SubmitType;
+use phpOMS\Message\Http\HttpRequest;
+use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\System\File\PathException;
use phpOMS\System\OperatingSystem;
use phpOMS\System\SystemType;
+use phpOMS\Uri\HttpUri;
/**
* Installer class.
*
* @package Modules\Admin\Admin
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
@@ -67,6 +69,11 @@ final class Installer extends InstallerAbstract
self::installDefaultSettings();
$sqlite->close();
+
+ $settings = include __DIR__ . '/Install/settings.php';
+ foreach ($settings as $setting) {
+ self::createSettings($app, $setting);
+ }
}
/**
@@ -78,38 +85,6 @@ 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', 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', pattern: '/\\d+/', 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', pattern: '/\\d+/', 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'));
- SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_CERT, '', module: 'Admin'));
- SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_KEY, '', module: 'Admin'));
- SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_KEYPASS, '', module: 'Admin'));
- SettingMapper::create()->execute(new Setting(0, SettingsEnum::MAIL_SERVER_TLS, (string) false, module: 'Admin'));
-
- SettingMapper::create()->execute(new Setting(0, SettingsEnum::GROUP_GENERATE_AUTOMATICALLY_APP, (string) true, module: 'Admin'));
-
$cmdResult = \shell_exec(
(OperatingSystem::getSystem() === SystemType::WIN
? 'php.exe'
@@ -157,9 +132,9 @@ final class Installer extends InstallerAbstract
foreach ($countries as $country) {
$query->values(
- $country['country_name'] === null ? null : \trim($country['country_name']),
- $country['country_code2'] === null ? null : \trim($country['country_code2']),
- $country['country_code3'] === null ? null : \trim($country['country_code3']),
+ $country['country_name'] === null ? null : \trim((string) $country['country_name']),
+ $country['country_code2'] === null ? null : \trim((string) $country['country_code2']),
+ $country['country_code3'] === null ? null : \trim((string) $country['country_code3']),
$country['country_numeric'],
$country['country_region'],
(int) $country['country_developed']
@@ -196,12 +171,12 @@ final class Installer extends InstallerAbstract
foreach ($languages as $language) {
$query->values(
- $language['language_name'] === null ? null : \trim($language['language_name']),
- $language['language_native'] === null ? null : \trim($language['language_native']),
- $language['language_639_1'] === null ? null : \trim($language['language_639_1']),
- $language['language_639_2T'] === null ? null : \trim($language['language_639_2T']),
- $language['language_639_2B'] === null ? null : \trim($language['language_639_2B']),
- $language['language_639_3'] === null ? null : \trim($language['language_639_3'])
+ $language['language_name'] === null ? null : \trim((string) $language['language_name']),
+ $language['language_native'] === null ? null : \trim((string) $language['language_native']),
+ $language['language_639_1'] === null ? null : \trim((string) $language['language_639_1']),
+ $language['language_639_2T'] === null ? null : \trim((string) $language['language_639_2T']),
+ $language['language_639_2B'] === null ? null : \trim((string) $language['language_639_2B']),
+ $language['language_639_3'] === null ? null : \trim((string) $language['language_639_3'])
);
}
@@ -236,13 +211,13 @@ final class Installer extends InstallerAbstract
foreach ($currencies as $currency) {
$query->values(
$currency['currency_id'],
- $currency['currency_name'] === null ? null : \trim($currency['currency_name']),
- $currency['currency_code'] === null ? null : \trim($currency['currency_code']),
- $currency['currency_number'] === null ? null : \trim($currency['currency_number']),
- $currency['currency_symbol'] === null ? null : \trim($currency['currency_symbol']),
+ $currency['currency_name'] === null ? null : \trim((string) $currency['currency_name']),
+ $currency['currency_code'] === null ? null : \trim((string) $currency['currency_code']),
+ $currency['currency_number'] === null ? null : \trim((string) $currency['currency_number']),
+ $currency['currency_symbol'] === null ? null : \trim((string) $currency['currency_symbol']),
$currency['currency_subunits'],
- $currency['currency_decimal'] === null ? null : \trim($currency['currency_decimal']),
- $currency['currency_countries'] === null ? null : \trim($currency['currency_countries'])
+ $currency['currency_decimal'] === null ? null : \trim((string) $currency['currency_decimal']),
+ $currency['currency_countries'] === null ? null : \trim((string) $currency['currency_countries'])
);
}
@@ -297,18 +272,41 @@ final class Installer extends InstallerAbstract
/**
* Create settings.
*
- * @param ApplicationAbstract $app Database instance
- * @param array $setting Media info
+ * @param ApplicationAbstract $app Database instance
+ * @param array $data Setting data
*
* @return array
*
* @since 1.0.0
*/
- private static function createSettings(ApplicationAbstract $app, array $setting) : array
+ private static function createSettings(ApplicationAbstract $app, array $data) : array
{
- unset($setting['type']);
- $app->appSettings->create($setting);
+ /** @var \Modules\Admin\Controller\ApiController $module */
+ $module = $app->moduleManager->get('Admin');
- return $setting;
+ $response = new HttpResponse();
+ $request = new HttpRequest(new HttpUri(''));
+
+ $request->header->account = 1;
+ $request->setData('id', $data['id'] ?? 0);
+ $request->setData('name', $data['name'] ?? '');
+ $request->setData('content', $data['content'] ?? '');
+ $request->setData('pattern', $data['pattern'] ?? '');
+ $request->setData('unit', $data['unit'] ?? null);
+ $request->setData('app', $data['app'] ?? null);
+ $request->setData('module', $data['module'] ?? null);
+ $request->setData('group', $data['group'] ?? null);
+ $request->setData('account', $data['account'] ?? null);
+
+ $module->apiSettingsCreate($request, $response);
+
+ $responseData = $response->get('');
+ if (!\is_array($responseData)) {
+ return [];
+ }
+
+ return !\is_array($responseData['response'])
+ ? $responseData['response']->toArray()
+ : $responseData['response'];
}
}
diff --git a/Admin/Routes/Web/Api.php b/Admin/Routes/Web/Api.php
index ec235e2..6f91aca 100755
--- a/Admin/Routes/Web/Api.php
+++ b/Admin/Routes/Web/Api.php
@@ -6,7 +6,7 @@
*
* @package Modules
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Routes/Web/Backend.php b/Admin/Routes/Web/Backend.php
index daa5c3b..eb6ae18 100755
--- a/Admin/Routes/Web/Backend.php
+++ b/Admin/Routes/Web/Backend.php
@@ -6,7 +6,7 @@
*
* @package Modules
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
diff --git a/Admin/Settings/Theme/Backend/settings.tpl.php b/Admin/Settings/Theme/Backend/settings.tpl.php
index 373c9e9..24c719e 100755
--- a/Admin/Settings/Theme/Backend/settings.tpl.php
+++ b/Admin/Settings/Theme/Backend/settings.tpl.php
@@ -6,7 +6,7 @@
*
* @package Modules\Admin\Models
* @copyright Dennis Eichhorn
- * @license OMS License 1.0
+ * @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@@ -103,7 +103,7 @@ echo $this->getData('nav')->render();
-
+
@@ -112,7 +112,7 @@ echo $this->getData('nav')->render();
-
+
@@ -121,7 +121,7 @@ echo $this->getData('nav')->render();
-
+
@@ -130,7 +130,7 @@ echo $this->getData('nav')->render();
-
+
@@ -139,7 +139,7 @@ echo $this->getData('nav')->render();
-
+
@@ -167,7 +167,7 @@ echo $this->getData('nav')->render();
-
+