Blame Identity/Models/Html/phpBB/3.0.4/includes/acp/acp_php_info.php

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