Example #1
0
void DeletetInstance(void)
{
#ifdef ISM3FIELDS
	sprintf(gcQuery,"DELETE FROM tInstance WHERE uInstance=%u AND ( uOwner=%u OR %u>9 )"
					,uInstance,guLoginClient,guPermLevel);
#else
	sprintf(gcQuery,"DELETE FROM tInstance WHERE uInstance=%u"
					,uInstance);
#endif
	mysql_query(&gMysql,gcQuery);
	if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));

	//tInstance("Record Deleted");
	if(mysql_affected_rows(&gMysql)>0)
	{
#ifdef ISM3FIELDS
		unxsISPLog(uInstance,"tInstance","Del");
#endif
		tInstance(LANG_NBR_RECDELETED);
	}
	else
	{
#ifdef ISM3FIELDS
		unxsISPLog(uInstance,"tInstance","DelError");
#endif
		tInstance(LANG_NBR_RECNOTDELETED);
	}

}//void DeletetInstance(void)
Example #2
0
void NewtInstance(unsigned uMode)
{
	register int i=0;
	MYSQL_RES *res;

	sprintf(gcQuery,"SELECT uInstance FROM tInstance\
				WHERE uInstance=%u"
							,uInstance);
	mysql_query(&gMysql,gcQuery);
	if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
	res=mysql_store_result(&gMysql);
	i=mysql_num_rows(res);

	if(i) 
		//tInstance("<blink>Record already exists");
		tInstance(LANG_NBR_RECEXISTS);

	//insert query
	Insert_tInstance();
	if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
	//sprintf(gcQuery,"New record %u added");
	uInstance=mysql_insert_id(&gMysql);
#ifdef ISM3FIELDS
	uCreatedDate=luGetCreatedDate("tInstance",uInstance);
	unxsISPLog(uInstance,"tInstance","New");
#endif

	if(!uMode)
	{
	sprintf(gcQuery,LANG_NBR_NEWRECADDED,uInstance);
	tInstance(gcQuery);
	}

}//NewtInstance(unsigned uMode)
Example #3
0
int tInstanceCommands(pentry entries[], int x)
{
	ProcessControlVars(entries,x);

	ExttInstanceCommands(entries,x);

	if(!strcmp(gcFunction,"tInstanceTools"))
	{
		if(!strcmp(gcFind,LANG_NB_LIST))
		{
			tInstanceList();
		}

		//Default
		ProcesstInstanceVars(entries,x);
		tInstance("");
	}
	else if(!strcmp(gcFunction,"tInstanceList"))
	{
		ProcessControlVars(entries,x);
		ProcesstInstanceListVars(entries,x);
		tInstanceList();
	}

	return(0);

}//tInstanceCommands()
Example #4
0
void ModtInstance(void)
{
	register int i=0;
	MYSQL_RES *res;
	MYSQL_ROW field;
#ifdef ISM3FIELDS
	unsigned uPreModDate=0;

	//Mod select gcQuery
	sprintf(gcQuery,"SELECT uInstance,uModDate FROM tInstance WHERE uInstance=%u"
						,uInstance);
#else
	sprintf(gcQuery,"SELECT uInstance FROM tInstance WHERE uInstance=%u"
						,uInstance);
#endif

	mysql_query(&gMysql,gcQuery);
	if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
	res=mysql_store_result(&gMysql);
	i=mysql_num_rows(res);

	//if(i<1) tInstance("<blink>Record does not exist");
	if(i<1) tInstance(LANG_NBR_RECNOTEXIST);
	//if(i>1) tInstance("<blink>Multiple rows!");
	if(i>1) tInstance(LANG_NBR_MULTRECS);

	field=mysql_fetch_row(res);
#ifdef ISM3FIELDS
	sscanf(field[1],"%u",&uPreModDate);
	if(uPreModDate!=uModDate) tInstance(LANG_NBR_EXTMOD);
#endif

	Update_tInstance(field[0]);
	if(mysql_errno(&gMysql)) htmlPlainTextError(mysql_error(&gMysql));
	//sprintf(query,"record %s modified",field[0]);
	sprintf(gcQuery,LANG_NBRF_REC_MODIFIED,field[0]);
#ifdef ISM3FIELDS
	uModDate=luGetModDate("tInstance",uInstance);
	unxsISPLog(uInstance,"tInstance","Mod");
#endif
	tInstance(gcQuery);

}//ModtInstance(void)
Example #5
0
//networkEngine* networkEngine::Instance()
boost::shared_ptr<networkEngine> networkEngine::Instance()
{
    if (pInstance == 0)  // is it the first call?
    {
        //pInstance = new networkEngine; // create sole instance
        boost::shared_ptr<networkEngine> tInstance(new networkEngine);
        pInstance = tInstance;
    }
    return pInstance; // address of sole instance
}
Example #6
0
//gameState *gameState::Instance()
boost::shared_ptr<gameState> gameState::Instance()
{
    if (pInstance == 0)  // is it the first call?
    {
        //pInstance = new gameState; // t sole instance
        
        boost::shared_ptr<gameState> tInstance(new gameState);
        pInstance = tInstance;
    }
    return pInstance; // address of sole instance
}
Example #7
0
//gameEngine* gameEngine::Instance()
boost::shared_ptr<gameEngine> gameEngine::Instance()
{
    if (pInstance == 0)  // is it the first call?
    {
        //pInstance = new AISystem; // create sole instance
        boost::shared_ptr<gameEngine> tInstance(new gameEngine);
        pInstance = tInstance;
        //return tInstance; // address of sole instance
    }
    return pInstance; // returns the value of pInstance
}
Example #8
0
void ProcesstInstanceListVars(pentry entries[], int x)
{
        register int i;

        for(i=0;i<x;i++)
        {
                if(!strncmp(entries[i].name,"ED",2))
                {
                        sscanf(entries[i].name+2,"%u",&uInstance);
                        guMode=2002;
                        tInstance("");
                }
        }
}//void ProcesstInstanceListVars(pentry entries[], int x)