// phpinfo.php - shows phpinfo for the current server
require_once("../config.php");
+ require_once($CFG->libdir.'/adminlib.php');
- $topframe = optional_param('topframe', false, PARAM_BOOL);
- $bottomframe = optional_param('bottomframe', false, PARAM_BOOL);
+ $adminroot = admin_get_root();
+ admin_externalpage_setup('phpinfo', $adminroot);
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
- if (!$topframe && !$bottomframe) {
- ?>
-
- <head>
- <title>PHP info</title>
- </head>
-
- <frameset rows="80,*">
- <frame src="phpinfo.php?topframe=true&sesskey=<?php echo $USER->sesskey ?>">
- <frame src="phpinfo.php?bottomframe=true&sesskey=<?php echo $USER->sesskey ?>">
- </frameset>
-
- <?php
- } else if ($topframe && confirm_sesskey()) {
- $stradministration = get_string("administration");
- $site = get_site();
-
- print_header("$site->shortname: phpinfo", "$site->fullname",
- "<a target=\"$CFG->framename\" href=\"index.php\">$stradministration</a> -> PHP info");
- exit;
- } else if ($bottomframe && confirm_sesskey()) {
- phpinfo();
- exit;
- }
+ admin_externalpage_print_header($adminroot);
+
+ echo '<div class="phpinfo">';
+
+ ob_start();
+ phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES);
+ $html = ob_get_contents();
+ ob_end_clean();
+
+ $html = preg_replace('#(\n?<style[^>]*?>.*?</style[^>]*?>)|(\n?<style[^>]*?/>)#is', '', $html);
+ $html = preg_replace('#(\n?<head[^>]*?>.*?</head[^>]*?>)|(\n?<head[^>]*?/>)#is', '', $html);
+
+ echo $html;
+
+ echo '</div>';
+
+ admin_externalpage_print_footer();
+
?>
font-size:0.8em;
}
+
+/***
+ *** Phpinfo display
+ ***/
+.phpinfo table {
+ border-collapse: collapse;
+}
+.phpinfo .center {
+ text-align: center;
+}
+.phpinfo .e, .v, .h {
+ border: 1px solid #000000;
+ font-size: 0.8em;
+ vertical-align: baseline;
+}
+.phpinfo .e {
+ background-color: #ccccff;
+ font-weight: bold;
+ color: #000000;
+}
+.phpinfo .h {
+ background-color: #9999cc;
+ font-weight: bold; color: #000000;
+}
+.phpinfo .v {
+ background-color: #cccccc;
+ color: #000000;
+}