<?php
// 初始化变量及引入初始文件
$dbPathPart		= '';
$webPathPart	= '';
$jsPathPart		= '';

require('ucCheck.php');

$userSysArr = Cache::PhpFile('userSys');

if ($userSysArr['US_isUserSys'] == 0){
	die('<br /><br /><center>会员系统已关闭，有问题请联系管理员</center>');
}

$username = Users::Username();

if ($username == ''){
	$backURL = urlencode(GetUrl::Query());
	die('
	<br /><br />
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
	<center style="font-size:14px;">
		请先登录，该功能需要登录才能使用。<br />
		如有账号请先 <a style="color:red;" href="./?m=login&force=1&backURL='. $backURL .'">[登录]</a>，如没账号请先 <a style="color:red;" href="./?m=reg&force=1&backURL='. $backURL .'">[注册]</a>
	</center>
	<br /><br />
	');
}

$addiFieldStr = '';
switch ($mudi){
	case 'recom':	$addiFieldStr = ',UE_recomLevel,UE_recomUser,UE_recomNum1,UE_recomNum2,UE_recomNum11,UE_recomNum12';	break;
}
$userRow = Users::Open('get',',UE_username,UE_authStr,UE_groupID,UE_isAgent,UE_state,UE_cardState,UE_pageNum,UE_pageWapNum'. $addiFieldStr,'',$judUserErr);
	if ((! $userRow) || $judUserErr != ''){
		$backURL = urlencode(GetUrl::Query());
		die('
		<br /><br />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
		<center style="font-size:14px;">
			请先登录，该功能需要登录才能使用（'. $judUserErr .'）。<br />
			如有账号请先 <a style="color:red;" href="./?m=login&force=1&backURL='. $backURL .'">[登录]</a>，如没账号请先 <a style="color:red;" href="./?m=reg&force=1&backURL='. $backURL .'">[注册]</a>
		</center>
		<br /><br />
		');
	}

	if (! in_array($mudi, array('revInfo', 'siteMessage', 'siteMessageAdd', 'siteMessageReply', 'userAndGroup', 'gift', 'workUsers', 'payRecord', 'diyPayRecord', 'moneyRecord', 'userScore','workOrderAdd','workOrderReply','workOrderManage','domainTpl','domainTplRev','domainTplAdd'))){
		// 检测用户邮箱、手机号是否需要强制验证
		AreaApp::UserTixing($userRow['UE_authStr'], $userSysArr, 1);
	}
	if ($userRow['UE_pageNum'] < 1){ $userRow['UE_pageNum'] = 20; }

// 如果手机端访问，手机版有开启，判断手机版独立域名有开启使用，当前网址不是独立域名进行跳转
if ( UcBase::JudMobile() ){
	$wapArr = Cache::PhpFile('wap');
	$currUrl = GetUrl::Query();
	$currDir = GetUrl::Dir();
	if ($wapArr['WAP_domainMode'] == 1 && strlen($wapArr['WAP_domainUrl']) > 7 && strpos($currUrl,$wapArr['WAP_domainUrl']) === false){
		$currUrl = str_replace(array($currDir, 'index.php'), array($wapArr['WAP_domainUrl'] .'users/', ''), $currUrl);
		header('Location: '. $currUrl);
		exit();
	}
}

require(OT_ROOT .'inc/classTemplate.php');

$tpl = new Template;
$tpl->obj->template_dir	= OT_ucROOT .'template/default/';	// 模板目录

// 初始化公共变量
$tpl->webTypeName	= 'usersCenter';
$tpl->webTitle		= '';
$tpl->webKey		= '*';
$tpl->webDesc		= '*';

if (empty($userSysArr['US_userAndGroupName'])){ $userSysArr['US_userAndGroupName'] = '会员和会员组'; }

$webContImg = '';
$menu1 = 'def';	// 默认展开的主菜单
$menu2 = '';	// 默认打开选中的菜单
$webContent = StrInfo::AlertStr('ucAudit0');
switch ($mudi){
	case 'revInfo':
		$menu1		= 'self';
		$webTitle	= '资料密码修改';
		if (Area::UcAudit('|noRightRevInfo|')){
			$webContent = UcMain::RevInfo($userRow['UE_ID']);
		}
		$webContImg = 'address-card-o';
		break;

	case 'userAndGroup':
		$webTitle	= $userSysArr['US_userAndGroupName'];
		$webContent = UcMain::UserAndGroup($userRow['UE_ID']);
		$webContImg = 'address-card-o';
		break;

	case 'userGroupRightList':
		$menu2		= 'userAndGroup';
		$webTitle	= '会员组权限列表';
		$webContent = UserGroup::RightList($userRow['UE_ID']);
		$webContImg = 'address-card-o';
		break;

	case 'log':
		$menu1		= 'self';
		$webTitle	= '会员日志';
		if (Area::UcAudit('|noRightLog|')){
			$webContent = UcMain::LogWeb($userRow['UE_ID']);
		}
		break;

	case 'infoType':
		$webTitle	= $userSysArr['US_infoTypeName'];
		if (Area::UcAudit('|noRightInfoType|')){
			$webContent = UcMain::InfoTypeWeb($userRow['UE_ID']);
		}
		break;

	case 'infoDet':
		$menu2		= 'infoType';
		$webTitle	= '文章详情';
		if (Area::UcAudit('|noRightInfoType|')){
			$webContent = UcMain::InfoDetWeb($userRow['UE_ID']);
		}
		break;

	case 'addNews':
		$webTitle	= '发表文章';
		if (Area::UcAudit()){
			$webContent = UcNews::AddOrRev();
		}
		$webContImg = 'newspaper-o';
		break;

	case 'revNews':
		$menu2		= 'newsManage';
		$webTitle	= '修改文章';
		if (Area::UcAudit()){
			$webContent = UcNews::AddOrRev();
		}
		$webContImg = 'newspaper-o';
		break;

	case 'newsManage':
		$webTitle	= '文章管理';
		$webContent = UcNews::Manage();
		break;

	case 'loginApi':
		$menu1		= 'self';
		$webTitle	= '快捷登录绑定';
		$webContent = AppLogin::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'quan':
		$menu1		= 'money';
		$webTitle	= '卡密充值';
		if (Area::UcAudit('|noRightQuan|')){
			$webContent = AppQuan::UcPayWeb($userRow['UE_ID'],'uc');
		}
		break;

	case 'onlinePay':
		$menu1		= 'money';
		$webTitle	= '在线充值';
		if (Area::UcAudit('|noRightPay|')){
			$webContent = AppMoneyPay::UcPayWeb($userRow['UE_ID'],$userRow['UE_username'],'uc');
		}
		break;

	case 'payRecord':
		$menu1		= 'money';
		$webTitle	= '充值记录';
		$webContent = AppMoneyPay::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'diyPayRecord':
		$menu1		= 'money';
		$webTitle	= '手动充值记录';
		$webContent = AppDiyPay::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'moneyRecord':
		$menu1		= 'money';
		$webTitle	= '财务明细';
		$webContent = AppMoneyRecord::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'userScore':
		$menu1		= 'money';
		$webTitle	= '积分明细';
		$webContent = AppUserScore::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'gift':
		$menu1		= 'func';
		$webTitle	= '积分兑换记录';
		$webContent = AppGift::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'recom':
		$menu1		= 'recom';
		$webTitle	= '邀请好友';
		if (Area::UcAudit()){
			$webContent = AppRecom::UcManage($userRow['UE_ID'],'uc');
		}
		break;

	case 'buyOrders':
		$menu1		= 'func';
		$webTitle	= '订单记录';
		if (Area::UcAudit()){
			$webContent = AppBuyOrders::UcManage($userRow['UE_ID'],'uc');
		}
		break;

	case 'goodsOrder':
		$menu1		= 'func';
		$webTitle	= '淘宝商品认领';
		$webContent = AppTaokeOrder::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'workCenter':
		$menu1		= 'func';
		$webTitle	= '任务中心';
		if (Area::UcAudit('|noRightWorkCenter|')){
			$webContent = AppWorkCenter::UcManage($userRow['UE_ID'],'uc');
		}
		break;

	case 'workUsers':
		$menu1		= 'func';
		$webTitle	= '任务记录';
		$webContent = AppWorkCenter::UcUsers($userRow['UE_ID'],'uc');
		break;

	case 'gainMoney':
		$menu1		= 'recom';
		$webTitle	= '提现记录';
		if (Area::UcAudit()){
			$webContent = AppGain::UcMoneyManage($userRow['UE_ID'],'uc');
		}
		break;

	case 'gainItem':
		$menu1		= 'recom';
		$webTitle	= '佣金记录';
		$webContent = AppGain::UcItemManage($userRow['UE_ID'],'uc');
		break;

	case 'userView':
		$webTitle	= '文章浏览记录';
		$webContent = AppUserView::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'userMark':
		$webTitle	= '文章收藏记录';
		$webContent = AppUserMark::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'infoDown':
		$webTitle	= '文章下载记录';
		$webContent = AppInfoDown::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'siteMessage':
		$webTitle	= '站内信息';
		$webContent = AppSiteMessage::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'siteMessageAdd':
		$menu2		= 'siteMessage';
		$webTitle	= '提交站内信息';
		$webContent = AppSiteMessage::UcAdd($userRow['UE_ID'], '', 'uc');
		break;

	case 'siteMessageReply':
		$menu2		= 'siteMessage';
		$webTitle	= '回复站内信息';
		$webContent = AppSiteMessage::UcReply($userRow['UE_ID'], '', 'uc');
		break;

	case 'api':
		$menu1		= 'self';
		$webTitle	= 'API授权码';
		if (Area::UcAudit('|noRightApi|')){
			$webContent = AppSiteApi::Manage($userRow['UE_ID'],'uc');
		}
		break;

	case 'authSoft':
		$menu1		= 'func';
		$webTitle	= '授权软件管理';
		$webContent = AppAuthSoft::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'ca':
		$menu1		= 'func';
		$webTitle	= '广告管理';
		$webContent = AppCa::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'form':
		$menu1		= 'func';
		$webTitle	= '表单管理';
		$webContent = AppForm::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'formDet':
		$menu1		= 'func';
		$menu2		= 'form';
		$webTitle	= '表单详情列表';
		$webContent = AppForm::UcManageDet($userRow['UE_ID'],'uc');
		break;

	case 'onePage':
		$menu1		= 'func';
		$webTitle	= '功能单页';
		$webContent = AppOnePage::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'onePageRev':
		$menu1		= 'func';
		$menu2		= 'onePage';
		$webTitle	= '修改功能单页';
		$webContent = AppOnePage::UcRev($userRow['UE_ID'],'uc');
		break;

	case 'getGift':
		$menu1		= 'func';
		$webTitle	= '抽奖记录';
		$webContent = AppGetGift::UcManage($userRow['UE_ID'],'uc');
		break;

	case 'adGift':
		$menu1		= 'func';
		$webTitle	= '广告奖励充值';
		// if (Area::UcAudit('|noRightAdGift|')){
			$webContent = AppXcxAd::UcPayWeb($userRow['UE_ID'],'uc');
		// }
		break;

	case 'adOrder':
		$menu1		= 'func';
		$webTitle	= '广告奖励卡密';
		// if (Area::UcAudit('|noRightAdOrder|')){
			$webContent = AppXcxAd::UcManage($userRow['UE_ID'],'uc');
		// }
		break;

	case 'payCodeAdd':
		$menu1		= 'func';
		$webTitle	= '提交奖励单';
		// if (Area::UcAudit('|noRightAdOrder|')){
			$webContent = AppPayCode::UcAdd($userRow['UE_ID'], $userRow['UE_username'], 'uc');
		// }
		break;

	case 'payCodeReward':
		$menu1		= 'func';
		$webTitle	= '收款码领奖励';
		// if (Area::UcAudit('|noRightAdOrder|')){
			$webContent = AppPayCode::UcManage($userRow['UE_ID'],'uc');
		// }
		break;
		
	/* IDC功能 */
	case 'workOrderAdd':
		$menu1		= 'serv';
		$webTitle	= '提交工单';
		$webContent = AppWorkOrderUc2::Add();
		$webContImg = 'newspaper-o';
		break;

	case 'workOrderReply':
		$menu1		= 'serv';
		$menu2		= 'workOrderManage';
		$webTitle	= '工单回复';
		$webContent = AppWorkOrderUc2::Reply();
		$webContImg = 'newspaper-o';
		break;

	case 'workOrderManage':
		$menu1		= 'serv';
		$webTitle	= '工单管理';
		$webContent = AppWorkOrderUc2::Manage();
		break;


	case 'domainTpl':
		$menu1		= 'pro';
		$menu2		= 'domainManage';
		$webTitle	= '域名注册模板';
		$webContent = AppDomainUc2::TplManage($userRow['UE_ID']);		// AppDomainTpl::Manage($userRow['UE_ID'])
		break;

	case 'domainTplRev':
		$menu1		= 'pro';
		$menu2		= 'domainManage';
		$webTitle	= '修改域名注册模板';
		$webContent = AppDomainUc2::TplAddOrRev($userRow['UE_ID']);		// AppDomainTpl::AddOrRev($userRow['UE_ID'])
		break;

	case 'domainTplAdd':
		$menu1		= 'pro';
		$menu2		= 'domainManage';
		$webTitle	= '新增域名注册模板';
		$webContent = AppDomainUc2::TplAddOrRev($userRow['UE_ID']);		// AppDomainTpl::AddOrRev($userRow['UE_ID'])
		break;

	case 'domainManage':
		$menu1		= 'pro';
		$webTitle	= '域名管理';
		$webContent = AppDomainUc2::Manage($userRow['UE_ID']);
		break;

	case 'domainXufei':
		$menu1		= 'pro';
		$menu2		= 'domainManage';
		$webTitle	= '域名续费';
		$webContent = AppDomainUc2::Xufei($userRow['UE_ID']);
		break;

	case 'domainOut':
		$menu1		= 'pro';
		$menu2		= 'domainManage';
		$webTitle	= '域名转出';
		$webContent = AppDomainUc2::Zhuanchu($userRow['UE_ID']);
		break;


	case 'hostKaitong':
		$menu1		= 'pro';
		$menu2		= 'hostManage';
		$webTitle	= '虚拟主机开通';
		$webContent = AppHostUc2::Kaitong();
		break;

	case 'hostKaitongDet':
		$menu1		= 'pro';
		$menu2		= 'hostManage';
		$webTitle	= '虚拟主机开通 - 详细信息';
		if (Area::UcAudit()){
			$webContent = AppHostUc2::KaitongDet($userRow['UE_ID']);
		}
		break;

	case 'hostManage':
		$menu1		= 'pro';
		$webTitle	= '虚拟主机管理';
		$webContent = AppHostUc2::Manage($userRow['UE_ID']);
		break;

	case 'hostManage_xufei':
		$menu1		= 'pro';
		$menu2		= 'hostManage';
		$webTitle	= '虚拟主机管理 - 续费';
		if (Area::UcAudit()){
			$webContent = AppHostUc2::Xufei($userRow['UE_ID']);
		}
		break;

	case 'hostManage_update':
		$menu1		= 'pro';
		$menu2		= 'hostManage';
		$webTitle	= '虚拟主机管理 - 升级';
		if (Area::UcAudit()){
			$webContent = AppHostUc2::Update($userRow['UE_ID']);
		}
		break;

	case 'hostManage_zhuanzheng':
		$menu1		= 'pro';
		$menu2		= 'hostManage';
		$webTitle	= '虚拟主机管理 - 转正';
		if (Area::UcAudit()){
			$webContent = AppHostUc2::Zhuanzheng($userRow['UE_ID']);
		}
		break;

	case 'hostManage_tuikuan':
		$menu1		= 'pro';
		$menu2		= 'hostManage';
		$webTitle	= '虚拟主机管理 - 退款';
		if (Area::UcAudit()){
			$webContent = AppHostUc2::Tuikuan($userRow['UE_ID']);
		}
		break;


	case 'vpsKaitong':
		$menu1		= 'pro';
		$menu2		= 'vpsManage';
		$webTitle	= '云服务器开通';
		$webContent = AppVpsApiUc2::Kaitong();
		break;

	case 'vpsKaitongDet':
		$menu1		= 'pro';
		$menu2		= 'vpsManage';
		$webTitle	= '云服务器开通 - 详细信息';
		if (Area::UcAudit()){
			$webContent = AppVpsApiUc2::KaitongDet($userRow['UE_ID']);
		}
		break;

	case 'vpsManage':
		$menu1		= 'pro';
		$webTitle	= '云服务器管理';
		$webContent = AppVpsApiUc2::Manage($userRow['UE_ID']);
		break;

	case 'vpsManage_xufei':
		$menu1		= 'pro';
		$menu2		= 'vpsManage';
		$webTitle	= '云服务器管理 - 续费';
		if (Area::UcAudit()){
			$webContent = AppVpsApiUc2::Xufei($userRow['UE_ID']);
		}
		break;

	case 'vpsManage_update':
		$menu1		= 'pro';
		$menu2		= 'vpsManage';
		$webTitle	= '云服务器管理 - 升级';
		if (Area::UcAudit()){
			$webContent = AppVpsApiUc2::Update($userRow['UE_ID']);
		}
		break;

	case 'vpsManage_zhuanzheng':
		$menu1		= 'pro';
		$menu2		= 'vpsManage';
		$webTitle	= '云服务器管理 - 转正';
		if (Area::UcAudit()){
			$webContent = AppVpsApiUc2::Zhuanzheng($userRow['UE_ID']);
		}
		break;

	case 'vpsManage_tuikuan':
		$menu1		= 'pro';
		$menu2		= 'vpsManage';
		$webTitle	= '云服务器管理 - 退款';
		if (Area::UcAudit()){
			$webContent = AppVpsApiUc2::Tuikuan($userRow['UE_ID']);
		}
		break;


	case 'dialingKaitong':
		$menu1		= 'pro';
		$menu2		= 'dialingManage';
		$webTitle	= '拨号VPS开通';
		$webContent = AppDialingUc2::Kaitong();
		break;

	case 'dialingKaitongDet':
		$menu1		= 'pro';
		$menu2		= 'dialingManage';
		$webTitle	= '拨号VPS开通 - 详细信息';
		if (Area::UcAudit()){
			$webContent = AppDialingUc2::KaitongDet($userRow['UE_ID']);
		}
		break;

	case 'dialingManage':
		$menu1		= 'pro';
		$webTitle	= '拨号VPS管理';
		$webContent = AppDialingUc2::Manage($userRow['UE_ID']);
		break;

	case 'dialingManage_xufei':
		$menu1		= 'pro';
		$menu2		= 'dialingManage';
		$webTitle	= '拨号VPS管理 - 续费';
		if (Area::UcAudit()){
			$webContent = AppDialingUc2::Xufei($userRow['UE_ID']);
		}
		break;

	case 'dialingManage_update':
		$menu1		= 'pro';
		$menu2		= 'dialingManage';
		$webTitle	= '拨号VPS管理 - 升级';
		if (Area::UcAudit()){
			$webContent = AppDialingUc2::Update($userRow['UE_ID']);
		}
		break;

	case 'dialingManage_zhuanzheng':
		$menu1		= 'pro';
		$menu2		= 'dialingManage';
		$webTitle	= '拨号VPS管理 - 转正';
		if (Area::UcAudit()){
			$webContent = AppDialingUc2::Zhuanzheng($userRow['UE_ID']);
		}
		break;

	case 'dialingManage_tuikuan':
		$menu1		= 'pro';
		$menu2		= 'dialingManage';
		$webTitle	= '拨号VPS管理 - 退款';
		if (Area::UcAudit()){
			$webContent = AppDialingUc2::Tuikuan($userRow['UE_ID']);
		}
		break;

	/*
	case 'pptpKaitong':
		$menu1		= 'pro';
		$menu2		= 'pptpManage';
		$webTitle	= 'PPTP开通';
		$webContent = AppPptp::Kaitong('uc');
		break;

	case 'pptpKaitongDet':
		$menu1		= 'pro';
		$menu2		= 'pptpManage';
		$webTitle	= 'PPTP开通 - 详细信息';
		if (Area::UcAudit()){
			$webContent = AppPptp::KaitongDet($userRow['UE_ID']);
		}
		break;

	case 'pptpManage':
		$menu1		= 'pro';
		$webTitle	= 'PPTP管理';
		$webContent = AppPptp::Manage($userRow['UE_ID'],'uc');
		break;

	case 'pptpManage_xufei':
		$menu1		= 'pro';
		$menu2		= 'pptpManage';
		$webTitle	= 'PPTP管理 - 续费';
		if (Area::UcAudit()){
			$webContent = AppPptp::Xufei($userRow['UE_ID']);
		}
		break;

	case 'pptpManage_tuikuan':
		$menu1		= 'pro';
		$menu2		= 'pptpManage';
		$webTitle	= 'PPTP管理 - 退款';
		if (Area::UcAudit()){
			$webContent = AppPptp::Tuikuan($userRow['UE_ID']);
		}
		break;
	*/

	case 'servKaitong':
		$menu1		= 'pro';
		$menu2		= 'servManage';
		$webTitle	= '服务器租用开通';
		$webContent = AppServUc2::Kaitong();
		break;

	case 'servKaitongDet':
		$menu1		= 'pro';
		$menu2		= 'servManage';
		$webTitle	= '服务器租用开通 - 详细信息';
		if (Area::UcAudit()){
			$webContent = AppServUc2::KaitongDet($userRow['UE_ID']);
		}
		break;

	case 'servManage':
		$menu1		= 'pro';
		$webTitle	= '服务器租用管理';
		$webContent = AppServUc2::Manage($userRow['UE_ID']);
		break;

	case 'servManage_xufei':
		$menu1		= 'pro';
		$menu2		= 'servManage';
		$webTitle	= '服务器租用管理 - 续费';
		if (Area::UcAudit()){
			$webContent = AppServUc2::Xufei($userRow['UE_ID']);
		}
		break;


	case 'sslManage':
		$menu1		= 'pro';
		$webTitle	= 'SSL证书管理';
		$webContent = AppSslUc2::Manage($userRow['UE_ID']);
		break;

	case 'sslManage_xufei':
		$menu1		= 'pro';
		$menu2		= 'sslManage';
		$webTitle	= 'SSL证书管理 - 续费';
		if (Area::UcAudit()){
			$webContent = AppSslUc2::Xufei($userRow['UE_ID']);
		}
		break;


	case 'agentUsers':
		$menu1		= 'pro';
		$webTitle	= '代理子用户管理';
		$webContent = AppAgent::UcManage($userRow['UE_ID']);
		break;

	case 'agentUsersAdd':
		$menu1		= 'pro';
		$menu2		= 'agentUsers';
		$webTitle	= '添加代理子用户';
		if (Area::UcAudit()){
			$webContent = AppAgent::AddOrRev($userRow['UE_ID']);
		}
		$webContImg = 'newspaper-o';
		break;

	case 'agentUsersRev':
		$menu1		= 'pro';
		$menu2		= 'agentUsers';
		$webTitle	= '修改代理子用户';
		if (Area::UcAudit()){
			$webContent = AppAgent::AddOrRev($userRow['UE_ID']);
		}
		break;

	case 'agentUsersManage':
		$menu1		= 'pro';
		$menu2		= 'agentUsers';
		$webTitle	= '代理子用户产品列表';
		$webContent = AppAgent::UserManage($userRow['UE_ID']);
		break;

	case 'agentUsersPro':
		$menu1		= 'pro';
		$menu2		= 'agentUsers';
		$webTitle	= '代理子用户产品归属';
		if (Area::UcAudit()){
			$webContent = AppAgent::ProManage($userRow['UE_ID']);
		}
		break;

	case 'index':
	default :
		$mudi = '';
		$webTitle	= '会员中心';
		$webContent = UcMain::index($userRow['UE_ID']);
		break;

}

if (strlen($mudi) == 0){
	$tpl->webTitle = $webTitle .'_'. $systemArr['SYS_title'];
}else{
	$tpl->webTitle = $webTitle .'_会员中心_'. $systemArr['SYS_title'];
}

if (strlen($menu2) == 0){ $menu2 = $mudi; }
	
if (strlen($webContImg) == 0){ $webContImg = 'snowflake-o'; }
$webContent = MainArea($webContent, $webTitle, $webContImg);


// 财务菜单
$moneyPayMenu = $servMenu = $dropMenuList = '';
if (AppMoneyPay::Jud()){
	if (empty($moneySysArr)){ $moneySysArr = Cache::PhpFile('moneySys'); }
	if ($moneySysArr['MS_isUserPay'] == 1){
		$moneyPayMenu .= SubMenu('onlinePay', '在线充值');
		$dropMenuList .= '<li><a href="usersCenter.php?m=onlinePay"><i class="otcms-uc-215"></i> 在线充值</a></li>';
	}
	$moneyPayMenu .= SubMenu('payRecord', '充值记录');
	$dropMenuList .= '<li><a href="usersCenter.php?m=payRecord"><i class="otcms-uc--13"></i> 充值记录</a></li>';
}
if (AppWorkOrder::Jud()){
	$servMenu .= SubMenu('workOrderAdd', '提交工单') . 
				SubMenu('workOrderManage', '工单管理');
	$dropMenuList .= '
		<li><a href="usersCenter.php?m=workOrderAdd"><i class="otcms-uc-user-plus"></i> 提交工单</a></li>
		<li><a href="usersCenter.php?m=workOrderManage"><i class="otcms-uc-users"></i> 工单管理</a></li>
		';
}

$webTop = '
	<div class="topbar-left">
		<div class="uc-aside-toggler">
			<span class="uc-toggler-bar"></span>
			<span class="uc-toggler-bar"></span>
			<span class="uc-toggler-bar"></span>
		</div>
		<span class="navbar-page-title"> '. $webTitle .'</span>
	</div>
	<ul class="topbar-right">
		<li class="dropdown dropdown-profile">
			<a href="javascript:void(0)" data-toggle="dropdown">
				<img class="img-qrcode img-qrcode-46" src="static/images/def-face.png" alt="用户头像" />
				<span>'. $userRow['UE_username'] .'<span class="caret"></span></span>
			</a>
			<ul class="dropdown-menu dropdown-menu-right" style="top:60px;">
				<li> <a href="?m=revInfo"><i class="otcms-uc-58"></i> 个人信息</a> </li>
				'. $dropMenuList .'
				<li class="divider"></li>
				<li><a href="javascript:void(0);" onclick="UserExit();return false;"><i class="otcms-uc-exit2"></i> 退出登录</a> </li>
			</ul>
		</li>
	</ul>
	';


// 客户服务
$servMenuStr = ''.
	$servMenu .
	'';
if (strlen($servMenuStr) > 5){
	$servMenuStr = '
		<li class="nav-item nav-item-has-subnav '. MenuOpenClass('serv') .'">
			<a href="javascript:void(0)"><i class="fa fa-users fa-fw"></i> 客户服务<i class="arrow"></i></a>
			<ul class="nav nav-subnav">'. $servMenuStr .'</ul>
		</li>
		';
}


// 功能模块
$funcMenuStr = ''.
	AppForm::Show( SubMenu('form', '表单管理') ) .
	AppBuyOrders::Show( SubMenu('buyOrders', '订单记录') ) .
	AppCa::Show( SubMenu('ca', '广告管理') ) .
	AppAuthSoft::Show( SubMenu('authSoft', '授权软件管理') ) .
	AppTaokeOrder::Show( SubMenu('goodsOrder', '淘宝商品认领') ) .
	AppWorkCenter::Show( SubMenu('workCenter', '任务中心') . 
						SubMenu('workUsers', '任务记录') ) .
	AppGift::Show( SubMenu('giftWeb', '积分商城', '', UcBase::PcWapParDir() .'w.php?m=gift') . 
					SubMenu('gift', '积分兑换记录') ) .
	AppGetGift::Show( SubMenu('getGiftWeb', '抽奖活动', '', UcBase::PcWapParDir() .'w.php?m=getGift') . 
					SubMenu('getGift', '抽奖记录')  ) .
	AppOnePage::Show( SubMenu('onePage', '功能单页') ) .
	AppXcxAd::Show( SubMenu('adOrder', '广告奖励卡密') ) .
	AppPayCode::Show( SubMenu('payCodeReward', '收款码领奖励') ) .
	'';
if (strlen($funcMenuStr) > 5){
	$funcMenuStr = '
		<li class="nav-item nav-item-has-subnav '. MenuOpenClass('func') .'">
			<a href="javascript:void(0)"><i class="fa fa-puzzle-piece fa-fw"></i> 功能模块<i class="arrow"></i></a>
			<ul class="nav nav-subnav">'. $funcMenuStr .'</ul>
		</li>
		';
}


// 推广返佣
$recomMenuStr = ''.
	AppRecom::Show( SubMenu('recom', '邀请好友') ) .
	AppGain::Show( SubMenu('gainMoney', '提现记录') . 
					SubMenu('gainItem', '佣金记录') ) .
	'';
if (strlen($recomMenuStr) > 5){
	$recomMenuStr = '
		<li class="nav-item nav-item-has-subnav '. MenuOpenClass('recom') .'">
			<a href="javascript:void(0)"><i class="fa fa-share-alt fa-fw"></i> 推广返佣<i class="arrow"></i></a>
			<ul class="nav nav-subnav">'. $recomMenuStr .'</ul>
		</li>
		';
}


$moneyMenuStr = ''.
	AppXcxAd::Show( SubMenu('adGift', '广告奖励充值') ) .
	AppQuan::Show( SubMenu('quan', '卡密充值') ) .
	$moneyPayMenu .
	AppDiyPay::Show( SubMenu('diyPayRecord', '手动充值记录') ) .
	AppMoneyRecord::Show( SubMenu('moneyRecord', '财务明细') ) .
	AppUserScore::Show( SubMenu('userScore', '积分明细') ) .
	'';
if (strlen($moneyMenuStr) > 5){
	$moneyMenuStr = '
		<li class="nav-item nav-item-has-subnav '. MenuOpenClass('money') .'">
			<a href="javascript:void(0)"><i class="fa fa-dollar fa-fw"></i> 财务相关<i class="arrow"></i></a>
			<ul class="nav nav-subnav">'. $moneyMenuStr .'</ul>
		</li>
		';
}

$shimingMenu = $siteMessageMenu = '';
if ($userSysArr['US_isShiming'] > 0){
	$cardStateStr = '<span style="color:red;font-weight:bold;">进入实名认证</span>';
	switch ($userRow['UE_cardState']){
		case 1:		$cardStateStr = '<span style="color:blue;">已实名认证</span>';	break;
		case 11:	$cardStateStr = '<span style="color:blue;">已微信实名</span>';	break;
		case 21:	$cardStateStr = '<span style="color:blue;">已支付宝实名</span>';	break;
	}
	$shimingMenu = SubMenu('shiming', $cardStateStr, '', '?m=revInfo&revType=shiming');
}
if (AppSiteMessage::Jud()){
	$addiStr = '';
	$newCount = $DB->GetOne('select count(1) from '. OT_dbPref .'siteMessage where SM_userID='. $userRow['UE_ID'] .' and SM_state=0');
	$newCount += $DB->GetOne('select count(1) from '. OT_dbPref .'siteMessage where SM_userID=-1 and SM_userList not like "%['. $userRow['UE_ID'] .']%"');
	if ($newCount > 0){
		$addiStr .= '<i style="font-style:normal; display:inline-block; width:20px; height:20px; line-height:20px; margin:0 0 0 6px; text-align:center; color:#fff; font-size:14px; background:red; border-radius:6px;">'. $newCount .'</i>';
		if (in_array($userSysArr['US_siteMsgIsSound'],array(1,12)) && in_array($mudi,array('siteMessage','siteMessageAdd','siteMessageReply')) == false){
			// 开启提示音
			$addiStr .= '<embed src="inc_img/media/message3.mp3" loop="0" autostart="true" hidden="true"></embed>';
		}
	}
	$siteMessageMenu = SubMenu('siteMessage', '站内信息'. $addiStr);
}

$webMenu = '
	<script language="javascript" type="text/javascript" src="js/usersCenter.js?v='. OT_VERSION .'"></script>

	'. (strpos($userSysArr['US_userMenuList'],'|noHome|') === false ? '<li class="nav-item"> <a href="'. UcBase::PcWapParDir() .'"><i class="otcms-uc-82"></i>网站首页</a> </li>' : '') .'
	<li class="nav-item"> <a href="usersCenter.php"><i class="otcms-uc-user-1"></i>会员中心首页</a> </li>
	<li class="nav-item nav-item-has-subnav '. MenuOpenClass('def') .'">
		<a href="javascript:void(0)"><i class="fa fa-paperclip fa-fw"></i> 菜单导航</a>
		<ul class="nav nav-subnav">
		'. $shimingMenu .'
		'. (strpos($userSysArr['US_userMenuList'],'|noInfoType|') === false ? SubMenu('infoType', '<b>'. $userSysArr['US_infoTypeName'] .'</b>') : '') .'
		'. SubMenu('userAndGroup', $userSysArr['US_userAndGroupName']) .'
		'. $siteMessageMenu .'
		'. UcNews::Show( SubMenu('addNews', '发布文章') . 
						SubMenu('newsManage', '文章管理') ) .'
		'. AppUserView::Show( SubMenu('userView', '文章浏览记录') ) .'
		'. AppUserMark::Show( SubMenu('userMark', '文章收藏记录') ) .'
		'. AppInfoDown::Show( SubMenu('infoDown', '文章下载记录') ) .'
		</ul>
	</li>
	<li class="nav-item nav-item-has-subnav '. MenuOpenClass('pro') .'">
		<a href="javascript:void(0)"><i class="fa fa-puzzle-piece fa-fw"></i> 产品管理<i class="arrow"></i></a>
		<ul class="nav nav-subnav">
			'. AppDomain::Show( SubMenu('domainManage', '域名') ) .'
			'. AppHost::Show( SubMenu('hostManage', '虚拟主机') ) .'
			'. SubMenu('vpsManage', '云服务器') .'
			'. AppDialing::Show( SubMenu('dialingManage', '拨号VPS') ) .'
			'. AppServ::Show( SubMenu('servManage', '服务器租用') ) .'
			'. AppSsl::Show( SubMenu('sslManage', 'SSL证书') ) .'
		</ul>
	</li>
	'. $servMenuStr .'
	'. $funcMenuStr .'
	'. $recomMenuStr .'
	'. $moneyMenuStr .'
	<li class="nav-item nav-item-has-subnav '. MenuOpenClass('self') .'">
		<a href="javascript:void(0)"><i class="fa fa-user fa-fw"></i> 个人信息<i class="arrow"></i></a>
		<ul class="nav nav-subnav">
		'. SubMenu('revInfo', '资料密码修改') .'
		'. AppLogin::Show( SubMenu('loginApi', '快捷登录绑定') ) .'
		'. AppSiteApi::Show( SubMenu('api', 'API授权码') ) .'
		'. (strpos($userSysArr['US_userMenuList'],'|noLog|') === false ? SubMenu('log', '会员日志') : '') .'
		<li><a href="#" onclick="UserExit();return false;">退出</a></li>
		</ul>
	</li>
	';

$styleWidthStr = '';
if ($userSysArr['US_newSysWidth'] > 0){ $styleWidthStr = ' style="max-width:'. $userSysArr['US_newSysWidth'] .'px;margin:0 auto;"'; }

$tpl->Add('siteVer',		OT_VERSION);
$tpl->Add('webTypeName',	$tpl->webTypeName);
$tpl->Add('dbPathPart',		$dbPathPart);
$tpl->Add('webPathPart',	$webPathPart);
$tpl->Add('jsPathPart',		$jsPathPart);
$tpl->Add('isMobile',		UcBase::JudMobile() ? 1 : 0);
$tpl->Add('beforeURL',		UcBase::BeforeURL());

$tpl->Add('webTitle',		$tpl->webTitle);
$tpl->Add('webTop',			$webTop);
$tpl->Add('webLogo',		'<a href="usersCenter.php"><img src="static/images/uc_logo.png" /></a>');
$tpl->Add('webMenu',		$webMenu);
$tpl->Add('webContent',		$webContent);
$tpl->Add('styleWidthStr',	$styleWidthStr);

$tpl->Show('ucMain.html');


function MainArea($content, $title, $faName='snowflake-o'){
	return '
	<div class="row">
		<div class="col-lg-12">
			<div class="card">
				<div class="card-header"><h4>'. $title .'</h4></div>
		  		<div class="card-body">
		  			'. $content .'
		  		</div>
            </div>
      	</div>
    </div>';
}

function SubMenu($type, $theme, $style='', $url=''){
	global $menu2;
	if ($type == $menu2){
		$theme = '<span style="color:#0099cc;">▶</span> '. $theme .' ';
	}
	if (strlen($url) == 0){ $url = 'usersCenter.php?m='. $type; }
	$retStr = '<li><a href="'. $url .'" id="'. $type .'" style="'. $style .'">'. $theme .'</a></li>';

	return $retStr;
}

function MenuOpenClass($type){
	global $menu1;

	if ($menu1 == $type){
		return 'open';
	}
}

?>