6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
14 if (!defined('IN_PHPBB'))
26 function main($id, $mode)
30 trigger_error('NO_MODE', E_USER_ERROR
);
33 $this->tpl_name
= 'acp_php_info';
34 $this->page_title
= 'ACP_PHP_INFO';
37 @phpinfo
(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES
);
38 $phpinfo = ob_get_clean();
40 $phpinfo = trim($phpinfo);
42 // Here we play around a little with the PHP Info HTML to try and stylise
43 // it along phpBB's lines ... hopefully without breaking anything. The idea
44 // for this was nabbed from the PHP annotated manual
45 preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output);
47 if (empty($phpinfo) ||
empty($output))
49 trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING
);
52 $output = $output[1][0];
54 // expose_php can make the image not exist
55 if (preg_match('#<a[^>]*><img[^>]*></a>#', $output))
57 $output = preg_replace('#<tr class="v"><td>(.*?<a[^>]*><img[^>]*></a>)(.*?)</td></tr>#s', '<tr class="row1"><td><table class="type2"><tr><td>\2</td><td>\1</td></tr></table></td></tr>', $output);
61 $output = preg_replace('#<tr class="v"><td>(.*?)</td></tr>#s', '<tr class="row1"><td><table class="type2"><tr><td>\1</td></tr></table></td></tr>', $output);
63 $output = preg_replace('#<table[^>]+>#i', '<table>', $output);
64 $output = preg_replace('#<img border="0"#i', '<img', $output);
65 $output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
69 trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING
);
72 $orig_output = $output;
74 preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
75 $output = (!empty($output[1][0])) ?
$output[1][0] : $orig_output;
77 phpbb
::$template->assign_var('PHPINFO', $output);