add phpinfo() in admin-panel, thx to EleRas; fixes #1270

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-10-02 09:48:24 +02:00
parent 91ed3cb128
commit 10dc017dd1
13 changed files with 118 additions and 0 deletions

View File

@@ -115,6 +115,46 @@ if(($page == 'settings' || $page == 'overview')
}
}
elseif($page == 'phpinfo'
&& $userinfo['change_serversettings'] == '1'
) {
ob_start();
phpinfo();
$phpinfo = array('phpinfo' => array());
if (preg_match_all(
'#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s',
ob_get_clean(), $matches, PREG_SET_ORDER
)
) {
foreach ($matches as $match) {
$end = array_keys($phpinfo);
$end = end($end);
if (strlen($match[1])) {
$phpinfo[$match[1]] = array();
} elseif (isset($match[3])) {
$phpinfo[$end][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3];
} else {
$phpinfo[$end][] = $match[2];
}
}
$phpinfohtml = '';
foreach ($phpinfo as $name => $section) {
$phpinfoentries = "";
foreach ($section as $key => $val) {
if (is_array($val)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_3") . "\";");
} elseif (is_string($key)) {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_2") . "\";");
} else {
eval("\$phpinfoentries .= \"" . getTemplate("settings/phpinfo/phpinfo_1") . "\";");
}
}
eval("\$phpinfohtml .= \"" . getTemplate("settings/phpinfo/phpinfo_table") . "\";");
}
$phpinfo = $phpinfohtml;
}
eval("echo \"" . getTemplate("settings/phpinfo") . "\";");
}
elseif($page == 'rebuildconfigs'
&& $userinfo['change_serversettings'] == '1')
{

View File

@@ -221,6 +221,11 @@ return array (
'label' => $lng['admin']['serversettings'],
'required_resources' => 'change_serversettings',
),
array (
'url' => 'admin_settings.php?page=phpinfo',
'label' => $lng['admin']['phpinfo'],
'required_resources' => 'change_serversettings',
),
array (
'url' => 'admin_ipsandports.php?page=ipsandports',
'label' => $lng['admin']['ipsandports']['ipsandports'],

View File

@@ -1968,3 +1968,4 @@ $lng['domains']['ipandport_multi']['description'] = 'Specify one or more IP addr
$lng['domains']['ipandport_ssl_multi']['title'] = 'SSL IP address(es)';
$lng['domains']['ssl_redirect']['title'] = 'SSL redirect';
$lng['domains']['ssl_redirect']['description'] = 'This option creates redirects for non-ssl vhosts so that all requests are redirected to the SSL-vhost.<br /><br />e.g. a request to <strong>http</strong>://domain.tld/ will redirect you to <strong>https</strong>://domain.tld/';
$lng['admin']['phpinfo'] = 'PHPinfo()';

View File

@@ -0,0 +1,14 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/icons/res_recalculate_big.png" alt="" />&nbsp;
{$lng['admin']['phpinfo']}
</h2>
</header>
<section class="fullform bradiusodd">
{$phpinfo}
</section>
</article>
$footer

View File

@@ -0,0 +1,3 @@
<tr>
<td colspan="3">{$val}</td>
</tr>

View File

@@ -0,0 +1,4 @@
<tr>
<td>{$key}</td>
<td colspan="2">{$val}</td>
</tr>

View File

@@ -0,0 +1,5 @@
<tr>
<td>{$key}</td>
<td>{$val[0]}</td>
<td>{$val[1]}</td>
</tr>

View File

@@ -0,0 +1,10 @@
<table>
<thead>
<tr>
<th colspan="3">{$name}</th>
</tr>
</thead>
<tbody>
{$phpinfoentries}
</tbody>
</table>

View File

@@ -0,0 +1,14 @@
$header
<article>
<header>
<h2>
<img src="templates/{$theme}/assets/img/icons/res_recalculate_big.png" alt="" />&nbsp;
{$lng['admin']['phpinfo']}
</h2>
</header>
<section class="fullform bradiusodd">
{$phpinfo}
</section>
</article>
$footer

View File

@@ -0,0 +1,3 @@
<tr>
<td colspan="3">{$val}</td>
</tr>

View File

@@ -0,0 +1,4 @@
<tr>
<td>{$key}</td>
<td colspan="2">{$val}</td>
</tr>

View File

@@ -0,0 +1,5 @@
<tr>
<td>{$key}</td>
<td>{$val[0]}</td>
<td>{$val[1]}</td>
</tr>

View File

@@ -0,0 +1,10 @@
<table>
<thead>
<tr>
<th colspan="3">{$name}</th>
</tr>
</thead>
<tbody>
{$phpinfoentries}
</tbody>
</table>