page2pagepro Posted May 13, 2010 Report Share Posted May 13, 2010 Purpose is to improve the native phpinfo() function to something a bit more specialized.Assumed %top% to be UniServer Root Installation folder/directoryReplace code in file %top%\home\admin\www\phpinfo.php with:<?php /**************************************************************************\ Contributors: http://nevstokes.com/blog/2009/06/23/a-better-phpinfo/ http://www.page2pagepro.com/a-better-phpinfo/ \**************************************************************************/ $options = array('CONFIGURATION', 'ENVIRONMENT', 'MODULES', 'EXTENSIONS', 'VARIABLES', 'GENERAL', 'CREDITS', 'LICENSE', 'ALL'); $display = (empty($_GET['display']) || !in_array(strtoupper($_GET['display']), $options)) ? 'ALL' : strtoupper($_GET['display']); $navigation = array(); foreach($options as $key=>$value) { $navigation[] = ($value != $display) ? '<a href="' . $_SERVER['SCRIPT_NAME'] . '?display=' . $value . '">' . $value . '</a>' : '<strong>' . $value . '</strong>'; } ob_start(); switch($display) { case 'CONFIGURATION': phpinfo(INFO_CONFIGURATION); break; case 'ENVIRONMENT': phpinfo(INFO_ENVIRONMENT); break; case 'MODULES': phpinfo(INFO_MODULES); break; case 'VARIABLES': phpinfo(INFO_VARIABLES); break; case 'GENERAL': phpinfo(INFO_GENERAL); break; case 'EXTENSIONS': case 'CREDITS': phpinfo(INFO_CREDITS); break; case 'LICENSE': phpinfo(INFO_LICENSE); break; case 'ALL': default: phpinfo(); break; } $content = ob_get_clean(); if (($display) == 'EXTENSIONS') { $str = '<body><div class="center">'; $content = substr($content, 0, strpos("$content$str", $str)+strlen($str)); ob_start(); echo '<h2>Overview</h2>'.PHP_EOL; echo '<table border="0" cellpadding="3" width="600">'.PHP_EOL; echo '<tr><td class="e">Extensions</td><td class="v">'.PHP_EOL; $exts = array(); foreach (get_loaded_extensions() as $ext) { $exts[] = $ext; } echo implode(', ', $exts).PHP_EOL; echo '</td></tr></table><br />'.PHP_EOL; echo '<h2>Details</h2>'.PHP_EOL; echo '<table border="0" cellpadding="3" width="600">'.PHP_EOL; foreach ($exts as $ext) { echo '<tr><td class="e">'.$ext.'</td><td class="v">'; $funcs = array(); foreach (get_extension_funcs($ext) as $func) { $funcs[] = $func; } echo implode(', ', $funcs).PHP_EOL; echo '</td></tr>'.PHP_EOL; } echo '</table><br />'.PHP_EOL; echo '</div></body></html>'.PHP_EOL; $content .= ob_get_contents(); ob_end_clean(); } echo str_replace('<body>', '</body><body><div class="center options"><p>' . implode(' | ', $navigation) .'</p></div>', $content); ?>Code is found with syntax-highlighting (Geshi) at Page2PagePro.comPlease let me know if you have any other additions to this project. Thanx! Quote Link to comment Share on other sites More sharing options...
Ric Posted May 14, 2010 Report Share Posted May 14, 2010 Yep! Excellent feature, tested on 5 Series will add with minor changes (menu lower case) All the bestRic Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.