|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
* @version $Id: acp_php_info.php 8479 2008-03-29 00:22:48Z naderman $
|
|
|
4c79b5 |
* @copyright (c) 2005 phpBB Group
|
|
|
4c79b5 |
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|
|
4c79b5 |
*
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @ignore
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
if (!defined('IN_PHPBB'))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
exit;
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
/**
|
|
|
4c79b5 |
* @package acp
|
|
|
4c79b5 |
*/
|
|
|
4c79b5 |
class acp_php_info
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
var $u_action;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
function main($id, $mode)
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
global $db, $user, $auth, $template;
|
|
|
4c79b5 |
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if ($mode != 'info')
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error('NO_MODE', E_USER_ERROR);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$this->tpl_name = 'acp_php_info';
|
|
|
4c79b5 |
$this->page_title = 'ACP_PHP_INFO';
|
|
|
4c79b5 |
|
|
|
4c79b5 |
ob_start();
|
|
|
4c79b5 |
@phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
|
|
|
4c79b5 |
$phpinfo = ob_get_clean();
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$phpinfo = trim($phpinfo);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// Here we play around a little with the PHP Info HTML to try and stylise
|
|
|
4c79b5 |
// it along phpBB's lines ... hopefully without breaking anything. The idea
|
|
|
4c79b5 |
// for this was nabbed from the PHP annotated manual
|
|
|
4c79b5 |
preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (empty($phpinfo) || empty($output))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$output = $output[1][0];
|
|
|
4c79b5 |
|
|
|
4c79b5 |
// expose_php can make the image not exist
|
|
|
4c79b5 |
if (preg_match('#<a[^>]*><img[^>]*>#', $output))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$output = preg_replace('#(.*?<a[^>]*><img[^>]*>)(.*?)#s', '', $output);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
else
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
$output = preg_replace('#(.*?)#s', '', $output);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
$output = preg_replace('#<table[^>]+>#i', '', $output);
|
|
|
4c79b5 |
$output = preg_replace('#
|
|
|
4c79b5 |
$output = str_replace(array('class="e"', 'class="v"', 'class="h"', ' ', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
|
|
|
4c79b5 |
|
|
|
4c79b5 |
if (empty($output))
|
|
|
4c79b5 |
{
|
|
|
4c79b5 |
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$orig_output = $output;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
preg_match_all('#(.*) #siU', $output, $output);
|
|
|
4c79b5 |
$output = (!empty($output[1][0])) ? $output[1][0] : $orig_output;
|
|
|
4c79b5 |
|
|
|
4c79b5 |
$template->assign_var('PHPINFO', $output);
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
}
|
|
|
4c79b5 |
|
|
|
4c79b5 |
?>
|