<?php
/**
 *	Generated by miceCMS
 *	http://www.miceCMS.com/
 */
class logoutAction extends security_login {
	
	function action(){
		$logout=$this->_getParamId(1);
		
		global $conn;
		//查找此分类的文章
		$articlemode=new model_Article();
		$articlemode->setSubsection('WHERE isvisible=0 AND ishtml=0');
		$ArticleRS=$articlemode->doSelect();
		if($ArticleRS AND MICE_HTML==1 AND $logout!='logout'){
			$jsstring='Dialog.alert(\'您的部分文档有改动,尚未生成HTML,单击"确定"退出系统,单击"取消"返回系统继续操作<br><br>更新HTML方法："系统"—"HTML更新"—"更新文档HTML"\',function(){window.location.href="'.MICE_URL.'admin.php/logout/logout";window.event.returnValue = false;},300,100,"提示信息");';
			MessageBox($jsstring);
			exit;
		}

		$category=new model_Category();
		$category->setSubsection('WHERE type LIKE \'article%\' AND isvisible=0 AND ishtml=0');
		$CategoryRS=$category->doSelect();
		if($CategoryRS AND MICE_HTML==1 AND $logout!='logout'){
			$jsstring='Dialog.alert(\'您的部分分类有改动,尚未生成HTML,单击"确定"退出系统,单击"取消"返回系统继续操作<br><br>更新HTML方法："系统"—"HTML更新"—"更新分类HTML"\',function(){window.location.href="'.MICE_URL.'admin.php/logout/logout";window.event.returnValue = false;},300,100,"提示信息");';
			MessageBox($jsstring);
			exit;
		}

		

		$smarty = new Smarty();
		$miceSession = new session();
		$miceSession->destroy('loginname');

		if($logout!='logout'){
			$jsstring='Dialog.alert(\'跳转到登录页面\',function(){window.location.href="'.MICE_URL.'admin.php/login";window.event.returnValue = false;},300,100,"退出成功");';
			MessageBox($jsstring);
			exit;
		}else{
			header("Location: ".MICE_URL.'admin.php/login');
			exit;
		}
		
		$filename = new getTPLFileName(__CLASS__);
		$smarty->display($filename->TPLFileName);
	}
}
?>