|
From: Markus P. <mar...@us...> - 2005-03-20 23:00:05
|
Update of /cvsroot/mxbb/core/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32178 Modified Files: admin_mx_phpinfo.php Log Message: Formatting output for phpInfo in ACP. Index: admin_mx_phpinfo.php =================================================================== RCS file: /cvsroot/mxbb/core/admin/admin_mx_phpinfo.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** admin_mx_phpinfo.php 9 Jan 2005 21:55:44 -0000 1.3 --- admin_mx_phpinfo.php 20 Mar 2005 22:59:55 -0000 1.4 *************** *** 1,7 **** <?php /** ------------------------------------------------------------------------ ! * subject : mx-portal, CMS & portal * begin : june, 2002 ! * copyright : (C) 2002-2005 MX-System * email : jon...@ho... * project site : www.mx-system.com --- 1,7 ---- <?php /** ------------------------------------------------------------------------ ! * subject : mxBB-Portal * begin : june, 2002 ! * copyright : (C) 2002-2005 mxBB-Portal * email : jon...@ho... * project site : www.mx-system.com *************** *** 19,39 **** */ ! $no_page_header = true; ! ! if ( !empty( $setmodules ) ) { ! $file = basename( __FILE__ ); $module['Portal - System']['phpInfo'] = 'admin/' . $file; return; } ! define( 'IN_PORTAL', 1 ); $mx_root_path = '../'; // Security and page header ! require( './pagestart.php' ); ! phpinfo(); ?> \ No newline at end of file --- 19,83 ---- */ ! if ( !empty($setmodules) ) { ! $file = basename(__FILE__); $module['Portal - System']['phpInfo'] = 'admin/' . $file; return; } ! define('IN_PORTAL', 1); $mx_root_path = '../'; + // // Security and page header + // + require('./pagestart.php'); ! // ! // Capture the phpInfo output ! // ! ob_start(); phpinfo(); + $output = ob_get_contents(); + ob_end_clean(); + + // + // Extract the BODY part. + // + preg_match_all('#<body[^>]*>(.*)</body>#siU', $output, $body_part); + $body_part = $body_part[1][0]; + + // + // Remove all, but some HTML Tags. + // + $allowedTags = '<h1><h2><h3><hr><ul><ol><li><b><i><u>'. + '<a><pre><blockquote><img><div><span><p><br>'. + '<table><tr><td><th><thead><tbody><tfoot>'; + $body_part = strip_tags($body_part, $allowedTags); + + // + // Alter some CSS related attributes. + // + $body_part = preg_replace('# (style|class)=["\'](.*?)["\']#si', '', $body_part); + $body_part = preg_replace('#<hr(.*?)>#si', '<hr size="1" width="600" />', $body_part); + $body_part = preg_replace('#<img(.*?)>#si', '<img style="float:right; border:0px;"\1>', $body_part); + $body_part = preg_replace('#<td(.*?)>(.*?)</td>#si', '<td\1><span class="genmed">\2</span></td>', $body_part); + $body_part = preg_replace('#cellpadding="(.*?)"#si', 'cellpadding="2"', $body_part); + $body_part = preg_replace('#cellspacing="(.*?)"#si', '', $body_part); + $body_part = preg_replace('#<table(.*?)>#si', '<table\1 cellspacing="1" class="forumline" style="margin-left:auto;margin-right:auto;">', $body_part); + $body_part = preg_replace('#<td(.*?)>#si', '<td\1 class="row1">', $body_part); + $body_part = preg_replace('#<td(.*?)class="row1">#si', '<td\1class="row2">', $body_part); + + // + // Send the formatted result to the browser. + // + $template->set_filenames(array('phpinfo' => 'admin/admin_mx_phpinfo.tpl')); + $template->assign_vars(array('PHPINFO' => $body_part)); + $template->pparse('phpinfo'); + + // + // Send page footer. + // + include_once('page_footer_admin.' . $phpEx); ?> \ No newline at end of file |