diff options
Diffstat (limited to 'mod/diagnostics/start.php')
-rw-r--r-- | mod/diagnostics/start.php | 44 |
1 files changed, 40 insertions, 4 deletions
diff --git a/mod/diagnostics/start.php b/mod/diagnostics/start.php index a9e3828e5..38cb6b167 100644 --- a/mod/diagnostics/start.php +++ b/mod/diagnostics/start.php @@ -130,18 +130,53 @@ } /** - * Get some information about the current session + * Get some information about the php install * * @param unknown_type $hook * @param unknown_type $entity_type * @param unknown_type $returnvalue * @param unknown_type $params */ - function diagnostics_session_hook($hook, $entity_type, $returnvalue, $params) + function diagnostics_phpinfo_hook($hook, $entity_type, $returnvalue, $params) { global $CONFIG; - $returnvalue .= sprintf(elgg_echo('diagnostics:report:session'), print_r($_SESSION, true)); + ob_start(); + phpinfo(); + $phpinfo = array('phpinfo' => array()); + + if(preg_match_all('#(?:<h2>(?:<a name=".*?">)?(.*?)(?:</a>)?</h2>)|(?:<tr(?: class=".*?")?><t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>(?:<t[hd](?: class=".*?")?>(.*?)\s*</t[hd]>)?)?</tr>)#s', ob_get_clean(), $matches, PREG_SET_ORDER)) + + foreach($matches as $match) + { + if(strlen($match[1])) + $phpinfo[$match[1]] = array(); + else if(isset($match[3])) + $phpinfo[end(array_keys($phpinfo))][$match[2]] = isset($match[4]) ? array($match[3], $match[4]) : $match[3]; + else + $phpinfo[end(array_keys($phpinfo))][] = $match[2]; + } + + + $returnvalue .= sprintf(elgg_echo('diagnostics:report:php'), print_r($phpinfo, true)); + + return $returnvalue; + } + + /** + * Get global variables. + * + * @param unknown_type $hook + * @param unknown_type $entity_type + * @param unknown_type $returnvalue + * @param unknown_type $params + * @return unknown + */ + function diagnostics_globals_hook($hook, $entity_type, $returnvalue, $params) + { + global $CONFIG; + + $returnvalue .= sprintf(elgg_echo('diagnostics:report:globals'), print_r($GLOBALS, true)); return $returnvalue; } @@ -154,5 +189,6 @@ register_plugin_hook("diagnostics:report", "all", "diagnostics_plugins_hook", 2); // Now the plugins register_plugin_hook("diagnostics:report", "all", "diagnostics_sigs_hook", 1); // Now the signatures - register_plugin_hook("diagnostics:report", "all", "diagnostics_session_hook"); // Session + register_plugin_hook("diagnostics:report", "all", "diagnostics_globals_hook"); // Global variables + register_plugin_hook("diagnostics:report", "all", "diagnostics_phpinfo_hook"); // PHP info ?>
\ No newline at end of file |