phpBB
Statistics
| Revision:

root / tags / milestone_3 / phpBB / adm / admin_phpinfo.php

History | View | Annotate | Download (3.5 kB)

1
<?php
2
/** 
3
*
4
* @package acp
5
* @version $Id: admin_phpinfo.php 5114 2005-04-09 12:26:45Z acydburn $
6
* @copyright (c) 2005 phpBB Group 
7
* @license http://opensource.org/licenses/gpl-license.php GNU Public License 
8
*
9
*/
10
11
/**
12
*/
13
if (!empty($setmodules))
14
{
15
        $module['GENERAL']['PHP_INFO'] = ($auth->acl_get('a_server')) ? basename(__FILE__) . $SID : '';
16
        return;
17
}
18
19
define('IN_PHPBB', 1);
20
// Load default header
21
$phpbb_root_path = '../';
22
$phpEx = substr(strrchr(__FILE__, '.'), 1);
23
require('pagestart.' . $phpEx);
24
25
26
// Check permissions
27
if (!$auth->acl_get('a_server'))
28
{
29
        trigger_error($user->lang['NO_ADMIN']);
30
}
31
32
ob_start(); 
33
phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES); 
34
$phpinfo = ob_get_contents(); 
35
ob_end_clean(); 
36
37
// Get used layout
38
$layout = (preg_match('#bgcolor#i', $phpinfo)) ? 'old' : 'new';
39
40
// Here we play around a little with the PHP Info HTML to try and stylise
41
// it along phpBB's lines ... hopefully without breaking anything. The idea
42
// for this was nabbed from the PHP annotated manual
43
preg_match_all('#<body[^>]*>(.*)</body>#siU', $phpinfo, $output); 
44
45
switch ($layout)
46
{
47
        case 'old':
48
                $output = preg_replace('#<table#', '<table class="bg"', $output[1][0]);
49
                $output = preg_replace('# bgcolor="\#(\w){6}"#', '', $output);
50
                $output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
51
                $output = preg_replace('#border="0" cellpadding="3" cellspacing="1" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
52
                $output = preg_replace('#<tr valign="top"><td align="left">(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td style="{background-color: #9999cc;}"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td style="{background-color: #9999cc;}">\2</td><td style="{background-color: #9999cc;}">\1</td></tr></table></td></tr>', $output);
53
                $output = preg_replace('#<tr valign="baseline"><td[ ]{0,1}><b>(.*?)</b>#', '<tr><td class="row1" nowrap="nowrap">\1', $output);
54
                $output = preg_replace('#<td align="(center|left)">#', '<td class="row2">', $output);
55
                $output = preg_replace('#<td>#', '<td class="row2">', $output);
56
                $output = preg_replace('#valign="middle"#', '', $output);
57
                $output = preg_replace('#<tr >#', '<tr>', $output);
58
                $output = preg_replace('#<hr(.*?)>#', '', $output);
59
                $output = preg_replace('#<h1 align="center">#i', '<h1>', $output);
60
                $output = preg_replace('#<h2 align="center">#i', '<h2>', $output);
61
                break;
62
        case 'new':
63
                $output = preg_replace('#<table#', '<table class="bg" align="center"', $output[1][0]);
64
                $output = preg_replace('#(\w),(\w)#', '\1, \2', $output);
65
                $output = preg_replace('#border="0" cellpadding="3" width="600"#', 'border="0" cellspacing="1" cellpadding="4" width="95%"', $output);
66
                $output = preg_replace('#<tr class="v"><td>(.*?<a .*?</a>)(.*?)</td></tr>#s', '<tr class="row1"><td><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td>\2</td><td>\1</td></tr></table></td></tr>', $output);
67
                $output = preg_replace('#<td>#', '<td style="{background-color: #9999cc;}">', $output);
68
                $output = preg_replace('#class="e"#', 'class="row1" nowrap="nowrap"', $output);
69
                $output = preg_replace('#class="v"#', 'class="row2"', $output);
70
                $output = preg_replace('# class="h"#', '', $output);
71
                $output = preg_replace('#<hr />#', '', $output);
72
                preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output); 
73
                $output = $output[1][0];
74
                break;
75
}
76
77
adm_page_header($user->lang['PHP_INFO']);
78
79
echo '<h1>' . $user->lang['PHP_INFO'] . '</h1>';
80
echo '<p>' . $user->lang['PHP_INFO_EXPLAIN'] . '</p>';
81
echo $output; 
82
83
adm_page_footer();
84
85
?>