Add html escaping

This commit is contained in:
Dennis Eichhorn 2017-07-24 20:48:22 +02:00
parent 9ce8b5af97
commit 5efb147ae3
3 changed files with 55 additions and 55 deletions

View File

@ -20,17 +20,17 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('System') ?></h1></header>
<header><h1><?= $this->getHtml('System'); ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr><td><?= $this->getText('OS') ?><td><?= php_uname('s'); ?>
<tr><td><?= $this->getText('Version') ?><td><?= php_uname('v'); ?>
<tr><td><?= $this->getText('Release') ?><td><?= php_uname('r'); ?>
<tr><td><?= $this->getText('RAMUsage') ?><td><?= memory_get_usage(true)/(1024*1024); ?> MB
<tr><td><?= $this->getText('MemoryLimit') ?><td><?= ini_get('memory_limit'); ?>
<tr><td><?= $this->getText('SystemRAM') ?><td><?= \phpOMS\System\SystemUtils::getRAM()/(1024); ?> MB
<tr><td><?= $this->getText('CPUUsage') ?><td><?= \phpOMS\System\SystemUtils::getCpuUsage(); ?>%
<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'); ?>%
</table>
</div>
</section>
@ -38,19 +38,19 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Logs') ?></h1></header>
<header><h1><?= $this->getHtml('Logs'); ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<tr><td><?= $this->getText('Emergencies') ?><td><?= $logs['emergency'] ?? 0; ?>
<tr><td><?= $this->getText('Criticals') ?><td><?= $logs['critical'] ?? 0; ?>
<tr><td><?= $this->getText('Errors') ?><td><?= $logs['error'] ?? 0; ?>
<tr><td><?= $this->getText('Warnings') ?><td><?= $logs['warning'] ?? 0; ?>
<tr><td><?= $this->getText('Alerts') ?><td><?= $logs['alert'] ?? 0; ?>
<tr><td><?= $this->getText('Notices') ?><td><?= $logs['notice'] ?? 0; ?>
<tr><td><?= $this->getText('Info') ?><td><?= $logs['info'] ?? 0; ?>
<tr><td><?= $this->getText('Debug') ?><td><?= $logs['debug'] ?? 0; ?>
<tr><td><?= $this->getText('Total') ?><td><?= array_sum($logs); ?>
<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'); ?>
</table>
</div>
</section>
@ -58,12 +58,12 @@ echo $this->getData('nav')->render(); ?>
<div class="col-xs-12 col-md-4">
<section class="box wf-100">
<header><h1><?= $this->getText('Penetrators') ?></h1></header>
<header><h1><?= $this->getHtml('Penetrators'); ?></h1></header>
<div class="inner">
<table class="list wf-100">
<tbody>
<?php foreach($penetrators as $ip => $count) : ?>
<tr><td><?= $ip; ?><td><?= $count; ?>
<tr><td><?= htmlspecialchars($ip, ENT_COMPAT, 'utf-8'); ?><td><?= htmlspecialchars($count, ENT_COMPAT, 'utf-8'); ?>
<?php endforeach; ?>
</table>
</div>

View File

@ -34,59 +34,59 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="col-xs-12 col-md-6">
<section class="box wf-100">
<header><h1><?= $this->getText('Logs'); ?></h1></header>
<header><h1><?= $this->getHtml('Logs') ?></h1></header>
<div class="inner">
<table class="list w-100">
<tr>
<td><?= $this->getText('ID', 0, 0); ?>
<td><?= $this->getHtml('ID', 0, 0); ?>
<td><i class="fa fa-anchor"></i>
<td class="wf-100"><?= (int) $this->request->getData('id') ?? 0; ?>
<td class="wf-100"><?= htmlspecialchars((int) $this->request->getData('id') ?? 0, ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('Time'); ?>
<td><?= $this->getHtml('Time') ?>
<td><i class="fa fa-clock-o"></i>
<td><?= $log['datetime']; ?>
<td><?= htmlspecialchars($log['datetime'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('Uri'); ?>
<td><?= $this->getHtml('Uri') ?>
<td><i class="fa fa-globe"></i>
<td><?= $log['path']; ?>
<td><?= htmlspecialchars($log['path'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('Source'); ?>
<td><?= $this->getHtml('Source') ?>
<td><i class="fa fa-wifi"></i>
<td><?= $log['ip']; ?>
<td><?= htmlspecialchars($log['ip'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('Level'); ?>
<td><?= $this->getHtml('Level') ?>
<td>
<i class="fa fa-<?= in_array($log['level'], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning'; ?>"></i>
<td><?= $log['level']; ?>
<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'); ?>
<tr>
<td><?= $this->getText('Message'); ?>
<td><?= $this->getHtml('Message') ?>
<td><i class="fa fa-commenting"></i>
<td><?= $log['message']; ?>
<td><?= htmlspecialchars($log['message'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('File'); ?>
<td><?= $this->getHtml('File') ?>
<td><i class="fa fa-file"></i>
<td><?= $log['file']; ?>
<td><?= htmlspecialchars($log['file'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('Line'); ?>
<td><?= $this->getHtml('Line') ?>
<td><i class="fa fa-commenting"></i>
<td><?= $log['line']; ?>
<td><?= htmlspecialchars($log['line'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('Version'); ?>
<td><?= $this->getHtml('Version') ?>
<td><i class="fa fa-pencil"></i>
<td><?= $log['version']; ?>
<td><?= htmlspecialchars($log['version'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td><?= $this->getText('OS'); ?>
<td><?= $this->getHtml('OS') ?>
<td><i class="fa fa-laptop"></i>
<td><?= $log['os']; ?>
<td><?= htmlspecialchars($log['os'], ENT_COMPAT, 'utf-8'); ?>
<tr>
<td colspan="3"><?= $this->getText('Backtrace'); ?>
<td colspan="3"><?= $this->getHtml('Backtrace') ?>
<tr>
<td colspan="3">
<pre><?= json_encode($log['backtrace'], JSON_PRETTY_PRINT); ?></pre>
<pre><?= htmlspecialchars(json_encode($log['backtrace'], JSON_PRETTY_PRINT), ENT_COMPAT, 'utf-8'); ?></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=<?= urlencode($log['message']); ?>&details=<?= urlencode($details); ?>"><?= $this->getText('Report'); ?></a>
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>
</table>
</div>
</section>

View File

@ -30,24 +30,24 @@ echo $this->getData('nav')->render(); ?>
<div class="row">
<div class="box col-xs-12 wf-100">
<table class="table red">
<caption><?= $this->getText('Logs'); ?></caption>
<caption><?= $this->getHtml('Logs') ?></caption>
<thead>
<tr>
<td><?= $this->getText('Timestamp'); ?>
<td><?= $this->getText('Level'); ?>
<td><?= $this->getText('Source'); ?>
<td class="wf-100"><?= $this->getText('Message'); ?>
<td><?= $this->getHtml('Timestamp') ?>
<td><?= $this->getHtml('Level') ?>
<td><?= $this->getHtml('Source') ?>
<td class="wf-100"><?= $this->getHtml('Message') ?>
<tfoot>
<tr>
<td colspan="5"><?= $footerView->render(); ?>
<td colspan="5"><?= htmlspecialchars($footerView->render(), ENT_COMPAT, 'utf-8'); ?>
<tbody>
<?php foreach ($logs as $key => $value) :
$url = \phpOMS\Uri\UriFactory::build('{/base}/{/lang}/backend/admin/monitoring/logs/single?{?}&id=' . $key);?>
<tr>
<td><a href=<?= $url; ?>><i class="fa fa-clock-o"></i> <?= $value[0] ?? ''; ?></a>
<td><a href=<?= $url; ?>><i class="fa fa-<?= in_array($value[1], ['notice', 'info', 'debug']) ? 'info-circle' : 'warning'; ?>"></i> <?= $value[1] ?? ''; ?></a>
<td><a href=<?= $url; ?>><i class="fa fa-wifi"></i> <?= $value[2] ?? ''; ?></a>
<td><a href=<?= $url; ?>><i class="fa fa-commenting"></i> <?= $value[7] ?? ''; ?></a>
<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>
<?php endforeach;
if (!isset($key)) : ?>
<tr>