<?php
if (!defined('GV32_COM')) exit('GV32.COM No direct script access allowed');
class Userconfig
{
	function Userconfig()
	{
		//$GLOBALS['WebSe'] -> isOnLine();
		//$GLOBALS['Templ']->assign('actUrl',EMPLOYEE_WEBURL."/index.php/login/actlogin");
	}
	
	function infolist(  )
	{

		$sqlQuery = " SELECT cfs_codestr,cfs_value  FROM ".SQL_PREFIX."configsys WHERE cfs_type ='reg' GROUP BY cfs_id ORDER BY `cfs_id`  ";
		
		$info = $GLOBALS['MySql'] -> selectInfo($sqlQuery);
		
		foreach( $info as $key => $val )
		{
			$reArray[$val["cfs_codestr"]] = explode('|',$val["cfs_value"]);
		}
		
		//var_dump($reArray);
		
		$GLOBALS['Templ']->assign('reArray',$reArray);
		$GLOBALS['Templ']->display('userconfig_tpl.html');
	
	}
	
	function editinfo( )
	{	

		$regmsnval 			= $GLOBALS['Reque'] -> funpost("regmsn");
		$regqqval 			= $GLOBALS['Reque'] -> funpost("regqq");
		$regphoteval 		= $GLOBALS['Reque'] -> funpost("regphote");
		$reghomephoteval	= $GLOBALS['Reque'] -> funpost("reghomephote");
		$regtelval 			= $GLOBALS['Reque'] -> funpost("regtel");
		//$regaskquestionval 	= $GLOBALS['Reque'] -> funpost("regaskquestion");

		//var_dump($regmsnval);


		
		if($regmsnval !='' and $regqqval !='' )
		{
			
			$upsql = '';
			$uparray = array('regmsn'=>$regmsnval, 'regqq'=>$regqqval, 'regphote'=>$regphoteval,'reghomephote'=>$reghomephoteval,'regtel'=>$regtelval );
		
			///var_dump($uparray);
			///$sqlup = " UPDATE configsys  set  cfs_value  = '".$itemup."'   WHERE  cfs_codestr = '".$keyup."' "; 
			foreach($uparray as $key => $val)
			{
				if($val!='')
				{
					$upsql = '';
					if($val[0]==''){$val[0] = '0';}
					if($val[1]==''){$val[1] = '0';}
					if($val[2]==''){$val[2] = '0';}
					
					$upsql = "UPDATE ".SQL_PREFIX."configsys  set  cfs_value  = '".$val[0]."|".$val[1]."|".$val[2]."'   WHERE  cfs_codestr = '".$key."' and  cfs_type ='reg' ";
					$GLOBALS['MySql'] -> querySql( $upsql );
				}
			}
			
			//exit();
			$GLOBALS['Templ'] -> assign('infomessage',$GLOBALS['_LANG']['bd_editsusse']);
			$GLOBALS['Templ'] -> assign('URL_TIME',URL_TIME);
			$GLOBALS['Templ'] -> assign('geturl',EMPLOYEE_WEBURL."/index.php?load=userconfig&act=infolist");
			$GLOBALS['Templ'] -> display('suggestion_tpl.html');
				
		}else{
		
			$GLOBALS['Templ'] -> assign('infomessage',$GLOBALS['_LANG']['bd_losssusse']);
			$GLOBALS['Templ'] -> assign('URL_TIME',URL_TIME);
			$GLOBALS['Templ'] -> assign('geturl',EMPLOYEE_WEBURL."/index.php?load=userconfig&act=infolist");
			$GLOBALS['Templ'] -> display('suggestion_tpl.html');	
		}
		
	}
	

		
}

//nmon_x86_rhel4


$Userconfig = new Userconfig();

?>