<?php
	!defined('DIRCMS_MANAGE') && exit('Access Denied!');
	$action=empty($action)?'manage':trim($action);
	if($_roleid!=1)showmsg_nourl('您没有该操作的权限!');
	$r=cache_read('module.cache.php',DIRCMS_ROOT.'data/cache_module/');
	$adminrole=cache_read('role.cache.php',DIRCMS_ROOT.'data/cache/');
	switch($action)
	{
		case 'manage':
			if(isset($do_submit))
			{
				if(!$key)showmsg('没有模块进行对应操作!');
				foreach($key as $k)
				{
					if($modulename[$k])$r[$k]['modulename']=$modulename[$k];
					if($moduleroleid[$k])$r[$k]['roleid']=$moduleroleid[$k];
				}
				cache_write('module.cache.php',$r,DIRCMS_ROOT.'data/cache_module/');
				showmsg('操作成功!<script language="javascript">self.top.document.frames("topFrame").location.reload();</script>',ADMIN_FILE.'?file=module');
			}
			include admin_tlp($file);
			break;
		case 'settop':
			$r[$modelurl]['istop']=$istop;
			$msg=$istop?'置为置顶菜单':'取消置顶菜单';
			cache_write('module.cache.php',$r,DIRCMS_ROOT.'data/cache_module/');
			showmsg('模块'.$msg.'成功!<script language="javascript">self.top.document.frames("topFrame").location.reload();</script>',ADMIN_FILE.'?file=module');
			break;
		case 'install':
			$r[$modelurl]['disabled']=$isinstall;
			$msg=$isinstall?'卸载':'安装';
			cache_write('module.cache.php',$r,DIRCMS_ROOT.'data/cache_module/');
			showmsg('模块'.$msg.'成功!<script language="javascript">self.top.document.frames("topFrame").location.reload();</script>',ADMIN_FILE.'?file=module');
			break;
		case 'member':
			$r=cache_read('member_module.cache.php',DIRCMS_ROOT.'data/cache_module/');
			$r=$r?$r:array(
					'info'=>array(
						'modulename'=>'我的资料',
						'disabled' => '0'
						)
					);
			include admin_tlp('module_member');
			break;
		case 'member_disable':
			$r=cache_read('member_module.cache.php',DIRCMS_ROOT.'data/cache_module/');
			$r[$modulename]['disabled']=$disabled;
			cache_write('member_module.cache.php',$r,DIRCMS_ROOT.'data/cache_module/');
			showmsg('操作成功!','?file=module&action=member');
			break;
	}
?>