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

		$sql_query = " SELECT *  FROM ".$this -> db -> prefix."configsys WHERE cfs_type ='bbs' GROUP BY cfs_id ORDER BY `cfs_id`  ";
		
		$info = $this -> db -> select_info($sql_query);
		
		foreach( $info as $key => $val )
		{
			$reArray[$val["cfs_codestr"]] = $val;
		}
		$this -> view -> assign('reArray',$reArray);
		$this -> view -> display('bbsconfig.tpl');
	
	}
	
	function edit_info( )
	{	
	
		$bbsnameval 			= $this -> input ->  funpost("bbsname");
		$bbstitleval 			= $this -> input ->  funpost("bbstitle");
		$bbskeywordval 			= $this -> input ->  funpost("bbskeyword");
		$bbsdescriptionval		= $this -> input ->  funpost("bbsdescription");
		$bbsadminval 			= $this -> input ->  funpost("bbsadmin");
		$bbsmailval 			= $this -> input ->  funpost("bbsmail");
		$bbsqqval				= $this -> input ->  funpost("bbsqq");
		$bbsphoteval 			= $this -> input ->  funpost("bbsphote");
		$bbsaddressval 			= $this -> input ->  funpost("bbsaddress");
		$bbscloseval 			= $this -> input ->  funpost("bbsclose");
		$bbsclosevalueval 		= $this -> input ->  funpost("bbsclosevalue");
		$bbslogoval 			= $this -> input ->  funpost("bbslogo");
		$bbsregval				= $this -> input ->  funpost("bbsreg");
		$bbscertificateval 		= $this -> input ->  funpost("bbscertificate");
		$bbskeywordval 			= $this -> input ->  funpost("bbskeyword");
		
		if($bbsnameval !='' and $bbstitleval !='' )
		{
			
			$upsql = '';
			$uparray = array('bbsname'=>$bbsnameval, 'bbstitle'=>$bbstitleval, 'bbskeyword'=>$bbskeywordval,'bbsdescription'=>$bbsdescriptionval,
							'bbsadmin'=>$bbsadminval, 'bbsmail'=>$bbsmailval, 'bbsqq'=>$bbsqqval,
							'bbsphote'=>$bbsphoteval, 'bbsaddress'=>$bbsaddressval, 'bbsclose'=>$bbscloseval,
							'bbsclosevalue'=>$bbsclosevalueval, 'bbslogo'=>$bbslogoval, 'bbsreg'=>$bbsregval,
							'bbscertificate'=>$bbscertificateval, 'bbskeyword'=>$bbskeywordval
							);
		

			foreach($uparray as $key => $val)
			{
				if($val!='')
				{
					$upsql = '';
					$upsql = "UPDATE ".$this -> db -> prefix."configsys  set  cfs_value  = '".$val."'   WHERE  cfs_codestr = '".$key."' and cfs_type ='bbs' ";
					$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=bbsconfig&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=bbsconfig&act=info_list");
			$this -> view ->  display('suggestion.tpl');	
		}
		
	}
	
 
		
}

//


$Bbsconfig = new Bbsconfig();

?>