<!--<?php
include_once PrintEot('left');
${'current' . $action} = 'class="current"';
print <<<EOT
-->
<script type="text/javascript">
function cateopen(id) {
	var o = getObj('cate_' + id);
	if (o == null) return;
	if (o.style.display == 'none') {
		o.style.display = '';
		getObj('bt_' + id).className = 'expand expand_b';
	} else {
		o.style.display = 'none';
		getObj('bt_' + id).className = 'expand expand_a';
	}
}

function changeValue(obj) {
	var pattern = /^auth\[(\d+)]\[(.+)]$/;
	if (! pattern.test(obj.name) || !RegExp.$2) return false;
	var fid = RegExp.$1, item = RegExp.$2;
	var changedItem = getObj('change' + item);
	var changedItemValue = changedItem.value;
	var value = ',' + fid + ',';
	if (changedItemValue.indexOf(value) < 0) {
		changedItem.value = changedItemValue + value;
	} else {
		changedItem.value = changedItemValue.replace(value,'');
	}
	//且 或 選擇
	if(obj.tagName == 'SELECT') {
		var sp = obj.id.split('_');
		if (sp[1]) {
			getObj('logical_2_'+sp[1]).innerHTML = getObj('logical_1_'+sp[1]).innerHTML = obj.value == 1 ? '或' : '且';
		}
	}
}
</script>
<div class="nav3 mb10 ta">
    <ul class="cc">
      <li $currentstate><a href="$basename&action=state">應用狀態</a></li>
      <li $currentbasic><a href="$basename&action=basic">基本設置</a></li>
      <li $currentforumpost><a href="$basename&action=forumpost">版塊設置</a></li>
      <li $currentforumcredit><a href="$basename&action=forumcredit">積分設置</a></li>
      <li $currentstatic><a href="$basename&action=static">應用統計</a></li>
      <li $currentsmsbuy><a href="$basename&action=smsbuy">短信購買</a></li>
      <li $currentcertificateauth><a href="$basename&action=certificateauth">證件認證</a></li>
    </ul>
</div>
<!--
EOT;
if($action == 'state'){
print <<<EOT
-->
<form action="$basename&action=state" method="post" name="stateset">
<input type="hidden" name="step" value="2" />
<h2 class="h1">應用狀態設置</h2>
<div class="admin_table mb10">
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr class="tr1 vt">
			<td class="td1">狀態設置</td>
			<td class="td2">
				<ul class="list_A list_80 cc">
					<li><input type="radio" value="1" $authstate_Y name="authstate" />開啟</li>
					<li><input type="radio" value="0" $authstate_N name="authstate" />關閉</li>
				</ul>
			</td>
        </tr>
     </table>
 </div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit" name="submit" onfocus="blur();">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($action == 'basic'){
print <<<EOT
-->
<form action="$basename&action=basic" method="post" name="basicset">
<input type="hidden" name="step" value="2" />
<h2 class="h1">基本設置</h2>
<div class="admin_table mb10">
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr class="tr1 vt">
			<td class="td1">新用戶注冊手機認證</td>
			<td class="td2">
				<ul class="list_A list_80 cc">
					<li><input type="radio" value="1" name="config[authreg]" {$openAuthreg} />開啟</li>
					<li><input type="radio" value="0" name="config[authreg]" {$closeAuthreg} />關閉</li>
				</ul>
			</td>
			<td class="td2">開啟該功能，僅當會員通過手機驗證才能完成注冊</td>
		</tr>
		<tr class="tr1 vt">
			<td class="td1">手機找回密碼</td>
			<td class="td2">
				<ul class="list_A list_80 cc">
					<li><input type="radio" value="1" name="config[authgetpwd]" {$openAuthpwd} />開啟</li>
					<li><input type="radio" value="0" name="config[authgetpwd]" {$closeAuthpwd} />關閉</li>
				</ul>
			</td>
			<td class="td2">開啟後，可通過手機驗證碼的方式幫助用戶找回密碼</td>
		</tr>
		<tr class="tr1 vt">
			<td class="td1">站點名稱</td>
			<td class="td2">
				<input type="text" name="config[authsitename]" value="$db_authsitename" class="input input_wa" maxlength="20" />
			</td>
			<td class="td2">用于手機短信內容自定義</td>
		</tr>
		<tr class="tr1 vt">
			<td class="td1">證件認證</td>
			<td class="td2">
				<ul class="list_A list_80 cc">
					<li><input type="radio" value="1" name="config[authcertificate]" {$openAuthcertificate} />開啟</li>
					<li><input type="radio" value="0" name="config[authcertificate]" {$closeAuthcertificate} />關閉</li>
				</ul>
			</td>
			<td class="td2">開啟該功能，啟用證件認證功能</td>
		</tr>
		<tr class="tr1 vt">
			<td class="td1">幫助鏈接</td>
			<td class="td2">
				<input type="text" name="config[authhelpurl]" value="$db_authhelpurl" class="input input_wb" />
			</td>
			<td class="td2"></td>
		</tr>
	</table>
</div>

<div class="tac mb10">
	<span class="btn"><span><button type="submit" name="submit" onfocus="blur();">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($action == 'forumpost'){
print <<<EOT
-->
<form action="$basename&action=forumpost" method="post" name="forumpost">
<input type="hidden" name="step" value="2" />
<input type="hidden" name="changedcellphone" id="changecellphone" value="" />
<input type="hidden" name="changedalipay" id="changealipay" value="" />
<input type="hidden" name="changedcertificate" id="changecertificate" value="" />
<input type="hidden" name="changedallowread" id="changeallowread" value="" />
<input type="hidden" name="changedallowpost" id="changeallowpost" value="" />
<input type="hidden" name="changedallowrp" id="changeallowrp" value="" />
<input type="hidden" name="changedallowupload" id="changeallowupload" value="" />
<input type="hidden" name="changedlogicalmethod" id="changelogicalmethod" value="" />
<h3 class="h1"><b>提示信息</b></h3>
<div class="legend mb10">開啟後，在指定版塊發帖、發布團購/活動/分類信息時，僅當會員通過認證才能繼續操作</div>
<h2 class="h1">版塊設置</h2>
<div class="admin_table mb10">
<table id="ftable" cellspacing="0" cellpadding="0" width="100%">
    <tr class="tr2">
        <td>[順序]版塊名稱</td>
        <td width="30">瀏覽</td>
        <td width="30">發帖</td>
        <td width="30">回復</td>
        <td width="40" style="border-right:1px solid #dde9f5;">附件</td>
        <td width="85" class="tac">綁定手機</td>
        <td width="90" class="tac">綁定支付寶</td>
        <td width="60" class="tac">證件認證</td>
        <td>認證關系</td>
    </tr>
<!--
EOT;
foreach ($catedb as $cate) {
$tmpStyle = $threaddb[$cate['fid']] ? 'expand expand_b' : 'expand expand_d';
print <<<EOT
-->
    <tr class="vt tr1">
		<td class="td3 tdcur">
			<i id="bt_$cate[fid]" class="$tmpStyle" onclick="cateopen('$cate[fid]')"></i>
			<span class="fourm_name" id="fourm_$cate[fid]">$cate[name]</span>
		</td>
		<td colspan="4" class="td2" style="border-right:1px solid #dde9f5;">&nbsp;</td>
		<td class="td2"></td>
		<td class="td2"></td>
		<td class="td2"></td>
    <td class="td2"></td>
	</tr>
<!--
EOT;
if ($threaddb[$cate['fid']]) {print <<<EOT
-->
	<tbody id="cate_$cate[fid]">
<!--
EOT;
foreach ($threaddb[$cate['fid']] as $thread) {
$forumset = unserialize($thread['forumset']);
$checkCellphone = $forumset['auth_cellphone'] == 1 ? 'checked' : '';
$checkAlipay = $forumset['auth_alipay'] == 1 ? 'checked' : '';
$checkCertificateauth = $forumset['auth_certificate'] == 1 ? 'checked' : '';
//實名認證控制權限
$checkAllowRead = $forumset['auth_allowread'] == 1 ? 'checked' : '';
$checkAllowPost = $forumset['auth_allowpost'] == 1 ? 'checked' : '';
$checkAllowRp = $forumset['auth_allowrp'] == 1 ? 'checked' : '';
$checkAllowUpload = $forumset['auth_allowupload'] == 1 ? 'checked' : '';
$checkLogicalMethod0 = $checkLogicalMethod1 = '';
$forumset['auth_logicalmethod'] == 1 ? $checkLogicalMethod1 = ' selected' : $checkLogicalMethod0 = ' selected';
$logicalText = $forumset['auth_logicalmethod'] == 1 ? '或' : '且';
$isspace = str_repeat($space,$thread['type'] == 'forum' ? 0 : ($thread['type'] == 'sub' ? 1 : 2));
print <<<EOT
-->
	<tr class="vt tr1">
		<td class="td3">{$isspace}<i class="lower"></i><span id="fourm_$thread[fid]" class="fourm_name">$thread[name]</span></td>
		<td class="td2"><input type="checkbox" name="auth[$thread[fid]][allowread]" value=1 onclick="changeValue(this);" $checkAllowRead></td>
		<td class="td2"><input type="checkbox" name="auth[$thread[fid]][allowpost]" value=1 onclick="changeValue(this);" $checkAllowPost></td>
		<td class="td2"><input type="checkbox" name="auth[$thread[fid]][allowrp]" value=1 onclick="changeValue(this);" $checkAllowRp></td>
		<td class="td2" style="border-right:1px solid #dde9f5;"><input type="checkbox" name="auth[$thread[fid]][allowupload]" value=1 onclick="changeValue(this);" $checkAllowUpload></td>
		<td class="td2 tac">
			<span id="logical_1_{$thread['fid']}" class="fr">$logicalText</span>
			<input type="checkbox" class="mr5" name="auth[$thread[fid]][cellphone]" value=1 onclick="changeValue(this);" $checkCellphone />
		</td>
		<td class="td2 tac">
			<span id="logical_2_{$thread['fid']}" class="fr">$logicalText</span>
			<input type="checkbox" class="mr5" name="auth[$thread[fid]][alipay]" value=1 onclick="changeValue(this);" $checkAlipay />
		</td>
		<td class="td2 tac"><input type="checkbox" name="auth[$thread[fid]][certificate]" value=1 onclick="changeValue(this);" $checkCertificateauth /></td>
		<td class="td2">
			<select name="auth[{$thread['fid']}][logicalmethod]" onchange="changeValue(this);" id="logicalSel_{$thread['fid']}">
				<option value="0"$checkLogicalMethod0>且</option>
				<option value="1"$checkLogicalMethod1>或</option>
			</select>
		</td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
	</tbody>
<!--
EOT;
}}print <<<EOT
-->
</table>
</div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit" name="submit" onfocus="blur();">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($action == 'forumcredit'){
print <<<EOT
-->
<form action="$basename&action=forumcredit" method="post" name="forumcredit">
<input type="hidden" name="step" value="2" />
<h3 class="h1"><b>提示信息</b></h3>
<div class="legend">開啟後，實名認證用戶發帖可獲得普通用戶的×倍積分，留空表示不使用此功能</div>
<h2 class="h1">積分獎勵設置</h2>
<div class="admin_table mb10">
<table id="ftable" cellspacing="0" cellpadding="0" width="100%">
    <tr class="tr2">
        <td>[順序]版塊名稱</td>
        <td width="160">綁定手機發帖</td>
        <td width="160">綁定支付寶發帖</td>
        <td>綁定證件認證發帖</td>
    </tr>
<!--
EOT;
foreach ($catedb as $cate) {
$tmpStyle = $threaddb[$cate['fid']] ? 'expand expand_b' : 'expand expand_d';
print <<<EOT
-->
    <tr class="vt tr1">
		<td class="td3 tdcur">
			<i id="bt_$cate[fid]" class="$tmpStyle" onclick="cateopen('$cate[fid]')"></i>
			<span class="fourm_name" id="fourm_$cate[fid]">$cate[name]</span>
		</td>
		<td class="td2"></td>
        <td class="td2"></td>
        <td class="td2"></td>
	</tr>
<!--
EOT;
if ($threaddb[$cate['fid']]) {print <<<EOT
-->
	<tbody id="cate_$cate[fid]">
<!--
EOT;
foreach ($threaddb[$cate['fid']] as $thread) {
$forumset = unserialize($thread['forumset']);
$isspace = str_repeat($space,$thread['type'] == 'forum' ? 0 : ($thread['type'] == 'sub' ? 1 : 2));
$forumset['auth_cellphone_credit'] = $forumset['auth_cellphone_credit'] ? $forumset['auth_cellphone_credit'] : 1;
$forumset['auth_alipay_credit'] = $forumset['auth_alipay_credit'] ? $forumset['auth_alipay_credit'] : 1;
$forumset['auth_certificate_credit'] = $forumset['auth_certificate_credit'] ? $forumset['auth_certificate_credit'] : 1;
print <<<EOT
-->
	<tr class="vt tr1">
		<td class="td3">
			{$isspace}
            <i class="lower"></i>
            <span id="fourm_$thread[fid]" class="fourm_name">$thread[name]</span>
        </td>
		<td class="td2">
			× <input class="input input_wc" type="text" name="auth[$thread[fid]][cellphone]" value="$forumset[auth_cellphone_credit]" />
		</td>
		<td class="td2">
            × <input class="input input_wc" type="text" name="auth[$thread[fid]][alipay]" value="$forumset[auth_alipay_credit]" />
        </td>
		<td class="td2">
            × <input class="input input_wc" type="text" name="auth[$thread[fid]][certificate]" value="$forumset[auth_certificate_credit]" />
        </td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
	</tbody>
<!--
EOT;
}}print <<<EOT
-->
</table>
</div>
<div class="tac mb10">
	<span class="btn"><span><button type="submit" name="submit" onfocus="blur();">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($action == 'static' || $action == 'smsbuy'){
print <<<EOT
-->
<script type="text/javascript" src="http://apps.phpwind.net/js/global.js"></script>
<script type="text/javascript">
var server = new PwJs.Server("pwapp");
server.start();
</script>
<iframe id="pwapp" name="pwapp" frameborder="0" width="100%" height="700" scrolling="auto" src="{$appurl}"></iframe>
<!--
EOT;
}elseif($action == 'certificateauth'){print <<<EOT
-->
<script>
var manageclass = {
		certificateinfo : function (obj,forumid){
			var form = getObj(forumid);
			var page = obj.getAttribute("page");
			if(!page){
				page = getObj("input_page").value;
			}
			page = (page) ? page : 1;
			form.page.value = page;
			form.step.value = '';
			setTimeout(function(){
				form.submit();
			},0);
		}
	}

function initPost(state){
	var form = getObj('certificate_form');
	if (state == -1 && hasCheckedItem(form) && !confirm("刪除操作無法還原,您確定要刪除本條實名認證記錄並刪除用戶上傳的文件麼？")) {
		return false;
	}
	form.dostate.value = state;
	form.submit();
}
function changeAuthState(state){
	document.location.href = "$basename&action=certificateauth&state=" + state;
}

function hasCheckedItem(form) {
	var ifcheck = false;
	var inputs = form.getElementsByTagName("input");
	for (var i=0; i<inputs.length; i++) {
		if (inputs[i].type == 'checkbox' && inputs[i].name == "selid[]" && inputs[i].checked == true) ifcheck = true;
	}
	return ifcheck;
}
</script>
<form action="$basename&action=certificateauth" method="post" name="certificate_form"  id="certificate_form">
	<input type="hidden" name="page" value="$page">
	<input type="hidden" name="step" value="2">
	<input type="hidden" name="dostate" value="0">
	<h3 class="h1">認證信息</h3>
    <div class="admin_table mb10">
		<table cellpadding="0" cellspacing="0" width="100%">
          <tr class="tr2 vt td_bgB">
            <td width="24"><span onclick="CheckAll(document.certificate_form)" class="cp">全選</span></td>
            <td width="100">
            	<select name="state" onchange="changeAuthState(this.value);">
            		<option value="0">全部</option>
            		$stateHtml
            	</select>
            </td>
            <td width="50">用戶名</td>
            <td width="150">提交時間</td>
            <td width="100">證件類型</td>
            <td width="100">證件圖片</td>
            <td>證件編號</td>
          </tr>
<!--
EOT;
if (empty($certificateInfo)) {print <<<EOT
-->
<tr><td class="p10" colspan="8"><div class="admin_tips">啊哦，沒有你要的信息！</div></td></tr>
<!--
EOT;
}else{
	foreach($certificateInfo as $v){
print <<<EOT
-->
          <tr class="tr1 vt">
            <td class="td2"><input type="checkbox" name="selid[]" value="$v[id]"></td>
            <td class="td2">$v[state]</td>
            <td class="td2">$v[username]</td>
            <td class="td2">$v[createtime]</td>
            <td class="td2">$v[type]</td>
            <td class="td2">
<!-- 
EOT;
if($v[attach1]){print <<<EOT
-->
				<a href="$v[attach1]" target="_blank" onmouseover="getObj('tips1_$v[id]').style.display=''" onmouseout="getObj('tips1_$v[id]').style.display='none'">正面</a>
				<div class="popout" id="tips1_$v[id]" style="display:none;position:absolute;left:10px;top:20px;"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="bgcorner1"></td><td class="pobg1"></td><td class="bgcorner2"></td></tr><tr><td class="pobg4"></td><td><div class="popoutContent pr" style="width:480px;height:320px;">
				<iframe frameborder='0' style='position:absolute;top:0;width:100%;height:320px;filter:Alpha(opacity=0);_filter:Alpha(opacity=0);opacity:.0;'></iframe>
				<div  style="position:absolute;z-index:1;left:0;top:0;"><img src="$v[attach1]" width="480" height="320" /></div>
				</div></td><td class="pobg2"></td></tr><tr><td class="bgcorner4"></td><td class="pobg3"></td><td class="bgcorner3"></td></tr></tbody></table></div>
<!-- 
EOT;
}
if($v[attach2]){print <<<EOT
-->
				<a href="$v[attach2]" target="_blank" onmouseover="getObj('tips2_$v[id]').style.display=''" onmouseout="getObj('tips2_$v[id]').style.display='none'">背面</a>
				<div class="popout" id="tips2_$v[id]" style="display:none;position:absolute;left:10px;top:20px;"><table border="0" cellspacing="0" cellpadding="0"><tbody><tr><td class="bgcorner1"></td><td class="pobg1"></td><td class="bgcorner2"></td></tr><tr><td class="pobg4"></td><td><div class="popoutContent pr" style="width:480px;height:320px;">
				<iframe frameborder='0' style='position:absolute;top:0;width:100%;height:320px;filter:Alpha(opacity=0);_filter:Alpha(opacity=0);opacity:.0;'></iframe>
				<div  style="position:absolute;z-index:1;left:0;top:0;"><img src="$v[attach2]" width="480" height="320" /></div>
				</div></td><td class="pobg2"></td></tr><tr><td class="bgcorner4"></td><td class="pobg3"></td><td class="bgcorner3"></td></tr></tbody></table></div>
<!-- 
EOT;
}print <<<EOT
-->
            </td>
            <td class="td2">$v[number]</td>
          </tr>
<!--
EOT;
}}
print <<<EOT
-->
        </table>
    </div>
  <div class="cc mb10">$pagination</div>
  <div class="mb10 tac">
	<span class="btn">
		<span><button type="button" onclick="initPost(2)">通過</button></span>
	</span>
	<span class="bt">
		<span><button type="button" onclick="initPost(3)">拒絕</button></span>
	</span>
    <span class="bt"><span><button type="button" onclick="initPost(-1)">刪 除</button></span></span>
  </div>
</form>
<!--
EOT;
}
print <<<EOT
-->

<!--
EOT;
include_once PrintEot('adminbottom');
?>-->