<?php
require(dirname(__FILE__) .'/check.php');
$skin->CheckIframe();

/* **** 版权所有 ****

 程序开发：网钛科技
 网钛CMS官网：http://otcms.com
 网钛IDC官网：http://idccms.com
 ＱＱ：877873666
 微信：QQ877873666
 邮箱：877873666@qq.com

 **** 版权所有 **** */


$skin->WebTop('',' bgcolor="#f4f8fc" onload="" onunload=\'parent.$id("RightFrmBg").style.backgroundColor="#ffffff"\'');

echo('
<script language="javascript" type="text/javascript" src="js/left_menuNote.js?v='. OT_VERSION .'"></script>
');


if (is_numeric($mudi)){ $mudi=''; }
if ($mudi==''){ $mudi = $sysAdminArr['SA_leftMenuNote']; }

switch ($mudi){
	case 'revSelf':
		RevSelfWeb();
		break;

	case 'user':
		UserWeb();
		break;
	
	default:
		DefautWeb();
		break;
}

$DB->Close();

echo('
</td></tr></table>
');


// 修改密码
function RevSelfWeb(){
	echo('
	<table width="90%" align="center" cellpadding="0" cellspacing="0" summary=""><tr><td style="padding-top:20px; line-height:2; font-size:13px;">
		<table border="0" align="center" cellpadding="0" cellspacing="1" summary="">
		<tr>
			<td style="height:35px;" colspan="2" align="center" class="font1_1"><b>修改密码</b></td>
		</tr>
		<tr>
			<td style="height:35px;" colspan="2" align="left" class="font1_1">建议定期更改用户名及密码，以确保后台的安全性。</td>
		</tr>
		</table>
	</td></tr></table>
	');
}


// 用户管理
function UserWeb(){
	if (AppBase::Jud()){
		$payStr = '';
	}else{
		$payStr = '<div style="padding-bottom:8px;"><a href="appShop.php?dataMode=app" style="color:red;font-weight:bold;">您尚未购买【'. SysDiff::PluginName('base') .'】插件，没有[用户组管理]和[用户组权限设置]菜单（点击购买）</a></div>';
	}
	echo('
	<table width="90%" align="center" cellpadding="0" cellspacing="0" summary=""><tr><td style="padding-top:20px; line-height:2; font-size:13px;">
		<table border="0" align="center" cellpadding="0" cellspacing="1" summary="">
		<tr>
			<td style="height:35px;" colspan="2" align="center" class="font1_1"><b>用户管理</b></td>
		</tr>
		<tr>
			<td style="height:35px;" colspan="2" align="left" class="font1_1">
				'. $payStr .'
				首先建立【用户组】（可以建多个用户组），<br />然后通过【权限设置】赋予各个【用户组】后台菜单权限，<br />最后创建【用户】，并指定用户所属的【用户组】，那么该用户就拥有了所属【用户组】的权限。
			</td>
		</tr>
		</table>
	</td></tr></table>
	');
}


// 默认页
function DefautWeb(){
	global $DB,$skin,$sysAdminArr,$systemArr,$user_ID,$pcTplArr,$wapTplArr;

	$adminURL	= GetUrl::CurrDir();
	$beforeURL	= GetUrl::CurrDir(1);
	$adminDirName = substr($adminURL,strlen($beforeURL),-1);

	$todayDate	= TimeDate::Get('date');

	$connLanJud = 1;
	if ($sysAdminArr['SA_isLan'] == 1){
		$connLanJud = 0;
	}elseif ($sysAdminArr['SA_isConnInternet'] == 0){
		$connLanJud = 0;
	}
	echo('
	<input type="hidden" id="adminDir" name="adminDir" value="'. $adminDirName .'" />
	<input type="hidden" id="isConnInternet" name="isConnInternet" value="'. $connLanJud .'" />

	<div style="height:4px;overflow:hidden;"></div>
	');

	$funcNum = 0;
	if ($user_ID == 1){
		$alertStr = AlertStr();
		if (strlen($alertStr) > 0){
			$funcNum ++;
			echo('
			<div class="font1_2 tabWeb1" style="margin:0 5px 4px 5px;padding:5px;color:red; line-height:1.5;">
				<div id="alertScreenStr" style="color:blue;display:none;">★ 当前电脑屏幕宽度<span id="screenWbox" style="color:#000;font-weight:bold;">??</span>px，界面宽度<span id="saWbox" style="color:#000;font-weight:bold;">??</span>px，建议选择不低于<span style="color:#000;font-weight:bold;">1280</span>px界面宽度，已获得更好的视觉效果。（点击<span onclick=\'parent.HrefTo("管理员区","后台参数配置","sysAdmin.php?mudi=manage","999993")\' style="cursor:pointer;font-weight:bold;">【管理员专区】-[后台参数配置] 后台界面宽度</span>）</div>
				'. $alertStr .'
			</div>
			<script language="javascript" type="text/javascript">if (window.screen.width>=1280 && '. $sysAdminArr['SA_skinWidth'] .'<1259 && '. $sysAdminArr['SA_skinWidth'] .'!=0){$id("alertScreenStr").style.display="";$id("screenWbox").innerHTML=window.screen.width;$id("saWbox").innerHTML="'. ($sysAdminArr['SA_skinWidth']+21) .'";}</script>
			');
		}
	}

	if ( Adm::FuncJud('siteStati') && AppBase::Jud()){
		$funcNum ++;
		AppBase::LeftMenuNoteBox();
	}

	if ( Adm::FuncJud('xcxStati') && AppXcx::Jud()){
		$funcNum ++;
		AppXcxStati::LeftMenuNoteBox();
	}

	AppRobot::AdmPanel('parent',$sysAdminArr['SA_funcCloseArea']);

	if ( Adm::FuncJud('memberLog') ){
		$funcNum ++;
		echo('<div style="height:5px;overflow:hidden;"></div>');

		$skin->TableTop2('share_list.gif','','最近后台操作记录');
		$skin->TableItemTitle('5%,55%,25%,15%','序号,操作内容,IP地址,操作时间');
		echo('<tbody class="tabBody padd5td">');
			$logexe = $DB->query('select * from '. OT_dbPref .'memberLog where ML_userID='. $user_ID .' order by ML_ID DESC limit 6');
			$number = 1;
			while ($row = $logexe->fetch()){
				if ($number % 2 == 1){ $bgcolor='class="tabColorTr"'; }else{ $bgcolor=''; }
				if (strlen($row['ML_ipCN']) > 0 && strpos($row['ML_ipCN'],'*') === false){
					$ipCN = '&ensp;<span style="color:#c0c0c0;">['. $row['ML_ipCN'] .']</span>';
				}else{
					$ipCN = '';
				}

				echo('
				<tr '. $bgcolor .'>
					<td align="center">'. $number .'</td>
					<td align="left">'. $row['ML_note'] .'</td>
					<td align="center">'. $row['ML_ip'] . $ipCN .'</td>
					<td align="center">'. $row['ML_time'] .'</td>
				</tr>
				');
				$number ++;
			}
			unset($logexe);
		echo('
		</tbody>
		</table>
		');
	}

	if ($user_ID == 1){
		$funcNum ++;
		echo('<div style="height:5px;overflow:hidden;"></div>');

		$skin->TableTop2('share_list.gif','','网站快捷处理信息');
			$appUpdateCount = $DB->GetOne('select count(PS_ID) from '. OT_dbPref .'paySoft where PS_state=1 and PS_currTime<PS_newTime');
			$appNoUseCount = $DB->GetOne('select count(PS_ID) from '. OT_dbPref .'paySoft where PS_state=0 and PS_currTime<PS_newTime');
			$appCount = $DB->GetOne('select count(PS_ID) from '. OT_dbPref .'paySoft');
			echo('
			<tr>
				<td width="50%" style="padding:5px;line-height:2;">
					<span style="cursor:pointer" onclick="parent.HrefToShop(\'\');">插件 <span style="color:blue;font-weight:bold;font-size:16px;">'. $appCount .'</span> 个，有更新 <span style="color:red;font-weight:bold;font-size:16px;">'. $appUpdateCount .'</span> 个'. ($appUpdateCount>0?'<img src="images/newVer2.gif" />':'') .''. ($appNoUseCount>0?'，禁用更新 <span style="font-weight:bold;font-size:16px;">'. $appNoUseCount .'</span> 个':'') .'</span>
					<span title="点击跳转到[插件平台]-[已购买插件]界面">&ensp;<input type="button" style="color:blue;" value="更新插件" onclick=\'AjaxGetDeal("appShop_deal.php?mudi=getInfo&mode=back&backURL="+ encodeURIComponent(document.location.href));\' /></span>
				</td>
				<td width="50%" style="padding:5px;line-height:2;">
					<span title="网站缓存数量：'. File::Count(OT_ROOT .'cache/html/',array('html','png')) .'">网站缓存：<span style="color:red;font-weight:bold;">'. File::SizeUnit(File::DirSize(OT_ROOT .'cache/html/',array('html','png'))) .'</span></span>&ensp;<input type="button" value="清缓存" onclick="ClearSiteCache();" title="如通过该按钮清理不干净，可手动到 cache/html/ 目录下删除html和png缓存文件" />
					');
					if (AppWap::Jud()){
						echo('，<span title="手机版缓存数量：'. File::Count(OT_ROOT .'wap/cache/','html') .'">手机版缓存：<span style="color:red;font-weight:bold;">'. File::SizeUnit(File::DirSize(OT_ROOT .'wap/cache/',array('html','png'))) .'</span></span>&ensp;<input type="button" value="清缓存" onclick="ClearWapHtml();" title="如通过该按钮清理不干净，可手动到 wap/cache/ 目录下删除html缓存文件" /></div>');
					}
				echo('
				</td>
			</tr>
			<tr>
				<td style="padding:5px;line-height:2;">
					<a href="users.php?mudi=online&dataTypeCN='. urlencode('在线会员') .'" class="font1_2">
						在线会员：
						15分钟内 <span style="color:blue;font-weight:bold;font-size:16px;">'. $DB->GetOne('select count(UO_ID) from '. OT_dbPref .'userOnline where UO_time>='. $DB->ForTime(TimeDate::Add('min',-15))) .'</span> 人
						，30分钟内 <span style="color:blue;font-weight:bold;font-size:16px;">'. $DB->GetOne('select count(UO_ID) from '. OT_dbPref .'userOnline where UO_time>='. $DB->ForTime(TimeDate::Add('min',-30))) .'</span> 人
						，1小时内 <span style="color:blue;font-weight:bold;font-size:16px;">'. $DB->GetOne('select count(UO_ID) from '. OT_dbPref .'userOnline where UO_time>='. $DB->ForTime(TimeDate::Add('min',-60))) .'</span> 人
					</a>
				</td>
				<td style="padding:5px;line-height:2;">
					<!-- 内容页：<input type="button" value="相关文章信息更新" onclick=\'AjaxGetDeal("infoSys_deal.php?mudi=clear&mudi2=markNewsId");\' title="建议一段时间更新次，没必要太频繁更新" />
					<input type="button" value="上下篇信息更新" onclick=\'AjaxGetDeal("infoSys_deal.php?mudi=clear&mudi2=prevNextId");\' title="建议一段时间更新次，没必要太频繁更新" /> -->
				</td>
			</tr>
		</table>

		<div style="height:5px;overflow:hidden;"></div>
		');

		$updateUrlGetStr = '&OT_Database='. OT_Database .'&OT_UPDATETIME='. OT_UPDATETIME .'&OT_VERSION='. OT_VERSION .'&dataVer='. OT_UPDATEVER .'&OT_URL='. urlencode($beforeURL) .'&username='. $sysAdminArr['SA_username'] .'&softID='. $sysAdminArr['SA_softID'] .'&softCode='. $sysAdminArr['SA_softCode'] .'&domainID='. $sysAdminArr['SA_domainID'] .'&domainCode='. $sysAdminArr['SA_domainCode'] .'';

		$skin->TableTop2('share_list.gif','','程序信息');
			$updateImgStr = $dbVerStr = '';
			if (OT_UPDATETIME<$sysAdminArr['SA_softVerTime']){ $updateImgStr = '<img src="images/newVer.gif" />'; }
			if (strtotime($sysAdminArr['SA_softLastTime'])){ $softLastTime = $sysAdminArr['SA_softLastTime']; }else{ $softLastTime = '2012-8-8'; }
			if (strtotime($sysAdminArr['SA_softVerLastTime'])){ $softVerLastTime = $sysAdminArr['SA_softVerLastTime']; }else{ $softVerLastTime = '2012-8-8'; }
			if ($systemArr['SYS_dbTimeStr'] != OT_DBTIME){ $dbVerStr='<div style="margin-top:6px;"><a href="update_'. OT_DBTIME .'.php" style="font-weight:bold;color:red;" target="_blank" title="点击此处看看是否存在该脚本文件，并运行它。">（数据库版本：[当前]'. $systemArr['SYS_dbTimeStr'] .'≠[程序]'. OT_DBTIME .'）<span style="color:blue;">[点击修复]</span></a></div>'; }

			$softDbName = OT_Database;
			switch (OT_Database){
				case 'sqlite':	$softDbName = 'SQLite';	break;
				case 'mysql':	$softDbName = 'MySQL';	break;
			}
			echo('
			<tr>
				<td width="50%" align="left" class="font1_1" style="padding:8px;">
					<div style="float:right;"><a href="http://idccms.com/softUpdate/9169.html" class="font3_2" target="_blank"><u>问题解决方案总结</u></a></div>
					程序名称：'. OT_SOFTNAME .' '. $softDbName .'版
					'. (OT_Database=='sqlite' ? '<span style="color:blue;">【开发测试专用版】</span>' : '') .'
					'. (AreaApp::Jud( SysDiff::PluginId('base') ) ? '' : '&ensp;&ensp;<div style="padding-top:5px;"><a href="appShop.php?dataMode=app" class="font2_2" style="color:red;">未购买【'. SysDiff::PluginName('base') .'】插件，前台底部会有版权信息</b></a></div>') .'
				</td>
				<td width="50%" align="left" class="font1_1" style="padding:8px;">程序开发：<a href="http://idccms.com/" target="_blank" class="font1_2" title="福州网钛软件科技有限公司">网钛科技</a> &ensp;&ensp;官网：<a href="http://idccms.com/" target="_blank" class="font1_2">http://idccms.com/</a> &ensp;&ensp;<a href="http://idccms.com/message.php" class="font3_2" target="_blank"><u>反馈问题或建议</u></a></td>
			</tr>
			<tr>
				<td align="left" class="font1_1" style="padding:8px;">
					<span title="数据库版本：'. $systemArr['SYS_dbTimeStr'] .'">程序版本：V'. OT_VERSION .''. OT_VERSION2 .' <span class="font3_2">build <b>'. OT_UPDATETIME .'</b></span></span>
					&ensp;&ensp;<a href="http://d.otcms.com/idccms/idccms_V'. OT_VERSION .'.zip" target="_blank" style="color:#ccc;">[下载该版本]</a>
					'. $dbVerStr .'
				</td>
				<td align="left" class="font1_1" style="padding:8px;">
					<div style="position:relative;"><div style="position:absolute;left:120px; top:-25px;" id="updateImgStr">'. $updateImgStr .'</div></div>
					最新版本：<span id="softUser_verTimeStr">'. $sysAdminArr['SA_softVerTimeStr'] .'</span>
					&ensp;<a id="updateUrlNoteHref" href="http://idccms.com/softUpdate/" style="color:red;" target="_blank">[更新记录]</a>
					&ensp;<input type="button" id="checkSoftVerBtn" onclick=\'CheckSoftVer("true");\' value="检测版本" title="最后更新时间：'. $sysAdminArr['SA_softVerLastTime'] .'" />
					&ensp;&ensp;&ensp;<span class="font3_2 fontU fontB pointer" onclick="CheckUpdateBox()">在线升级</span>
				</td>
			</tr>
		</table>
		<input type="hidden" id="OTCMS_userUrlSoftVer" name="OTCMS_userUrlSoftVer" value="readDeal2.php?mudi=getSoftUser&mode=softVer'. $updateUrlGetStr .'" />
		<input type="hidden" id="isAnnounShow" name="isAnnounShow" value="'. $sysAdminArr['SA_isAnnounShow'] .'" />
		<input type="hidden" id="softVerDiffDay" name="softVerDiffDay" value="'. TimeDate::Diff('d',$todayDate,TimeDate::Add('d',$sysAdminArr['SA_softVerUpdateDay'],$softVerLastTime)) .'" />

		<div style="height:5px;overflow:hidden;"></div>

		<div id="updateBox" style="display:none;">
		<form id="updateForm" name="updateForm" method="post" action="updateV2.php?mudi=checkRight">
		<input type="hidden" id="updateEventStr" name="updateEventStr" value="" />
		<input type="hidden" id="updateFileNum" name="updateFileNum" value="" />
		<input type="hidden" id="updateFileSize" name="updateFileSize" value="" />
		<input type="hidden" id="updateVerInfo" name="updateVerInfo" value="" />
		<input type="hidden" id="updateVerTheme" name="updateVerTheme" value="" />

		<input type="hidden" id="runVerIdList" name="runVerIdList" value="" />
		<input type="hidden" id="checkFileListStr" name="checkFileListStr" value="" />
		<input type="hidden" id="updateVerListStr" name="updateVerListStr" value="" />
		<input type="hidden" id="updateFileListStr" name="updateFileListStr" value="" />
		<input type="hidden" id="updateVerPoint" name="updateVerPoint" value="" />
		<input type="hidden" id="updateFilePoint" name="updateFilePoint" value="" />

		<input type="hidden" id="updateErrUrl" name="updateErrUrl" value="about:blank" />
		<input type="hidden" id="updateConfigWindow" name="updateConfigWindow" value="" />
		</form>

		<div id="updateBox_new">
		');

		$skin->TableTop2('share_reply.gif','','在线升级');
			echo('
			<tr>
				<td width="44%" align="left" valign="top" class="font1_1" style="padding:8px;line-height:2;">
					<div>1.尝试连接网钛科技升级系统 &ensp;<span id="updateV2Step1"></span></div>
					<div>2.检测所需的目录文件权限 &ensp;<span id="updateV2Step2"></span></div>
					<div>3.获取升级包更新文件 &ensp;<span id="updateV2Step3"></span></div>
					<div>4.运行升级过程 &ensp;<span id="updateV2Step4"></span></div>
					<div>5.升级完毕 &ensp;<span id="updateV2Step5"></span></div>
					<div style="color:#cccccc;cursor:pointer;" onclick="window.frames[\'updateV2Box\'].UpdateWinHeight(0)">[调整右侧升级框高度]</div>
				</td>
				<td width="56%" align="left" valign="top" style="padding:4px 8px 0 8px;">
					<input type="hidden" id="updateUrlGetStr" name="updateUrlGetStr" value="'. $updateUrlGetStr .'" />
					<span id="updateV2NoteStr"></span>
					<iframe id="updateV2Box" name="updateV2Box" width="98%" hei'.'ght="300" style="width:98%;hei'.'ght:300px;" frameborder="0" scrolling="no" allowtransparency="true" src="updateV2.php"></iframe>
				</td>
			</tr>
		</table>

		<div style="height:5px;overflow:hidden;"></div>
		</div>
		</div>
		');

		if ( Adm::FuncJud('OTannoun') ){
			$funcNum ++;
			$skin->TableTop2('share_list.gif','','官方最新公告');
				echo('
				<tr>
					<td align="left" style="padding:3px;">
						<iframe id="onetiAnnoun" name="onetiAnnoun" frameborder="0" allowTransparency="true" scrolling="no" style="width:100%;height:205px;" src=""></iframe>
					</td>
				</tr>
			</table>
			<input type="hidden" id="OTCMS_softUpdate" name="OTCMS_softUpdate" value="http://s.otcms.net/idcCMS/softInfo.php?OT_Database='. OT_Database .'&updateTime='. OT_UPDATETIME .'&version='. OT_VERSION .'&softID='. $sysAdminArr['SA_softID'] .'&softCode='. $sysAdminArr['SA_softCode'] .'&domainID='. $sysAdminArr['SA_domainID'] .'&domainCode='. $sysAdminArr['SA_domainCode'] .'" /><!-- &OT_URL='. urlencode($beforeURL) .' -->

			<div style="height:5px;overflow:hidden;"></div>
			');
		}

		if (OT::GetStr('mudi2') != 'more'){
			echo('<div style="margin:0 auto; padding:15px 0 15px 0;text-align:center;"><a href="?mudi=&mudi2=more" class="font2_1" style="color:red;font-weight:bold;">&gt;&gt;&gt;【点击查看更多服务器信息】&lt;&lt;&lt;</a></div>');
		}else{

			if ($connLanJud == 0){
				$OutUrlState	= '<span style="color:red"><b> 内网模式不检测</b></span>';
				$OtUrlState		= '<span style="color:red"><b> 内网模式不检测</b></span>';
			}else{
				$OutUrlState	= '<span style="color:#000;"><b> ??</b></span>';
				$OtUrlState		= '<span style="color:#000;"><b> ??</b></span>';
				$Ot2UrlState	= '';
				$Ot3UrlState	= '';
		//		$Ot2UrlState	= '<span style="color:green"><b> √</b></span>';
		//		$Ot3UrlState	= '<span style="color:green"><b> √</b></span>';
				$retArr = ReqUrl::UseAuto($sysAdminArr['SA_getUrlMode'], 'GET', 'http://www.baidu.com', 'GB2312');
					if ($retArr['res']){
						$OutUrlState	= '<span style="color:green"><b> √</b></span>';
					}else{
						$OutUrlState	= '<span style="color:red;"><b> ×</b></span>';
					}
					//echo('<!-- http://www.baidu.com '. $retArr['note'] .' -->');
				$retArr = ReqUrl::UseAuto($sysAdminArr['SA_getUrlMode'], 'GET', 'http://otcms2.oneti.cn/info.php');
					if ($retArr['res']){
						$OtUrlState	= '<span style="color:green"><b> √</b></span>';
					}else{
						$OtUrlState	= '<span style="color:red;"><b> ×</b></span>';
					}
		/*		$retArr = ReqUrl::UseAuto($sysAdminArr['SA_getUrlMode'], 'GET', 'http://otcms2.otcms.cn/info.php');
					if (! $retArr['res']){
						$Ot2UrlState	= '<span style="color:red;"><b> ×</b></span>';
					}
				$retArr = ReqUrl::UseAuto($sysAdminArr['SA_getUrlMode'],'GET','http://otcms2.otcms.net/info.php');
					if (! $retArr['res']){
						$Ot3UrlState	= '<span style="color:red;"><b> ×</b></span>';
					}*/
			}

			try{
				$gdArr = gd_info();
				$gd_res = $gdArr['GD Version'] .'';
			}
			catch (Exception $e){
				$gd_res = '不支持';
			}

/*
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">MYSQL（暂时没用到）：'. ExtCN(function_exists('mysql')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">sqlite（暂时没用到）：'. ExtCN(function_exists('sqlite')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">ACCESS（暂时没用到）：'. ExtCN(function_exists('com_dotnet')) .'</td>
				</tr>
*/

			// 根据操作系统取得CPU相关信息
			switch(PHP_OS) {
				case "Linux":
					$judSys = (($sys_info = sys_linux()) !== false) ? true : false;
					break;
				case "FreeBSD":
					$judSys = (($sys_info = sys_freebsd()) !== false) ? true : false;
					break;
				case "WINNT":
					$judSys = (($sys_info = sys_windows()) !== false) ? true : false;
					break;
				default:
					break;
			}

			$skin->TableTop2('share_list.gif','','服务器信息');
				$mysqlAddi = '';
				if (extension_loaded('pdo_mysql') && OT_Database=='mysql'){
					$ver = $DB->GetOne('select VERSION()');
					$mysqlAddi .= '&ensp;&ensp;v'. $ver . (version_compare($ver, '5.5.3') < 0 ? '<span style="color:red;">（建议版本≥5.5.3）</span>' : '');

					$rs = $DB->GetRow('show variables like "lower_case_table_names"');	// 大小写敏感
					if (isset($rs['Value'])){
						$tabNameStr = '';
						if ($rs['Value'] == 0){
							$tabNameStr = '区分大小写('. $rs['Value'] .')';
						}elseif ($rs['Value'] == 1){
							$tabNameStr = '不区分大小写，自动小写化('. $rs['Value'] .')';
						}elseif ($rs['Value'] == 2){
							$tabNameStr = '不区分大小写，保留大小写('. $rs['Value'] .')';
						}
						$mysqlAddi .= '&ensp;&ensp;&ensp;<span title="lower_case_table_names='. $rs['Value'] .'；0 Linux默认值，大小写敏感；1 Windows默认值，大小写不敏感，自动小写化；2 MacOS默认值，大小写不敏感，保持大小写">表名'. $tabNameStr .'</span>';
					}
					$rs = $DB->GetRow('show variables like "max_allowed_packet"');	// set global max_allowed_packet = 99999999
					if (isset($rs['Value'])){
						$mysqlAddi .= '&ensp;&ensp;&ensp;<span title="max_allowed_packet='. $rs['Value'] .'">SQL数据包最大：'. File::SizeUnit($rs['Value']) .'</span>';
					}
					/*
					*/
				}
				$retArr = ReqUrl::UseAuto($sysAdminArr['SA_getUrlMode'],'GET',GetUrl::CurrDir(1) .'readSoft.html','UTF-8');
				if ($retArr['res'] && $retArr['note'] == '[该访问地址存在]'){
					$rewriteRes = '<span style="color:green;">支持</span>';
				}else{
					$rewriteRes = '<span style="color:red;">不支持</span>';
				}

				echo('
				<tr>
					<td width="34%" align="left" class="font1_1" style="padding:8px;">服务器类型：'. PHP_OS .'（端口：'. $_SERVER['SERVER_PORT'] .'）</td>
					<td width="33%" align="left" class="font1_1" style="padding:8px;">服务器端信息：'. $_SERVER['SERVER_SOFTWARE'] .'</td>
					<td width="33%" align="left" class="font1_1" style="padding:8px;">
						当前根目录[服务器设置]：'. str_replace('\\\\','\\',$_SERVER['DOCUMENT_ROOT']) .'
						<div>[实际路径]：'. dirname(dirname(__FILE__)) .'</div>
					</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;" title="可通过php.ini里memory_limit参数设置">脚本运行占用最大内存：'. (get_cfg_var('memory_limit') ? get_cfg_var('memory_limit') : '无') .'</td><!-- ini_get("memory_limit") get_cfg_var():取的值是配置文件中的值 ini_get():则取的当前值 -->
					<td align="left" class="font1_1" style="padding:8px;" title="可通过php.ini里upload_max_filesize参数设置">最大上传限制：'. (get_cfg_var('upload_max_filesize') ? get_cfg_var('upload_max_filesize') : '不允许上传附件') .'</td>
					<td align="left" class="font1_1" style="padding:8px;" title="可通过php.ini里max_execution_time参数设置">最大执行时间：'. get_cfg_var('max_execution_time') .'秒' .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">PHP版本：'. PHP_VERSION .'&ensp;&ensp;'. (PHP_VERSION < 5.3 ? '<span style="color:red;">（建议版本≥5.3）</span>' : '') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">GD 库：'. $gd_res .'</td>
					<td align="left" class="font1_1" style="padding:8px;">rewrite 伪静态：'. $rewriteRes .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">pdo:mysql：'. ExtCN(extension_loaded('pdo_mysql')) . $mysqlAddi .'</td>
					<td align="left" class="font1_1" style="padding:8px;">pdo:sqlite：'. ExtCN(extension_loaded('pdo_sqlite')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">openssl 扩展（https协议采集）：'. ExtCN(extension_loaded('openssl')) .'</td>
					<!-- <td align="left" class="font1_1" style="padding:8px;">pdo:ACCESS（预留项，目前没用到）：'. ExtCN(extension_loaded('PDO_ODBC')) .'</td> -->
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">Snoopy插件：'. ExtCN(function_exists('stream_socket_client')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">curl模式：'. ExtCN(extension_loaded('curl')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">fsockopen模式：'. ExtCN(function_exists('fsockopen')) .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">zip 扩展（ZIP压缩解压）：'. ExtCN(extension_loaded('zip')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">FTP 扩展（FTP云存储）：'. ExtCN(extension_loaded('ftp')) .'</td>
					<td align="left" class="font1_1" style="padding:8px;">网站目录总空间：'. round(@disk_total_space('.') / (1024*1024*1024), 2) .' GB</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">session信息：'. (isset($_SESSION[OT_SiteID .'memberID']) ? '存在' : '不存在') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">cookies信息：'. (isset($_COOKIE[OT_SiteID .'memberInfo']) ? '存在' : '不存在') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">网站目录可用空间：'. File::SizeUnit(@disk_free_space('/')) .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;" colspan="3">当前使用的浏览器：'. $_SERVER['HTTP_USER_AGENT'] .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px; word-break:break-all;" colspan="3">禁用函数：'. ini_get('disable_functions') .'</td>
				</tr>
				');
				if ($judSys){
					// 整理实时数据
					$realtime = array(
						'time' => date('Y年n月j日 H:i:s'),
						'uptime' => $sys_info['uptime'],
						'disk_free' => round(@disk_free_space('.') / (1024*1024*1024), 2).' G',
						'mem_used' => round($sys_info['mem_used']/1024, 2).' G',
						'mem_free' => round($sys_info['mem_free']/1024, 2).' G',
						'mem_cached' => round($sys_info['mem_cached']/1024, 2).' G',
						'mem_buffers' => round($sys_info['mem_buffers']/1024, 2).' G',
						'mem_real_used' => round($sys_info['mem_real_used']/1024, 2).' G', //真实内存使用
						'mem_real_free' => round($sys_info['mem_real_free']/1024, 2).' G', //真实内存空闲
						'mem_real_percent' => (int)$sys_info['mem_real_percent'].'%', //真实内存使用比率
						'mem_percent' => (int)$sys_info['mem_percent'].'%', //内存总使用率
						'mem_cached_percent' => (int)$sys_info['mem_cached_percent'].'%', //cache内存使用率
						'swap_percent' => (int)$sys_info['swap_percent'].'%',
						'load_avg' => $sys_info['load_avg'] //系统平均负载
					);
					echo('
					<tr>
						<td align="left" class="font1_1" style="padding:8px;" colspan="2">CPU型号：['. $sys_info['cpu']['num_text'] .'] '. $sys_info['cpu']['model'] .'</td>
						<td align="left" class="font1_1" style="padding:8px;">系统平均负载：<span class="f-pink" id="loadAvg">'. $realtime['load_avg'] .'</span></td>
					</tr>
					<tr>
						<td align="left" class="font1_1" style="padding:8px;" colspan="2">
							<div style="float:left;padding:2px 8px 0 0;">内存使用状况：<div style="color:#c9c9c9;margin-top:3px;">(数据仅供参考)</div></div>
							<div style="float:left;">
							');

							$tmp = array('mem_total', 'mem_used', 'mem_free', 'mem_percent','mem_cached','mem_real_percent', 'swap_total', 'swap_used', 'swap_free', 'swap_percent');
							foreach ($tmp as $v) {
								$sys_info[$v] = empty($sys_info[$v]) ? 0 : $sys_info[$v];
							}
							echo('
							物理内存：
							共 <span style="color:#800080;">'. round($sys_info['mem_total']/1024, 2) .' G</span> ，
							已使用 <span style="color:red;" id="memUsed">'. $realtime['mem_used'] .'</span> ，
							空闲 <span style="color:green;" id="memFree">'. $realtime['mem_free'] .'</span> ，
							使用率 <span style="color:blue;" id="memPercent">'. $realtime['mem_percent'] .'</span>
							<div class="bar"><div id="barMemPercent" class="barli_green" style="width:'. $realtime['mem_percent'] .'">&ensp;</div></div>
							');

							// 判断如果cache为0，不显示
							if($sys_info['mem_cached'] > 0) {
								echo('
								Cache化内存：
								已使用 <span style="color:red;" id="memCached">'. $realtime['mem_cached'] .'</span> ，
								使用率 <span style="color:blue;" id="memCachedPercent">'. $realtime['mem_cached_percent'] .'</span>  | 
								Buffers缓冲为 <span id="memBuffers">'. $realtime['mem_buffers'] .'</span>
								<div class="bar"><div id="barMemCachedPercent" class="barli_blue" style="width:'. $realtime['mem_cached_percent'] .'">&ensp;</div></div>
								真实内存：
								已使用 <span style="color:red;" id="memRealUsed">'. $realtime['mem_real_used'] .'</span> ，
								空闲 <span style="color:green;" id="memRealFree">'. $realtime['mem_real_free'] .'</span> ，
								使用率 <span style="color:blue;" id="memRealPercent">'. $realtime['mem_real_percent'] .'</span>
								<div class="bar_dotted"><div id="barMemRealPercent" class="barli_grey" style="width:'. $realtime['mem_real_percent'] .'">&ensp;</div></div>
								');
							}
							//判断如果SWAP区为0，不显示
							if($sys_info['swap_total'] > 0) {
								echo('
								SWAP区：
								共 <span style="color:#800080;">'. round($sys_info['swap_total']/1024, 2) .' G</span> ，
								已使用 <span style="color:red;">'. round($sys_info['swap_used']/1024, 2) .' G</span> ，
								空闲 <span style="color:green;">'. round($sys_info['swap_free']/1024, 2) .' G</span> ，
								使用率 <span style="color:blue;">'. $realtime['swap_percent'] .'</span>
								<div class="bar"><div id="barSwapPercent" class="barli_red" style="width:'. $realtime['swap_percent'] .'">&ensp;</div></div>
								');
							}
							echo('
							</div>
						</td>
						<td align="left" class="font1_1" style="padding:8px;">服务器已运行时间：'. $realtime['uptime'] .'</td>
					</tr>
					');
				}
			echo('
			</table>

			<div style="height:5px;overflow:hidden;"></div>
			');

			$skin->TableTop2('share_list.gif','','目录、文件权限检查');
				echo('
				<tr>
					<td width="34%" align="left" class="font1_1" style="padding:8px;">news/：'. File::IsWrite(OT_ROOT .'news/', 'cn') .'</td>
					<td width="33%" align="left" class="font1_1" style="padding:8px;">cache/（缓存文件）：'. File::IsWrite(OT_ROOT .'cache/', 'cn') .'</td>
					<td width="33%" align="left" class="font1_1" style="padding:8px;">cache/php/（缓存文件）：'. File::IsWrite(OT_ROOT .'cache/php/', 'cn') .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">cache/js/（缓存文件）：'. File::IsWrite(OT_ROOT .'cache/js/', 'cn') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">cache/html/（缓存文件）：'. File::IsWrite(OT_ROOT .'cache/html/', 'cn') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">cache/web/（网站缓存）：'. File::IsWrite(OT_ROOT .'cache/web/', 'cn') .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">upFiles/infoImg/：'. File::IsWrite(OT_ROOT .'upFiles/infoImg/', 'cn') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">upFiles/images/：'. File::IsWrite(OT_ROOT .'upFiles/images/', 'cn') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">upFiles/users/：'. File::IsWrite(OT_ROOT .'upFiles/users/', 'cn') .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">upFiles/download/（附件下载）：'. File::IsWrite(OT_ROOT .'upFiles/download/', 'cn') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">后台/upFile/updateVer/（升级补丁）：'. File::IsWrite(OT_adminROOT .'upFile/updateVer/', 'cn') .'</td>
					<td align="left" class="font1_1" style="padding:8px;">判断访问外网（采集功能） '. $OutUrlState .'</td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;">判断访问官网（获取授权信息和页面、在线升级） '. $OtUrlState .'</td>
					<td align="left" class="font1_1" style="padding:8px;">判断访问官网路线2 '. $Ot2UrlState .'&ensp;&ensp;<input type="button" value="测试连接" onclick=\'CheckCollUrl("otcms2")\' /></td>
					<td align="left" class="font1_1" style="padding:8px;">判断访问官网路线3 '. $Ot3UrlState .'&ensp;&ensp;<input type="button" value="测试连接" onclick=\'CheckCollUrl("otcms3")\' /></td>
				</tr>
				<tr>
					<td align="left" class="font1_1" style="padding:8px;" colspan="3">
						&ensp;&ensp;<input type="button" value="测试百度连接" onclick=\'CheckCollUrl("baidu")\' />
						&ensp;&ensp;<input type="button" value="测试网易连接" onclick=\'CheckCollUrl("163")\' />
						&ensp;&ensp;<input type="button" value="测试网钛连接" onclick=\'CheckCollUrl("otcms")\' />
					</td>
				</tr>
			</table>
			');
		}

	}
	if ($funcNum == 0){
		echo('<div style="padding:16px;font-size:18px;font-weight:bold;">欢迎来到后台管理！</div>');
	}
}


function ExtCN($jud){
	if ($jud){
		return '<span style="color:green;">支持</span>';
	}else{
		return '<span style="color:red;">不支持</span>';
	}
}


// 警示信息
function AlertStr(){
	global $DB,$sysAdminArr,$systemArr,$user_ID,$pcTplArr,$wapTplArr;

	$adminURL	= GetUrl::CurrDir();
	$beforeURL	= GetUrl::CurrDir(1);
	$adminDirName = substr($adminURL,strlen($beforeURL),-1);

	$todayDate	= TimeDate::Get('date');

	$alertStr1 = $alertStr2 = '';
	if ( OT::VerCompare('5.3') < 0 ){
		$alertStr1 .= '<div style="font-weight:bold;">★ 提醒！您当前PHP环境版本是 v'. PHP_VERSION .'，程序不兼容该低版本，会出现各种问题，支持版本 v5.3 ~ v8.3，建议版本 v7.1 ~ v8.3</div>';
	/* 
	}elseif ( OT::VerCompare('7.3') > 0 ){
		$alertStr1 .= '<div style="color:#000;">★ 提醒！您当前PHP环境版本是 v'. PHP_VERSION .'，第三方开发者插件可能不兼容，支持版本 v5.3 ~ v8.3，建议版本 v7.1 ~ v7.3</div>';
	*/
	}elseif ( OT::VerCompare('7.1') < 0 ){
		$alertStr1 .= '<div style="color:#000;">★ 提醒！您当前PHP环境版本是 v'. PHP_VERSION .'，版本偏低，个别插件会不兼容，建议使用版本 v7.1 ~ v8.3</div>';
	}
	/* if (! function_exists('sg_load')){
		$alertStr1 .= '★ 提醒！您当前环境不支持【SG11】加密扩展，如果有购买IDC类插件会没法使用。有能力的当前环境安装下【SG11】扩展，不然只能禁用掉IDC类插件<br />';
	} */
	if (File::IsExists(OT_ROOT .'install')){
		$alertStr1 .= '<div>★ 危险！请修改根目录下install/目录名(安装向导目录)，默认名称会带给你网站安全隐患。<span class="pointer" style="font-weight:bold;color:blue;" onclick=\'AjaxGetDeal("readDeal2.php?mudi=revInstallName");\'>【点击修复】</div>';
	}
	if ($adminDirName == 'admin'){
		$alertStr1 .= '<div>★ 危险！当前网站后台目录名是系统默认目录名，强烈建议更改网站后台目录名，以提高网站安全性。</div>';
	}

	if (strlen($systemArr['SYS_URL']) > 8 && $systemArr['SYS_URL'] != $beforeURL){	// $systemArr['SYS_isUrl301'] == 0 && 
		$alertStr1 .= '<div onclick=\'parent.HrefTo("常规设置","网站参数设置","system.php?mudi=companyInfo&dataTypeCN=%E7%BD%91%E7%AB%99%E5%8F%82%E6%95%B0%E8%AE%BE%E7%BD%AE","10");return false;\' style="cursor:pointer;color:;">● 提示：检测到您当前网址跟【网站参数设置】填写的[网站网址]（<b></b><span style="color:blue;">'. $systemArr['SYS_URL'] .'</span>）不一致，错误会导致前台一些资源和图片调用出错。</div>';
	}
	if (! in_array($systemArr['SYS_templateDir'], $pcTplArr)){
		$alertStr2 .= '<div style="color:#000000;">● 提示：系统检测到您当前使用的<b>电脑端模板</b>（<span style="font-weight:bold;color:red;">'. $systemArr['SYS_templateDir'] .'</span>）不是官方模板，请确保跟当前版本完全兼容，不然前台会出现各种问题。</div>';
	}
	$webConfigStr = File::Read(OT_ROOT .'web.config');
	if (strpos($webConfigStr,'baidu') !== false || strpos($webConfigStr,'sogou') !== false || strpos($webConfigStr,'google') !== false){
		$alertStr2 .= '<div style="color:#000000;">● 提示：web.config 里存在 baidu/sogou/google 等字眼，请检查WAP手机版是否被挂马，如不是，忽略该提示。</div>';
	}
	$tplSysArr = Cache::PhpFile('tplSys');
	if (strlen(''. $tplSysArr['TS_homeJumpUrl']) > 0){
		$alertStr2 .= '<div style="color:#000000;">● 提示：首页已开启跳转网址（<span style="color:red;">'. $tplSysArr['TS_homeJumpUrl'] .'</span>），如要关闭请到【模板功能→模板参数设置】-[首页]-[首页跳转网址]</div>';
	}
	if (AppWap::Jud()){
		if (File::IsExists(OT_ROOT .'wap/.user.ini')){
			$alertStr2 .= '<div style="color:#000;">● 提示：存在 wap/.user.ini 配置文件，如果手机版出现错误里有（<span style="color:red;">/:/tmp/</span>），请删掉或改名该文件（如用宝塔，站点设置防跨站不要打钩），如正常，忽略该提示。</div>';
		}
		$webConfigStr = File::Read(OT_ROOT .'wap/web.config');
		if (strpos($webConfigStr,'baidu') !== false || strpos($webConfigStr,'sogou') !== false || strpos($webConfigStr,'google') !== false){
			$alertStr2 .= '<div style="color:#000;">● 提示：wap/web.config 里存在 baidu/sogou/google 等字眼，请检查是否被挂马，如不是，忽略该提示。</div>';
		}
		$wapArr = Cache::PhpFile('wap');
		if (! in_array($wapArr['WAP_templateDir'], $wapTplArr)){
			$alertStr2 .= '<div style="color:#000000;">● 提示：系统检测到您当前使用的<b>手机端模板</b>（<span style="font-weight:bold;color:red;">'. $wapArr['WAP_templateDir'] .'</span>）不是官方模板，请确保跟当前版本完全兼容，不然前台会出现各种问题。</div>';
		}
		if (strlen(''. $wapArr['WAP_homeJumpUrl']) > 0){
			$alertStr2 .= '<div style="color:#000000;">● 提示：手机版首页已开启跳转网址（<span style="color:red;">'. $wapArr['WAP_homeJumpUrl'] .'</span>），如要关闭请到【移动端管理→WAP手机版】-[首页]-[首页跳转网址]</div>';
		}
	}
	/* $tplBottomStr = File::Read(OT_ROOT .'template/'. $systemArr['SYS_templateDir'] .'bottom.html');
		if (strpos($tplBottomStr,'{otcms:$siteCopyright}') === false){
			die('
			<script language="javascript" type="text/javascript">
			alert("模板标签缺失，请不要乱改模板文件。");window.parent.location.href="admin_cl.php?mudi=exit&nohrefStr=close";
			</script>
			');
		} */


	if ($systemArr['SYS_htmlCacheMin'] > 0){
		$alertStr2 .= '<div style="color:#000000;">● 提示：前台开启了页面缓存功能，页面会自动每<b>'. $systemArr['SYS_htmlCacheMin'] .'</b>分钟更新缓存一次，如修改分钟<a href="#" onclick=\'parent.HrefTo("常规设置","网站参数设置","system.php?mudi=companyInfo&dataTypeCN=%E7%BD%91%E7%AB%99%E5%8F%82%E6%95%B0%E8%AE%BE%E7%BD%AE","10");return false;\' style="font-weight:bold;color:#000;">【网站参数设置】-[商业版专属]</a>，如需看最新效果，请点击<input type="button" value="清空页面缓存" onclick="ClearWebCache();" /></div>';
	}
	if ($systemArr['SYS_isHtmlHome'] == 1){
		$alertStr2 .= '<div style="color:#000000;">● 提示：前台首页开启了首页静态页，如需看最新效果，请点击<input type="button" value="生成首页静态页" onclick=\'DataDeal.location.href="makeHtml_run.php?mudi=homeHtml";return false;\' /></div>';
	}
	if ($sysAdminArr['SA_backupCallDay'] > 0){
		$backupCallTime = $sysAdminArr['SA_backupCallTime'];
		if (! strtotime($backupCallTime)){ $backupCallTime='2012-1-1'; }
		if (TimeDate::Add('d',$sysAdminArr['SA_backupCallDay'],$backupCallTime) <= $todayDate){
			$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：距离上次备份提醒（<span style="font-weight:bold;">'. $backupCallTime .'</span>）已经有&ensp;<span style="color:red;font-weight:bold;">'. TimeDate::Diff('d',$backupCallTime,$todayDate) .'</span>&ensp;天了，请及时备份。<a href="#" onclick=\'parent.HrefTo("管理员区","程序文件备份","softBak.php?mudi=backup","999991");return false;\' style="font-weight:bold;color:#000;">【进入程序备份】</a><a href="#" onclick=\'parent.HrefTo("管理员区","数据库备份","dbBak'. (OT_Database=='sqlite'?'':'MySQL') .'.php?mudi=backup","999992");return false;\' style="font-weight:bold;color:#000;">【进入数据库备份】</a><input type="button" value="知道了" onclick="UpdateBackupCall(-1);" />&ensp;<input type="button" value="明天再提醒" onclick="UpdateBackupCall(1);" />&ensp;<input type="button" value="7天后再提醒" onclick="UpdateBackupCall(7);" /></div>';
		}
	}
	if ($user_ID == 1){
		$dataNum = OT::ToInt($DB->GetOne('select count(ARL_ID) from '. OT_dbPref .'autoRunLog'));
		if ($dataNum > 10000){
			$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：自动操作日志有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条记录，建议清理下。<a href="#" onclick=\'parent.HrefTo("常规设置","自动操作日志","autoRunLog.php?mudi=manage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E8%87%AA%E5%8A%A8%E6%93%8D%E4%BD%9C%E6%97%A5%E5%BF%97&dataType2=&dataID=0","883");return false;\' style="font-weight:bold;color:#000;">【自动操作日志】</a></div>';
		}
		$dataNum = OT::ToInt($DB->GetOne('select count(UL_ID) from '. OT_dbPref .'userLog'));
		if ($dataNum > 30000){
			$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：会员操作日志有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条记录，建议清理下。<a href="#" onclick=\'parent.HrefTo("会员管理","会员操作日志","userLog.php?mudi=manage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E4%BC%9A%E5%91%98%E6%93%8D%E4%BD%9C%E6%97%A5%E5%BF%97&dataType2=&dataID=0","907");return false;\' style="font-weight:bold;color:#000;">【会员操作日志】</a></div>';
		}
		$dataNum = OT::ToInt($DB->GetOne('select count(DE_ID) from '. OT_dbPref .'dbErr'));
		if ($dataNum > 5000){
			$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：数据库错误日志有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条记录，建议清理下。<a href="#" onclick=\'parent.HrefTo("管理员区","数据库错误日志","dbErr.php?mudi=manage","999916");return false;\' style="font-weight:bold;color:#000;">【数据库错误日志】</a></div>';
		}
		if (AppUserScore::Jud()){	// 会员积分记录
			$dataNum = OT::ToInt($DB->GetOne('select count(UM_ID) from '. OT_dbPref .'userMoney'));
			if ($dataNum > 50000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：会员积分记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条记录，建议清理下。<a href="#" onclick=\'parent.HrefTo("会员管理","会员积分记录","userMoney.php?mudi=manage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E4%BC%9A%E5%91%98%E7%A7%AF%E5%88%86%E8%AE%B0%E5%BD%95&dataType2=&dataID=0","592");return false;\' style="font-weight:bold;color:#000;">【会员积分记录】</a></div>';
			}
		}
		if (AreaApp::Jud(30)){	// 网址跳转管理
			$dataNum = OT::ToInt($DB->GetOne('select count(GUU_ID) from '. OT_dbPref .'goUrlUsers'));
			if ($dataNum > 10000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：网址跳转功能访客有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条记录，建议清理下。<a href="#" onclick=\'parent.HrefTo("辅助管理","网址跳转管理","goUrl.php?mudi=manage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E7%BD%91%E5%9D%80%E8%B7%B3%E8%BD%AC&dataType2=&dataID=0&imgStr=%26isImgWH%3D0%26imgWHread%3D0%26imgW%3D0%26imgH%3D0%26isImgWater%3D0%26imgWaterW%3D%26imgWaterH%3D%26imgWaterName%3D","575");return false;\' style="font-weight:bold;color:#000;">【网址跳转管理】</a></div>';
			}
		}
		if (AppMoneyPay::Jud()){	// 充值支付基础包（含支付宝）
			$dataNum = OT::ToInt($DB->GetOne('select count(MP_ID) from '. OT_dbPref .'moneyPay'));
			if ($dataNum > 30000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：进出账记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("财务管理","进出账记录删除","moneyRecord.php?mudi=delManage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E8%BF%9B%E5%87%BA%E8%B4%A6%E8%AE%B0%E5%BD%95%E5%88%A0%E9%99%A4&dataType2=&dataID=0&imgStr=%26isImgWH%3D0%26imgWHread%3D0%26imgW%3D0%26imgH%3D0%26isImgWater%3D0%26imgWaterW%3D%26imgWaterH%3D%26imgWaterName%3D","611");return false;\' style="font-weight:bold;color:#000;">【进出账记录删除】</a></div>';
			}
		}
		if (AppTaobaoke::Jud()){	// 淘宝客基础包
			$dataNum = OT::ToInt($DB->GetOne('select count(TG_ID) from '. OT_dbPref .'taokeGoods'));
			if ($dataNum > 30000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：淘客商品管理有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;个商品，建议清理下。<a href="#" onclick=\'parent.HrefTo("淘宝客管理","淘客商品管理","taokeGoods.php?mudi=manage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E6%B7%98%E5%AE%A2%E5%95%86%E5%93%81&dataType2=&dataID=0&imgStr=%26isImgWH%3D0%26imgWHread%3D0%26imgW%3D0%26imgH%3D0%26isImgWater%3D0%26imgWaterW%3D%26imgWaterH%3D%26imgWaterName%3D","600");return false;\' style="font-weight:bold;color:#000;">【淘客商品管理】</a></div>';
			}
			$dataNum = OT::ToInt($DB->GetOne('select count(TV_ID) from '. OT_dbPref .'taokeView'));
			if ($dataNum > 30000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：淘客商品用户访问记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("淘宝客管理","淘客商品管理","taokeGoods.php?mudi=viewManage&dataMode=&dataModeStr=&dataType=&dataTypeCN=%E6%B7%98%E5%AE%A2%E5%95%86%E5%93%81&dataType2=&dataID=0&imgStr=%26isImgWH%3D0%26imgWHread%3D0%26imgW%3D0%26imgH%3D0%26isImgWater%3D0%26imgWaterW%3D%26imgWaterH%3D%26imgWaterName%3D","600");return false;\' style="font-weight:bold;color:#000;">【淘客用户访问记录】</a></div>';
			}
		}
		if (AppMail::Jud()){	// 邮件验证通知
			$dataNum = OT::ToInt($DB->GetOne('select count(MU_ID) from '. OT_dbPref .'mailUsers'));
			if ($dataNum > 20000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：邮件发送记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("辅助管理","邮件模板管理","mailTpl.php?mudi=users&dataType=&dataTypeCN=%E9%82%AE%E4%BB%B6%E6%A8%A1%E6%9D%BF","790");return false;\' style="font-weight:bold;color:#000;">【邮件模板管理】</a></div>';
			}
		}
		if (AppPhone::Jud()){	// 短信验证通知
			$dataNum = OT::ToInt($DB->GetOne('select count(PU_ID) from '. OT_dbPref .'phoneUsers'));
			if ($dataNum > 20000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：短信发送记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("辅助管理","短信模板管理","phoneTpl.php?mudi=users&dataType=&dataTypeCN=%E7%9F%AD%E4%BF%A1%E6%A8%A1%E6%9D%BF","801");return false;\' style="font-weight:bold;color:#000;">【短信模板管理】</a></div>';
			}
		}
		if (AppInfoDown::Jud()){	// 会员文章下载记录
			$dataNum = OT::ToInt($DB->GetOne('select count(ID_ID) from '. OT_dbPref .'infoDown'));
			if ($dataNum > 50000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：会员文章下载记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("会员管理","会员下载记录","infoDown.php?mudi=manage&dataType=&dataTypeCN=%E4%BC%9A%E5%91%98%E4%B8%8B%E8%BD%BD%E8%AE%B0%E5%BD%95","946");return false;\' style="font-weight:bold;color:#000;">【会员下载记录】</a></div>';
			}
		}
		if (AppUserView::Jud()){	// 会员文章浏览记录
			$dataNum = OT::ToInt($DB->GetOne('select count(UV_ID) from '. OT_dbPref .'userView'));
			if ($dataNum > 50000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：会员文章浏览记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("会员管理","会员浏览记录","userView.php?mudi=manage&dataType=&dataTypeCN=%E4%BC%9A%E5%91%98%E6%B5%8F%E8%A7%88%E8%AE%B0%E5%BD%95","940");return false;\' style="font-weight:bold;color:#000;">【会员浏览记录】</a></div>';
			}
		}
		if (AppRobot::Jud()){	// 访客雷达/蜘蛛爬行
			$dataNum = OT::ToInt($DB->GetOne('select count(RD_ID) from '. OT_dbPref .'robotData'));
			if ($dataNum > 100000){
				$alertStr2 .= '<div id="backupCallBox" style="color:blue;">● 提醒：访客雷达中访客记录记录有&ensp;<span style="color:red;font-weight:bold;">'. $dataNum .'</span>&ensp;条，建议清理下。<a href="#" onclick=\'parent.HrefTo("常规设置","访客雷达","robot.php?mudi=robot","1044");return false;\' style="font-weight:bold;color:#000;">【访客雷达-访客记录】</a></div>';
			}
		}
	}
	/*
	$retNum = File::Count(OT_ROOT .'cache/html/',array('html','png'));
	if ($retNum > 4000){
		$alertStr2 .= '<div style="color:blue;">● 提醒：网站缓存（<span style="font-weight:bold;">cache/html/</span>）文件比较多（'. $retNum .'个）建议清空下&ensp;<input type="button" value="清空网站缓存" onclick="ClearSiteCache();" /></div>';
	}
	if (AppWap::Jud()){
		$retNum = File::Count(OT_ROOT .'wap/cache/','html');
		if ($retNum > 4000){
			$alertStr2 .= '<div style="color:blue;">● 提醒：WAP手机版缓存（<span style="font-weight:bold;">wap/cache/</span>）文件比较多（'. $retNum .'个）建议清空下&ensp;<input type="button" value="清空手机版缓存" onclick="ClearWapHtml();" /></div>';
		}
	}
	*/

	$alertStr3 = '';
	if ($sysAdminArr['SA_isLan'] == 1){
		$alertStr3 .= '已开启<span style="color:red;">内网模式</span>；';
	}
	if ($sysAdminArr['SA_sendUrlMode'] == 1){
		$alertStr3 .= '授权页面获取模式：<span style="color:red;">AJAX</span>；';
	}
	if ($sysAdminArr['SA_checkUrlMode'] > 0){
		$alertStr3 .= '授权页面获取路线：<span style="color:red;">'. Adm::UrlWebMode($sysAdminArr['SA_checkUrlMode']) .'</span>；';
	}
	if ($sysAdminArr['SA_updateUrlMode'] > 0){
		$alertStr3 .= '授权信息获取路线：<span style="color:red;">'. Adm::UrlWebMode($sysAdminArr['SA_updateUrlMode']) .'</span>；';
	}
	if ($sysAdminArr['SA_getUrlMode'] > 0){
		$alertStr3 .= '授权调用模式：<span style="color:red;">'. Adm::UrlGetMode($sysAdminArr['SA_getUrlMode']) .'</span>；';
	}
	if ($sysAdminArr['SA_collUrlMode'] > 0){
		$alertStr3 .= '采集调用模式：<span style="color:red;">'. Adm::UrlGetMode($sysAdminArr['SA_collUrlMode']) .'</span>；';
	}
	if (strlen($alertStr3) > 0){ $alertStr3 = '<div style="color:#000;">◆ '. $alertStr3 .'</div>'; }

	return $alertStr1 . $alertStr2 . $alertStr3;
}


// linux系统探测
function sys_linux() {
	// CPU
	if (false === ($str = @file("/proc/cpuinfo"))) return false;
	$str = implode("", $str);
	@preg_match_all("/model\s+name\s{0,}\:+\s{0,}([\w\s\)\(\@.-]+)([\r\n]+)/s", $str, $model);
	@preg_match_all("/cpu\s+MHz\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $mhz);
	@preg_match_all("/cache\s+size\s{0,}\:+\s{0,}([\d\.]+\s{0,}[A-Z]+[\r\n]+)/", $str, $cache);
	@preg_match_all("/bogomips\s{0,}\:+\s{0,}([\d\.]+)[\r\n]+/", $str, $bogomips);
	if (false !== is_array($model[1]))	{
	$res['cpu']['num'] = sizeof($model[1]);
	$res['cpu']['num_text'] = str_replace(array(1,2,4,8,16), array('单','双','四','八','十六'), $res['cpu']['num']).'核';
	/* for($i = 0; $i < $res['cpu']['num']; $i++) {
		$res['cpu']['model'][] = $model[1][$i].'&ensp;('.$mhz[1][$i].')';
		$res['cpu']['mhz'][] = $mhz[1][$i];
		$res['cpu']['cache'][] = $cache[1][$i];
		$res['cpu']['bogomips'][] = $bogomips[1][$i];
	} */
	$x1 = ($res['cpu']['num']==1) ? '' : ' ×'.$res['cpu']['num'];
	$mhz[1][0] = ' | 频率:'.$mhz[1][0];
	$cache[1][0] = ' | 二级缓存:'.$cache[1][0];
	$bogomips[1][0] = ' | Bogomips:'.$bogomips[1][0];
	$res['cpu']['model'][] = $model[1][0].$mhz[1][0].$cache[1][0].$bogomips[1][0].$x1;
		if (false !== is_array($res['cpu']['model'])) $res['cpu']['model'] = implode("<br />", $res['cpu']['model']);
		if (false !== is_array($res['cpu']['mhz'])) $res['cpu']['mhz'] = implode("<br />", $res['cpu']['mhz']);
		if (false !== is_array($res['cpu']['cache'])) $res['cpu']['cache'] = implode("<br />", $res['cpu']['cache']);
		if (false !== is_array($res['cpu']['bogomips'])) $res['cpu']['bogomips'] = implode("<br />", $res['cpu']['bogomips']);
	}
	// NETWORK
	// UPTIME
	if (false === ($str = @file("/proc/uptime"))) return false;
	$str	= explode(' ', implode("", $str));
	$str	= trim($str[0]);
	$min	= $str / 60;
	$hours	= $min / 60;
	$days	= floor($hours / 24);
	$hours	= floor($hours - ($days * 24));
	$min	= floor($min - ($days * 60 * 24) - ($hours * 60));
	if ($days !== 0) $res['uptime'] = $days."天";
	if ($hours !== 0) $res['uptime'] .= $hours."小时";
	$res['uptime'] .= $min."分钟";
	// MEMORY
	if(false === ($str = @file("/proc/meminfo"))) return false;
	$str = implode("", $str);
	preg_match_all("/MemTotal\s{0,}\:+\s{0,}([\d\.]+).+?MemFree\s{0,}\:+\s{0,}([\d\.]+).+?Cached\s{0,}\:+\s{0,}([\d\.]+).+?SwapTotal\s{0,}\:+\s{0,}([\d\.]+).+?SwapFree\s{0,}\:+\s{0,}([\d\.]+)/s", $str, $buf);
	preg_match_all("/Buffers\s{0,}\:+\s{0,}([\d\.]+)/s", $str, $buffers);
	$res['mem_total']			= round($buf[1][0]/1024, 2);
	$res['mem_free']			= round($buf[2][0]/1024, 2);
	$res['mem_buffers']			= round($buffers[1][0]/1024, 2);
	$res['mem_cached']			= round($buf[3][0]/1024, 2);
	$res['mem_used']			= $res['mem_total']-$res['mem_free'];
	$res['mem_percent']			= (floatval($res['mem_total'])!=0)?round($res['mem_used']/$res['mem_total']*100,2):0;
	$res['mem_real_used']		= $res['mem_total'] - $res['mem_free'] - $res['mem_cached'] - $res['mem_buffers']; //真实内存使用
	$res['mem_real_free']		= $res['mem_total'] - $res['mem_real_used']; //真实空闲
	$res['mem_real_percent']	= (floatval($res['mem_total'])!=0)?round($res['mem_real_used']/$res['mem_total']*100,2):0; //真实内存使用率
	$res['mem_cached_percent']	= (floatval($res['mem_cached'])!=0)?round($res['mem_cached']/$res['mem_total']*100,2):0; //Cached内存使用率
	$res['swap_total']			= round($buf[4][0]/1024, 2);
	$res['swap_free']			= round($buf[5][0]/1024, 2);
	$res['swap_used']			= round($res['swap_total']-$res['swap_free'], 2);
	$res['swap_percent']		= (floatval($res['swap_total'])!=0)?round($res['swap_used']/$res['swap_total']*100,2):0;
	// LOAD AVG
	if (false === ($str = @file("/proc/loadavg"))) return false;
	$str = explode(' ', implode("", $str));
	$str = array_chunk($str, 4);
	$res['load_avg'] = implode(' ', $str[0]);
	return $res;
}

// FreeBSD系统探测
function sys_freebsd() {
	// CPU
	if (false === ($res['cpu']['num'] = get_key("hw.ncpu"))) return false;
	$res['cpu']['num_text'] = str_replace(array(1,2,4,8,16), array('单','双','四','八','十六'), $res['cpu']['num']).'核';
	$res['cpu']['model'] = get_key("hw.model");
	// LOAD AVG
	if (false === ($res['load_avg'] = get_key("vm.loadavg"))) return false;
	// UPTIME
	if (false === ($buf = get_key("kern.boottime"))) return false;
	$buf		= explode(' ', $buf);
	$sys_ticks	= time() - intval($buf[3]);
	$min		= $sys_ticks / 60;
	$hours		= $min / 60;
	$days		= floor($hours / 24);
	$hours		= floor($hours - ($days * 24));
	$min		= floor($min - ($days * 60 * 24) - ($hours * 60));
	if ($days !== 0) $res['uptime'] = $days."天";
	if ($hours !== 0) $res['uptime'] .= $hours."小时";
	$res['uptime'] .= $min."分钟";
	// MEMORY
	if (false === ($buf = get_key("hw.physmem"))) return false;
	$res['mem_total'] = round($buf/1024/1024, 2);
	$str = get_key("vm.vmtotal");
	preg_match_all("/\nVirtual Memory[\:\s]*\(Total[\:\s]*([\d]+)K[\,\s]*Active[\:\s]*([\d]+)K\)\n/i", $str, $buff, PREG_SET_ORDER);
	preg_match_all("/\nReal Memory[\:\s]*\(Total[\:\s]*([\d]+)K[\,\s]*Active[\:\s]*([\d]+)K\)\n/i", $str, $buf, PREG_SET_ORDER);
	$res['mem_real_used']		= round($buf[0][2]/1024, 2);
	$res['mem_cached']			= round($buff[0][2]/1024, 2);
	$res['mem_used']			= round($buf[0][1]/1024, 2) + $res['mem_cached'];
	$res['mem_free']			= $res['mem_total'] - $res['mem_used'];
	$res['mem_percent']			= (floatval($res['mem_total'])!=0)?round($res['mem_used']/$res['mem_total']*100,2):0;
	$res['mem_real_percent']	= (floatval($res['mem_total'])!=0)?round($res['mem_real_used']/$res['mem_total']*100,2):0;
	$res['mem_buffers']			= 0;
	$res['mem_real_free']		= 0;
	$res['mem_cached_percent']	= 0;
	$res['swap_percent']		= 0;
	return $res;
}

// windows系统探测
function sys_windows() {
	if(PHP_VERSION < 5) { return false; }

	if (! class_exists('COM',false)){ return false; }
	$obj_locator = new COM("WbemScripting.SWbemLocator");
	try{
		$wmi = &$obj_locator->ConnectServer();
	}catch (Exception $e){
		return false;
	}

	// CPU
	$cpuinfo = GetWMI($wmi, "Win32_Processor", array("Name", "L2CacheSize", "NumberOfCores"));
	$res['cpu']['num'] = $cpuinfo[0]['NumberOfCores'];
	if (null == $res['cpu']['num']) {
		$res['cpu']['num'] = 1;
	}
	$res['cpu']['num_text'] = str_replace(array(1,2,4,8,16), array('单','双','四','八','十六'), $res['cpu']['num']).'核';
	/*
	for ($i=0;$i<$res['cpu']['num'];$i++) {
		$res['cpu']['model'] .= $cpuinfo[0]['Name']."<br />";
		$res['cpu']['cache'] .= $cpuinfo[0]['L2CacheSize']."<br />";
	}*/
	$cpuinfo[0]['L2CacheSize'] = ' ('.$cpuinfo[0]['L2CacheSize'].')';
	$x1 = ($res['cpu']['num']==1) ? '' : ' ×'.$res['cpu']['num'];
	$res['cpu']['model'] = $cpuinfo[0]['Name'].$cpuinfo[0]['L2CacheSize'].$x1;
	// SYSINFO
	$sysinfo = GetWMI($wmi, "Win32_OperatingSystem", array('LastBootUpTime','TotalVisibleMemorySize','FreePhysicalMemory','Caption','CSDVersion','SerialNumber','InstallDate'));
	$sysinfo[0]['Caption']=iconv('GBK', 'UTF-8',$sysinfo[0]['Caption']);
	$sysinfo[0]['CSDVersion']=iconv('GBK', 'UTF-8',$sysinfo[0]['CSDVersion']);
	$res['win_n'] = $sysinfo[0]['Caption'].' '.$sysinfo[0]['CSDVersion']." 序列号:{$sysinfo[0]['SerialNumber']} 于".date('Y年m月d日H:i:s',strtotime(substr($sysinfo[0]['InstallDate'],0,14)))."安装";
	// UPTIME
	$res['uptime'] = $sysinfo[0]['LastBootUpTime'];
	$sys_ticks = time() - strtotime(substr($res['uptime'], 0, 14));
	$min = $sys_ticks / 60;
	$hours = $min / 60;
	$days = floor($hours / 24);
	$hours = floor($hours - ($days * 24));
	$min = floor($min - ($days * 60 * 24) - ($hours * 60));
	if ($days !== 0) $res['uptime'] = $days."天";
	if ($hours !== 0) $res['uptime'] .= $hours."小时";
	$res['uptime'] .= $min."分钟";
	// MEMORY
	$res['mem_total']		= round($sysinfo[0]['TotalVisibleMemorySize']/1024,2);
	$res['mem_free']		= round($sysinfo[0]['FreePhysicalMemory']/1024,2);
	$res['mem_used']		= $res['mem_total']-$res['mem_free'];	//上面两行已经除以1024,这行不用再除了
	$res['mem_percent']		= round($res['mem_used'] / $res['mem_total']*100,2);
	// LoadPercentage
	$loadinfo = GetWMI($wmi, "Win32_Processor", array("LoadPercentage"));
	$res['load_avg'] = $loadinfo[0]['LoadPercentage'];
	$res['mem_cached']			= 0;
	$res['mem_buffers']			= 0;
	$res['mem_real_used']		= 0;
	$res['mem_real_free']		= 0;
	$res['mem_real_percent']	= 0;
	$res['mem_cached_percent']	= 0;
	$res['swap_percent']		= 0;
	return $res;
}

function GetWMI(&$wmi, $strClass, $strValue = array()) {
	$arrData = array();
	$objWEBM = $wmi->Get($strClass);
	$arrProp = $objWEBM->Properties_;
	$arrWEBMCol = $objWEBM->Instances_();
	foreach($arrWEBMCol as $objItem) {
		@reset($arrProp);
		$arrInstance = array();
		foreach($arrProp as $propItem) {
			eval("\$value = \$objItem->" . $propItem->Name . ";");
			if (empty($strValue)) {
				$arrInstance[$propItem->Name] = trim($value);
			} else {
				if (in_array($propItem->Name, $strValue)) {
					$arrInstance[$propItem->Name] = trim($value);
				}
			}
		}
		$arrData[] = $arrInstance;
	}
	return $arrData;
}

?>