[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/includes/acp/ -> acp_php_info.php (source)

   1  <?php
   2  /**
   3  *
   4  * This file is part of the phpBB Forum Software package.
   5  *
   6  * @copyright (c) phpBB Limited <https://www.phpbb.com>
   7  * @license GNU General Public License, version 2 (GPL-2.0)
   8  *
   9  * For full copyright and license information, please see
  10  * the docs/CREDITS.txt file.
  11  *
  12  */
  13  
  14  /**
  15  * @ignore
  16  */
  17  if (!defined('IN_PHPBB'))
  18  {
  19      exit;
  20  }
  21  
  22  class acp_php_info
  23  {
  24      var $u_action;
  25  
  26  	function main($id, $mode)
  27      {
  28          global $template;
  29  
  30          if ($mode != 'info')
  31          {
  32              trigger_error('NO_MODE', E_USER_ERROR);
  33          }
  34  
  35          $this->tpl_name = 'acp_php_info';
  36          $this->page_title = 'ACP_PHP_INFO';
  37  
  38          ob_start();
  39          phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES);
  40          $phpinfo = ob_get_clean();
  41  
  42          $phpinfo = trim($phpinfo);
  43  
  44          // Here we play around a little with the PHP Info HTML to try and stylise
  45          // it along phpBB's lines ... hopefully without breaking anything. The idea
  46          // for this was nabbed from the PHP annotated manual
  47          preg_match_all('#<body[^>]*>(.*)</body>#si', $phpinfo, $output);
  48  
  49          if (empty($phpinfo) || empty($output[1][0]))
  50          {
  51              trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
  52          }
  53  
  54          $output = $output[1][0];
  55  
  56          // expose_php can make the image not exist
  57          if (preg_match('#<a[^>]*><img[^>]*></a>#', $output))
  58          {
  59              $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);
  60          }
  61          else
  62          {
  63              $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);
  64          }
  65          $output = preg_replace('#<table[^>]+>#i', '<table>', $output);
  66          $output = preg_replace('#<img border="0"#i', '<img', $output);
  67          $output = str_replace(array('class="e"', 'class="v"', 'class="h"', '<hr />', '<font', '</font>'), array('class="row1"', 'class="row2"', '', '', '<span', '</span>'), $output);
  68  
  69          // Fix invalid anchor names (eg "module_Zend Optimizer")
  70          $output = preg_replace_callback('#<a name="([^"]+)">#', array($this, 'remove_spaces'), $output);
  71  
  72          if (empty($output))
  73          {
  74              trigger_error('NO_PHPINFO_AVAILABLE', E_USER_WARNING);
  75          }
  76  
  77          $orig_output = $output;
  78  
  79          preg_match_all('#<div class="center">(.*)</div>#siU', $output, $output);
  80          $output = (!empty($output[1][0])) ? $output[1][0] : $orig_output;
  81  
  82          $template->assign_var('PHPINFO', $output);
  83      }
  84  
  85  	function remove_spaces($matches)
  86      {
  87          return '<a name="' . str_replace(' ', '_', $matches[1]) . '">';
  88      }
  89  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1