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 / administration [ view in CVS ]


Deprecated: Function gmstrftime() is deprecated in /home/mikespub/www/list.php on line 509
Date Directory [filter] File(s) [view] Author [filter]
05 Aug 2002 12:15:31postnuke_modules/New_pnadmin/html/modules/administrationpninit.php,NONE,1.1 pntables.php,NONE,1.1John Robeson
 newest versions of pntables and pninit files

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

Added Files:
	pninit.php pntables.php 
Log Message:
newest versions of pntables and pninit files


--- NEW FILE: pninit.php ---
<?php
// File: $Id: pninit.php,v 1.1 2002/08/05 12:15:29 johnny Exp $ $Name:  $
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// 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.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file:
// Purpose of file:  initialization functions for administration module
// ----------------------------------------------------------------------

//FIXME <johnny>
// MLize the error messages
// finish group member table definitions
// convert to adodb

// --------------------------------------------
// This is not a standardfunction in pninit.php
//
function isInAGroup($mID)
{
    list($dbconn) = pnDBGetConn();
    $pntable = pnDBGetTables();

    $query = 'SELECT * FROM '.$pntable['admin_members']." WHERE moduleID='".$mID."'";
    $result = $dbconn->Execute($query);
    // add error
    return mysql_numrows($result);
}

function restoreToDefault()
{
    list($dbconn) = pnDBGetConn();
    $pntable      = pnDBGetTables();
	
    // Delete all records of any tab and modules
    $dbconn->Execute('DELETE FROM '.$pntable['admin_members'].'');
    
    if($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'DELETE FROM '.$pntable['admin_members'].' table failed');
        return false;
    }
    
    $dbconn->Execute('DELETE FROM '.$pntable['admin_groups'].'');
    if($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'DELETE FROM '.$pntable['admin_groups'].' 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'];
		$query = "INSERT INTO ".$pntable['admin_groups']." (". $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['admin_members']." (". $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['admin_groups']." (". $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 = pnModGetAdminMods();			
	$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['admin_members']." (". $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;
}


/**
 * initialize the administration module
 */
function administration_init()
{
    list($dbconn) = pnDBGetConn();
    $pntable	  = pnDBGetTables();
    
    //Create administration group table
    $query = "CREATE TABLE ".$pntable['admin_groups']." (
              groupID INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
              groupName VARCHAR(200) NOT NULL DEFAULT '',
              groupLock VARCHAR(200) NOT NULL DEFAULT '0',
              groupShowAllModules VARCHAR(200) NOT NULL DEFAULT '0',
              sortOrder INT(11) NOT NULL DEFAULT '0',
              groupDefault TINYINT(1) DEFAULT '0' NOT NULL
              )";
    
    $dbconn->($query);
    if ($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'Creation of '.$pntable['admin_groups'].' table failed');
        return false;
    }

    $query = "CREATE TABLE ".$pntable['admin_members']." (
             groupID INT(11),
             sortOrder INT(11),
             moduleID INT(11)
             )";
            
    $dbconn->($query);
    if ($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'Creation of '.$pntable['admin_members'].' table failed');
        return false;
    }
    
    $query = "INSERT INTO ".$pntable['module_vars']." (pn_modname,pn_name,pn_value) VALUES ('/PNConfig','use_new_admin','1')";
    $dbconn->($query);
    if ($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'could not add configuration variable use_new_admin');
        return false;
    }

   if(!restoreToDefault()){
        return false;
   
   //Initialization successful
   return true;
}



/**
 * upgrade the administration module from an old version
 */
function administration_upgrade($oldversion)
{
    // Upgrade dependent on old version number
    switch($oldversion) {
        case 1.0:
            // Code to upgrade from version 1.0 goes here
            break;
        case 2.0:
            // Code to upgrade from version 2.0 goes here
            break;
    }

    // Update successful
    return true;
}
}

function administration_delete()
{
    list($dbconn) = pnDBGetConn();
    $pntable 	= pnDBGetTables();

    $query = "DROP TABLE IF EXISTS ".$pntable['admin_groups'];
    $dbconn->Execute($query);

    if ($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'Deletion of '.$pntable['admin_groups'].' table failed');
        return false;
    }
	
    $query = "DROP TABLE IF EXISTS ".$pntable['admin_members'];
    $dbconn->Execute($query);

    if ($dbconn->ErrorNo() != 0) {
        pnSessionSetVar('errormsg', 'Deletion of '.$pntable['admin_members'].' table failed');
        return false;
    }
    
    return true;
}
?>
--- NEW FILE: pntables.php ---
<?php
// File: $Id: pntables.php,v 1.1 2002/08/05 12:15:29 johnny Exp $ $Name:  $
// ----------------------------------------------------------------------
// PostNuke Content Management System
// Copyright (C) 2001 by the PostNuke Development Team.
// http://www.postnuke.com/
// ----------------------------------------------------------------------
// LICENSE
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// 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.
//
// To read the license please visit http://www.gnu.org/copyleft/gpl.html
// ----------------------------------------------------------------------
// Original Author of file: Johnny Robeson
// Purpose of file: table definitions for administration module
// ----------------------------------------------------------------------

function administration_pntables()
{
    $pntable = array();

    $pntable['admin_groups']   = pnConfigGetVar('prefix') . '_admin_groups';
    $pntable['admin_members'] = pnConfigGetVar('prefix') . '_admin_members';

    return $pntable;
}
?>

Directory filter : [ all ] / postnuke_modules / New_pnadmin / html / modules / administration [ 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