phpBB
Statistics
| Revision:

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

History | View | Annotate | Download (3.5 kB)

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