<?php
/**
 *	Generated by miceCMS
 *	http://www.miceCMS.com/
 */
class user_editAction extends security_login {
	function action(){
		ModuleLimit(__CLASS__);
		global $conn;
		$user_id=$this->_getParam('user_id');
		if($user_id){
			$user=new model_User();
			$user->setSubsection('WHERE user_id='.$user_id);
			$results=$user->doSelectOne();
		}else{
			$results=new model_User();
		}

		if($results->getStopdate()){
			$stopdate=Num2Date('micefun',$results->getStopdate());
		}else{
			$stopdate=0;
		}

		$usergroup=new model_Usergroup();
		$usergroup->setSubsection('ORDER BY level');
		$usergroups=$usergroup->doSelect();

		$editor='';
		//调用插件
		$plugin=new model_Plugin();
		$plugin->setSubsection('WHERE isopen=1 AND hook=\'editor_fast\' ORDER BY orderid ASC,plugin_id DESC');
		$plugins=$plugin->doSelectOne();
		include_once MICE_DIR.'includes/plugin.php';
		if($plugins){
			if(file_exists(MICE_DIR.'plugins/'.$plugins->getName().'/index.php')){
				include_once MICE_DIR.'plugins/'.$plugins->getName().'/index.php';
				add_filter('editor_fast', $plugins->getName());
				$editor=apply_filters('editor_fast',1);
				remove_filter('editor_fast', $plugins->getName());
			}
		}

		if($editor==''){
			$editor='<textarea id="MCEname" name="MCEname" rows="15" cols="80" style="width: 100%">MCEcontent</textarea>';
		}

		$editor=str_replace('MCEname','explam',$editor);
		$editor=str_replace('MCEcontent',str_replace("\r\n","",$results->getExplam()),$editor);

		

		$smarty = new Smarty();
		$smarty->load_filter('pre','micePreCompileAdmin');
		$smarty->assign('results',$results);
		$smarty->assign('usergroups',$usergroups);
		$smarty->assign('stopdate',$stopdate);
		$smarty->assign('editor',$editor);
		$smarty->assign('index',MICE_URL.'admin.php/user');
		$smarty->assign('formaction',MICE_URL.'admin.php/user/update');
		$filename = new getTPLFileName(__CLASS__);
		$smarty->display($filename->TPLFileName);
	}
}
?>