<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	printFooter();
	exit;
}
$_RawUrl = getRawUrl(true);
$debug = false;
if( $doaction === 'table_service' ) {
	$_tableStatus =& GetTableStatus();
	$_colspan = 8;
?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function selectInverse(chk){
		var ele = null;
		for( var i = 0 ; i < chk.form.elements.length ; i++ ){
			ele = chk.form.elements[i];
			if( !ele ) continue;
			if( ele.disabled != true && ele.type && ele.type.toLowerCase() === 'checkbox' ){
				ele.checked = chk.checked;
			}
		}
	}
	function TableServiceOnSubmit(form){
		var tableNameSelected = false;
		var tableServiceSelected = false;
		if( form.elements['table_service[check]'].checked === true ){
			tableServiceSelected = true;
		}
		if( form.elements['table_service[repair]'].checked === true ){
			tableServiceSelected = true;
		}
		if( form.elements['table_service[analyze]'].checked === true ){
			tableServiceSelected = true;
		}
		if( form.elements['table_service[optimize]'].checked === true ){
			tableServiceSelected = true;
		}
		if( tableServiceSelected === false ){
			alert("<?=$lang['maintance.info1']?>");
			return false;
		}
		for( var i = 0 ; i < form.elements.length ; i++ ){
			if( form.elements[i].name === 'table_name[]' ){
				if( form.elements[i].checked === true ){
					tableNameSelected = true;
					break;
				}
			} else{
				continue;
			}
		}
		if( tableNameSelected === false ){
			alert("<?=$lang['maintance.info1']?>");
			return false;
		}
		return true;
	}
	//-->
	</SCRIPT>
	<br>
	<table border="0" cellspacing="1" cellpadding="1"  align="center" class="tableborder">
<tr> 
<td height="23" align="left" colspan="6" class="tit1">■ <?=$lang['PageTitle']?></td>
</tr>
<tr align="left">
<td height="23" style="width:15%;text-align:center;" class="forumrow" style="LINE-HEIGHT: 140%">
<input type="submit" name="Submit" value="<? echo $lang['maintance.info59']?>" style="color: #FF0000;width:80px;height:50px;border:1px outset;">
</td>
<td height="23" class="forumrow" style="LINE-HEIGHT: 140%">
<li><?=$lang['maintance.info58']?>
</td>
</tr>
</table>
	<!--导航-->
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
<tr align="center">
<td height="25" align="center" <?if($doaction=='table_service'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>  width="10%"><a href="?doaction=table_service"><font color="<?if($doaction=='table_service'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info60']?></font></a></td>
<td height="25" align="center" <?if($doaction=='dump_data'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?> width="10%"><a href="?doaction=dump_data"><font color="<?if($doaction=='dump_data'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info61']?></font></a></td>
<td width="10%" align="center" <?if($doaction=='import_data'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>></font><a href="?doaction=import_data"><font color="<?if($doaction=='import_data'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info62']?></font></a></td>
</tr>
</table>
<!--导航结束-->
		<table cellpadding="0" cellspacing="0" border="0"0 class="tableborder" align="center">
			<form method="post" action="<?=$_RawUrl?>" onsubmit="return TableServiceOnSubmit(this)">
				<input type="hidden" name="sub_action" value="do_submit">
			<tr>
				<td align="left" colspan="<?=$_colspan?>" height="23" class="tdtit"><?=$lang['maintance.info2']?></td>
			</tr>
<?php
if( is_array($_tableStatus) && !empty($_tableStatus) ){
	?>
			<tr class="forumrow2" style="font-size:9pt;">
				<th style="text-align:center;"><input type="checkbox" name="none" onclick="selectInverse(this)"></th>
				<th style="text-align:center;"><?=$lang['maintance.info3']?></th>
				<th style="text-align:right;"><?=$lang['maintance.info4']?></th>
				<th style="text-align:right;" nowrap><?=$lang['maintance.info5']?></th>
				<th style="text-align:right;"><?=$lang['maintance.info6']?></th>
				<th style="text-align:center;"><?=$lang['maintance.info7']?></th>
				<th style="text-align:center;"><?=$lang['maintance.info8']?></th>
				<th width="30%" style="text-align:left;" wrap><?=$lang['maintance.info9']?></th>
			</tr>
<?php
foreach( $_tableStatus as $result ){
	$dataUnit = 'KB';
	$dataLength = (float)$result['Data_length'] / 1024;
	if( $dataLength / 1024 >= 1 ){
		$dataLength = $dataLength / 1024;
		$dataUnit = 'MB';
	}
	$dataLength = number_format($dataLength,2);
	$indexUnit = 'KB';
	$indexLength = (float)$result['Index_length'] / 1024;
	if( $indexLength / 1024 >= 1 ){
		$indexLength = $indexLength / 1024;
		$indexUnit = 'MB';
	}
	$indexLength = number_format($indexLength,2);
	$tableDesc = GetTableDescription($result['Comment'],$result['Name']);
	if( $tableDesc === false ){
		$tableDesc = $lang['TableDescUndefined'];
		$currDidabled = ' disabled ';
	} elseif ($dv.'argue_topic' == $result['Name'] OR $dv.'argue' == $result['Name']) {
		$currDidabled = ' disabled ';
	} else {
		$currDidabled = '';
	}
	is_numeric($result['Update_time']) AND ($result['Update_time'] = gmdate('Y-m-d H:i:s', $result['Update_time']+getUserTimeZoneOffset()));
	is_numeric($result['Create_time']) AND ($result['Create_time'] = gmdate('Y-m-d H:i:s', $result['Create_time']+getUserTimeZoneOffset()));
		?>
			<tr class=forumrow>
				<td align="center"><input type="checkbox" name="table_name[]" value="<?=$result['Name']?>" <?=$currDidabled?>></td>
				<td align="left" height="23">&nbsp;&nbsp;<?=$result['Name']?></td>
				<td align="right"><?=$result['Rows']?></td>
				<td align="right"><?=$dataLength?>&nbsp;<?=$dataUnit?></td>
				<td align="right"><?=$indexLength?>&nbsp;<?=$indexUnit?></td>
				<td align="center"><?=$result['Create_time']?></td>
				<td align="center"><?=$result['Update_time']?></td>
				<td align="left"><?=$tableDesc?></td>
			</tr>
<?php
}
	?>
			<tr>
				<td width="100%" class="forumrow1" align="center" colspan="<?=$_colspan?>" style="text-align:center;"><?=$lang['maintance.info10']?><input type="checkbox" name="table_service[check]" value="1"><?=$lang['maintance.info11']?>&nbsp;<input type="checkbox" name="table_service[analyze]" value="1"><?=$lang['maintance.info12']?>&nbsp;<input type="checkbox" name="table_service[repair]" value="1"><?=$lang['maintance.info13']?>&nbsp;<input type="checkbox" name="table_service[optimize]" value="1"><?=$lang['maintance.info14']?>&nbsp;&nbsp;&nbsp;&nbsp;<input name="submit" class="button" type="submit" value="   <?=$lang['maintance.info15']?>"></td>
			</tr>
			</table>
			<p></p>
		</form>
<?php
}
} elseif( $doaction === 'dump_data' ) {
	$_colspan = 8;
	$_colspan1 = $_colspan - 1;
	if( $debug === true ){
		$formTarget = ' target="_blank" ';
	}
?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	function selectInverse(chk){
		var ele = null;
		for( var i = 0 ; i < chk.form.elements.length ; i++ ){
			ele = chk.form.elements[i];
			if( !ele ) continue;
			if( ele.disabled != true && ele.type && ele.type.toLowerCase() === 'checkbox' && (ele.name === 'dump_tables[]'||ele.name === 'tablename[]') ){
				ele.checked = chk.checked;
			}
		}
	}
	function BackupDataOnSubmit(form){
		var tableNameSelected = false;
		for( var i = 0 ; i < form.elements.length ; i++ ){
			if( form.elements[i].name === 'dump_tables[]' ){
				if( form.elements[i].checked === true ){
					tableNameSelected = true;
					break;
				}
			} else{
				continue;
			}
		}
		if( tableNameSelected === false ){
			alert("<?=$lang['maintance.info1']?>");
			return false;
		}
		return true;
	}
	//-->
	</SCRIPT>
	<style>
	.mybr { font-size:1px; line-height:100%; height:8px; }
	</style>
	<br>
	<table border="0" cellspacing="1" cellpadding="1"  align="center" class="tableborder">
<tr> 
<td height="23" align="left" colspan="6" class="tit1">■ <?=$lang['PageTitle']?></td>
</tr>
<tr align="left">
<td height="23" style="width:15%;text-align:center;" class="forumrow" style="LINE-HEIGHT: 140%">
<input type="submit" name="Submit" value="<? echo $lang['maintance.info59']?>" style="color: #FF0000;width:80px;height:50px;border:1px outset;">
</td>
<td height="23" class="forumrow" style="LINE-HEIGHT: 140%">
<ul style="line-height:200%;">
<li><?=$lang['maintance.info19']?></li>
<ul>
<li><?=$lang['maintance.info20']?></li>
<li><?=$lang['maintance.info21']?></li>
<li><?=$lang['maintance.info22']?></li>
<li><?=$lang['maintance.info22_1']?></li>
</ul>
</li>
<li><?=$lang['maintance.info24']?></li>
</ul>
</td>
</tr>
</table>
	<!--导航-->
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
<tr align="center">
<td height="25" align="center" <?if($doaction=='table_service'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>  width="10%"><a href="?doaction=table_service"><font color="<?if($doaction=='table_service'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info60']?></font></a></td>
<td height="25" align="center" <?if($doaction=='dump_data'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?> width="10%"><a href="?doaction=dump_data"><font color="<?if($doaction=='dump_data'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info61']?></font></a></td>
<td width="10%" align="center" <?if($doaction=='import_data'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>></font><a href="?doaction=import_data"><font color="<?if($doaction=='import_data'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info62']?></font></a></td>
</tr>
</table>
<!--导航结束-->
		<table cellpadding="0" cellspacing="0" border="0" class="tableborder" align="center">
			<form method="post" action="<?=$_RawUrl?>" onsubmit="return BackupDataOnSubmit(this)">
				<input type="hidden" name="sub_action" value="do_submit">
<?php
clearstatcache();
if( !dir_iswritable($outputDir) || ( function_exists('is_executable') && !is_executable($outputDir) ) ){
	?>
						
			<tr align="left">
				<td width="100%" class="forumrow" colspan="<?=$_colspan?>">
						<li><font color="red"><?=$lang['maintance.info17']?><?=$arrDataPath['output_dir']?><?=$lang['maintance.info18']?></font></li>
				</td>
			</tr>
<?php
}
?>
			<tr>
				<td align="center" height="23" class="tdtit" colspan="<?=$_colspan?>" style="text-align:center;"><?=$lang['maintance.info25']?></td>
			</tr>
			<tr align="left">
				<td nowrap class="forumrow" style="text-align:left;"><?=$lang['maintance.info23']?><span style="border-style:solid;border-color:#999999;border-width:1px;"><input type="hidden" name="base_dir" value="<?=$arrDataPath['output_dir']?>"><?=$arrDataPath['output_dir']?>/<input size="57" type="text" name="dump_file" value="<?=$arrDataPath['output_file_noextension']?><?=$arrDataPath['output_file_extension']?>" style="border-width:0;" disabled></span></td>
			</tr>
			<tr align="left">
				<td class="forumrow" colspan="<?=$_colspan?>">
<?php
$displayOpts = 'none';
$selectShell = '';
$selectSymLink = '';
$selectMultiVol = ' checked ';
$disabledMultiVol = '';
$disableShell = ' disabled ';
$disableSymLink = ' disabled ';
if( false AND  TestSymLink() === true ){
	$selectMultiVol = '';
	$selectSymLink = ' checked ';
	$disabledMultiVol = ' disabled ';
	$displayOpts = 'none';
	$disableSymLink = '';
} elseif(TestShellExec() === true ){
	$selectShell = ' checked ';
	$selectSymLink = '';
	$selectMultiVol = '';
	$disabledMultiVol = ' disabled ';
	$disableShell = '';
	$displayOpts = '';
	$shellDisable = '';
} else {
	$selectShell = '';
	$selectSymLink = '';
	$selectMultiVol = ' checked ';
	$disabledMultiVol = '';
	$disableShell = ' disabled ';
	$disableSymLink = ' disabled ';
	$displayOpts = '';
	$shellDisable = '';
}
?>
				<input type="radio" name="dump_method" value="shell" <?=$selectShell?> <?=$disableShell?> onclick="with(this.form.dump_volume_size){disabled=true;};this.form.dump_file.disabled=false;document.getElementById('opts_id').style.display='';"><?=$lang['maintance.info26']?>
				<input type="radio" name="dump_method" value="symlink" <?=$selectSymLink?> <?=$disableSymLink?> onclick="with(this.form.dump_volume_size){disabled=true;};this.form.dump_file.disabled=false;document.getElementById('opts_id').style.display='none';"><?=$lang['maintance.info27']?><input type="radio" name="dump_method" value="multivol" <?=$selectMultiVol?> onclick="with(this.form.dump_volume_size){disabled=false;select();};this.form.dump_file.disabled=false;document.getElementById('opts_id').style.display='';"><?=$lang['maintance.info28']?><input size="8" type="text" name="dump_volume_size" value="2048" <?=$disabledMultiVol?>><input type="radio" name="dump_method" value="pack" onclick="with(this.form.dump_volume_size){disabled=true;};this.form.dump_file.disabled=true;document.getElementById('opts_id').style.display='';" checked>&nbsp;<?=$lang['maintance.info63']?></td>
			</tr>
<?php
$_DefaultCharacterSet = GetDefaultCharacterSet();
?>
			<tr id="opts_id" align="left" style="display:<?=$displayOpts?>;">
				<td class="forumrow" nowrap colspan="<?=$_colspan?>">
					<div class="mybr"></div>
					<fieldset>
						<legend>&nbsp;<?=$lang['maintance.info29']?>&nbsp;</legend>
						<div class="mybr"></div>
						&nbsp;&nbsp;<input type="hidden" name="add_drop_table" value="1"><!--<input type="checkbox" name="add_drop_table" checked value="1">添加 DROP TABLE&nbsp;&nbsp;&nbsp;&nbsp;--><input type="checkbox" name="pack_inc" value="1" checked><?=$lang['maintance.info30_1']?>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="insert_ignore" value="1"><?=$lang['maintance.info30']?>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="delayed_insert" value="1" checked onclick="if(this.checked){this.form.add_locks.checked=false;}"><?=$lang['maintance.info31']?>&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" name="add_locks" value="1" onclick="if(this.checked){this.form.delayed_insert.checked=false;}"><?=$lang['maintance.info32']?>&nbsp;&nbsp;&nbsp;&nbsp;<span title="<?=$lang['maintance.info33']?>"><input type="checkbox" name="disable_keys" value="1" checked><?=$lang['maintance.info34']?></span>&nbsp;&nbsp;&nbsp;&nbsp;<input type="radio" name="extended_insert" checked value="0"><?=$lang['maintance.info35']?><input type="radio" name="extended_insert" value="1"><?=$lang['maintance.info36']?>&nbsp;&nbsp;&nbsp;&nbsp;<?=$lang['maintance.info37']?><input size="5" type="text" name="default_character_set" rawvalue="<?=$_DefaultCharacterSet?>" value="<?=$_DefaultCharacterSet?>" contenteditable="false" onfocus="if(this.value==this.rawvalue){if(confirm('<?=$lang['maintance.info38']?>')){this.contentEditable=true;this.select();}else{this.contentEditable=false;this.blur();}}"><!--<select name="default_character_set"><option value="gbk">gbk字符集</option><option value="big5">繁体字符集</option><option value="utf8">utf-8字符集</option></select>-->
						<div class="mybr"></div>
					</fieldset>
					<div class="mybr"></div>
					<div class="mybr"></div>
					<div class="mybr"></div>
				</td>
			</tr>
<?php
$_tableStatus =& GetTableStatus();
if( is_array($_tableStatus) && !empty($_tableStatus) ){
	?>
			<tr>
				<td align="left" colspan="<?=$_colspan?>" height="23" class1="tit1">
					<table width="100%" cellpadding="2" cellspacing="0" class1="tit1" bgcolor="#E4EDF9">
						<tr class="forumrow1" style="font-size:9pt;">
							<td style="text-align:center;"><input type="checkbox" name="none" onclick="selectInverse(this)"></td>
							<td style="text-align:left;"><?=$lang['maintance.info3']?></td>
							<td style="text-align:right;"><?=$lang['maintance.info4']?></td>
							<td style="text-align:right;" nowrap><?=$lang['maintance.info5']?></td>
							<td style="text-align:right;"><?=$lang['maintance.info6']?></th>
							<td style="text-align:center;"><?=$lang['maintance.info7']?></td>
							<td style="text-align:center;"><?=$lang['maintance.info8']?></td>
							<td width="30%" style="text-align:left;" wrap><?=$lang['maintance.info9']?></td>
						</tr>
<?php
foreach( $_tableStatus as $result ) {
	$dataUnit = 'KB';
	$dataLength = (float)$result['Data_length'] / 1024;
	if( $dataLength / 1024 >= 1 ){
		$dataLength = $dataLength / 1024;
		$dataUnit = 'MB';
	}
	$dataLength = number_format($dataLength,2);
	$indexUnit = 'KB';
	$indexLength = (float)$result['Index_length'] / 1024;
	if( $indexLength / 1024 >= 1 ){
		$indexLength = $indexLength / 1024;
		$indexUnit = 'MB';
	}
	$indexLength = number_format($indexLength,2);
	$tableDesc = GetTableDescription($result['Comment'],$result['Name']);
	if( $tableDesc === false ){
		$tableDesc = $lang['TableDescUndefined'];
		$currDidabled = ' disabled ';
	} elseif ($dv.'argue_topic' == $result['Name'] OR $dv.'argue' == $result['Name']) {
		$currDidabled = ' disabled ';
	} else {
		$currDidabled = '';
	}
	is_numeric($result['Update_time']) AND ($result['Update_time'] = gmdate('Y-m-d H:i:s', $result['Update_time']+getUserTimeZoneOffset()));
	is_numeric($result['Create_time']) AND ($result['Create_time'] = gmdate('Y-m-d H:i:s', $result['Create_time']+getUserTimeZoneOffset()));
		?>
			<tr class=forumrow>
				<td align="center"><input type="checkbox" name="dump_tables[]" value="<?=$result['Name']?>" <?=$currDidabled?>></td>
				<td align="left" height="23">&nbsp;&nbsp;<?=$result['Name']?></td>
				<td align="right"><?=$result['Rows']?></td>
				<td align="right"><?=$dataLength?>&nbsp;<?=$dataUnit?></td>
				<td align="right"><?=$indexLength?>&nbsp;<?=$indexUnit?></td>
				<td align="center"><?=$result['Create_time']?></td>
				<td align="center"><?=$result['Update_time']?></td>
				<td align="left"><?=$tableDesc?></td>
			</tr>
<?php
}
}
	?>
						</table>
					</td>
				</tr>
				<tr>
					<td width="100%" class="forumrow1" align="center" colspan="<?=$_colspan?>" style="text-align:center;"><input name="submit" type="submit" class="button" value="   <?=$lang['maintance.info15']?>   "></td>
				</tr>
		</form>
			</table>
<?php
} elseif( $doaction === 'import_data' ) {
	$_colspan = 3;
	$_colspan1 = $_colspan - 1;
	if( $debug === true ){
		$formTarget = ' target="_blank" ';
	}
	//get pack file list
	$fdh = opendir($outputDir);
	$i=0;
	while($entry = readdir($fdh)) {
		if($entry != '.' && $entry != '..' && eregi(".*\.rec\.php$",$entry)) {
			$arrpacktable[$i] = get_backup_info($outputDir."/".$entry);
			$arrpacktable[$i]['filename']=$entry;
			$arrpacktable[$i]['filesize']=filesize($outputDir."/".$entry);
			$filestat=stat($outputDir."/".$entry);
			$arrpacktable[$i]['date']=$filestat['mtime'];
			$i++;
		}
	}
	//
?>
	<SCRIPT LANGUAGE="JavaScript">
	function selectInverse(chk){
		var ele = null;
		for( var i = 0 ; i < chk.form.elements.length ; i++ ){
			ele = chk.form.elements[i];
			if( !ele ) continue;
			if( ele.type && ele.type.toLowerCase() === 'checkbox' && (ele.name === 'server_files[]'||ele.name === 'tablename[]') ){
				ele.checked = chk.checked;
			}
		}
	}
	function DeleteDataFileOnSubmit(form,sub_action){
		var itemSelected = false;
		for( var i = 0 ; i < form.elements.length ; i++ ){
			if( form.elements[i].name === 'server_files[]' && form.elements[i].checked === true ){
				itemSelected = true;
				break;
			}
		}
		if( itemSelected === false ){
			alert("<?=$lang['maintance.info39']?>");
			return false;
		}
		form.sub_action.value = sub_action;
		form.submit();
		return itemSelected;
	}
	function ImportDataOnSubmit(form,sub_action){
		var canSubmit = false;
		if( form.import_from[0].checked === true ){
			if( form.server_data_file.value !== '' ){
				canSubmit = true;
			}
		} else if( form.import_from[1].checked === true ){
			if( form.local_data_file.value !== '' ){
				canSubmit = true;
			}
		}else{
			canSubmit = true;
		}
		if( canSubmit === false ){
			alert("<?=$lang['maintance.info40']?>");
			return false;
		}
		form.sub_action.value = sub_action;
		form.submit();
		return canSubmit;
	}
	</SCRIPT>
	<br>
	<table border="0" cellspacing="1" cellpadding="1"  align="center" class="tableborder">
<tr> 
<td height="23" align="left" colspan="6" class="tit1">■ <?=$lang['PageTitle']?></td>
</tr>
<tr align="left">
<td height="23" style="width:15%;text-align:center;" class="forumrow" style="LINE-HEIGHT: 140%">
<input type="submit" name="Submit" value="<? echo $lang['maintance.info59']?>" style="color: #FF0000;width:80px;height:50px;border:1px outset;">
</td>
<td height="23" class="forumrow" style="LINE-HEIGHT: 140%">
<ul style="line-height:200%;">
<li><?=$lang['maintance.info41']?></li>
<li><?=$lang['maintance.info42']?></li>
<li><?=$lang['maintance.info43']?></li>
</ul>
</td>
</tr>
</table>
	<!--导航-->
<table border="0" cellspacing="0" cellpadding="0"  align="center" class="tableborder">
<tr align="center">
<td height="25" align="center" <?if($doaction=='table_service'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>  width="10%"><a href="?doaction=table_service"><font color="<?if($doaction=='table_service'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info60']?></font></a></td>
<td height="25" align="center" <?if($doaction=='dump_data'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?> width="10%"><a href="?doaction=dump_data"><font color="<?if($doaction=='dump_data'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info61']?></font></a></td>
<td width="10%" align="center" <?if($doaction=='import_data'){echo 'bgcolor="#C9DEFA"';}else{echo 'bgcolor="#F1F3F5"';}?>></font><a href="?doaction=import_data"><font color="<?if($doaction=='import_data'){echo 'red';}else{echo '#000000';}?>"><?=$lang['maintance.info62']?></font></a></td>
</tr>
</table>
<!--导航结束-->
		<table cellpadding="0" cellspacing="0" border="0" class="tableborder" align="center">
			<form method="post" action="<?=$_RawUrl?>" <?=$formTarget?> enctype="multipart/form-data">
				<input type="hidden" name="sub_action" value="do_submit">
			<tr>
				<td align="left" height="23" class="tdtit" colspan="<?=$_colspan?>" style="text-align:center;"><?=$lang['maintance.info44']?></td>
			</tr>
			<tr class="forumrow">
				<td width="20%" nowrap><input type="radio" name="import_from" value="server" checked onclick="document.getElementById('ttablename').style.display='none';this.form.server_data_file.disabled=!this.checked;this.form.local_data_file.disabled=this.checked;this.form.server_data_file.focus();"><?=$lang['maintance.info45']?></td>
				<td width="80%" colspan="<?=$_colspan1?>"><input type="text" size="29" name="server_data_file"></td>
			</tr>
			<tr class="forumrow1">
				<td><input type="radio" name="import_from" value="local" onclick="document.getElementById('ttablename').style.display='none';this.form.server_data_file.disabled=this.checked;this.form.local_data_file.disabled=!this.checked"><?=$lang['maintance.info46']?></td>
				<td colspan="<?=$_colspan1?>"><input type="file" class="button" size="29" name="local_data_file" disabled></td>
			
			
				<tr class="forumrow">
					<td width="20%" nowrap><input type="radio" name="import_from" value="pack" checked onclick="document.getElementById('ttablename').style.display='block';this.form.server_data_file.disabled=!this.checked;this.form.local_data_file.disabled=this.checked;this.form.server_data_file.focus();"><?=$lang['maintance.info46_2']?></td>
				<td ><input type="checkbox" name="drop_table" onclick="if(this.checked)return confirm('<?=$lang['maintance.info68_1']?>');" value="1"><?=$lang['maintance.info68']?></td>
				<td ><?=$lang['maintance.info46_3']?></td>
			</tr>
		<tr class="forumrow1" height="0">
				<td colspan="<?=$_colspan?>" height="0">
				<!--pack restore-->
				<table width="100%" align="center" cellspacing="0" cellpadding="0" id="ttablename" bgcolor="#EEF7FD">
				<tr bgcolor="#D8E6ED">
				<td width="20%" height="30" align="left" bgcolor="#D8E6ED"><input type="checkbox" onclick="selectInverse(this);" checked>&nbsp;&nbsp;&nbsp;<b><?=$lang['maintance.info72']?></b></td>
				<td width="20%" align="left" bgcolor="#D8E6ED"><b><?=$lang['maintance.info69']?></b></td>
				<td width="20%" align="left" bgcolor="#D8E6ED"><b><?=$lang['maintance.info70']?></b></td>
				<td width="20%" align="left" bgcolor="#D8E6ED"><b><?=$lang['maintance.info71']?></b></td>
				<td width="20%" height="20" align="left" bgcolor="#D8E6ED"><b><?=$lang['maintance.info73']?></b></td>
				</tr>
			 <?php 
			 if(is_array($arrpacktable)){
			 	foreach ($arrpacktable as $packtable){
			 ?>
		    	<tr><td width="20%" height="20" align="left"><input type="checkbox" name="tablename[]" value="<?=$packtable['tablename']?>" checked>&nbsp;&nbsp;&nbsp;<?=$packtable['tablename']?></td><td width="20%" height="25" align="left"><?=$packtable['filename']?></td><td width="20%" height="20" align="left"><?=formatSize($packtable['filesize']);?></td><td width="20%" height="20" align="left"><?=$packtable['recnums'];?></td><td width="20%" height="20" align="left"><?=date('Y-m-d',$packtable['date']);?></td></tr>
			<?php
			 	}
			 }
			?>
				</table>
				
				<!--END pack restore-->
				</td>
			</tr>
			
			<tr class="forumrow">
				<td colspan="<?=$_colspan?>" style="text-align:center;"><input name="importBtn" class="button" type="button" value="   <?=$lang['maintance.info15']?>   " onclick="return ImportDataOnSubmit(this.form,'do_submit')"></td>
			</tr>
<?php
$arrDumpedFiles =& GetDumpedFiles();
if( is_array($arrDumpedFiles) && !empty($arrDumpedFiles) ){
	asort($arrDumpedFiles);
	?>
			<tr>
				<td align="center" height="23" class="tit1" colspan="<?=$_colspan?>" style="text-align:center;"><?=$lang['maintance.info47']?></td>
			</tr>
			<tr>
				<td colspan="<?=$_colspan?>" align="center"> 
					<table cellspacing="1" cellpadding="0" border="0" class="tableborer">
						<tr class="forumrow1">
							<th width="55" style="text-align:center;">
							<input type="checkbox" name="none" onclick="selectInverse(this)"><?=$lang['maintance.info48']?></th>
							<th style="text-align:center;"><?=$lang['maintance.info49']?></th>
							<th style="text-align:center;"><?=$lang['maintance.info7']?></th>
							<th style="text-align:center;"><?=$lang['maintance.info50']?></th>
							<th style="text-align:center;"><?=$lang['maintance.info51']?></th>
							<th style="text-align:center;"><?=$lang['maintance.info52']?></th>
						</tr>
<?php
global $lang;
foreach( $arrDumpedFiles as $key => $val ){
	$currUrlEncodeFile = urlencode("{$val['path']}/{$val['entry']}");
	$currVolNum = $val['identify']['curr_volume_num'];
	if( $currVolNum <= 0 || $currVolNum == 1 ){
		$strTmp1 = '<input type="checkbox" name="server_files[]" value="'.$val['path'].'/'.$val['entry'].'">';
		$strTmp2 = '[<a href="?doaction=import_data&sub_action=do_submit&import_from=server&server_data_file='.$currUrlEncodeFile.'">'.$lang['maintance.info54'].'</a>]';
	} else{
		$strTmp1 = '&nbsp;';
		$strTmp2 = '&nbsp;';
	}
	if( is_numeric($currVolNum) ){
		$currVolNum = '#'.$currVolNum;
	}
	if( $val['identify']['data_format'] === 'MultiVolume' ){
		$currMethod = 'Dvbbs'.$lang['maintance.info56'];
	} elseif( $val['identify']['data_format'] === 'SymLink' ){
		$currMethod = 'Dvbbs SymLink';
	} elseif( $val['identify']['data_format'] === 'MysqlDump' ){
		$currMethod = 'MYSQL Dump';
	} else{
		$currMethod = $lang['maintance.info57'];
	}
	is_numeric($val['create_time']) AND ($val['create_time'] = gmdate('Y-m-d H:i:s', $val['create_time']+getUserTimeZoneOffset()));
		?>
						<tr class="forumrow">
							<td align="center" style="padding:0px;"><?=$strTmp1?></td>
							<td align="center"><a href="<?=$val['path']?>/<?=$val['entry']?>" onclick="alert('<?=$lang['maintance.info55']?>');return false;"><?=$val['entry']?></a></td>
							<td align="center"><?=$val['create_time']?></td>
							<td align="center"><?=$val['file_size']?></td>
							<td align="center"><?=$currMethod?><?=$currVolNum?></td>
							<td align="center"><?=$strTmp2?></td>
						</tr>
<?php
}
	?>
					</table>
				</td>
			</tr>
			<tr>
				<td width="100%" class="forumrow1" align="center" colspan="<?=$_colspan?>" style="text-align:center;"><input name="deleteBtn" type="button" class="button" value="   <?=$lang['maintance.info15_1']?>   " onclick="return DeleteDataFileOnSubmit(this.form,'delete_server_files')"></td>
			</tr>
<?php
}
?>
		</form>
		</table>
<?php
}
?>