]> git.mjollnir.org Git - moodle.git/commitdiff
Bringing phpinfo into the fold
authormoodler <moodler>
Fri, 15 Sep 2006 08:59:02 +0000 (08:59 +0000)
committermoodler <moodler>
Fri, 15 Sep 2006 08:59:02 +0000 (08:59 +0000)
admin/phpinfo.php
theme/standard/styles_fonts.css

index 8db0fcc8050213a6bf3bf6f4f962dcb83a17c36c..eed8350553ccf2fea35d50703fa1631fbf230125 100644 (file)
@@ -2,36 +2,31 @@
        // 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&amp;sesskey=<?php echo $USER->sesskey ?>">
-           <frame src="phpinfo.php?bottomframe=true&amp;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();
+
 ?>
index d12514c71b9ff8728e5a4e740be889929f9784a4..0215bc0138c76a8027fe83386ab827519582e603 100644 (file)
@@ -763,3 +763,31 @@ body#mod-forum-index .generalbox .cell {
   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;
+}