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

		$sqlQuery = " SELECT *  FROM ".SQL_PREFIX."configsys WHERE cfs_type ='bbs' GROUP BY cfs_id ORDER BY `cfs_id`  ";
		
		$info = $GLOBALS['MySql'] -> selectInfo($sqlQuery);
		
		foreach( $info as $key => $val )
		{
			$reArray[$val["cfs_codestr"]] = $val;
		}
		$GLOBALS['Templ']->assign('reArray',$reArray);
		$GLOBALS['Templ']->display('bbsconfig_tpl.html');
	
	}
	
	function editinfo( )
	{	
	
		$bbsnameval 			= $GLOBALS['Reque'] -> funpost("bbsname");
		$bbstitleval 			= $GLOBALS['Reque'] -> funpost("bbstitle");
		$bbskeywordval 			= $GLOBALS['Reque'] -> funpost("bbskeyword");
		$bbsdescriptionval		= $GLOBALS['Reque'] -> funpost("bbsdescription");
		$bbsadminval 			= $GLOBALS['Reque'] -> funpost("bbsadmin");
		$bbsmailval 			= $GLOBALS['Reque'] -> funpost("bbsmail");
		$bbsqqval				= $GLOBALS['Reque'] -> funpost("bbsqq");
		$bbsphoteval 			= $GLOBALS['Reque'] -> funpost("bbsphote");
		$bbsaddressval 			= $GLOBALS['Reque'] -> funpost("bbsaddress");
		$bbscloseval 			= $GLOBALS['Reque'] -> funpost("bbsclose");
		$bbsclosevalueval 		= $GLOBALS['Reque'] -> funpost("bbsclosevalue");
		$bbslogoval 			= $GLOBALS['Reque'] -> funpost("bbslogo");
		$bbsregval				= $GLOBALS['Reque'] -> funpost("bbsreg");
		$bbscertificateval 		= $GLOBALS['Reque'] -> funpost("bbscertificate");
		$bbskeywordval 			= $GLOBALS['Reque'] -> 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 ".SQL_PREFIX."configsys  set  cfs_value  = '".$val."'   WHERE  cfs_codestr = '".$key."' and cfs_type ='bbs' ";
					$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=bbsconfig&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=bbsconfig&act=infolist");
			$GLOBALS['Templ'] -> display('suggestion_tpl.html');	
		}
		
	}
	
 
		
}

//nmon_x86_rhel4


$Bbsconfig = new Bbsconfig();

?>