Merge branch 'm30_MDL-50415_Add_PHP_Variables_In_PHPInfo_Admin_Page' of https://githu...
[moodle.git] / admin / phpinfo.php
CommitLineData
20207b82 1<?php
0e3e960a 2 // phpinfo.php - shows phpinfo for the current server
3
4 require_once("../config.php");
6a12bc48 5 require_once($CFG->libdir.'/adminlib.php');
0e3e960a 6
1ae083e4 7 admin_externalpage_setup('phpinfo');
04eb5d52 8
61ef8f9f 9 echo $OUTPUT->header();
6a12bc48 10
11 echo '<div class="phpinfo">';
12
13 ob_start();
7b9f73ee 14 phpinfo(INFO_GENERAL + INFO_CONFIGURATION + INFO_MODULES + INFO_VARIABLES);
6a12bc48 15 $html = ob_get_contents();
16 ob_end_clean();
17
629b635d 18/// Delete styles from output
6a12bc48 19 $html = preg_replace('#(\n?<style[^>]*?>.*?</style[^>]*?>)|(\n?<style[^>]*?/>)#is', '', $html);
20 $html = preg_replace('#(\n?<head[^>]*?>.*?</head[^>]*?>)|(\n?<head[^>]*?/>)#is', '', $html);
629b635d 21/// Delete DOCTYPE from output
22 $html = preg_replace('/<!DOCTYPE html PUBLIC.*?>/is', '', $html);
23/// Delete body and html tags
24 $html = preg_replace('/<html.*?>.*?<body.*?>/is', '', $html);
25 $html = preg_replace('/<\/body><\/html>/is', '', $html);
6a12bc48 26
27 echo $html;
28
29 echo '</div>';
30
73d6f52f 31 echo $OUTPUT->footer();
6a12bc48 32
20207b82 33