| 1 | <?php
|
|---|
| 2 | /**
|
|---|
| 3 | *
|
|---|
| 4 | * @package acp
|
|---|
| 5 | * @version $Id: acp_php_info.php 8479 2008-03-29 00:22:48Z naderman $
|
|---|
| 6 | * @copyright (c) 2005 phpBB Group
|
|---|
| 7 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License
|
|---|
| 8 | *
|
|---|
| 9 | */
|
|---|
| 10 |
|
|---|
| 11 | /**
|
|---|
| 12 | * @ignore
|
|---|
| 13 | */
|
|---|
| 14 | if (!defined('IN_PHPBB'))
|
|---|
| 15 | {
|
|---|
| 16 | exit;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | /**
|
|---|
| 20 | * @package acp
|
|---|
| 21 | */
|
|---|
| 22 | class acp_php_info
|
|---|
| 23 | {
|
|---|
| 24 | var $u_action;
|
|---|
| 25 |
|
|---|
| 26 | function main($id, $mode)
|
|---|
| 27 | {
|
|---|
| 28 | global $db, $user, $auth, $template;
|
|---|
| 29 | global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
|---|
| 30 |
|
|---|
| 31 | if ($mode != 'info')
|
|---|
| 32 | {
|
|---|
| 33 | trigger_error('NO_MODE', E_USER_ERROR);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | $this->tpl_name = 'acp_php_info';
|
|---|
| 37 | $this->page_title = 'ACP_PHP_INFO';
|
|---|
| 38 |
|
|---|
| 39 | ob_start();
|
|---|
| 40 | @phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
|
|---|
| 41 | $phpinfo = ob_get_clean();
|
|---|
| 42 |
|
|---|
| 43 | $phpinfo = trim($phpinfo);
|
|---|
| 44 |
|
|---|
| 45 | // Here we play around a little with the PHP Info HTML to try and stylise
|
|---|
| 46 | // it along phpBB's lines ... hopefully without breaking anything. The idea
|
|---|
| 47 | // for this was nabbed from the PHP annotated manual
|
|---|
| 48 | preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output);
|
|---|
| 49 |
|
|---|
| 50 | if (empty($phpinfo) || empty($output))
|
|---|
| 51 | {
|
|---|
| 52 | trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | $output = $output[1][0];
|
|---|
| 56 |
|
|---|
| 57 | // expose_php can make the image not exist
|
|---|
| 58 | if (preg_match('#<a[^>]*><img[^>]*></a>#', $output))
|
|---|
| 59 | {
|
|---|
| 60 | $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 | }
|
|---|
| 62 | else
|
|---|
| 63 | {
|
|---|
| 64 | $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);
|
|---|
| 65 | }
|
|---|
| 66 | $output = preg_replace('#<table[^>]+>#i', '<table>', $output);
|
|---|
| 67 | $output = preg_replace('#<img border="0"#i', '<img', $output);
|
|---|
| 68 | $output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
|
|---|
| 69 |
|
|---|
| 70 | if (empty($output))
|
|---|
| 71 | {
|
|---|
| 72 | trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 | $orig_output = $output;
|
|---|
| 76 |
|
|---|
| 77 | preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
|
|---|
| 78 | $output = (!empty($output[1][0])) ? $output[1][0] : $orig_output;
|
|---|
| 79 |
|
|---|
| 80 | $template->assign_var('PHPINFO', $output);
|
|---|
| 81 | }
|
|---|
| 82 | }
|
|---|
| 83 |
|
|---|
| 84 | ?>
|
|---|