MDL-9506 More work in the unit tests
[moodle-pu.git] / admin / phpinfo.php
blobdaf30b2da4eb85bf0539d68f9220c2a932bffb86
1 <?PHP // $Id$
2 // phpinfo.php - shows phpinfo for the current server
4 require_once("../config.php");
5 require_once($CFG->libdir.'/adminlib.php');
7 $adminroot = admin_get_root();
8 admin_externalpage_setup('phpinfo', $adminroot);
10 require_login();
12 require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID));
14 admin_externalpage_print_header($adminroot);
16 echo '<div class="phpinfo">';
18 ob_start();
19 phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES);
20 $html = ob_get_contents();
21 ob_end_clean();
23 /// Delete styles from output
24 $html = preg_replace('#(\n?<style[^>]*?>.*?</style[^>]*?>)|(\n?<style[^>]*?/>)#is', '', $html);
25 $html = preg_replace('#(\n?<head[^>]*?>.*?</head[^>]*?>)|(\n?<head[^>]*?/>)#is', '', $html);
26 /// Delete DOCTYPE from output
27 $html = preg_replace('/<!DOCTYPE html PUBLIC.*?>/is', '', $html);
28 /// Delete body and html tags
29 $html = preg_replace('/<html.*?>.*?<body.*?>/is', '', $html);
30 $html = preg_replace('/<\/body><\/html>/is', '', $html);
32 echo $html;
34 echo '</div>';
36 admin_externalpage_print_footer($adminroot);