commit 371487291814fcf83b8b5f40dcbe870fc56e4e1d Author: Dennis Eichhorn Date: Sun May 20 09:58:42 2018 +0200 Added new module for import/export diff --git a/Admin/Install/Navigation.install.json b/Admin/Install/Navigation.install.json new file mode 100644 index 0000000..53ea9fd --- /dev/null +++ b/Admin/Install/Navigation.install.json @@ -0,0 +1,78 @@ +[ + { + "id": 1007001001, + "pid": "/backend", + "type": 2, + "subtype": 1, + "name": "Exchange", + "uri": "/{/lang}/backend/admin/exchange/dashboard?{?}", + "target": "self", + "icon": null, + "order": 50, + "from": "Exchange", + "permission": { "type": null, "element": null }, + "parent": 1000101001, + "children": [ + { + "id": 1007002001, + "pid": "/backend/admin/exchange", + "type": 3, + "subtype": 1, + "name": "Dashboard", + "uri": "/{/lang}/backend/admin/exchange/dashboard?{?}", + "target": "self", + "icon": null, + "order": 1, + "from": "Exchange", + "permission": { "type": null, "element": null }, + "parent": 1007001001, + "children": [] + }, + { + "id": 1007002002, + "pid": "/backend/admin/exchange", + "type": 3, + "subtype": 1, + "name": "Import", + "uri": "/{/lang}/backend/admin/exchange/import?{?}", + "target": "self", + "icon": null, + "order": 5, + "from": "Exchange", + "permission": { "type": null, "element": null }, + "parent": 1007001001, + "children": [] + }, + { + "id": 1007002003, + "pid": "/backend/admin/exchange", + "type": 3, + "subtype": 1, + "name": "Export", + "uri": "/{/lang}/backend/admin/exchange/export?{?}", + "target": "self", + "icon": null, + "order": 10, + "from": "Exchange", + "permission": { "type": null, "element": null }, + "parent": 1007001001, + "children": [] + }, + { + "id": 1007002004, + "pid": "/backend/admin/exchange", + "type": 3, + "subtype": 1, + "name": "Setup", + "uri": "/{/lang}/backend/admin/exchange/setup?{?}", + "target": "self", + "icon": null, + "order": 15, + "from": "Exchange", + "permission": { "type": null, "element": null }, + "parent": 1007001001, + "children": [] + } + ] + } +] diff --git a/Admin/Install/Navigation.php b/Admin/Install/Navigation.php new file mode 100644 index 0000000..035faa3 --- /dev/null +++ b/Admin/Install/Navigation.php @@ -0,0 +1,47 @@ + [ + [ + 'dest' => '\Modules\Exchange\Controller:viewExchangeImport', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/admin/exchange/export.*$' => [ + [ + 'dest' => '\Modules\Exchange\Controller:viewExchangeExport', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/admin/exchange/dashboard.*$' => [ + [ + 'dest' => '\Modules\Exchange\Controller:viewExchangeDashboard', + 'verb' => RouteVerb::GET, + ], + ], + '^.*/backend/admin/exchange/setup.*$' => [ + [ + 'dest' => '\Modules\Exchange\Controller:viewExchangeSetup', + 'verb' => RouteVerb::GET, + ], + ], +]; diff --git a/Admin/Routes/console.php b/Admin/Routes/console.php new file mode 100644 index 0000000..1ecbfac --- /dev/null +++ b/Admin/Routes/console.php @@ -0,0 +1,3 @@ + [ + 'List' => 'List', + 'Exchange' => 'Exchange', +]]; diff --git a/Theme/Backend/Lang/api.en.lang.php b/Theme/Backend/Lang/api.en.lang.php new file mode 100644 index 0000000..12ac5fd --- /dev/null +++ b/Theme/Backend/Lang/api.en.lang.php @@ -0,0 +1,15 @@ + 'Installation of the module {$1} was successful.', +]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php new file mode 100644 index 0000000..7360d0d --- /dev/null +++ b/Theme/Backend/Lang/en.lang.php @@ -0,0 +1,15 @@ + [ + 'Exchange' => 'Exchange', +]]; diff --git a/Theme/Backend/exchange-dashboard.tpl.php b/Theme/Backend/exchange-dashboard.tpl.php new file mode 100644 index 0000000..7381814 --- /dev/null +++ b/Theme/Backend/exchange-dashboard.tpl.php @@ -0,0 +1,70 @@ +app->logger->countLogs(); +$penetrators = $this->app->logger->getHighestPerpetrator(); + +echo $this->getData('nav')->render(); ?> + +
+
+
+

getHtml('System'); ?>

+
+ + +
getHtml('OS'); ?>printHtml(php_uname('s')); ?> +
getHtml('Version'); ?>printHtml(php_uname('v')); ?> +
getHtml('Release'); ?>printHtml(php_uname('r')); ?> +
getHtml('RAMUsage'); ?>printHtml(memory_get_usage(true)/(1024*1024)); ?> MB +
getHtml('MemoryLimit'); ?>printHtml(ini_get('memory_limit')); ?> +
getHtml('SystemRAM'); ?>printHtml(\phpOMS\System\SystemUtils::getRAM()/(1024)); ?> MB +
getHtml('CPUUsage'); ?>printHtml(\phpOMS\System\SystemUtils::getCpuUsage()); ?>% +
+
+
+
+ +
+
+

getHtml('Logs'); ?>

+
+ + +
getHtml('Emergencies'); ?>printHtml($logs['emergency'] ?? 0); ?> +
getHtml('Criticals'); ?>printHtml($logs['critical'] ?? 0); ?> +
getHtml('Errors'); ?>printHtml($logs['error'] ?? 0); ?> +
getHtml('Warnings'); ?>printHtml($logs['warning'] ?? 0); ?> +
getHtml('Alerts'); ?>printHtml($logs['alert'] ?? 0); ?> +
getHtml('Notices'); ?>printHtml($logs['notice'] ?? 0); ?> +
getHtml('Info'); ?>printHtml($logs['info'] ?? 0); ?> +
getHtml('Debug'); ?>printHtml($logs['debug'] ?? 0); ?> +
getHtml('Total'); ?>printHtml(array_sum($logs)); ?> +
+
+
+
+ +
+
+

getHtml('Penetrators'); ?>

+
+ + + $count) : ?> +
printHtml($ip); ?>printHtml($count); ?> + +
+
+
+
+
diff --git a/Theme/Backend/export.tpl.php b/Theme/Backend/export.tpl.php new file mode 100644 index 0000000..ad7dcb5 --- /dev/null +++ b/Theme/Backend/export.tpl.php @@ -0,0 +1,92 @@ +app->logger->getByLine((int) $this->request->getData('id') ?? 1); +$temp = trim($log['backtrace']); +$log['backtrace'] = json_decode($temp, true); + +$details = '* Uri: `' . trim($log['path']) . "`\n" + . '* Level: `' . trim($log['level']) . "`\n" + . '* Message: `' . trim($log['message']) . "`\n" + . '* File: `' . trim($log['file']) . "`\n" + . '* Line: `' . trim($log['line']) . "`\n" + . '* Version: `' . trim($log['version']) . "`\n" + . '* OS: `' . trim($log['os']) . "`\n\n" + . "Backtrace: \n\n```\n" . json_encode($log['backtrace'], JSON_PRETTY_PRINT); + +echo $this->getData('nav')->render(); ?> + +
+
+
+

getHtml('Logs') ?>

+ +
+ + + + + + + + + + + + + + +
getHtml('ID', 0, 0); ?> + + printHtml((int) $this->request->getData('id') ?? 0); ?> +
getHtml('Time') ?> + + printHtml($log['datetime']); ?> +
getHtml('Uri') ?> + + printHtml($log['path']); ?> +
getHtml('Source') ?> + + printHtml($log['ip']); ?> +
getHtml('Level') ?> + + + printHtml($log['level']); ?> +
getHtml('Message') ?> + + printHtml($log['message']); ?> +
getHtml('File') ?> + + printHtml($log['file']); ?> +
getHtml('Line') ?> + + printHtml($log['line']); ?> +
getHtml('Version') ?> + + printHtml($log['version']); ?> +
getHtml('OS') ?> + + printHtml($log['os']); ?> +
getHtml('Backtrace') ?> +
+
printHtml(json_encode($log['backtrace'], JSON_PRETTY_PRINT)); ?>
+
getHtml('Report') ?> +
+
+
+
+
diff --git a/Theme/Backend/import.tpl.php b/Theme/Backend/import.tpl.php new file mode 100644 index 0000000..512ee17 --- /dev/null +++ b/Theme/Backend/import.tpl.php @@ -0,0 +1,48 @@ +app->logger->get(25), true); + +echo $this->getData('nav')->render(); ?> + +
+
+ + + + + + + + $value) : + $url = \phpOMS\Uri\UriFactory::build('/{/lang}/backend/admin/monitoring/logs/single?{?}&id=' . $key);?> + + +
getHtml('Logs') ?>
getHtml('Timestamp') ?> + getHtml('Level') ?> + getHtml('Source') ?> + getHtml('Message') ?> +
+
printHtml($url); ?>> printHtml($value[0] ?? ''); ?> + printHtml($url); ?>> printHtml($value[1] ?? ''); ?> + printHtml($url); ?>> printHtml($value[2] ?? ''); ?> + printHtml($url); ?>> printHtml($value[7] ?? ''); ?> + +
+ +
+
+
diff --git a/img/module_teaser_small.png b/img/module_teaser_small.png new file mode 100644 index 0000000..9147e4f Binary files /dev/null and b/img/module_teaser_small.png differ diff --git a/info.json b/info.json new file mode 100644 index 0000000..e8ebbd1 --- /dev/null +++ b/info.json @@ -0,0 +1,45 @@ +{ + "name": { + "id": 1007000000, + "internal": "Exchange", + "external": "Exchange" + }, + "category": "Admin", + "version": "1.0.0", + "requirements": { + "phpOMS": "1.0.0", + "phpOMS-db": "1.0.0" + }, + "creator": { + "name": "Orange Management", + "website": "www.spl1nes.com" + }, + "description": "The administration module.", + "directory": "Exchange", + "dependencies": { + "Admin": "1.0.0" + }, + "providing": { + "Navigation": "*" + }, + "load": [ + { + "pid": [ + "/backend" + ], + "type": 5, + "from": "Exchange", + "for": "Navigation", + "file": "Navigation" + }, + { + "pid": [ + "/backend/admin/exchange" + ], + "type": 4, + "for": "Content", + "file": "Exchange", + "from": "Exchange" + } + ] +}