<?php
if (!defined('HUCART_ORG')) exit('HuCart.COM No direct script access allowed');
class Userconfig
{
	function Userconfig()
	{
		//$GLOBALS['WebSe'] -> isOnLine();
		//$this -> view -> assign('act_url',ADMIN_WEBURL."/index.php?/login/actlogin");
	}
	
	function info_list(  )
	{

		$sql_query = " SELECT cfs_codestr,cfs_value  FROM ".$this -> db -> prefix."configsys WHERE cfs_type ='reg' GROUP BY cfs_id ORDER BY `cfs_id`  ";
		
		$info = $this -> db -> select_info($sql_query);
		
		foreach( $info as $key => $val )
		{
			$reArray[$val["cfs_codestr"]] = explode('|',$val["cfs_value"]);
		}
		
		//var_dump($reArray);
		
		$this -> view -> assign('reArray',$reArray);
		$this -> view -> display('userconfig.tpl');
	
	}
	
	function edit_info( )
	{	

		$regmsnval 			= $this -> input ->  funpost("regmsn");
		$regqqval 			= $this -> input ->  funpost("regqq");
		$regphoteval 		= $this -> input ->  funpost("regphote");
		$reghomephoteval	= $this -> input ->  funpost("reghomephote");
		$regtelval 			= $this -> input ->  funpost("regtel");
		//$regaskquestionval 	= $this -> input ->  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 ".$this -> db -> prefix."configsys  set  cfs_value  = '".$val[0]."|".$val[1]."|".$val[2]."'   WHERE  cfs_codestr = '".$key."' and  cfs_type ='reg' ";
					$this -> db -> query_sql( $upsql );
				}
			}
			
			//exit();
			$this -> view ->  assign('info_title',$this->lang['edit_success']);
			$this -> view ->  assign('URL_TIME',URL_TIME);
			$this -> view ->  assign('get_url',ADMIN_WEBURL."/index.php?load=userconfig&act=info_list");
			$this -> view ->  display('suggestion.tpl');
				
		}else{
		
			$this -> view ->  assign('info_title',$this->lang['err_info_missing']);
			$this -> view ->  assign('URL_TIME',URL_TIME);
			$this -> view ->  assign('get_url',ADMIN_WEBURL."/index.php?load=userconfig&act=info_list");
			$this -> view ->  display('suggestion.tpl');	
		}
		
	}
	

		
}

//


$Userconfig = new Userconfig();

?>