migrate phpinfo page

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-24 15:10:00 +01:00
parent 04a08f9095
commit 2b53c4b918
2 changed files with 46 additions and 20 deletions

View File

@@ -118,29 +118,13 @@ if ($page == 'overview' && $userinfo['change_serversettings'] == '1') {
$phpinfo[$end][] = $match[2];
}
}
$phpinfohtml = '';
foreach ($phpinfo as $name => $section) {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else {
eval("\$phpinfoentries .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_1") . "\";");
}
}
// first header -> show actual php version
if (strtolower($name) == "phpinfo") {
$name = "PHP " . PHP_VERSION;
}
eval("\$phpinfohtml .= \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
} else {
\Froxlor\UI\Response::standard_error($lng['error']['no_phpinfo']);
}
eval("echo \"" . \Froxlor\UI\Template::getTemplate("settings/phpinfo") . "\";");
UI::view('settings/phpinfo.html.twig', [
'phpversion' => PHP_VERSION,
'phpinfo' => $phpinfo
]);
} elseif ($page == 'rebuildconfigs' && $userinfo['change_serversettings'] == '1') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {

View File

@@ -0,0 +1,42 @@
{% extends "Froxlor/userarea.html.twig" %}
{% block heading %}
<h5>
<i class="fa-solid fa-gears"></i>
{{ lng('admin.phpinfo') }}
</h5>
{% endblock %}
{% block content %}
<div class="card table-responsive">
<table class="table table-borderless table-striped align-middle mb-0 px-3">
<tbody>
{% for name,section in phpinfo %}
{% if name|lower == 'phpinfo' %}
{% set name = 'PHP ' ~ phpversion %}
{% endif %}
<tr>
<th colspan="3">{{ name|raw }}</th>
</tr>
{% for key,val in section %}
{% if key != 'Directive' %}
<tr>
{% if val is iterable %}
<td width="180">{{ key|raw }}</td>
<td colspan="2">{{ val[0]|raw }}<br/><small>(Master:
{{ val[1]|raw }})</small>
</td>
{% elseif key matches '/^\\d+$/' %}
<td colspan="3" align="center">{{ val|raw }}</td>
{% else %}
<td width="180">{{ key|raw }}</td>
<td colspan="2">{{ val|raw }}</td>
{% endif %}
</tr>
{% endif %}
{% endfor %}
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}