//
// default configuration file
// 




section:"main"
{
	max_connections=1200;
	port=8088;
	default_domain="sn_computer";
	default_templates="sn_templates";
	daemon=false;
	watchdog=false;
	timeout=60;
	connectstring="users;localhost;chris;kpdrZ49$#";
	user="user";
	chroot=".";	
}


section:"newpostings"
{
	select = "SELECT id_group, count(*) FROM {table}tr_msgmain
		where sn_datecreated > '{sn_date}'
		group by id_group";
}


section:"users"
{

	on_admin_insert = "insert into tr_user( sn_senderip,sn_nickname, sn_cryptopass, sn_firstname, sn_lastname, sn_city, sn_nickmail, 
		sn_firstmail, sn_datecreated, sn_datelastlogin ) values ( '{sn_senderip}', '{sn_nickname}', '{sn_cryptopass}', '{sn_firstname}', '{sn_lastname}',
		'{sn_city}','{sn_firstmail}', '{sn_nickmail}', now(), now() )";

	on_admin_remove = "delete from tr_user where id = '{id}'";		

	on_admin_update = "update tr_user set sn_firstname='{sn_firstname: }', sn_lastname='{sn_lastname: }',
		sn_memberbonus='{sn_memberbonus}', sn_numquestions='{sn_numquestions}', sn_numanswers='{sn_numanswers}', flag_male='{flag_male}',
		sn_numreasonable='{sn_numreasonable}', sn_numsolutions='{sn_numsolutions}', sn_numvotes='{sn_numvotes}',
		sn_city='{sn_city: }', sn_nickname='{sn_nickname}', sn_nickmail='{sn_nickmail: }', sn_street='{sn_street}', sn_zipcode='{sn_zipcode}',
		sn_icqs='{sn_icqs: }', sn_addressbook='{sn_addressbook: }', sn_homepagetext='{sn_homepagetext: }',sn_homepagelink='{sn_homepagelink: }', 
		sn_homepageimage='{sn_homepageimage: }', sn_googlechannel1='{sn_googlechannel1}', sn_googlechannel2='{sn_googlechannel2}' where id='{id}'";

	on_update = "update tr_user set sn_firstname='{sn_firstname: }',sn_lastname='{sn_lastname: }', flag_male='{flag_male}',	
		sn_city='{sn_city: }', sn_nickmail='{sn_nickmail: }', sn_street='{sn_street}', sn_zipcode='{sn_zipcode}',
		sn_icqs='{sn_icqs: }', sn_addressbook='{sn_addressbook: }' where id='{id}'";

	on_update_home = "update tr_user set sn_homepagetext='{sn_homepagetext: }',sn_homepagelink='{sn_homepagelink: }', 
		sn_homepageimage='{sn_homepageimage: }' where id='{id}'";
	
	adminblock = "update tr_user set sn_cryptopass='{sn_cryptopass}', sn_nickmail='{sn_nickmail}' where id='{id}'";

	update_single1 = "update tr_user set {name}= {value}  where id = '{id}'";
	update_single2 = "update tr_user set {name}='{value}' where id = '{id}'";

	
	select =        "select id id_user, sn_nickname, sn_cryptopass, sn_nickmail, sn_addressbook, sn_googlechannel1, sn_googlechannel2, sn_itemsperpage, sn_mailalert, sn_properties from tr_user order by id";
	select_single = "select id id_user, sn_nickname, sn_cryptopass, sn_nickmail, sn_addressbook, sn_googlechannel1, sn_googlechannel2, sn_itemsperpage, sn_mailalert, sn_properties from tr_user where sn_nickname='{sn_nickname}'";	
	
	
	pagermsg_xx  = "insert into tr_pager_xx( id_sender, id_receiver, sn_nicksender, sn_nickreceiver, sn_datecreated, sn_msgbody ) 
		values( {id_sender}, {id_receiver}, '{sn_nicksender}', '{sn_nickreceiver}', now(), '{sn_msgbody}' )";
	
	pagermsg_admin = "insert into tr_pager_admin( id_sender, id_parent, sn_nicksender, sn_datecreated, sn_msgbody ) 
		values( {id_sender}, {id}, '{sn_nicksender}', now(), '{sn_msgbody}' )";
	

	pagerclear = "delete from tr_pager where to_days(CURDATE()) - to_days(sn_datecreated) > 90";
	
	score_inc1 = "update tr_user set sn_numsolutions=sn_numsolutions+1,sn_memberbonus=sn_memberbonus+{sn_memberbonus} where id = '{id}'";
	score_inc2 = "insert into tr_bonus values( {id_user}, {sn_memberbonus}, now() )";
	
	change_nick = "update sn_computer.tr_msgmain set sn_nickname = '{newnick}' where id_user = '{id}';
								 update sn_games.tr_msgmain set sn_nickname = '{newnick}' where id_user = '{id}';
								 update sn_kochen.tr_msgmain set sn_nickname = '{newnick}' where id_user = '{id}'";
								 
	last_login	= "select sn_datelastlogin from tr_user where id = '{id}'";	
	
	last_id	= "select max(id) + 1 from tr_user";					 	
	
}

