Update code_sniffer build.xml file to be executable on our system
[phpbb.git] / phpBB / modules / acp / acp_php_info.php
blob31a241a36f39ea153578009d1eed681ed0aef397
1 <?php
2 /**
4 * @package acp
5 * @version $Id$
6 * @copyright (c) 2005 phpBB Group
7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
9 */
11 /**
12 * @ignore
14 if (!defined('IN_PHPBB'))
16 exit;
19 /**
20 * @package acp
22 class acp_php_info
24 var $u_action;
26 function main($id, $mode)
28 if ($mode != 'info')
30 trigger_error('NO_MODE', E_USER_ERROR);
33 $this->tpl_name = 'acp_php_info';
34 $this->page_title = 'ACP_PHP_INFO';
36 ob_start();
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);
59 else
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);
67 if (empty($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);