Xaraya / Postnuke CVS Notices - Message

Note: this list is kept only as a demonstration for CVSNotice. For the latest CVS notices, see the Xaraya and Postnuke sites

View Statistics - Next Notice - Previous Notice

Directory filter : [ all ] / postnuke_modules / New_pnadmin / html / modules / admin [ view in CVS ]

Date Directory [filter] File(s) [view] Author [filter]
10 Aug 2002 00:31:54postnuke_modules/New_pnadmin/html/modules/adminpnfunctions.php,1.2,1.3 pninit.php,1.2,1.3Richard Cave
 ADODB conversion.

Update of /home/cvsroot/postnuke_modules/New_pnadmin/html/modules/admin
In directory ns7.hostnuke.net:/tmp/cvs-serv26607/New_pnadmin/html/modules/admin

Modified Files:
	pnfunctions.php pninit.php 
Log Message:
ADODB conversion.


Index: pnfunctions.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/New_pnadmin/html/modules/admin/pnfunctions.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pnfunctions.php	5 Aug 2002 11:10:36 -0000	1.2
--- pnfunctions.php	10 Aug 2002 00:31:51 -0000	1.3
***************
*** 25,59 ****
  // for use in admin.
  // ----------------------------------------------------------------------
- // Functions in "old" admin:
- // ----------------------------------------------------------------------
  
! function getAllSkins(){
! 	$ModName 	= basename(dirname(__FILE__));
! 	$skinDir	= "modules/".$ModName."/skins";
! 	$handle		= opendir($skinDir);
! 	$i		= 0;
[...2836 lines suppressed...]
!             elseif (file_exists($file.'jpg'))
!             $imgfile = $file.'jpg';
!             elseif (file_exists($file.'png'))
!             $imgfile = $file.'png';
!             else $imgfile = 'modules/'.$ModName.'/images/default.gif';
  
                  menu_add_option("admin.php?module=$mod[directory]&op=main", $mod['displayname'], $imgfile);
***************
*** 1331,1335 ****
  {
      OpenTable();
! 	echo "<center><font class=\"pn-title\"><b>".$title."</b></font></center>";
      CloseTable();
  }
--- 1585,1589 ----
  {
      OpenTable();
!     echo "<center><font class=\"pn-title\"><b>".$title."</b></font></center>";
      CloseTable();
  }

Index: pninit.php
===================================================================
RCS file: /home/cvsroot/postnuke_modules/New_pnadmin/html/modules/admin/pninit.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pninit.php	5 Aug 2002 11:10:36 -0000	1.2
--- pninit.php	10 Aug 2002 00:31:51 -0000	1.3
***************
*** 24,28 ****
  // ----------------------------------------------------------------------
  
- 
  // --------------------------------------------
  // This is not a standardfunction in pninit.php
--- 24,27 ----
***************
*** 30,163 ****
  function isInAGroup($mID)
  {
!     list($dbconn) = pnDBGetConn();
! 	
      if(function_exists(admin_pntables)){
! 	$pntable = admin_pntables();
      }
!     else{
! 	$pntable = pnDBGetTables();
      }
!     $table	= $pntable['member_table'];
!     $column	= &$pntable['members'];
!     $query	= "SELECT * FROM ".$table." WHERE ".$column['mid']."='".$mID."'";
!     $result 	= mysql_query($query);
! 	return mysql_numrows($result);
  }
  
! function restoreToDefault(){
! 	$ModName = basename(dirname(__FILE__));
! 	list($dbconn) 	= pnDBGetConn();
! 	if(function_exists(admin_pntables)){
! 		$pntable		= admin_pntables();
! 	}else{
! 		$pntable		= pnDBGetTables();
! 	}
! 	$modTable 		= pnConfigGetVar('prefix')."_modules";
! 	
! 	
! 	// Delete all records of any tab and modules
! 	$table			= $pntable['member_table'];
! 	mysql_query("DELETE FROM ".$table);
!     if (mysql_error()){
!         pnSessionSetVar('errormsg', _CREATETABLEFAILED);
!         echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
          return false;
      }
! 	$table			= $pntable['group_table'];
! 	mysql_query("DELETE FROM ".$table);
!     if (mysql_error()){
!         pnSessionSetVar('errormsg', _CREATETABLEFAILED);
!         echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
          return false;
!     }	// Create a list of default tabs
! 	
!    	// ----------------------------------------------------------------------------------------
! 	// All tabnames
! 	$tabNames 		            = array("Configuration","Users","Content","Quick Links");
!    	// ----------------------------------------------------------------------------------------
! 	// All sorting of tabs
! 	$sort['Quick Links'] 			= 1;
! 	$sort['Content'] 				= 2;
! 	$sort['Users'] 					= 3;
! 	$sort['Configuration'] 			= 4;
!    	// ----------------------------------------------------------------------------------------
! 	// All sorting of tabs
! 	$lockID['Quick Links'] 			= 0;
! 	$lockID['Content'] 				= 0;
! 	$lockID['Users'] 				= 0;
! 	$lockID['Configuration'] 		= 1;
!    	// ----------------------------------------------------------------------------------------
! 	// All sorting of tabs
! 	$defaultID['Quick Links'] 		= 1;
! 	$defaultID['Content'] 			= 0;
! 	$defaultID['Users'] 			= 0;
! 	$defaultID['Configuration'] 	= 0;
  
!    	// ----------------------------------------------------------------------------------------
! 	// All default modules in tabs, each number is the ID in the table "modules"
! 	$modsIDs['Quick Links'] 	= array("6","60","84","86","77","19","52","25");
! 	$modsIDs['Content'] 		= array("8","9","10","13","3","20","27","90","33");
! 	$modsIDs['Users'] 			= array("14","16","18","53","32");
! 	$modsIDs['Configuration'] 	= array("7","96","11","12","15","17","41","93","21","22","29","31");
!    	// ----------------------------------------------------------------------------------------
! 	// Let's loop and create tabs and it's content.
! 	for($x = 0;$x < count($tabNames);$x++){
! 		$newTabName		= $tabNames[$x];
! 		$sortOrder		= $sort[$newTabName];
! 		$listODModIDs	= $modsIDs[$newTabName];
! 		$UseLock		= $lockID[$newTabName];
! 		$default		= $defaultID[$newTabName];
! 		$infotype_cols = &$pntable['group'];
! 		$query = "INSERT INTO ".$pntable['group_table']." (". $infotype_cols['id'].",". $infotype_cols['lock'].",".$infotype_cols['order'].",". $infotype_cols['name'].",". $infotype_cols['default'].") VALUES ('','".$UseLock."','".$sortOrder."','".$newTabName."','".$default."')";
! 		mysql_query($query);
!     	if (mysql_error()){
!     	    pnSessionSetVar('errormsg', _CREATETABLEFAILED);
!     	    echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
!     	    return false;
!     	}else{
! 			$infotype_cols = &$pntable['members'];
!     		$groupID	= mysql_insert_id();
! 	   		for($i = 0;$i < count($listODModIDs);$i++){
!     			$modID		= $listODModIDs[$i];
! 				$query		= "INSERT INTO ".$pntable['member_table']." (". $infotype_cols['gid'].",". $infotype_cols['mid'].") VALUES ('".$groupID."','".$modID."')";
! 				mysql_query($query);
! 			}
!     	}
      }
!    	// ----------------------------------------------------------------------------------------
! 	// Create a Misc tab where all other modules should be stored.
! 	//
      $infotype_cols = &$pntable['group'];
! 	$newTabName	= "Misc";
! 	$sortOrder	= "";
! 	$default	= 0;
! 	$query = "INSERT INTO ".$pntable['group_table']." (". $infotype_cols['id'].",". $infotype_cols['lock'].",".$infotype_cols['order'].",". $infotype_cols['name'].",". $infotype_cols['default'].") VALUES ('','0','".(count($tabNames)+1)."','".$newTabName."','".$default."')";
! 	mysql_query($query);
!     if (mysql_error()){
!         pnSessionSetVar('errormsg', _CREATETABLEFAILED);
!         echo "<p>".nl2br($query). " <br> ".mysql_error()."</p>";
          return false;
      }else{
!     	$miscID = mysql_insert_id();
!     }
!     
      
! 	// ----------------------------------------------------------------------------------------
! 	// Modules in group
! 	$infotype_cols	= &$pntable['members'];
! 	$result			= mysql_query("SELECT * FROM ".pnConfigGetVar('prefix')."_modules WHERE pn_admin_capable='1'");
! 	$num			= mysql_numrows($result);
! 	for ($i = 0 ;$i < $num; $i++){
! 		$modID	= mysql_result($result, $i, "pn_id");
! 		if(isInAGroup($modID) < 1){
! 			$query	= "INSERT INTO ".$pntable['member_table']." (". $infotype_cols['gid'].",". $infotype_cols['mid'].") VALUES ('".$miscID."','".$modID."')";
! 			mysql_query($query);
! 			if(mysql_error()){
! 				pnSessionSetVar('errormsg', _CREATETABLEFAILED);
! 				echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
! 				return false;
! 			}
! 		}
! 	}
  return true;
  }
--- 29,206 ----
  function isInAGroup($mID)
  {
!     list($dbconn)   = pnDBGetConn();
      if(function_exists(admin_pntables)){
!         $pntable        = admin_pntables();
!     }else{
!         $pntable        = pnDBGetTables();
      }
!     $table      = $pntable['member_table'];
!     $column     = &$pntable['members'];
! 
!     $query      = "SELECT COUNT(*) FROM ".$table." WHERE ".$column['mid']."='".$mID."'";
!     $result = $dbconn->Execute( $query );
!     if ($result == false) {        
!         pnSessionSetVar('errormsg', "SELECT of ".$table." table failed.");
!         $recordCount = 0;
!     } else {
!         $recordCount = $result->fields[0];
      }
! 
!     return $recordCount;
  }
  
! function restoreToDefault()
! {
!     $ModName = basename(dirname(__FILE__));
!     list($dbconn)   = pnDBGetConn();
! 
!     if(function_exists(admin_pntables)){
!         $pntable        = admin_pntables();
!     }else{
!         $pntable        = pnDBGetTables();
!     }
!     $modTable       = pnConfigGetVar('prefix')."_modules";
!     
!     
!     // Delete all records of any tab and modules
!     $table          = $pntable['member_table'];
!     $query = "DELETE FROM ".$table;
!     $result = $dbconn->Execute( $query );
!     if ($result == false) {
!         pnSessionSetVar('errormsg', "DELETE of ".$table." table failed.");
          return false;
      }
! 
!     $table          = $pntable['group_table'];
!     $query = "DELETE FROM ".$table;
!     $result = $dbconn->Execute( $query );
!     if ($result == false) {
!         pnSessionSetVar('errormsg', "DELETE of ".$table." table failed.");
          return false;
!     }   
!     
!     // Create a list of default tabs
!     
!     // ----------------------------------------------------------------------------------------
!     // All tabnames
!     $tabNames                       = array("Configuration","Users","Content","Quick Links");
!     // ----------------------------------------------------------------------------------------
!     // All sorting of tabs
!     $sort['Quick Links']            = 1;
!     $sort['Content']                = 2;
!     $sort['Users']                  = 3;
!     $sort['Configuration']          = 4;
!     // ----------------------------------------------------------------------------------------
!     // All sorting of tabs
!     $lockID['Quick Links']          = 0;
!     $lockID['Content']              = 0;
!     $lockID['Users']                = 0;
!     $lockID['Configuration']        = 1;
!     // ----------------------------------------------------------------------------------------
!     // All sorting of tabs
!     $defaultID['Quick Links']       = 1;
!     $defaultID['Content']           = 0;
!     $defaultID['Users']             = 0;
!     $defaultID['Configuration']     = 0;
  
!     // ----------------------------------------------------------------------------------------
!     // All default modules in tabs, each number is the ID in the table "modules"
!     $modsIDs['Quick Links']     = array("6","60","84","86","77","19","52","25");
!     $modsIDs['Content']         = array("8","9","10","13","3","20","27","90","33");
!     $modsIDs['Users']           = array("14","16","18","53","32");
!     $modsIDs['Configuration']   = array("7","96","11","12","15","17","41","93","21","22","29","31");
!     // ----------------------------------------------------------------------------------------
!     // Let's loop and create tabs and it's content.
!     for($x = 0;$x < count($tabNames);$x++){
!         $newTabName     = $tabNames[$x];
!         $sortOrder      = $sort[$newTabName];
!         $listODModIDs   = $modsIDs[$newTabName];
!         $UseLock        = $lockID[$newTabName];
!         $default        = $defaultID[$newTabName];
!         $infotype_cols = &$pntable['group'];
! 
!         // Generate id
!         $groupID = $dbconn->GenId($infotype_cols['id']);
! 
!         $query = "INSERT INTO ".$pntable['group_table'].
!             " (". $infotype_cols['id'].",". $infotype_cols['lock'].",".$infotype_cols['order'].",". $infotype_cols['name'].",". $infotype_cols['default']." )".
!             " VALUES ('".$groupID."','".$UseLock."','".$sortOrder."','".$newTabName."','".$default."')";
! 
!         $resultIns = $dbconn->Execute( $query );
!         if ($resultIns == false) {
!             pnSessionSetVar('errormsg', "INSERT into ".$pntable['group_table']." table failed.");
!             return false;
!         }else{
!             // Get the newly generated id
!             $groupID = $dbconn->PO_Insert_ID( $pntable, $infotype_cols['id'] );
! 
!             // New table - not to be confused with above id from group table
!             $infotype_cols = &$pntable['members'];
! 
!             for($i = 0;$i < count($listODModIDs);$i++){
!                 $modID = $listODModIDs[$i];
! 
!                 $query = "INSERT INTO ".$pntable['member_table'].
!                     " (". $infotype_cols['gid'].")".",". $infotype_cols['mid'].
!                     " VALUES ('".$groupID."','".$modID."')";
! 
!                 $resultInsSub = $dbconn->Execute( $query );
!                 if ($resultInsSub == false) {
!                     pnSessionSetVar('errormsg', "INSERT into ".$pntable['member_table']." table failed.");
!                     return false;
!                 }
!             }
!         }
      }
!     // ----------------------------------------------------------------------------------------
!     // Create a Misc tab where all other modules should be stored.
!     //
      $infotype_cols = &$pntable['group'];
!     $newTabName = "Misc";
!     $sortOrder  = "";
!     $default    = 0;
! 
!     // Generate id
!     $miscID = $dbconn->GenId($infotype_cols['id']);
! 
!     $query = "INSERT INTO ".$pntable['group_table'].
!         " (". $infotype_cols['id'].",". $infotype_cols['lock'].",".$infotype_cols['order'].",". $infotype_cols['name'].",". $infotype_cols['default'].")".
!         " VALUES ('".$miscID."','".$default."','".(count($tabNames)+1)."','".$newTabName."','".$default."')";
! 
!     $resultIns = $dbconn->Execute( $query );
!     if ($resultIns == false) {
!         pnSessionSetVar('errormsg', "INSERT into ".$pntable['group_table']." table failed.");
          return false;
      }else{
!         // Get the newly generated id
!         $miscID = $dbconn->PO_Insert_ID( $pntable, $infotype_cols['id'] );
      
!         // ----------------------------------------------------------------------------------------
!         // Modules in group
!         $infotype_cols  = &$pntable['members'];
!         $query = "SELECT ".$column['pn_id']." FROM ".pnConfigGetVar('prefix')."_modules WHERE pn_admin_capable='1'";
! 
!         $resultSel = $dbconn->Execute( $query );
!         if ( $resultSel == false ) {
!             pnSessionSetVar('errormsg', "SELECT of ".pnConfigGetVar('prefix')."_modules table failed.");
!             return false;
!         }
!         for (; !$resultSel->EOF; $resultSel->MoveNext() ) {
!             $modID                 = $resultSel->fields[0];
! 
!             if(isInAGroup($modID) < 1){
!                 $query  = "INSERT INTO ".$pntable['member_table'].
!                     " (". $infotype_cols['gid'].",". $infotype_cols['mid'].")".
!                     " VALUES ('".$miscID."','".$modID."')";
! 
!                 $resultInsSub = $dbconn->Execute( $query );
!                 if ($resultInsSub == false) {
!                     pnSessionSetVar('errormsg', "INSERT into ".$pntable['member_table']." table failed.");
!                     return false;
!                 }
!             }
!         }
!     }
! 
  return true;
  }
***************
*** 167,182 ****
  function admin_init()
  {
! 	list($dbconn)	= pnDBGetConn();
! 	$pntable	= pnDBGetTables();
      if(!is_array($pntable)){
!     	echo "<p><b>No tables found to create!</b></p>";
      }
! 	// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
! 	// ============================== NEXT TABLE ===============================
! 	//                               group_table
! 	// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
      $templatetable = $pntable['group_table'];
      $templatecolumn = &$pntable['group'];
!     $sql = "CREATE TABLE ".$templatetable." (
              ".$templatecolumn['id']." INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
              ".$templatecolumn['name']." VARCHAR(200) NOT NULL DEFAULT '',
--- 210,225 ----
  function admin_init()
  {
!     list($dbconn)   = pnDBGetConn();
!     $pntable        = pnDBGetTables();
      if(!is_array($pntable)){
!         echo "<p><b>No tables found to create!</b></p>";
      }
!     // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
!     // ============================== NEXT TABLE ===============================
!     //                               group_table
!     // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
      $templatetable = $pntable['group_table'];
      $templatecolumn = &$pntable['group'];
!     $query = "CREATE TABLE ".$templatetable." (
              ".$templatecolumn['id']." INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
              ".$templatecolumn['name']." VARCHAR(200) NOT NULL DEFAULT '',
***************
*** 186,222 ****
              ".$templatecolumn['default']." TINYINT(1) DEFAULT '0' NOT NULL
              )";
!     mysql_query($sql);
!     // Check for an error with the database code, and if so set an
!     // appropriate error message and return
!     if (mysql_error()) {
!        pnSessionSetVar('errormsg', _CREATETABLEFAILED);
!        return false;
      }
  
! 	// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
! 	// ============================== NEXT TABLE ===============================
! 	//                               member_table
! 	// :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
      $templatetable = $pntable['member_table'];
      $templatecolumn = &$pntable['members'];
!     $sql = "CREATE TABLE ".$templatetable." (
              ".$templatecolumn['gid']." INT(11),
              ".$templatecolumn['order']." INT(11),
              ".$templatecolumn['mid']." INT(11)
              )";
!     mysql_query($sql);
!     // Check for an error with the database code, and if so set an
!     // appropriate error message and return
!     if (mysql_error()) {
! 		pnSessionSetVar('errormsg', _CREATETABLEFAILED);
! 		return false;
      }
! 	$query = "INSERT INTO ".pnConfigGetVar('prefix')."_module_vars (pn_modname,pn_name,pn_value) VALUES ('/PNConfig','use_new_admin','1')";
! 	mysql_query($query);
! 	if(restoreToDefault()){
! 	    return true;
!     }else{
!     	return false;
      }
  }
  
--- 229,263 ----
              ".$templatecolumn['default']." TINYINT(1) DEFAULT '0' NOT NULL
              )";
!     $dbconn->Execute( $query );
!     if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', "CREATE table ".$pntable['group_table']." table failed.");
!         return false;
      }
  
!     // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
!     // ============================== NEXT TABLE ===============================
!     //                               member_table
!     // :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
      $templatetable = $pntable['member_table'];
      $templatecolumn = &$pntable['members'];
!     $query = "CREATE TABLE ".$templatetable." (
              ".$templatecolumn['gid']." INT(11),
              ".$templatecolumn['order']." INT(11),
              ".$templatecolumn['mid']." INT(11)
              )";
!     $dbconn->Execute( $query );
!     if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', "CREATE table ".$pntable['member_table']." table failed.");
!         return false;
      }
!     $query = "INSERT INTO ".pnConfigGetVar('prefix')."_module_vars (pn_modname,pn_name,pn_value) ".
!         " VALUES ('/PNConfig','use_new_admin','1')";
!     $dbconn->Execute( $query );
!     if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', "INSERT into ".pnConfigGetVar('prefix')."_module_vars table failed.");
!         return false;
      }
+ 
+     return true;
  }
  
***************
*** 229,338 ****
  function admin_upgrade($oldversion)
  {
!     list($dbconn) = pnDBGetConn();
!     $pntable = pnDBGetTables();
  
-    	if(!is_array($pntable)){
- 		echo "<p><b>No tables to create were found!</b></p>";
- 		die;
-    		return false;
- 	}
- 	switch($oldversion) {
-          case "0.0.6":
-          	// No table update needed.
- 			return true;
- 		break;
           case "0.0.5":
!          	// No table update needed.
! 			admin_upgrade("0.0.6");
! 		break;
          case "0.0.4":
! 			$query = "INSERT INTO ".pnConfigGetVar('prefix')."_module_vars (pn_modname,pn_name,pn_value) VALUES ('/PNConfig','use_new_admin','1')";
! 			mysql_query($sql);
! 			if (mysql_error()) {
! 				pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
!        			 echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
! 				return false;
! 			}
! 			admin_upgrade("0.0.5");
! 		break;
           case "0.0.3":
! 			$templatetable = $pntable['group_table'];
! 			$templatecolumn = &$pntable['group'];
! 			$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['all']." INT(11) NOT NULL default '0'";
! 			mysql_query($sql);
! 			if (mysql_error()) {
! 				pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
!        			 echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
! 				return false;
! 			}
! 			admin_upgrade("0.0.4");
! 		break;
           case "0.0.2":
! 			$templatetable = $pntable['group_table'];
! 			$templatecolumn = &$pntable['group'];
! 			$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['lock']." INT(11) NOT NULL default '0'";
! 			mysql_query($sql);
! 			if (mysql_error()) {
! 				pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
!        			 echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
! 				return false;
! 			}
! 			admin_upgrade("0.0.3");
! 		break;
! 		case "0.0.1":
! 			$templatetable = $pntable['member_table'];
! 			$templatecolumn = &$pntable['members'];
! 			$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['order']." INT(11) NOT NULL default '1'";
! 			mysql_query($sql);
! 			if (mysql_error()) {
! 				pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
!        			 echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
! 				return false;
! 			}
! 			
! 			$templatetable = $pntable['group_table'];
! 			$templatecolumn = &$pntable['group'];
! 			$sql = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['order']." INT(11) NOT NULL default '1'";
! 			mysql_query($sql);
! 			if (mysql_error()){
! 				pnSessionSetVar('errormsg', _UPDATETABLEFAILED);
!        			 echo "<p>".nl2br($sql). " <br> ".mysql_error()."</p>";
! 				return false;
! 			}
! 			admin_upgrade("0.0.2");
! 		break;
! 		// ------------------------------------------------------------------------
! 	}
  }
  
  function admin_delete()
  {
      list($dbconn) = pnDBGetConn();
!     $pntable 	= pnDBGetTables();
  
      $query = "DROP TABLE IF EXISTS ".$pntable['group_table'];
!     $dbconn->Execute($query);
! 
      if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', 'Deletion of admin lite group table failed');
          return false;
      }
! 	
      $query = "DROP TABLE IF EXISTS ".$pntable['member_table'];
!     $dbconn->Execute($query);
! 
      if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', 'Deletion of admin lite group members table failed');
          return false;
      }
      //FIXME <johnny> - use pnModDelVar()
!     pnModDelVar('admin','
! 	$sql = "DELETE FROM ".pnConfigGetVar('prefix')."_module_vars WHERE pn_modname='/PNConfig' AND pn_name='use_new_admin'";
!         mysql_query($sql);
! 	if (mysql_error()) {
! 		return false;
! 	}
  
      return true;
  }
  ?>
--- 270,393 ----
  function admin_upgrade($oldversion)
  {
!     list($dbconn)   = pnDBGetConn();
!     $pntable        = pnDBGetTables();
!     
!     if(!is_array($pntable)){
!         echo "<p><b>No tables to create were found!</b></p>";
!         die;
!         return false;
!     }
! 
!     switch($oldversion) {
! 
!         case "0.0.7":
!             // No table update needed.
!             //admin_upgrade("0.0.8");
!         break;
! 
!         case "0.0.6":
!             // No table update needed.
!             admin_upgrade("0.0.7");
!         break;
  
           case "0.0.5":
!             // No table update needed.
!             admin_upgrade("0.0.6");
!         break;
! 
          case "0.0.4":
!             $query = "INSERT INTO ".pnConfigGetVar('prefix')."_module_vars (pn_modname,pn_name,pn_value) ".
!             " VALUES ('/PNConfig','use_new_admin','1')";
!             $dbconn->Execute( $query );
!             if ($dbconn->ErrorNo() != 0) {
!                 pnSessionSetVar('errormsg', "INSERT into ".pnConfigGetVar('prefix')."_module_vars table failed.");
!                 return false;
!             }
!             admin_upgrade("0.0.5");
!         break;
! 
           case "0.0.3":
!             $templatetable = $pntable['group_table'];
!             $templatecolumn = &$pntable['group'];
!             $query = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['all']." INT(11) NOT NULL default '0'";
!             $dbconn->Execute( $query );
!             if ($dbconn->ErrorNo() != 0) {
!                 pnSessionSetVar('errormsg', "ALTER table ".$templatetable." table failed.");
!                 return false;
!             }
!             admin_upgrade("0.0.4");
!         break;
! 
           case "0.0.2":
!             $templatetable = $pntable['group_table'];
!             $templatecolumn = &$pntable['group'];
!             $query = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['lock']." INT(11) NOT NULL default '0'";
!             $dbconn->Execute( $query );
!             if ($dbconn->ErrorNo() != 0) {
!                 pnSessionSetVar('errormsg', "ALTER table ".$templatetable." table failed.");
!                 return false;
!             }
!             admin_upgrade("0.0.3");
!         break;
! 
!         case "0.0.1":
!             $templatetable = $pntable['member_table'];
!             $templatecolumn = &$pntable['members'];
!             $query = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['order']." INT(11) NOT NULL default '1'";
!             $dbconn->Execute( $query );
!             if ($dbconn->ErrorNo() != 0) {
!                 pnSessionSetVar('errormsg', "ALTER table ".$templatetable." table failed.");
!                 return false;
!             }
!             
!             $templatetable = $pntable['group_table'];
!             $templatecolumn = &$pntable['group'];
!             $query = "ALTER TABLE ".$templatetable." ADD ".$templatecolumn['order']." INT(11) NOT NULL default '1'";
!             $dbconn->Execute( $query );
!             if ($dbconn->ErrorNo() != 0) {
!                 pnSessionSetVar('errormsg', "ALTER table ".$templatetable." table failed.");
!                 return false;
!             }
!             admin_upgrade("0.0.2");
!         break;
! 
!         default:            	
!             break;
!     }
! 
!     // Update successful
!     return true;
  }
  
+ 
  function admin_delete()
  {
      list($dbconn) = pnDBGetConn();
!     $pntable    = pnDBGetTables();
  
      $query = "DROP TABLE IF EXISTS ".$pntable['group_table'];
!     $dbconn->Execute( $query );
      if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', "DROP of table ".$pntable['group_table']." table failed.");
          return false;
      }
!     
      $query = "DROP TABLE IF EXISTS ".$pntable['member_table'];
!     $dbconn->Execute( $query );
      if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', "DROP of table ".$pntable['member_table']." table failed.");
          return false;
      }
+ 
      //FIXME <johnny> - use pnModDelVar()
!     $query = "DELETE FROM ".pnConfigGetVar('prefix')."_module_vars WHERE pn_modname='/PNConfig' AND pn_name='use_new_admin'";
!     $dbconn->Execute( $query );
!     if ($dbconn->ErrorNo() != 0) {
!         pnSessionSetVar('errormsg', "DELETE from table ".pnConfigGetVar('prefix')."_module_vars table failed.");
!         return false;
!     }
  
      return true;
  }
+ 
  ?>


Directory filter : [ all ] / postnuke_modules / New_pnadmin / html / modules / admin [ view in CVS ]

View Statistics - Next Notice - Previous Notice


Visit Developer Site - Browse CVS Repository Syndicate via backend.rss
(max. once per hour please)
Powered by CVSNotice 0.1.3