diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 1c20ca1..d77e86c 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -47,6 +47,8 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Monitoring/Theme/Backend/monitoring-dashboard'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000706001, $request, $response)); + $view->setData('logger', $this->app->logger); + return $view; } @@ -68,6 +70,8 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Monitoring/Theme/Backend/monitoring-logs'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000706001, $request, $response)); + $view->setData('logger', $this->app->logger); + return $view; } @@ -89,6 +93,8 @@ final class BackendController extends Controller $view->setTemplate('/Modules/Monitoring/Theme/Backend/monitoring-logs-single'); $view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1000706001, $request, $response)); + $view->setData('logger', $this->app->logger); + return $view; } diff --git a/Theme/Backend/monitoring-dashboard.tpl.php b/Theme/Backend/monitoring-dashboard.tpl.php index d875539..2367122 100755 --- a/Theme/Backend/monitoring-dashboard.tpl.php +++ b/Theme/Backend/monitoring-dashboard.tpl.php @@ -12,54 +12,57 @@ */ declare(strict_types=1); -$logs = $this->app->logger->countLogs(); -$penetrators = $this->app->logger->getHighestPerpetrator(); +use phpOMS\System\SystemUtils; + +$logger = $this->getData('logger'); +$logs = $logger->countLogs(); +$penetrators = $logger->getHighestPerpetrator(); echo $this->getData('nav')->render(); ?>
-
-

getHtml('System'); ?>

-
+
+
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('RAMUsage'); ?>printHtml((string) (\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('SystemRAM'); ?>printHtml((string) (SystemUtils::getRAM() / (1024))); ?> MB +
getHtml('CPUUsage'); ?>printHtml((string) SystemUtils::getCpuUsage()); ?>%
-
-

getHtml('Logs'); ?>

-
+
+
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('Emergencies'); ?>printHtml((string) ($logs['emergency'] ?? 0)); ?> +
getHtml('Criticals'); ?>printHtml((string) ($logs['critical'] ?? 0)); ?> +
getHtml('Errors'); ?>printHtml((string) ($logs['error'] ?? 0)); ?> +
getHtml('Warnings'); ?>printHtml((string) ($logs['warning'] ?? 0)); ?> +
getHtml('Alerts'); ?>printHtml((string) ($logs['alert'] ?? 0)); ?> +
getHtml('Notices'); ?>printHtml((string) ($logs['notice'] ?? 0)); ?> +
getHtml('Info'); ?>printHtml((string) ($logs['info'] ?? 0)); ?> +
getHtml('Debug'); ?>printHtml((string) ($logs['debug'] ?? 0)); ?> +
getHtml('Total'); ?>printHtml((string) \array_sum($logs)); ?>
-
-

getHtml('Penetrators'); ?>

-
+
+
getHtml('Penetrators'); ?>
+
$count) : ?> diff --git a/Theme/Backend/monitoring-logs.tpl.php b/Theme/Backend/monitoring-logs.tpl.php index 0251af7..713c6fd 100755 --- a/Theme/Backend/monitoring-logs.tpl.php +++ b/Theme/Backend/monitoring-logs.tpl.php @@ -15,36 +15,37 @@ declare(strict_types=1); /** * @var \phpOMS\Views\View $this */ -$logs = \array_reverse($this->app->logger->get(25), true); +$logger = $this->getData('logger'); + +$logs = \array_reverse($logger->get(25), true); echo $this->getData('nav')->render(); ?>
-
-
- - - - - - - $value) : - $url = \phpOMS\Uri\UriFactory::build('{/prefix}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] ?? ''); ?> - -
- -
+
+
+
getHtml('Modules'); ?>
+ + + + + $value) : + $url = \phpOMS\Uri\UriFactory::build('{/prefix}admin/monitoring/logs/single?{?}&id=' . $key); ?> + + +
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/Theme/Backend/monitoring-security.tpl.php b/Theme/Backend/monitoring-security.tpl.php index eb9a35e..0f4cfe0 100755 --- a/Theme/Backend/monitoring-security.tpl.php +++ b/Theme/Backend/monitoring-security.tpl.php @@ -19,13 +19,39 @@ use phpOMS\System\File\Local\Directory; use phpOMS\System\File\Local\File; use phpOMS\Uri\HttpUri; +$fileHashs = \file_get_contents(__DIR__ . '/../../../../hashs.txt'); /* Rest::request( + new HttpRequest( + new HttpUri('https://raw.githubusercontent.com/Orange-Management/Build/master/hashs.txt') + ) +)->getBody(); */ + +$hashs = []; +$fp = \fopen("php://memory", 'r+'); +\fputs($fp, $fileHashs); +\rewind($fp); + +while($line = \fgets($fp)){ + $line = \trim($line); + if ($line === '') { + continue; + } + + $whitespace = \stripos($line, ' '); + $length = \strlen($line); + $hash = \substr($line, 0, $whitespace); + $file = \trim(\substr($line, $whitespace + 2), '.\\/'); + + $hashs[$file] = $hash; +} +\fclose($fp); + echo $this->getData('nav')->render(); ?>
-
-

getHtml('PHPSettings'); ?>

-
+
+
getHtml('PHPSettings'); ?>
+
getHtml('DisabledFunctions'); ?>getHtml('OK') : $this->getHtml('NG'); ?> @@ -38,74 +64,125 @@ echo $this->getData('nav')->render(); ?>
-
- - +
+
getHtml('Inspection'); ?>
+
getHtml('Inspection'); ?>
- - -
getHtml('Status'); ?> + + + getHtml('File'); ?> + + + getHtml('Unicode'); ?> + + + getHtml('Deprecated'); ?> + + + getHtml('Modified'); ?> + + + getHtml('Integrity'); ?> + + +
+ getHtml('NG') : $this->getHtml('OK'); ?> - getHtml('NG') : $this->getHtml('OK'); ?> - getHtml('NG') : $this->getHtml('OK'); ?> + getHtml('NG') : $this->getHtml('OK'); ?> + getHtml('NG') : $this->getHtml('OK'); ?> format('Y-m-d'); ?> - - getBody() - ) ? $this->getHtml('OK') : $this->getHtml('NG'); ?> + getHtml('OK') : $this->getHtml('NG'); ?>
+ getHtml('NG') : $this->getHtml('OK'); ?> - getHtml('NG') : $this->getHtml('OK'); ?> - getHtml('NG') : $this->getHtml('OK'); ?> + getHtml('NG') : $this->getHtml('OK'); ?> + getHtml('NG') : $this->getHtml('OK'); ?> format('Y-m-d'); ?> - - getBody() - ) ? $this->getHtml('OK') : $this->getHtml('NG'); ?> + getHtml('OK') : $this->getHtml('NG'); ?>
+ getHtml('NG') : $this->getHtml('OK'); ?> - getHtml('NG') : $this->getHtml('OK'); ?> - getHtml('NG') : $this->getHtml('OK'); ?> + getHtml('NG') : $this->getHtml('OK'); ?> + getHtml('NG') : $this->getHtml('OK'); ?> format('Y-m-d'); ?> - - getBody() - ) ? $this->getHtml('OK') : $this->getHtml('NG'); ?> + getHtml('OK') : $this->getHtml('NG'); ?>