<!--<?php
include_once PrintEot('left');
if($job=='bakout'){print <<<EOT
-->
<div class="nav3 mb10">
	<ul class="cc">
		<li class="current"><a href="$basename&job=bakout">數據維護</a></li>
		<li><a href="$basename&job=bakin">數據恢復</a></li>
		<li><a href="$basename&job=ptable">數據庫分卷</a></li>
	</ul>
</div>

<div class="admin_info mb10">
    <h3 class="h1"><b>提示信息</b></h3>
    <div class="legend">您可以根據自己的需要選擇需要備份的數據庫表,導出的數據文件可用"數據恢復"功能<br />為了數據安全,備份文件采用時間戳命名保存,如果備份數據超過設定的大小程序會自動采用分卷備份功能，請耐心等待直到程序提示全部備份完成<br />附件的備份只需手工轉移附件目錄和文件即可,風格備份也同! phpwind不提供單獨備份</div>
</div>
<!--
EOT;
}elseif($job=='bakin'){print <<<EOT
-->
<div class="nav3 mb10">
	<ul class="cc">
		<li><a href="$basename&job=bakout">數據維護</a></li>
		<li class="current"><a href="$basename&job=bakin">數據恢復</a></li>
		<li><a href="$basename&job=ptable">數據庫分卷</a></li>
	</ul>
</div>
<div class="admin_info mb10">
    <h3 class="h1"><b>提示信息</b></h3>
    <div class="legend">本功能在恢復備份數據的同時,將覆蓋原有數據,請確定是否需要恢復,以免造成數據損失<br />數據恢復功能只能恢復由當前版本導出的數據文件,其他軟件導出格式可能無法識別<br />如果一個備份文件有多個分卷，您只需任選一個備份文件導入，程序會自動導入其他分卷<br />選擇類型為目錄的備份文件後，使用“導入指定表的備份數據”功能，就可以只導入這個表的備份數據</div>
</div>
<!--
EOT;
}
if($job=='bakout'){
if ($action == 'repair' || $action == 'optimize') {print <<<EOT
-->
<h2 class="h1">
<span class="mr10"><b>數據庫優化信息</b></span><a href="$basename" class="linka">返回上一級<span class="f9">▲</span></a>
</h2>
<div class="admin_table mb10">
    <table width="100%" cellspacing="0" cellpadding="0">
        <tr class="tr2 vt td_bgB">
            <td>數據庫表</td>
            <td>操作</td>
            <td>信息</td>
        </tr>
<!--
EOT;
foreach($msgdb as $msg){
print <<<EOT
-->
        <tr class="tr1 vt">
            <td class="td2">$msg[Table]</td>
            <td class="td2">$msg[Op]</td>
            <td class="td2">$msg[Msg_type]:$msg[Msg_text]</td>
        </tr>
<!--
EOT;
}print <<<EOT
-->
    </table>
</div>
<!--
EOT;
} else {print <<<EOT
-->
<form action="$basename&" method="post" name="FORM">
<h2 class="h1">
<!--
EOT;
if($type == 'pw'){
$operateTips = 'phpwind自帶數據表';
$pwStyle = 'style="color:#008800"';
print <<<EOT
-->
phpwind自帶數據表
<!--
EOT;
} elseif ($type == 'other'){
$operateTips = '非phpwind自帶數據表';
$NotPwStyle = 'style="color:#008800"';
print <<<EOT
-->
非phpwind自帶數據表
<!--
EOT;
} else {
$operateTips = '數據表(包括phpwind自帶數據表與非phpwind自帶數據表)';
$allStyle = 'style="color:#008800"';
print <<<EOT
-->
數據表
<!--
EOT;
}print <<<EOT
-->
</h2>
<div class="admin_table mb10">
	<table width="100%" align=center cellspacing="0" cellpadding="0">
		<tr class="tr1 vt">
			<td class="td1">數據表類型</td>
            <td class="td2">
				<ul class="list_A list_80">
					<li style="width:80px;"><a href="$basename" $allStyle>所有數據表</a></li>
					<li style="width:120px;"><a href="$basename&t=pw" $pwStyle>phpwind自帶數據表</a></li>
					<li style="width:120px;"><a href="$basename&t=other" $NotPwStyle>非phpwind自帶數據表</a></li>
				</ul>
			</td>
        </tr>
        <tr class="tr1 vt">
			<td class="td1">要操作的數據表</td>
            <td class="td2">
				<ul class="list_A">
					<li class="current"><input type="radio" name="tablerange" value="all" checked="checked" onclick="tableRange();" /> 全部$operateTips</li>
					<li><input type="radio" name="tablerange" value="custom" onclick="getObj('tablelists').style.display=''" /> 自定義選擇</li>
				</ul>
			</td>
        </tr>
    </table>
</div>
<div class="admin_table mb10" id="tablelists" style="display:none">
    <table width="100%">
        <tr class="tr2 vt td_bgB">
			<td width="70"><span onclick="CheckAll(document.FORM)" class="cp">全選</span></td>
            <td width="200">數據庫表</td>
            <td>描述</td>
        </tr>
<!--
EOT;
foreach($tables as $key=>$value){print <<<EOT
-->
        <tr class="tr1 vt">
            <td class="td2" width="70">
<!--
EOT;
if (isset($existTables[$value])) {
$dkey = $PW != 'pw_' ? str_replace($PW,'pw_',$value) : $value;
print <<<EOT
-->
        	<input type="checkbox" name="tabledb[]" value="$dkey" onclick="pwJsCheck(this)" />
<!--
EOT;
} else {print <<<EOT
-->
          	<span class="s1"> PW表丟失 </span>
<!--
EOT;
}
print <<<EOT
-->
            </td>
            <td class="td2">$value</td>
            <td class="td2">{$lang[dbtable][$dkey]}</td>
        </tr>
<!--
EOT;
}print <<<EOT
-->
	</table>
</div>
<h2 class="h1">數據備份選項</h2>
<div class="admin_table mb10">
	<table width="100%" align=center cellspacing="0" cellpadding="0">
		<tr class="tr1 vt">
			<td class="td1">數據插入方式</td>
            <td class="td2">
				<ul class="list_A cc">
					<li><input type="radio" name="insertmethod" value="common" checked="checked" />普通方式</li>
					<li><input type="radio" name="insertmethod" value="extend" />擴展插入</li>
				</ul>
				&nbsp;一條INSERT語句對應一個記錄<br/>&nbsp;一條INSERT語句對應多個記錄
			</td>
        </tr>
        <tr class="tr1 vt">
			<td class="td1">分卷備份</td>
            <td class="td2"><input type="text" class="input input_wa" name="sizelimit" value="2048">&nbsp;每個分卷文件長度(單位: KB)</td>
        </tr>
		<tr class="tr1 vt">
			<td class="td1">壓縮備份文件</td>
            <td class="td2">
<!--
EOT;
if ($isZlibEnabled) {
print <<<EOT
-->
				<ul class="list_A list_80 cc">
					<li><input type="radio" name="compress" value="1" checked="checked" />開啟</li>
					<li><input type="radio" name="compress" value="0" />關閉</li>
				</ul>
				&nbsp;壓縮備份文件以減少佔用的空間
<!--
EOT;
} else {
print <<<EOT
-->
				Zlib庫沒有開啟，無法使用壓縮功能
<!--
EOT;
}
print <<<EOT
-->
			</td>
        </tr>
    </table>
</div>
<div class="tac mb10">
	<p class="mb10">
		<span>選中操作:</span>
		<input type="radio" name="action" value="bak" checked />&nbsp;備份&nbsp;
		<input type="radio" name="action" value="repair" />&nbsp;修復&nbsp;
		<input type="radio" name="action" value="optimize" />&nbsp;優化&nbsp;
	</p>
	<p>
	<!--<span class="bt"><span><button type="button" onclick="CheckAll(document.FORM)">全 選</button></span></span>-->
	<span class="btn"><span><button type="submit" onclick="return confirm('您確認要進行此操作嗎?');">提 交</button></span></span></p>
</div>
</form>
<script type="text/javascript">
function tableRange() {
	getObj('tablelists').style.display='none';
	var elements = document.FORM.getElementsByTagName('input');
	for (var i=0; i < elements.length; i++) {
		if (elements[i].type != 'checkbox' || elements[i].name != 'tabledb[]') continue;
		elements[i].checked = 'checked';
		if (typeof elements[i].onclick == 'function') elements[i].onclick();
	}
	return true;
}

setTimeout(function(){checkAllConflict(document.FORM);}, 100);

function checkAllConflict(form){
	var ifcheck = null;
	for (var i=0;i<form.elements.length-1;i++){
		var e = form.elements[i];
		if(e.type=='checkbox'){
			if (ifcheck === null) ifcheck = !e.checked;
			e.checked = ifcheck;
			if (typeof e.onclick == 'function') e.onclick();
		}
	}
	return ifcheck;
}
</script>
<!--
EOT;
}}elseif($job=='bakin'){
if(!$action || $action == 'listsubcat'){
$action == 'listsubcat' && $isSub = '<input type="hidden" name="issub" value="1">';
if ($action == 'listsubcat' && $showRecover) {
print <<<EOT
-->
<h2 class="h1"><b>單表恢復</b></h2>
<form method="post" action="$basename" name="FORM">
<input type="hidden" name="action" value="singlerestore" />
<input type="hidden" name="pre" value="$pre" />
<div class="admin_table mb10">
	<table width="100%" align=center cellspacing="0" cellpadding="0">
		<tr class="tr1 vt">
			<td class="td1">數據表</td>
            <td class="td2">
				<input class="input input_wa" type="text" name="tablename" value="" />
			</td>
			<td class="td2">
			&nbsp;輸入要恢復的數據表名稱<br/> &nbsp;注意:該操作會將當前備份文件目錄 ($pre) 中該表的數據恢復到數據庫
			</td>
        </tr>
    </table>
</div>
<div class="tac mb10">
<p><span class="btn"><span><button type="submit">提 交</button></span></span></p>
</div>
</form>
<!--
EOT;
}
print <<<EOT
-->
<form method="post" action="$basename" name="FORM">
<input type="hidden" name="action" value="del">
$isSub
<h2 class="h1"><b>站點備份文件</b></h2>
<div class="admin_table mb10">
    <table width="100%">
    <tr class="tr2 vt td_bgB">
		<td width="30"><span onclick="CheckAll(document.FORM)" class="cp">全選</span></td>
        <td>目錄名</td>
		<td>類型</td>
        <td>版本</td>
        <td>備份時間</td>
        <td>卷號</td>
        <td>導入</td>
    </tr>
<!--
EOT;
foreach($filedb as $id=>$bakfile){
$fileLink = $bakfile['isdir'] ? ($bakfile['nosub'] ? "data/sqlback/$bakfile[pre]/$bakfile[name]" : "$basename&action=listsubcat&pre=$bakfile[name]") : "data/sqlback/$bakfile[name]";
print <<<EOT
-->
    <tr class="tr1 vt">
        <td class="td2"><input name="delfile[]" type="checkbox" value="$bakfile[name]" onclick="pwJsCheck(this)" /></td>
        <td class="td2"><a href="$fileLink">$bakfile[name]</a></td>
		<td class="td2">$bakfile[type]</td>
        <td class="td2">$bakfile[version]</td>
        <td class="td2">$bakfile[time]</td>
        <td class="td2">$bakfile[num]</td>
        <td class="td2"><a href="$basename&action=bakincheck&pre=$bakfile[pre]&isdir=$bakfile[isdir]">導入</a></td>
    </tr>
<!--
EOT;
}print <<<EOT
-->
    </table>
</div>
<!--<input name="action" type="hidden" value="del">-->
<div class="mb10 tac">
	<span class="bt"><span><button type="button" onclick="CheckAll(document.FORM)">全 選</button></span></span>
    <span class="bt"><span><button type="submit" name="delete" onclick="return checkset('此功能不可恢復,您確認要刪除選中的備份文件！');">刪除備份</button></span></span>
</div>
</form>
<script type="text/javascript">
function checkset(confirm_info)
{
	if(confirm(confirm_info)){
		return true;
	} else {
		return false;
	}
}
</script>
<!--
EOT;
}elseif($action=='bakincheck'){
print <<<EOT
-->
<form action="$basename&action=bakin&pre=$pre&isdir=$isdir" method="post">
<h2 class="h1"><b>提示信息</b></h2>
<div class="admin_table mb10">
    <table width="100%" cellspacing="0" cellpadding="0">
        <tr class="tr1 vt">
            <td class="td2"><font color="blue">備份恢復功能將覆蓋原來的數據,您確認要導入備份數據！</font></td>
            <td class="td2"><span class="btn2"><span><button type="submit">確認導入備份</button></span></span></td>
        </tr>
    </table>
</div>
<div class="mb10 tac"><span class="bt"><span><button type="pw_msg_back" onclick='javascript:history.go(-1);'>返回繼續操作</button></span></span></div>
</form>
<!--
EOT;
}}include_once PrintEot('adminbottom');
?>-->