<!--<?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');
?>-->