$curr_source = str_replace(".sql", "_v{$curr_page}.sql", $filename); $next_source = str_replace(".sql", "_v{$next_page}.sql", $filename); //echo $curr_source."==".$next_source; //恢复数据 $ActionMessage = restore_file($curr_source); //是否有下一卷 if (file_exists($data_path . "/" . $next_source)) { header("Content-Type: text/html; charset=utf-8"); $url = "db_restore.php?action=save&curr_page={$next_page}&restorefile={$filename}|{$filecount}"; $content = "{$strDataRestoreAlert1}<font color=\"red\"> " . $next_page . " / " . $filecount . "</font>" . $strDataRestoreAlert2; echo NavigatorNextURL($url, $content); exit; } } else { //恢复单个文件 $ActionMessage = restore_file($filename); } if (!empty($ActionMessage)) { //如果是F2blog v1.0数据,则进行升级数据,v1.0的categories没有cateIcons这个字段。 $DMC->query("select cateIcons from {$DBPrefix}categories limit 0,1", "T"); if ($DMC->error()) { include "f211to12.inc.php"; } //如果是F2blog v1.1 beta 11.11,则增加setting设定值。 if (!$DMC->fetchArray($DMC->query("select * from " . $DBPrefix . "setting where settName='treeCategory'"))) { //增加属性项目 $arr_setting['applylink'] = "1"; $arr_setting['disSearch'] = "0"; $arr_setting['disTop'] = "0"; $arr_setting['gbface'] = "1"; $arr_setting['disAttach'] = "1";
require_once 'utilities.inc.php'; $message = ''; if ($tbpref == '') { $pref = ""; } else { $pref = substr($tbpref, 0, -1) . "-"; } // RESTORE if (isset($_REQUEST['restore'])) { if (isset($_FILES["thefile"]) && $_FILES["thefile"]["tmp_name"] != "" && $_FILES["thefile"]["error"] == 0) { $handle = gzopen($_FILES["thefile"]["tmp_name"], "r"); if ($handle === FALSE) { $message = "Error: Restore file could not be opened"; } else { // $handle OK $message = restore_file($handle, "Database"); } // $handle OK } else { $message = "Error: No Restore file specified"; } } elseif (isset($_REQUEST['backup'])) { $tables = array('archivedtexts', 'archtexttags', 'languages', 'sentences', 'settings', 'tags', 'tags2', 'textitems', 'texts', 'texttags', 'words', 'wordtags'); $fname = "lwt-backup-" . $pref . date('Y-m-d-H-i-s') . ".sql.gz"; $out = "-- " . $fname . "\n"; foreach ($tables as $table) { // foreach table $result = do_mysql_query('SELECT * FROM ' . $tbpref . $table); $num_fields = mysql_num_fields($result); $out .= "\nDROP TABLE IF EXISTS " . $table . ";\n"; $row2 = mysql_fetch_row(do_mysql_query('SHOW CREATE TABLE ' . $tbpref . $table));
include_once 'ressources/class.user.inc'; include_once 'ressources/class.backup.inc'; $user = new usersMenus(); if ($user->AsAnAdministratorGeneric == false) { die('alert("no privileges")'); } if (isset($_GET["restore-file-id"])) { popup_findfile(); exit; } if (isset($_GET["restore-file-step2"])) { popup_storage(); exit; } if (isset($_GET["restore-file"])) { restore_file(); exit; } if (isset($_GET["GetStatus"])) { restore_status(); exit; } js(); function js() { $tpl = new templates(); $title = $tpl->_ENGINE_parse_body('{restore}'); $page = CurrentPageName(); $prefix = str_replace(".", "_", $page); $html = "\n\tvar {$prefix}timerID = null;\n\tvar {$prefix}tant=0;\n\tvar {$prefix}reste=0;\n\t\n\tfunction {$prefix}demarre(){\n\t\t{$prefix}tant = {$prefix}tant+1;\n\n\t\t\n\t\tif(document.getElementById('restore-progress-number')){\n\t\t\tif(document.getElementById('restore-progress-number').value>99){\n\t\t\t\t{$prefix}finish();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif ({$prefix}tant < 5 ) { \n\t\t{$prefix}timerID =setTimeout(\"{$prefix}demarre()\",900);\n\t } else {\n\t\t\t{$prefix}tant = 0;\n\t\t\t{$prefix}LoadStatus();\n\t\t\t{$prefix}demarre(); \n\t\t\t \n\t }\n\t}\n\n\tvar x_{$prefix}ChangeStatus= function (obj) {\n\t\tvar tempvalue=obj.responseText;\n\t\tdocument.getElementById('restore_body').innerHTML=tempvalue;\n\t}\t\n\n\tfunction {$prefix}LoadStatus(){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('GetStatus','yes');\n\t\tXHR.sendAndLoad('{$page}', 'GET',x_{$prefix}ChangeStatus);\n\t}\n\n\n\tfunction {$prefix}finish(){\n\t\tif(document.getElementById('wait')){\n\t\t\tdocument.getElementById('wait').innerHTML='';\n\t\t}\n\t\t\n\t}\n\t\n\tfunction {$prefix}_load(){\n\t\t\tYahooWin5('600','{$page}?restore-file-id={$_GET["fileid"]}','{$title}');\n\t\t\n\t\t}\n\t\t\n\tfunction DarRestoreStep2(id,db){\n\t\t\tYahooWin5('600','{$page}?restore-file-step2=yes&id='+id+'&db='+db,'{$title}');\n\t\t\n\t\t}\t\n\t\t\n\tvar x_FinalRestore= function (obj) {\n\t\tdocument.getElementById('restore_body').innerHTML=obj.responseText;\n\t\t{$prefix}demarre();\n\t}\n\t\t\t\n\n\t\t\n\tfunction FinalRestore(){\n\t\tvar db=document.getElementById('db').value;\n\t\tif(db.length==0){\n\t\t\talert('No database found');\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tvar storage=document.getElementById('dar-external-storage-restore').value;\n\t\tif(storage.length>0){\n\t\t\tdocument.getElementById('restore_body').innerHTML='<center><img src=\"img/wait_verybig.gif\"></center>';\n\t\t\tvar XHR = new XHRConnection();\n\t\t\tXHR.appendData('restore-file','{$_GET["fileid"]}');\n\t\t\tXHR.appendData('restore-resource',storage);\n\t\t\tXHR.appendData('restore-db',db);\n\t\t\tXHR.sendAndLoad('{$page}', 'GET',x_FinalRestore);\t\t\t\t\t\t\t\n\t\t\t}else{\n\t\t\t\talert('no target specified');\n\t\t\t}\n\t\t}\n\t\n\t\n\t{$prefix}_load();\n\t"; echo $html;
<?php /** * (c) 2004-2007 Linbox / Free&ALter Soft, http://linbox.com * (c) 2007-2008 Mandriva, http://www.mandriva.com * * $Id$ * * This file is part of Mandriva Management Console (MMC). * * MMC is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once "includes/xmlrpc.inc.php"; require_once 'modules/backuppc/includes/xmlrpc.php'; restore_file($_GET['host'], $_GET['backupnum'], $_GET['sharename'], $_GET['dir'], '0'); new NotifyWidgetSuccess(_T('Your file is being prepared, please wait.'));
$data_buffer = ''; $last_char = "\n"; $started_query = 0; } $last_char = $current_char; } } fclose($fp); $filename = str_replace("../backup/", "", $filename); $filename = str_replace(".sql", "", $filename); $ActionMessage = "{$filename} ==> " . $ActionMessage; return $ActionMessage; } if ($action == "save") { $filename = $_REQUEST['restorefile']; $ActionMessage = restore_file("../backup/" . $filename . ".sql"); if (strpos($filename, "_v") > 0) { $prev = intval(substr($filename, -1, 1)); $next = $prev + 1; $nextfile = str_replace("_v" . $prev, "_v" . $next, $filename); if (file_exists("../backup/" . $nextfile . ".sql")) { @header("Content-Type: text/html; charset=utf-8"); echo "<span style='font-size:14px;color:blue'>{$ActionMessage}<br><br>{$strDataRestoreAlert1}" . $nextfile . ".sql{$strDataRestoreAlert2}</span>"; sleep(3); echo "<script language='javascript'>"; echo "location='db_restore.php?action=save&restorefile={$nextfile}';"; echo "</script>"; } else { $ActionMessage .= "<br><br>{$strDataRestoreTotal}{$strDataRestoreSuccess}"; } }
* MMC is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MMC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ require_once "includes/xmlrpc.inc.php"; require_once 'modules/backuppc/includes/xmlrpc.php'; $host = $_POST['host']; $backupnum = $_POST['backupnum']; $sharename = $_POST['sharename']; // unset no-files vars unset($_POST['host']); unset($_POST['backupnum']); unset($_POST['sharename']); unset($_POST['restoredir']); unset($_POST['dir']); if (isset($_GET['dir'])) { $files = array($_GET['dir']); } else { $files = array_values($_POST); } $files[] = ':'; restore_file($host, $backupnum, $sharename, $files); $_GET['host'] = $host; $_GET['backupnum'] = $backupnum; $_GET['sharename'] = $sharename; new NotifyWidgetSuccess(_T('Your ZIP file is being prepared, please wait.<br/>Please use 7zip to open this archive (for proper special characters handling).', 'backuupc'));