[phpMP-CVS] CVS: phpMP modules.php,1.4,1.5
Status: Pre-Alpha
Brought to you by:
heimidal
From: Brian R. <hei...@us...> - 2002-04-11 06:30:37
|
Update of /cvsroot/phpmp/phpMP In directory usw-pr-cvs1:/tmp/cvs-serv7698 Modified Files: modules.php Log Message: Updated module error handling; fixed early session termination. Index: modules.php =================================================================== RCS file: /cvsroot/phpmp/phpMP/modules.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** modules.php 11 Apr 2002 05:40:15 -0000 1.4 --- modules.php 11 Apr 2002 06:02:37 -0000 1.5 *************** *** 48,51 **** --- 48,53 ---- var $modulename; + var $_inactive; + var $_exists; function Init() { *************** *** 53,56 **** --- 55,60 ---- $this->modulename = $HTTP_GET_VARS['module']; + $this->_inactive = 0; + $this->_exists = 1; $query = $DBA->query("SELECT * FROM " . $MPCONF['DB']['table_prefix'] . "modules WHERE unixname='" . $this->modulename . "'"); *************** *** 58,64 **** if($num_rows > 0) { $MPCONF['MOD'] = $DBA->fetch_array($query); } if($MPCONF['MOD']['active'] != 1) { ! header("Location: " . $MPCONF['GEN']['uri'] . "/error.php?ecode=activemod"); } } --- 62,78 ---- if($num_rows > 0) { $MPCONF['MOD'] = $DBA->fetch_array($query); + } else { + $this->_exists = 0; } if($MPCONF['MOD']['active'] != 1) { ! $this->_inactive = 1; ! } ! } ! ! function DoCheck() { ! if(($this->_inactive == 1) || ($this->_exists != 1)) { ! return 0; ! } else { ! return 1; } } *************** *** 68,74 **** $ModClass->Init(); ! include($MPCONF['GEN']['abs_path'] . '/modules/' . $MPCONF['MOD']['filename']); ! $Module->Init(); $Template->PrintHeader( array(PAGETITLE => ".::" . $Module->pagetitle . "::.") ); --- 82,92 ---- $ModClass->Init(); ! $ModCheck = $ModClass->DoCheck(); ! if($ModCheck != 0) { ! include($MPCONF['GEN']['abs_path'] . '/modules/' . $MPCONF['MOD']['filename']); ! ! $Module->Init(); ! } $Template->PrintHeader( array(PAGETITLE => ".::" . $Module->pagetitle . "::.") ); *************** *** 78,82 **** $Template->Blocking('BeginMain'); ! $Module->MakeContent(); $Template->Blocking('EndMain'); --- 96,106 ---- $Template->Blocking('BeginMain'); ! if($ModCheck != 0) { ! $Module->MakeContent(); ! } else { ! $Template->Blocking('BeginBig', array(PAGETITLE => 'Module Error' )); ! print "An error occured while trying to process the module. It is either inactive or does not exist."; ! $Template->Blocking('EndBig'); ! } $Template->Blocking('EndMain'); |