Thread: [Phpcms-plugins-cvs] admin4phpCMS/modules/hilfe class.module_hilfe.php,NONE,1.1
Brought to you by:
mjahn
From: Martin J. <mj...@us...> - 2004-08-25 21:16:59
|
Update of /cvsroot/phpcms-plugins/admin4phpCMS/modules/hilfe In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2565/modules/hilfe Added Files: class.module_hilfe.php Log Message: step 1 is taken --- NEW FILE: class.module_hilfe.php --- <?php /** * <b>License</b> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * @author Martin Jahn <mj...@us...> * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @copyright Copyright (c) 2004, Martin Jahn * @version $Id$ * @package admin4phpCMS * @subpackage module_statistik **/ /* * $Log$ */ /** * Class for help and documentation * * @package admin4phpCMS * @subpackage module_help * @todo Get the class work completly **/ class module_hilfe extends module { /** * Initialization of the module * * The module registers its own events and connects his methods to some actions **/ function init () { // connect to actions $this->_registerAction ('doParseParam', 'parseParam'); $this->_registerAction ('doParseMenuMain', 'getMenuMain'); $this->_registerAction ('doParseMenuSub', 'getMenuSub'); return true; } /** * Parse the URI-params * * @param array $actiondata $actiondata contains the URI-param-arrays **/ function parseParam (&$actiondata) { // print_r ($actiondata); $this->display = (isset ($actiondata ['request'] ['moduleid']) && $actiondata ['request'] ['moduleid'] == 'hilfe'); $this->action = ''; if (isset ($actiondata ['request'] ['action'])) { $this->action = $actiondata ['request'] ['action']; } $actiondata1 = array (); $this->_callEvent ('USER_GET_STATUS', $actiondata1); $this->_USER = $actiondata1; switch ($this->action) { case 'phpinfo': $this->_registerAction ('doParseContent', 'getPHPContent'); break; default:; } return true; } // function parseParam () /** * Get content for mainmenu * * @param array $actiondata $actiondata['_root'] must provide the id of the parental element **/ function getMenuMain (&$actiondata) { if (!$this->_USER['isLoggedIn']) { return true; } $root = $actiondata['_root']; $actiondata1 = array ('_type'=>'menu_main_entry', '_root'=>$root, 'name'=>'Hilfe', 'module'=>'hilfe', '_id'=>'hilfemenu', '_root'=>'mainmenu'); if ($this->display) { $actiondata1 ['extra'] = 'class="active"'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); return true; } // function getMenuMain () /** * Get submenu of module * * @param array $actiondata $actiondata['_root'] must provide the id of the parental element **/ function getMenuSub (&$actiondata) { if (!$this->_USER['isLoggedIn']) { return true; } if (!$this->display) { return true; } $root = $actiondata['_root']; $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Allgemein', 'module'=>'hilfe', '_id'=>'hilfe_common', 'action'=>'common'); if ($this->action == 'common') { $actiondata1 ['extra'] = 'id="current"'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'PHP-Info', 'module'=>'hilfe', '_id'=>'hilfe_phpinfo', 'action'=>'phpinfo'); if ($this->action == 'phpinfo') { $actiondata1 ['extra'] = 'id="current"'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'phpCMS-Doku', 'module'=>'hilfe', '_id'=>'hilfe_phpcmsdocu', 'action'=>'phpcmsdocu'); if ($this->action == 'phpcmsdocu') { $actiondata1 ['extra'] = 'id="current"'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); $actiondata1 = array ('_type'=>'menu_sub_entry', '_root'=>$root, 'name'=>'Hilfe', 'module'=>'hilfe', '_id'=>'hilfe_hilfe', 'action'=>'hilfe'); if ($this->action == 'hilfe') { $actiondata1 ['extra'] = 'id="current"'; } $this->_callEvent('LAYOUT_ADD_ELEMENT', $actiondata1); } // function getMenuSub () function getPHPContent (&$actiondata) { $actiondata1 = array ('_root'=>$actiondata ['_root'], '_type'=>'h2', '_id'=>'h2_ext', 'content'=>'Geladene Erweiterungen'); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $actiondata1 = array ('_root'=>$actiondata ['_root'], '_type'=>'block', '_id'=>'extensions', 'content'=>join ('<br />', get_loaded_extensions ())); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); $style = 'body, td { font-family: arial, helvetica, sans-serif; font-size: 95%; }'."\n". 'h1 {clear:both; font-family: arial, helvetica, sans-serif; font-size: 120%; font-weight: bold;}'."\n". 'h2 {clear:both;margin:2em 0 1em 0; font-family: arial, helvetica, sans-serif; font-size: 110%; font-weight: bold;}'."\n". 'a { text-decoration: none; }'."\n". 'a:hover { text-decoration: underline; }'."\n". 'hr { clear:both; width: 600px; align: center; background-color: #cccccc; border: 0px; height: 1px;}'."\n". 'table {clear:both; text-align:left;margin: 0 0 1em 0}'."\n". 'th { font-family: arial, helvetica, sans-serif; font-size: 140%; font-weight: bold; }'."\n". '.p {text-align: left;}'."\n". '.e {background-color: #ccccff; font-weight: bold;}'."\n". '.h {background-color: #9999cc; font-weight: bold;}'."\n". '.v {background-color: #cccccc;}'."\n". 'i {color: #666666;}'."\n". 'img {float: right; border: 0px;}'."\n"; $actiondata1 = array ('_root'=>$actiondata ['_root'], '_type'=>'style', '_id'=>'phpinfo-style', 'content'=>$style); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); // BOF Fix phpinfo ob_start(); phpinfo(); $infobuffer .= ob_get_contents(); ob_end_clean(); preg_match_all("=<body[^>]*>(.*)</body>=siU", $infobuffer, $a); $phpinfo = $a[1][0]; $phpinfo = str_replace( ';','; ', $phpinfo ); $phpinfo = str_replace( ',',', ', $phpinfo ); $phpinfo = str_replace( '<br>','<br />', $phpinfo ); $phpinfo = str_replace( 'align="center"','align="left"', $phpinfo ); $phpinfo = str_replace( 'align="right"','align="left"', $phpinfo ); $actiondata1 = array ('_root'=>$actiondata ['_root'], '_type'=>'block', '_id'=>'phpinfo', 'content'=>$phpinfo); $this->_callEvent ('LAYOUT_ADD_ELEMENT', $actiondata1); return true; } } ?> |