<!--<?php print <<<EOT
-->
<style type="text/css">
.sidebar{width:130px;border-right:1px solid $tdcolor;}
.content_thread{margin-left:130px;border-left:1px solid $tdcolor;_float:left;_margin:0;}
.tabB{padding-left:0;}
.content_thread .hB{padding-left:10px;}
.tr3 td,.tr3 th,.tr2 td,.tr2 th{border-bottom:1px solid #dae7f0;padding:5px 0 5px 10px;}
.ftc{border:1px dotted #ccc;background:#f7f7f7;padding:10px;width:760px;}
</style>
<div id="breadCrumb">
		<img align="absmiddle" src="$imgpath/$stylepath/thread/home.gif" alt="forumlist" class="breadHome" /><em class="breadEm"></em><a href="$db_bfn_temp" title="$db_bbsname">$db_bbsname</a><!--
EOT;
if($forum_name){ print <<<EOT
--><em>&gt;</em><a href="thread.php?fid=$fid">$forum_name</a><em>&gt;</em><a href="forumcp.php">版塊管理</a><!--
EOT;
}else{
print <<<EOT
--><em>&gt;</em><a href="forumcp.php">版塊管理</a><!--
EOT;
}
print <<<EOT
-->
</div>
<div id="pw_content">
<!--
EOT;
if(!$action){ print <<<EOT
-->
<div class="h">
	<h2>基本統計信息</h2>
</div>
<div class="t f_one">
<table width="100%" cellspacing="0" cellpadding="0">
<tr class="tr3">
<!--
EOT;
$i=0;
foreach($forumdb as $key=>$value){
$i++;
print <<<EOT
-->
<td valign="top" width="$j_wid">
	<div class="p10">
        <h2 class="mr10"><a href="thread.php?fid=$value[fid]">$value[name]</a></h2>
    	<a href="forumcp.php?action=edit&fid=$value[fid]" class="s7">版主特權</a>
        <div class="s6">
        <p>主 題 數: $value[topic]</p>
        <p>文 章 數: $value[article]</p>
        <p>今日主題:$value[tpost]</p>
        </div>
    </div>
</td>
<!--
EOT;
if($i==4){
$i=0;
print <<<EOT
-->
</tr><tr class="tr3">
<!--
EOT;
}}if($j_sum==4 && $i<4){
for($j=$i;$j<4;$j++){print <<<EOT
-->
<td class="f_one" valign="top" width="$j_wid"><br /></td>
<!--
EOT;
}}print <<<EOT
-->
</tr></table></div>
<!--
EOT;
}elseif($action=='edit'){
${$type} = 'class="current"';
print <<<EOT
-->
	<div id="sidebar" class="f_tree cc">
		<div class="sidebar">
			<div class="myForum">
                <h6>管理選項</h6>
        	</div>
            <div class="sideForum" id="sideForum">
                <dl class="one">
                    <dt>內部留言</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $msg><a href="forumcp.php?action=edit&type=msg&fid=$fid">留言管理</a></li>
                            <li $addmsg><a href="forumcp.php?action=edit&type=addmsg&fid=$fid">添加留言</a></li>
                        </ul>
                    </dd>
                </dl><!--
                <dl class="one">
                    <dt>版塊編輯</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li><a href="forumcp.php?action=edit&type=notice&fid=$fid">公告管理</a></li>
                            <li><a href="forumcp.php?action=edit&type=add&fid=$fid">發布公告</a></li>
                            <li><a href="forumcp.php?action=edit&type=f_type&fid=$fid">主題分類</a></li>
                        </ul>
                    </dd>
                </dl>
                -->
<!--
EOT;
if($isGM || $forumcp_type['addnotice'] == 1 || $forumcp_type['allowtpctype'] == 1){print <<<EOT
-->
				<dl class="one">
                    <dt>版塊編輯</dt>
                    <dd>
                        <ul class="pw_ulD">
<!--
EOT;
if($isGM || $forumcp_type['addnotice'] == 1){print <<<EOT
-->
                        	<li $notice><a href="forumcp.php?action=edit&type=notice&fid=$fid">公告管理</a></li>
                            <li $add><a href="forumcp.php?action=edit&type=add&fid=$fid">發布公告</a></li>
<!--
EOT;
}
if($isGM || $forumcp_type['allowtpctype'] == 1){print <<<EOT
-->
                            <li $f_type><a href="forumcp.php?action=edit&type=f_type&fid=$fid">主題分類</a></li>
<!--
EOT;
}print <<<EOT
-->
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
}print <<<EOT
-->
                <dl class="one">
                    <dt>帖子管理</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $report><a href="forumcp.php?action=edit&type=report&fid=$fid">舉報帖</a></li>
                            <li $reward><a href="forumcp.php?action=edit&type=reward&fid=$fid">懸賞帖</a></li>
                            <li $thread><a href="forumcp.php?action=edit&type=thread&fid=$fid">主題列表</a></li>
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
if($isGM || pwRights($isBM,'viewcheck')){print <<<EOT
-->
                <dl class="one">
                    <dt>帖子審核</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $tcheck><a href="forumcp.php?action=edit&type=tcheck&fid=$fid">主題審核</a></li>
                            <li $pcheck><a href="forumcp.php?action=edit&type=pcheck&fid=$fid">回復審核</a></li>
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
}if($db_recycle){print <<<EOT
-->
				<dl class="one">
                    <dt>回收站</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $trecycle><a href="forumcp.php?action=edit&type=trecycle&fid=$fid">主題回收站</a></li>
                            <li $precycle><a href="forumcp.php?action=edit&type=precycle&fid=$fid">回復回收站</a></li>
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
}if($forumset['commend'] && $first_admin){print <<<EOT
-->
				<dl class="one">
                    <dt>版主特權</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $commend><a href="forumcp.php?action=edit&type=commend&fid=$fid">版主推薦列表</a></li>
                            <li $adminset><a href="forumcp.php?action=edit&type=adminset&fid=$fid">副版主任免</a></li>
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
}elseif($forumset['commend']){print <<<EOT
-->
				<dl class="one">
                    <dt>版主特權</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $commend><a href="forumcp.php?action=edit&type=commend&fid=$fid">版主推薦列表</a></li>
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
}elseif($first_admin){ print <<<EOT
-->
				<dl class="one">
                    <dt>版主特權</dt>
                    <dd>
                        <ul class="pw_ulD">
                        	<li $adminset><a href="forumcp.php?action=edit&type=adminset&fid=$fid">副版主任免</a></li>
                        </ul>
                    </dd>
                </dl>
<!--
EOT;
}print <<<EOT
-->
            </div>
        </div>
        <div class="content_thread cc">
            <div class="content_ie" style="min-height:800px;_height:800px;">
<!--
EOT;
if(in_array($type,array('thread','tcheck','pcheck','trecycle','precycle'))){
$starttime && $starttime = get_date($starttime,'Y-n-j');
$endtime && $endtime = get_date($endtime,'Y-n-j');
print <<<EOT
-->
<script type="text/javascript" src="js/date.js"></script>
<form action="forumcp.php?action=edit&type=$type&fid=$fid" method="post">
<input type="hidden" name="ptable" value="$ptable"/>
<div class="h">搜索</div>
<table width="100%"><tr><td class="p10 f_two">
<span class="mr20">用&nbsp;戶&nbsp;名&nbsp;︰<input class="input" type="text" name="username" size="15" value="$username" /></span>
帖子類型︰<select name="t_type" class="mr20">
		<option value="0">全部帖子</option>
		<option value="digest" $t_type_digest>精華帖</option>
		<option value="active" $t_type_active>活動帖</option>
		<option value="reward" $t_type_reward>懸賞帖</option>
		<option value="sale" $t_type_sale>交易帖</option>
		</select>
發表日期︰<input class="input" type="text" name="starttime" size="15" id="starttime" onClick="javascript:ShowCalendar(this.id)" value="$starttime"/>&nbsp;-&nbsp;<input class="input" type="text" name="endtime" size="15" id="endtime" onClick="javascript:ShowCalendar(this.id)" value="$endtime"/>
<span class="btn2"><span><button type="submit">提 交</button></span></span>
</td></tr></table>
</form>
<!--
EOT;
}print <<<EOT
-->
<!--
EOT;
if($type=='notice'){ print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="type" value="n_order" />
<input type="hidden" name="verify" value="$verifyhash" />
<input type="hidden" name="fid" value="$fid" />
<div class="h">站點公告編輯</div>
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="20">ID</td>
		<td width="*">標題</td>
		<td width="8%">順序</td>
		<td width="8%">狀態</td>
		<td width="90">發布者</td>
		<td width="100">開始時間</td>
		<td width="100">結束時間</td>
		<td width="90">操作</td>
	</tr>
<!--
EOT;
$id=0;
foreach($annoucedb as $value){
$value[ifopen] = $value[ifopen] ? ($timestamp<$value[startdate] ? '未發布' : ($value[enddate] && $timestamp>$value[enddate] ? '已過期' : '已發布')) : '已關閉';
$id++;print <<<EOT
-->
	<tr class="tr3">
		<td>$id</td>
		<td align="left">$value[subject]</td>
		<td><input class="input" name="vieworder[$value[aid]]" value="$value[vieworder]" style="width:20px;"></td>
		<td>$value[ifopen]</td>
		<td>$value[author]</td>
		<td>$value[starttime]</td>
		<td>$value[endtime]</td>
		<td><a href="forumcp.php?action=edit&type=edit&fid=$fid&aid=$value[aid]" class="mr10 s4">[編輯]</a><a href="javascript:;" onclick="return delnotice('$value[aid]')" class="mr10 s4">[刪除]</a></td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
	<tr><td colspan="8" class="p10">$pages</td></tr>
	<tr><td colspan="8"><div class="tac p10"><span class="btn"><span><button type="submit" name="add">提 交</button></span></span></div></td></tr>
</table>
</form>
<script>
function delnotice(aid) {
	if (!aid || !confirm('確定要刪除此公告嗎？')) {
		return false;
	}
	location.href = 'forumcp.php?action=edit&type=n_del&fid=$fid&verify=$verifyhash&aid=' + aid;
	return false;
}
</script>
<!--
EOT;
}elseif(in_array($type,array('add','edit'))){print <<<EOT
-->
<script type="text/javascript" src="js/date.js"></script>
<form name="FORM" method="post" action="forumcp.php?">
<input type="hidden" name="verify" value="$verifyhash" />
<input type="hidden" name="action" value="$action">
<input type="hidden" name="type" value="$type">
<input type="hidden" name="fid" value="$fid">
<input type="hidden" name="aid" value="$aid">
<input type="hidden" name="step" value="2">
<div class="h">更新公告信息</div>
<div>
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr class="tr3">
        	<td width="100">是否開啟:</td>
            <td colspan="2"><label class="mr20" for="ifopen1"><input type="radio" id="ifopen1" name="ifopen" value="1" $ifopen_Y> 開啟</label><label for="ifopen0"><input type="radio" id="ifopen0" name="ifopen" value="0" $ifopen_N> 關閉</label></td>
        </tr>
		<tr class="tr3 f_two">
        	<td>公告標題</td>
			<td colspan="2"><input class="input" name="atc_title" value="$subject" size="35"></td>
        </tr>
		<tr class="tr3">
        	<td>起始日期<br />結束日期</td>
			<td width="120"><input class="input" name="startdate" id="starttime" onclick="ShowCalendar(this.id,1);"  value="$startdate" size="15" style="margin-bottom:8px;"><br /><input class="input" id="endtime" onclick="ShowCalendar(this.id,1);" name="enddate" value="$enddate" size="15"></td>
            <td>格式:(YYYY-MM-DD HH:II，如:1983-12-20 00:00)<br />起始時間:公告開始發布的時間，留空則使用當前時間<br />結束時間:公告結束發布的時間，留空則公告不結束</td>
       	</tr>
		<tr class="tr3 f_two">
        	<td>顯示順序</td>
			<td colspan="2"><input class="input" name="vieworder" value="$vieworder" size="35"></td>
        </tr>
		<tr class="tr3 vt">
        	<td>公告內容<br /><span class="s2">不支持 html 代碼</span></td>
            <td colspan="2" style="padding-right:10px;">
<!--
EOT;
require PrintEot('wysiwyg_editor_common');
print <<<EOT
-->
			</td></tr>
		<tr>
            <td class="p10 tac" colspan="3"><span class="btn"><span><button type="submit" name="add">提 交</button></span></span></td>
        </tr>
</table>
</div>
</form>
<script src="js/wind_editor.js"></script>
<script src="js/post.js"></script>
<!--
EOT;
}elseif($type=='report'){ print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">會員舉報帖處理</div>
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="25">ID</td>
		<td width="60">版塊</td>
		<td width="60">帖子位置</td>
		<td width="90">反映用戶</td>
		<td>原因:</td>
		<td width="60">報告類型</td>
		<td width="40">刪除</td>
	</tr>
<!--
EOT;
$id=0;
foreach($reportdb as $report){
$id++;
print <<<EOT
-->
	<tr class="tr3 vt">
		<td>$id</td>
		<td><a href="thread.php?fid=$report[fid]" target="_blank">$report[fname]</a></td>
		<td><a href="read.php?tid=$report[tid]#$report[pid]" target="_blank">進入帖子</a></td>
		<td><a target="_blank" href="{$db_userurl}$report[uid]">$report[username]</a></td>
		<td><div style="line-height:18px;height:18px;overflow:hidden;width:400px;" title="$report[reason]">$report[reason]</div></td>
<!--
EOT;
if($report[type]==1){ print <<<EOT
-->
		<td>優秀帖子</td>
<!--
EOT;
}else{ print <<<EOT
-->
		<td>不良帖子</td>
<!--
EOT;
} print <<<EOT
-->
		<td><input type="checkbox" name="selid[]" value="$report[id]" /></td></tr>
<!--
EOT;
}print <<<EOT
-->
	<tr><td colspan="7" class="p10">$pages</td></tr>
	<tr>
		<td colspan="7" class="p10 tac">
		<span class="bt"><span><button type="button" name="chkall" onclick="CheckAll(this.form)">全 選</button></span></span>
		<span class="btn"><span><button type="submit" name="add">提 交</button></span></span>
		</td>
	</tr>
</table>
<input type="hidden" name="action" value="del" />
<input type="hidden" name="fid" value="$fid" />
<input type="hidden" name="type" value="report" />
</form>
<!--
EOT;
}elseif($type=='f_type'){ print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">版塊主題分類</div>
	<table width="100%" cellspacing="0" cellpadding="0">
		<tr class="tr3">
			<td width="70">列表顯示︰</td>
			<td>
				<label class="mr20"><input type="radio" value="1" $addtpctype_Y name="addtpctype" /> 開啟</label>
				<label class="mr20"><input type="radio" value="0" $addtpctype_N name="addtpctype" /> 關閉</label><span class="s6">（開啟後帖子列表頁顯示主題分類）</span>
			</td>
		</tr>
		<tr class="tr3 f_two">
			<td width="70">發帖控制︰</td>
			<td>
				<label class="mr20"><input type="radio" value="2" $t_type_2 name="t_type" /> 強制分類</label>
				<label class="mr20"><input type="radio" value="1" $t_type_1 name="t_type" /> 允許分類</label>
				<label class="mr20"><input type="radio" value="0" $t_type_0 name="t_type" /> 關閉分類</label>
			</td>
		</tr>
		<tr class="tr3 vt">
			<td style="padding:0;border-bottom:0;" colspan="2">
				 <div class="admin_table_c">
						<table cellpadding="0" cellspacing="0" width="100%">
								<tr class="tr2">
										<td width="40">系統組</td>
										<td width="60">順序</td>
										<td width="175">名稱</td>
										<td width="350">圖標URL</td>
										<td width=""><a class="cp s2" onclick="addtype();">[添加一級分類]</a></td>
									</tr>
<!--
EOT;
foreach ($typedb as $key => $value){
$ifsystype = $value['ifsys'] ? 'checked' : '';
print <<<EOT
-->
									<tr id="ttype_$value[id]">
										<td><input type="checkbox" value="1" name="t_sys_db[$key]" $ifsystype /></td>
										<td><input type="text" class="input" style="width:20px;" value="$value[vieworder]" name="t_view_db[$key]"></td>
										<td><input type="text" class="input input_wa" value="$value[name]" name="t_db[$key]" /></td>
										<td><input type="text" class="input input_wb" value="$value[logo]" name="t_logo_db[$key]" /></td>
										<td><a href="javascript:;" onclick="addSubType($value[id]);" class="s4 mr10">[添加二級分類]</a><a href="forumcp.php?action=edit&type=f_type&fid=$fid&dodel=delttype&typename=top&id=$value[id]" onclick="return confirm('確定要刪除此主題分類嗎？刪除此主題分類將同時刪除其二級分類');">[刪除]</a></td>
									</tr>
<!--
EOT;
	foreach ($subtypedb as $k => $v){
		if ($key == $v['upid']){
		$ifsubsystype = $v['ifsys'] ? 'checked' : '';
print <<<EOT
-->
									<tr id="ttype_$v[id]">
										<td><input type="checkbox" value="1" name="t_sys_db[{$v[id]}]" $ifsubsystype /></td>
										<td>|&mdash;&nbsp;<input type="text" class="input" style="width:20px;" name="t_view_db[{$v[id]}]" value="$v[vieworder]"></td>
										<td><input type="text" class="input input_wa" value="$v[name]" name="t_db[{$v[id]}]" /></td>
										<td><input type="text" class="input input_wb" value="$v[logo]" name="t_logo_db[{$v[id]}]" /></td>
										<td><a href="forumcp.php?action=edit&type=f_type&fid=$fid&dodel=delttype&typename=sub&id=$v[id]" onclick="return confirm('確定要刪除此主題分類嗎？');">[刪除]</a></td>
									</tr>
<!--
EOT;
		}
	}print <<<EOT
-->
									<tbody id="t_sub_body_$value[id]"></tbody>
<!--
EOT;
}print <<<EOT
-->
								<tbody id="tbody"></tbody>
								<tbody id="tmode" style="display:none"><tr><td></td><td><input type="text" class="input" style="width:20px;" name="new_t_view_db[]"></td><td><input type="text" class="input input_wa" value="" name="new_t_db[]" /></td><td><input type="text" class="input input_wb" name="new_t_logo_db[]" /></td><td>&nbsp;</td></tr></tbody>
								<tbody id="t_sub_mode" style="display:none"><tr><td></td><td>|&mdash;&nbsp;<input type="text" class="input" style="width:20px;" name="new_t_sub_view_db"></td><td><input type="text" class="input input_wa" value="" name="new_t_sub_db" /></td><td><input type="text" class="input input_wb" name="new_t_sub_logo_db" /></td><td>&nbsp;</td></tr></tbody>
						</table>
					</div>
       </td>
    </tr>
</table>
<div class="p10 tac"><span class="btn"><span><button type="submit" name="add">提 交</button></span></span></div>
<input type="hidden" name="action" value="edit" />
<input type="hidden" name="type" value="f_type" />
<input type="hidden" name="fid" value="$fid" />
<input type="hidden" name="step" value="3" />
</form>
<script type="text/javascript" src="js/pw_ajax.js"></script>
<script>
function addtype(){
	var s = getObj('tmode').firstChild.cloneNode(true);
	getObj('tbody').appendChild(s);
}

function addSubType(id) {
	var inputs = getObj('t_sub_mode').getElementsByTagName('input');
	inputs[0].name = "new_t_sub_view_db\["+id+"\]\[\]";
	inputs[1].name = "new_t_sub_db\["+id+"\]\[\]";
	inputs[2].name = "new_t_sub_logo_db\["+id+"\]\[\]";
	var s = getObj('t_sub_mode').firstChild.cloneNode(true);
	getObj('t_sub_body_'+id).appendChild(s);
}

addtype();
</script>
<!--
EOT;
}elseif($type=='reward'){print <<<EOT
-->
<form action="forumcp.php" method="post">
<div class="h">懸賞帖到期處理</div>
<table width="100%" align="center" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="35">ID</td>
		<td width="*">懸賞主題</td>
		<td width="12%">懸賞作者</td>
		<td width="12%">&nbsp;懸賞時間</td>
		<td width="15%">版塊</td>
		<td width="12%">最佳答案獎勵</td>
		<td width="12%">熱心助人獎勵</td>
	</tr>
<!--
EOT;
$i=($page-1)*$db_perpage;
foreach($threaddb as $key=>$thread){
$i++;
print <<<EOT
-->
	<tr class="tr3 vt">
		<td>$i</td>
		<td align="left"><a href="read.php?tid=$thread[tid]" target="_blank">$thread[subject]</a></td>
		<td><a href="{$db_userurl}$thread[authorid]" target="_blank">$thread[author]</a></td>
		<td>$thread[postdate]</td>
		<td><a href="thread.php?fid=$fid">{$forum[$fid][name]}</a></td>
		<td>$thread[binfo]</td>
		<td>$thread[ainfo]</td>
	</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
</form>
<!--
EOT;
}elseif($type=='thread'){ print <<<EOT
-->
<form action="mawhole.php?jumptype=forumcp" method="post">
<div class="h">主題列表</div>
<table width="100%" align="center" cellspacing="0" cellpadding="0">
	<tr class="tr2">
		<td width="35">選項</td>
		<td>標題</td>
		<td width="100px">作者</td>
		<td width="120px">發表日期</td>
	</tr>
<!--
EOT;
foreach($threaddb as $key=>$thread){print <<<EOT
-->
<tr class="tr3 vt">
	<td><input type="checkbox" name="tidarray[]" value="$thread[tid]" /></td>
	<td>
<!--
EOT;
if($thread[specialsort]==PW_THREADSPECIALSORT_KMD){print <<<EOT
-->
<img src="$imgpath/pwicon/headtopic_4.gif" alt="孔明燈帖標志" align="absmiddle" />		
<!--
EOT;
}elseif($thread[topped]){print <<<EOT
-->
<img src="$imgpath/$stylepath/file/headtopic_$thread[topped].gif" alt="置頂帖" align="absmiddle" />
<!--
EOT;
}print <<<EOT
-->
		<a href="read.php?tid=$thread[tid]" target="_blank">$thread[subject]</a>
<!--
EOT;
if($thread[digest]){ print <<<EOT
-->
<img src="$imgpath/$stylepath/file/digest_$thread[digest].gif" alt="精華帖" align="absmiddle" />
<!--
EOT;
}print <<<EOT
-->
	</td>
	<td><a target="_blank" href="{$db_userurl}$thread[authorid]">$thread[author]</a></td>
	<td>$thread[postdate]</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<div class="tac p10">
	<span class="bt"><span><button type="button" name="chkall" onclick="CheckAll(this.form)">全 選</button></span></span>
	<span class="btn"><span><button type="submit" name="hello">刪 除</button></span></span>
</div>
<input type="hidden" name="action" value="del" />
<input type="hidden" name="fid" value="$fid" />
</form>
<!--
EOT;
}elseif($type=='tcheck'){print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">主題審核</div>
<table width="100%" align="center" cellspacing="0" cellpadding="0">
<tr class="tr2">
	<td width="35">選項</td>
	<td>標題</td>
	<td width="100px">作者</td>
	<td width="120px">發表日期</td>
</tr>
<!--
EOT;
foreach($threaddb as $key=>$thread){print <<<EOT
-->
<tr class="tr3 vt">
	<td><input type="checkbox" name="selid[]" value="$thread[tid]" /></td>
	<th onclick="content('$thread[tid]');" class="cp"><a href="read.php?tid=$thread[tid]" target="_blank" class="s4 fr">[查看原帖]</a>$thread[subject]</th>
	<td><a href="{$db_userurl}$thread[authorid]">$thread[author]</a></td>
	<td>$thread[postdate]</td>
</tr>
<tr class="tr3" id="content_$thread[tid]" style="display:none;"><td colspan="4" style="padding:5px 10px;"><div class="ftc">$thread[content]</div></td></tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<!--
EOT;
if($pages){print <<<EOT
-->
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<!--
EOT;
}print <<<EOT
-->
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="fid" value="$fid" />
<div class="p10 f_two">
		短消息通知︰
		<label class="mr10"><input type="radio" name="ifmsg" value="1" checked />是</label>
		<label class="mr20"><input type="radio" name="ifmsg" value="0"/>否</label><span class="mr20 gray">|</span>審核︰
	<label class="mr10"><input type="radio" name="step" value="3" checked /> 通過</label>
	<label class="mr10"><input type="radio" name="step" value="5" /> 刪除</label>
	<span class="bt2"><span><button type="button" onclick="CheckAll(this.form)" name="chkall">全 選</button></span></span>
	<span class="btn2"><span><button type="submit" name="hello">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($type=='pcheck'){print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">
<!--
EOT;
if($db_plist && count($db_plist)>1){print <<<EOT
-->
<select onchange="window.location=('forumcp.php?action=$action&type=$type&fid=$fid&ptable='+this.value);" class="fr" name="ptable">$p_table</select>
<!--
EOT;
}print <<<EOT
-->
回復審核</div>
<table width="100%" class="z">
<tr class="tr2">
	<td width="35">選項</td>
	<td>回復內容</td>
	<td width="100px">作者</td>
	<td width="120px">發表日期</td>
</tr>
<!--
EOT;
foreach($postdb as $key=>$post){print <<<EOT
-->
<tr class="tr3">
	<td><input type="checkbox" name="selid[]" value="$post[pid]" /></td>
	<th onclick="content('$post[pid]');"><a href="job.php?action=topost&tid=$post[tid]&pid=$post[pid]" target="_blank" class="fr s4">[查看原帖]</a>$post[subject]</th>
	<td><a href="{$db_userurl}$post[authorid]">$post[author]</a></td>
	<td>$post[postdate]</td>
</tr>
<tr class="tr3" id="content_$post[pid]" style="display:none;"><td colspan="4" style="padding:5px 10px"><div class="ftc">$post[content]</div></td></tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<!--
EOT;
if($pages){print <<<EOT
-->
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<!--
EOT;
}print <<<EOT
-->
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="fid" value="$fid" />
<div class="p10 f_two">
		短消息通知︰
		<label class="mr10"><input type="radio" name="ifmsg" value="1" checked />是</label>
		<label class="mr20"><input type="radio" name="ifmsg" value="0"/>否</label><span class="mr20 gray">|</span>審核︰
	<label class="mr10"><input type="radio" name="step" value="3" checked /> 通過</label>
	<label class="mr10"><input type="radio" name="step" value="5" /> 刪除</label>
	<span class="bt2"><span><button type="button" onclick="CheckAll(this.form)" name="chkall">全 選</button></span></span>
	<span class="btn2"><span><button type="submit" name="hello">提 交</button></span></span>
</div>
</form>
<!--
EOT;
}elseif($type=='commend'){print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">版主推薦列表</div>
<table width="100%" align="center" cellspacing="0" cellpadding="0">
<tr class="tr2">
	<td width="30">選項</td>
	<!--td width="35">ID</td-->
	<td>標題</td>
	<td width="100px">作者</td>
	<td width="120px">發表日期</td>
</tr>
<!--
EOT;
$i=0;
foreach($commendThread as $key=>$thread){
$i++;
print <<<EOT
-->
<tr class="tr3">
	<td><input type="checkbox" name="selid[]" value="$thread[tid]" /></td>
	<!--td>$i</td-->
	<th><a href="read.php?tid=$thread[tid]" target="_blank">$thread[subject]</a></th>
	<td><a href="{$db_userurl}$thread[authorid]">$thread[author]</a></td>
	<td>$thread[postdate]</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="fid" value="$fid" />
<input type="hidden" name="step" value="2" />
<div class="p10 tac">
	<span class="bt"><span><button type="button" onclick="CheckAll(this.form)" name="chkall">全 選</button></span></span>
	<span class="btn"><span><button type="submit" name="hello">刪 除</button></span></span>
</div></form>
<!--
EOT;
}elseif($type=='adminset'){print <<<EOT
-->
<form action="forumcp.php?action=edit&type=$type" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">副版主任免</div>
<table width="100%">
	<tr class="tr3">
		<td width="80">第一版主</td>
		<td>$firstadmin</td>
	</tr>
	<tr class="tr3 f_twp">
		<td>版主</td>
		<td><input class="input input_wb" type="text" name="forumadmin" value="$s_admin" /></td>
	</tr>
</table>
<input type="hidden" name="fid" value="$fid" />
<input type="hidden" name="step" value="3" />
<div class="tac p10"><span class="btn"><span><button type="submit" name="hello">提 交</button></span></span></div></form>
<!--
EOT;
}elseif($type=='trecycle' && $db_recycle){print <<<EOT
-->
<div class="h">主題回收站</div>
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<table width="100%" style="table-layout:fixed;">
<tr class="tr2">
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
	<td width="35">選擇</td>
<!--
EOT;
}print <<<EOT
-->
	<td>標題</td>
	<td width="80px">作者</td>
	<td width="120px">發帖時間</td>
	<td width="80px">管理員</td>
	<td width="120px">刪除日期</td>
</tr>
<!--
EOT;
foreach($recycledb as $key=>$thread){
$thread['fname'] && $fromforum = '['.$thread['fname'].']';
print <<<EOT
-->
<tr class="tr3">
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
	<td><input type="checkbox" name="ids[]" value="$thread[tid]" /></td>
<!--
EOT;
}print <<<EOT
-->
	<th><a href="thread.php?fid=$thread[fid]" target="_blank" class="fr s4">$fromforum</a><span class="cp" onclick="content('$thread[tid]');">$thread[subject]</span></th>
	<td><a href="{$db_userurl}$thread[authorid]">$thread[author]</a></td>
	<td>$thread[postdate]</td>
	<td>$thread[admin]</td>
	<td>$thread[deltime]</td>
</tr>
<tr class="tr3" id="content_$thread[tid]" style="display:none;"><td colspan="5" style="padding:5px 10px"><div class="ftc">$thread[content]</div></td></tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="fid" value="$fid" />
<div class="tac p10">
<!--
EOT;
if($forumset['recycle']){print <<<EOT
-->
<select name="step" class="mr5">
	<option value="0">選擇操作</option>
<!--
EOT;
}if($forumset[recycle] & 2){print <<<EOT
-->
	<option value="1">刪除帖子</option>
<!--
EOT;
}if($forumset[recycle] & 4){print <<<EOT
-->
	<option value="2">還原帖子</option>
<!--
EOT;
}if($forumset[recycle] & 8){print <<<EOT
-->
	<option value="3">清空帖子</option>
<!--
EOT;
}print <<<EOT
-->
</select>
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
	<span class="bt"><span><button type="button" onclick="CheckAll(this.form)">全 選</button></span></span>
	<span class="btn"><span><button type="submit" name="hello" onclick="return Psubmit(this.form)">提 交</button></span></span>
<!--
EOT;
}print <<<EOT
-->
</div></form>
<!--
EOT;
}elseif($type=='precycle' && $db_recycle){print <<<EOT
-->
<form action="forumcp.php" method="post" name="FORM">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">
<!--
EOT;
if($db_plist && count($db_plist)>1){print <<<EOT
-->
<select onchange="window.location=('forumcp.php?action=$action&type=$type&fid=$fid&ptable='+this.value);" class="fr" name="ptable">$p_table</select>
<!--
EOT;
}print <<<EOT
-->
回復回收站
</div>
<table width="100%" style="table-layout:fixed;">
<tr class="tr2">
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
	<td width="35">選擇</td>
<!--
EOT;
}print <<<EOT
-->
	<td>標題</td>
	<td width="80">作者</td>
	<td width="120">回帖時間</td>
	<td width="80">管理員</td>
	<td width="120">刪除日期</td>
</tr>
<!--
EOT;
foreach($recycledb as $key=>$posts){print <<<EOT
-->
<tr class="tr3">
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
	<td><input type="checkbox" name="ids[]" value="$posts[pid]" /></td>
<!--
EOT;
}print <<<EOT
-->
	<th class="cp" onclick="content('$posts[pid]');"><a href="read.php?tid=$posts[tid]" target="_blank" class="fr s4">[查看主題帖]</a>$posts[subject]</th>
	<td><a href="{$db_userurl}$posts[authorid]">$posts[author]</a></td>
	<td>$posts[postdate]</td>
	<td>$posts[admin]</td>
	<td>$posts[deltime]</td>
</tr>
<tr class="tr3" id="content_$posts[pid]" style="display:none;"><td colspan="5" style="padding:5px 10px"><div class="ftc">$posts[content]</div></td></tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="fid" value="$fid" />
<div class="tac p10">
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
<select name="step" class="mr5">
<!--
EOT;
if($forumset[recycle]){print <<<EOT
-->
	<option value="0">選擇操作</option>

<!--
EOT;
}if($forumset[recycle] & 2){print <<<EOT
-->
	<option value="1">刪除回復</option>
<!--
EOT;
}if($forumset[recycle] & 4){print <<<EOT
-->
<option value="2">還原回復</option>
<!--
EOT;
}if($forumset[recycle] & 8){print <<<EOT
-->
<option value="3">清空回復</option>
<!--
EOT;
}print <<<EOT
-->
</select>
<!--
EOT;
}
if($forumset[recycle]){print <<<EOT
-->
	<span class="bt"><span><button type="button" name="chkall" onclick="CheckAll(this.form)">全 選</button></span></span>
	<span class="btn"><span><button type="submit" name="hello" onclick="return Psubmit(this.form)">提 交</button></span></span>
</div></form>
<!--
EOT;
}}elseif($type=='addmsg'){
$adminsel = '<label class="mr10"><input type="checkbox" name="msgtype" value="1" checked>所有版主</label>';
foreach ($adminname as $val) {
	if($val!=$windid && $val){
		$adminsel .= "<label class=\"mr10\"><input type=\"checkbox\" name=\"toname[]\" value=\"$val\">$val</label>";
	}
}
print <<<EOT
-->
<form name="FORM" method="post" action="forumcp.php?">
<input type="hidden" name="verify" value="$verifyhash" />
<input type="hidden" name="action" value="$action">
<input type="hidden" name="type" value="$type">
<input type="hidden" name="fid" value="$fid">
<input type="hidden" name="step" value="2">
<div class="h">添加內部留言</div>
<table width="100%" cellspacing="0" cellpadding="0">
	<tr class="tr3">
		<td width="80">留言對象</td>
		<td>$adminsel<span class="s6"> （管理員及總版主不受限制）</span></td>
	</tr>
	<tr class="tr3 f_two">
		<td>有效期時間至</td>
		<td><input class="input" name="savetime" value="30" size="4"> 天 （請輸入整數）</td>
	</tr>
	<tr class="tr3">
		<td valign="top">留言內容</td>
		<td><textarea name="message" class="textareaA"></textarea></td>
	</tr>
	<tr>
		<td></td>
		<td style="padding:5px;"><span class="btn2"><span><button type="submit" name="add">提 交</button></span></span></td>
	</tr>
</table>
</form>
<!--
EOT;
}elseif($type=='msg'){ print <<<EOT
-->
<form action="forumcp.php" method="post">
<input type="hidden" name="verify" value="$verifyhash" />
<div class="h">內部留言管理</div>
<table width="100%" style="table-layout:fixed;">
<tr class="tr2">
	<td width="35">選項</td>
	<td>內容</td>
	<td width="100">留言人</td>
	<td width="120">留言時間</td>
	<td width="120">有效期時間至</td>
</tr>
<!--
EOT;
foreach($msgdb as $key=>$val){
$val['ifuse'] = !S::inArray($val['uid'],$notManager) ? $val['ifuse'] : '';
print <<<EOT
-->
<tr class="tr3">
	<td><input type="checkbox" name="ids[]" value="$val[id]" $val[ifuse]/></td>
	<td  id="content_$val[id]">$val[message]</td>
	<td>$val[username]</td>
	<td>$val[posttime]</td>
	<td>$val[savetime]</td>
</tr>
<!--
EOT;
}print <<<EOT
-->
</table>
<table width="100%"><tr><td class="p10">$pages</td></tr></table>
<input type="hidden" name="action" value="$action" />
<input type="hidden" name="type" value="$type" />
<input type="hidden" name="fid" value="$fid" />
<input type="hidden" name="demsg" value="1">
<div class="p10 tac">
<span class="bt"><span><button type="button" name="chkall" onclick="CheckAll(this.form)">全 選</button></span></span>
<span class="btn"><span><button type="submit">刪除</button></span></span>
</div></form>
<!--
EOT;
}print <<<EOT
-->
            </div>
        </div>
    </div>
<script>
/*function CheckAll(form){
	for(var i=0;i<form.elements.length-2;i++){
		var e = form.elements[i];
		if(e.type=='checkbox' && e.disabled == false) e.checked = e.checked == true ? false : true;
	}
}*/

function CheckAll(form) {
	var ifcheck = null;
	for (var i=0;i<form.elements.length-2;i++){
		var e = form.elements[i];
		if(e.type=='checkbox' && e.disabled == false){
			if (ifcheck === null) ifcheck = !e.checked;
			e.checked = ifcheck;
		}
	}
	return ifcheck;	
}

function content(id){
	var o = getObj('content_'+id);
	o.style.display = o.style.display == 'none' ? '' : 'none';
}
function Psubmit(form){
	//var ids = form['ids[]'];
	var ids = form.getElementsByTagName('input');
	var flag = false;
	for(var i=0; i<ids.length; i++){
		if(ids[i].type == 'checkbox' && ids[i].name == 'ids[]' &&  ids[i].checked){
			flag = true; break;
		}
	}
	if(false == flag){
		showDialog({type:'warning',message:'請選擇要操作的項!'});return false;
	}
	switch(form.step.value){
		case '0':
			alert('請先選擇操作,再提交');
			break;
		case '1':
			return confirm('您確認要進行刪除操作嗎?');
			break;
		case '2':
			return confirm('您確認要進行還原操作嗎?');
			break;
		case '3':
			return confirm('您確認要對該版塊進行清除操作嗎?');
			break;
	}
	return false;
}
</script>
<!--
EOT;
}
print <<<EOT
-->
</div>
<script type="text/javascript">
/*側欄版塊展開動態*/
window.onReady(function(){
	var div = document.getElementById("sideForum");
	var tt = div.getElementsByTagName("dt");
	for(i=0; i<tt.length; i++){
		tt[i].index = i;
		tt[i].onclick= function(){
			document.cookie='hide_'+this.index+'='+(this.parentNode.className == 'one' ? 1 : 0);
			this.parentNode.className = this.parentNode.className == 'one'?'':'one';
		}
	}
	/*
	var sfs = document.getElementById('shortcutforum').getElementsByTagName('li');
	for (i=0;i<sfs.length;i++) {
		sfs[i].onmouseover=function(){this.className='hover';}
		sfs[i].onmouseout=function(){this.className='';}
	}
	*/
});

function toggleSidebar(){
	var sidebar = getObj('sidebar');
	var toggle = (sidebar.className == 'f_tree cc') ? 0: 1;
	SetCookie('toggle',toggle);	
	getObj('sidebar').className = (sidebar.className == 'f_tree cc')?"f_tree cc sideClose":'f_tree cc';
}
</script>
<!--
EOT;
?>-->