2005-11-17 18:06:11 +00:00
|
|
|
<?php
|
2007-10-05 14:36:34 +00:00
|
|
|
/**
|
2005-11-17 18:06:11 +00:00
|
|
|
*
|
|
|
|
* @package acp
|
2007-10-05 14:36:34 +00:00
|
|
|
* @copyright (c) 2005 phpBB Group
|
2011-12-31 13:32:52 +00:00
|
|
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
2005-11-17 18:06:11 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-10-05 14:36:34 +00:00
|
|
|
/**
|
|
|
|
* @ignore
|
|
|
|
*/
|
|
|
|
if (!defined('IN_PHPBB'))
|
|
|
|
{
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2005-11-17 18:06:11 +00:00
|
|
|
/**
|
|
|
|
* @package acp
|
|
|
|
*/
|
|
|
|
class acp_php_info
|
|
|
|
{
|
2006-02-18 13:54:12 +00:00
|
|
|
var $u_action;
|
|
|
|
|
2005-11-17 18:06:11 +00:00
|
|
|
function main($id, $mode)
|
|
|
|
{
|
|
|
|
global $db, $user, $auth, $template;
|
2006-06-06 20:53:46 +00:00
|
|
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
2005-11-17 18:06:11 +00:00
|
|
|
|
|
|
|
if ($mode != 'info')
|
|
|
|
{
|
2006-08-28 15:50:33 +00:00
|
|
|
trigger_error('NO_MODE', E_USER_ERROR);
|
2005-11-17 18:06:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$this->tpl_name = 'acp_php_info';
|
2005-11-20 18:58:34 +00:00
|
|
|
$this->page_title = 'ACP_PHP_INFO';
|
2010-06-14 22:34:31 +02:00
|
|
|
|
2007-10-05 14:36:34 +00:00
|
|
|
ob_start();
|
2010-06-14 22:34:31 +02:00
|
|
|
phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
|
2007-10-05 14:36:34 +00:00
|
|
|
$phpinfo = ob_get_clean();
|
2005-11-17 18:06:11 +00:00
|
|
|
|
2006-12-06 15:47:50 +00:00
|
|
|
$phpinfo = trim($phpinfo);
|
|
|
|
|
2005-11-17 18:06:11 +00:00
|
|
|
// Here we play around a little with the PHP Info HTML to try and stylise
|
|
|
|
// it along phpBB's lines ... hopefully without breaking anything. The idea
|
|
|
|
// for this was nabbed from the PHP annotated manual
|
2007-10-05 14:36:34 +00:00
|
|
|
preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output);
|
2005-11-17 18:06:11 +00:00
|
|
|
|
2006-12-06 15:47:50 +00:00
|
|
|
if (empty($phpinfo) || empty($output))
|
|
|
|
{
|
|
|
|
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
|
|
|
}
|
|
|
|
|
2006-03-02 01:05:32 +00:00
|
|
|
$output = $output[1][0];
|
2007-07-10 17:46:47 +00:00
|
|
|
|
|
|
|
// expose_php can make the image not exist
|
|
|
|
if (preg_match('#<a[^>]*><img[^>]*></a>#', $output))
|
|
|
|
{
|
|
|
|
$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);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$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);
|
|
|
|
}
|
2006-03-02 01:05:32 +00:00
|
|
|
$output = preg_replace('#<table[^>]+>#i', '<table>', $output);
|
|
|
|
$output = preg_replace('#<img border="0"#i', '<img', $output);
|
|
|
|
$output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
|
2007-07-06 10:55:31 +00:00
|
|
|
|
2011-07-11 15:17:46 +01:00
|
|
|
// Fix invalid anchor names (eg "module_Zend Optimizer")
|
|
|
|
$output = preg_replace_callback('#<a name="([^"]+)">#', array($this, 'remove_spaces'), $output);
|
|
|
|
|
2007-07-06 10:55:31 +00:00
|
|
|
if (empty($output))
|
|
|
|
{
|
|
|
|
trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
|
|
|
|
}
|
|
|
|
|
|
|
|
$orig_output = $output;
|
|
|
|
|
2007-10-05 14:36:34 +00:00
|
|
|
preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
|
2007-07-06 10:55:31 +00:00
|
|
|
$output = (!empty($output[1][0])) ? $output[1][0] : $orig_output;
|
2005-11-17 18:06:11 +00:00
|
|
|
|
|
|
|
$template->assign_var('PHPINFO', $output);
|
|
|
|
}
|
2011-07-11 15:17:46 +01:00
|
|
|
|
|
|
|
function remove_spaces($matches)
|
|
|
|
{
|
|
|
|
return '<a name="' . str_replace(' ', '_', $matches[1]) . '">';
|
|
|
|
}
|
2005-11-17 18:06:11 +00:00
|
|
|
}
|