Skip to content

Commit

Permalink
Bringing phpinfo into the fold
Browse files Browse the repository at this point in the history
  • Loading branch information
moodler committed Sep 15, 2006
1 parent 3bac4f9 commit 6a12bc4
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 26 deletions.
47 changes: 21 additions & 26 deletions admin/phpinfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

?>
28 changes: 28 additions & 0 deletions theme/standard/styles_fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 6a12bc4

Please sign in to comment.