<?php
/**
 *----------------------------------------------------------------------------*
 * 版权所有 2005-2010 GV32.COM，并保留所有权利。
 * 网站地址: http://www.gv32.com；
 * 作者: GV32.COM
 *----------------------------------------------------------------------------*
**/
class Message
{
	function Message()
	{
		
		//缓存
		if($GLOBALS["WebConfig"]["webtmp"]==1)
		{
			$GLOBALS['Templ'] -> caching = true;
			if($GLOBALS["WebConfig"]["webtmptime"] > 0 ){
				$GLOBALS['Templ'] -> cache_lifetime = $GLOBALS["WebConfig"]["webtmptime"] ;  //60 *  60 * 24
			}else{
				$GLOBALS['Templ'] -> cache_lifetime = 3600 ;  //60 *  60 * 24
			}
			$GLOBALS['Templ'] -> cache_dir = ROOT_PATH.$GLOBALS['cache_path'];
		}
		
		
		$getconfig = $GLOBALS['Helpe'] -> get_config();
		$GLOBALS['Templ'] -> assign('getconfig',$getconfig);

		$getmenu = $GLOBALS['Helpe'] -> get_menu();
		$GLOBALS['Templ'] -> assign('getmenu',$getmenu);
		

	
		$getlink = $GLOBALS['Helpe'] -> get_link();
		$GLOBALS['Templ'] -> assign('getlink',$getlink);	
		
		$getads = $GLOBALS['Helpe'] -> get_ads( $instr = '1,2,3,4,5,6,7,8,9,10,11' );
		$GLOBALS['Templ'] -> assign('getads',$getads);
		
		$getuserlink = $GLOBALS['WebSe']->getuserlink();
		$GLOBALS['Templ']->assign('getuserlink',$getuserlink);
		
		$actval = trim($_REQUEST["act"]);
		if($actval=='')
		{
			$this -> infolist();
		}
	}
	
	function infolist()
	{
		$webtitle = '在线咨询';
		//处理你现在的位置
		$nowaddress = '您的位置：<a href="'.BASE_WEBURL.'/">首页</a> > <a href="'.BASE_WEBURL.'/?load=message">在线咨询</a>';
		$GLOBALS['Helpe'] -> load_ckeditor( $textName = 'mes_content','','Basic','','510' );	//加载文本编辑器
		
		$GLOBALS['Templ'] -> assign('webtitle',$webtitle);
		$GLOBALS['Templ'] -> assign('nowaddress',$nowaddress);
		$GLOBALS['Templ'] -> display('message_tpl.html');
	}
	
	function addinfo()
	{
		$mes_titleval 		= $GLOBALS['Reque'] -> funpost("mes_title");
		$use_emailval  		= $GLOBALS['Reque'] -> funpost("use_email");
		$mes_contentval  	= $GLOBALS['Reque'] -> funpost("mes_content");
		
		$mes_addtimeval 		= time();
		
		$mes_ipval 			= $GLOBALS['Helpe'] -> getip();


		$insertsql ="INSERT INTO `".SQL_PREFIX."message` (`mes_title` , `use_email` , `mes_content` , `mes_addtime` , `mes_ip` ) VALUES (  '$mes_titleval', '$use_emailval', '$mes_contentval', '$mes_addtimeval', '$mes_ipval')"; 
		
		$GLOBALS['MySql'] -> querySql($insertsql);
		
		$GLOBALS['Templ'] -> assign('infomessage',$GLOBALS['_LANG']['bd_addsusse']);
		$GLOBALS['Templ'] -> assign('URL_TIME',URL_TIME);
		$GLOBALS['Templ'] -> assign('geturl',BASE_WEBURL."/?load=message");
		$GLOBALS['Templ'] -> display('suggestion_tpl.html');
		
	
	}	
}

$Message = new Message();

?>