Simplify htmlescape

This commit is contained in:
Dennis Eichhorn 2017-09-14 20:39:58 +02:00
parent 58b55a1b62
commit cd31fb9234
3 changed files with 34 additions and 34 deletions

View File

@ -23,13 +23,13 @@ echo $this->getData('nav')->render(); ?>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr><td><?= $this->getHtml('OS'); ?><td><?= htmlspecialchars(php_uname('s'), ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Version'); ?><td><?= htmlspecialchars(php_uname('v'), ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Release'); ?><td><?= htmlspecialchars(php_uname('r'), ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('RAMUsage'); ?><td><?= htmlspecialchars(memory_get_usage(true)/(1024*1024), ENT_COMPAT, 'utf-8'); ?> MB
<tr><td><?= $this->getHtml('MemoryLimit'); ?><td><?= htmlspecialchars(ini_get('memory_limit'), ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('SystemRAM'); ?><td><?= htmlspecialchars(\phpOMS\System\SystemUtils::getRAM()/(1024), ENT_COMPAT, 'utf-8'); ?> MB
<tr><td><?= $this->getHtml('CPUUsage'); ?><td><?= htmlspecialchars(\phpOMS\System\SystemUtils::getCpuUsage(), ENT_COMPAT, 'utf-8'); ?>%
<tr><td><?= $this->getHtml('OS'); ?><td><?= $this->printHtml(php_uname('s')); ?>
<tr><td><?= $this->getHtml('Version'); ?><td><?= $this->printHtml(php_uname('v')); ?>
<tr><td><?= $this->getHtml('Release'); ?><td><?= $this->printHtml(php_uname('r')); ?>
<tr><td><?= $this->getHtml('RAMUsage'); ?><td><?= $this->printHtml(memory_get_usage(true)/(1024*1024)); ?> MB
<tr><td><?= $this->getHtml('MemoryLimit'); ?><td><?= $this->printHtml(ini_get('memory_limit')); ?>
<tr><td><?= $this->getHtml('SystemRAM'); ?><td><?= $this->printHtml(\phpOMS\System\SystemUtils::getRAM()/(1024)); ?> MB
<tr><td><?= $this->getHtml('CPUUsage'); ?><td><?= $this->printHtml(\phpOMS\System\SystemUtils::getCpuUsage()); ?>%
</table>
</div>
</section>
@ -41,15 +41,15 @@ echo $this->getData('nav')->render(); ?>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr><td><?= $this->getHtml('Emergencies'); ?><td><?= htmlspecialchars($logs['emergency'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Criticals'); ?><td><?= htmlspecialchars($logs['critical'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Errors'); ?><td><?= htmlspecialchars($logs['error'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Warnings'); ?><td><?= htmlspecialchars($logs['warning'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Alerts'); ?><td><?= htmlspecialchars($logs['alert'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Notices'); ?><td><?= htmlspecialchars($logs['notice'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Info'); ?><td><?= htmlspecialchars($logs['info'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Debug'); ?><td><?= htmlspecialchars($logs['debug'] ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Total'); ?><td><?= htmlspecialchars(array_sum($logs), ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->getHtml('Emergencies'); ?><td><?= $this->printHtml($logs['emergency'] ?? 0); ?>
<tr><td><?= $this->getHtml('Criticals'); ?><td><?= $this->printHtml($logs['critical'] ?? 0); ?>
<tr><td><?= $this->getHtml('Errors'); ?><td><?= $this->printHtml($logs['error'] ?? 0); ?>
<tr><td><?= $this->getHtml('Warnings'); ?><td><?= $this->printHtml($logs['warning'] ?? 0); ?>
<tr><td><?= $this->getHtml('Alerts'); ?><td><?= $this->printHtml($logs['alert'] ?? 0); ?>
<tr><td><?= $this->getHtml('Notices'); ?><td><?= $this->printHtml($logs['notice'] ?? 0); ?>
<tr><td><?= $this->getHtml('Info'); ?><td><?= $this->printHtml($logs['info'] ?? 0); ?>
<tr><td><?= $this->getHtml('Debug'); ?><td><?= $this->printHtml($logs['debug'] ?? 0); ?>
<tr><td><?= $this->getHtml('Total'); ?><td><?= $this->printHtml(array_sum($logs)); ?>
</table>
</div>
</section>
@ -62,7 +62,7 @@ echo $this->getData('nav')->render(); ?>
<table class="list wf-100">
<tbody>
<?php foreach($penetrators as $ip => $count) : ?>
<tr><td><?= htmlspecialchars($ip, ENT_COMPAT, 'utf-8'); ?><td><?= htmlspecialchars($count, ENT_COMPAT, 'utf-8'); ?>
<tr><td><?= $this->printHtml($ip); ?><td><?= $this->printHtml($count); ?>
<?php endforeach; ?>
</table>
</div>

View File

@ -40,52 +40,52 @@ echo $this->getData('nav')->render(); ?>
<tr>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td><i class="fa fa-anchor"></i>
<td class="wf-100"><?= htmlspecialchars((int) $this->request->getData('id') ?? 0, ENT_COMPAT, 'utf-8'); ?>
<td class="wf-100"><?= $this->printHtml((int) $this->request->getData('id') ?? 0); ?>
<tr>
<td><?= $this->getHtml('Time') ?>
<td><i class="fa fa-clock-o"></i>
<td><?= htmlspecialchars($log['datetime'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['datetime']); ?>
<tr>
<td><?= $this->getHtml('Uri') ?>
<td><i class="fa fa-globe"></i>
<td><?= htmlspecialchars($log['path'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['path']); ?>
<tr>
<td><?= $this->getHtml('Source') ?>
<td><i class="fa fa-wifi"></i>
<td><?= htmlspecialchars($log['ip'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['ip']); ?>
<tr>
<td><?= $this->getHtml('Level') ?>
<td>
<i class="fa fa-<?= htmlspecialchars(in_array($log['level'], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning', ENT_COMPAT, 'utf-8'); ?>"></i>
<td><?= htmlspecialchars($log['level'], ENT_COMPAT, 'utf-8'); ?>
<i class="fa fa-<?= $this->printHtml(in_array($log['level'], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning'); ?>"></i>
<td><?= $this->printHtml($log['level']); ?>
<tr>
<td><?= $this->getHtml('Message') ?>
<td><i class="fa fa-commenting"></i>
<td><?= htmlspecialchars($log['message'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['message']); ?>
<tr>
<td><?= $this->getHtml('File') ?>
<td><i class="fa fa-file"></i>
<td><?= htmlspecialchars($log['file'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['file']); ?>
<tr>
<td><?= $this->getHtml('Line') ?>
<td><i class="fa fa-commenting"></i>
<td><?= htmlspecialchars($log['line'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['line']); ?>
<tr>
<td><?= $this->getHtml('Version') ?>
<td><i class="fa fa-pencil"></i>
<td><?= htmlspecialchars($log['version'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['version']); ?>
<tr>
<td><?= $this->getHtml('OS') ?>
<td><i class="fa fa-laptop"></i>
<td><?= htmlspecialchars($log['os'], ENT_COMPAT, 'utf-8'); ?>
<td><?= $this->printHtml($log['os']); ?>
<tr>
<td colspan="3"><?= $this->getHtml('Backtrace') ?>
<tr>
<td colspan="3">
<pre><?= htmlspecialchars(json_encode($log['backtrace'], JSON_PRETTY_PRINT), ENT_COMPAT, 'utf-8'); ?></pre>
<pre><?= $this->printHtml(json_encode($log['backtrace'], JSON_PRETTY_PRINT)); ?></pre>
<tr>
<td colspan="3" style="padding-top: 10px"><a class="button" target="_blank"
href="https://gitreports.com/issue/Orange-Management/Orange-Management/?name=Guest&issue_title=<?= htmlspecialchars(urlencode($log['message']), ENT_COMPAT, 'utf-8'); ?>&details=<?= htmlspecialchars(urlencode($details), ENT_COMPAT, 'utf-8'); ?>"><?= $this->getHtml('Report') ?></a>
href="https://gitreports.com/issue/Orange-Management/Orange-Management/?name=Guest&issue_title=<?= $this->printHtml(urlencode($log['message'])); ?>&details=<?= $this->printHtml(urlencode($details)); ?>"><?= $this->getHtml('Report') ?></a>
</table>
</div>
</section>

View File

@ -43,10 +43,10 @@ echo $this->getData('nav')->render(); ?>
<?php foreach ($logs as $key => $value) :
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/monitoring/logs/single?{?}&id=' . $key);?>
<tr>
<td><a href=<?= htmlspecialchars($url, ENT_COMPAT, 'utf-8'); ?>><i class="fa fa-clock-o"></i> <?= htmlspecialchars($value[0] ?? '', ENT_COMPAT, 'utf-8'); ?></a>
<td><a href=<?= htmlspecialchars($url, ENT_COMPAT, 'utf-8'); ?>><i class="fa fa-<?= htmlspecialchars(in_array($value[1], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning', ENT_COMPAT, 'utf-8'); ?>"></i> <?= htmlspecialchars($value[1] ?? '', ENT_COMPAT, 'utf-8'); ?></a>
<td><a href=<?= htmlspecialchars($url, ENT_COMPAT, 'utf-8'); ?>><i class="fa fa-wifi"></i> <?= htmlspecialchars($value[2] ?? '', ENT_COMPAT, 'utf-8'); ?></a>
<td><a href=<?= htmlspecialchars($url, ENT_COMPAT, 'utf-8'); ?>><i class="fa fa-commenting"></i> <?= htmlspecialchars($value[7] ?? '', ENT_COMPAT, 'utf-8'); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-clock-o"></i> <?= $this->printHtml($value[0] ?? ''); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-<?= $this->printHtml(in_array($value[1], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning'); ?>"></i> <?= $this->printHtml($value[1] ?? ''); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-wifi"></i> <?= $this->printHtml($value[2] ?? ''); ?></a>
<td><a href=<?= $this->printHtml($url); ?>><i class="fa fa-commenting"></i> <?= $this->printHtml($value[7] ?? ''); ?></a>
<?php endforeach;
if (!isset($key)) : ?>
<tr>