You are here

function systeminfo_admin_php in System Information 6.3

Same name and namespace in other branches
  1. 7.3 systeminfo.admin.php.inc \systeminfo_admin_php()
  2. 7.2 systeminfo.admin.php.inc \systeminfo_admin_php()

Menu callback; displays the PHP page.

1 string reference to 'systeminfo_admin_php'
systeminfo_menu in ./systeminfo.module
Implementation of hook_menu().

File

./systeminfo.admin.php.inc, line 12
Admin PHP page callbacks for the systeminfo module.

Code

function systeminfo_admin_php() {
  if (function_exists('phpinfo')) {
    ob_start();
    phpinfo(variable_get('systeminfo_php_phpinfo_parameter', INFO_ALL));
    $phpinfo = ob_get_contents();
    ob_end_clean();
    preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output);
    $output = preg_replace('#<table[^>]*>#', '<table class="adminlist">', $output[1][0]);
    $output = preg_replace('#(\\w),(\\w)#', '\\1, \\2', $output);
    $output = preg_replace('#<hr />#', '', $output);
    $output = str_replace('<div class="center">', '', $output);
    $output = preg_replace('#<tr class="h">(.*)<\\/tr>#', '<thead><tr class="h">$1</tr></thead><tbody>', $output);
    $output = str_replace('</table>', '</tbody></table>', $output);
    $output = str_replace('</div>', '', $output);
    $output = str_replace('h2>', 'h3>', $output);
    $output = str_replace('h1>', 'h2>', $output);
    return $output;
  }
  else {
    return '<p>' . t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information, <a href="@phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array(
      '@phpinfo' => 'http://drupal.org/node/243993',
    )) . '</p>';
  }
}