2013-03-28 01:12:57 +02:00
|
|
|
<?php
|
|
|
|
// Init
|
|
|
|
error_reporting(NULL);
|
|
|
|
ob_start();
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
|
|
|
|
|
2015-06-03 02:31:03 +03:00
|
|
|
// Check token
|
|
|
|
if ((!isset($_POST['token'])) || ($_SESSION['token'] != $_POST['token'])) {
|
|
|
|
header('location: /login/');
|
2015-12-11 21:14:49 +02:00
|
|
|
exit();
|
2015-06-03 02:31:03 +03:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:12:57 +02:00
|
|
|
$action = $_POST['action'];
|
2015-12-11 21:14:49 +02:00
|
|
|
$backup = escapeshellarg($_POST['backup']);
|
2013-03-28 01:12:57 +02:00
|
|
|
|
|
|
|
$web = 'no';
|
|
|
|
$dns = 'no';
|
|
|
|
$mail = 'no';
|
|
|
|
$db = 'no';
|
|
|
|
$cron = 'no';
|
|
|
|
$udir = 'no';
|
|
|
|
|
2015-12-11 21:14:49 +02:00
|
|
|
if (!empty($_POST['web'])) $web = escapeshellarg(implode(",",$_POST['web']));
|
|
|
|
if (!empty($_POST['dns'])) $dns = escapeshellarg(implode(",",$_POST['dns']));
|
|
|
|
if (!empty($_POST['mail'])) $mail = escapeshellarg(implode(",",$_POST['mail']));
|
|
|
|
if (!empty($_POST['db'])) $db = escapeshellarg(implode(",",$_POST['db']));
|
2013-03-28 01:12:57 +02:00
|
|
|
if (!empty($_POST['cron'])) $cron = 'yes';
|
2015-12-11 21:14:49 +02:00
|
|
|
if (!empty($_POST['udir'])) $udir = escapeshellarg(implode(",",$_POST['udir']));
|
2013-03-28 01:12:57 +02:00
|
|
|
|
|
|
|
if ($action == 'restore') {
|
2015-12-11 21:14:49 +02:00
|
|
|
exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
|
|
|
|
if ($return_var == 0) {
|
|
|
|
$_SESSION['error_msg'] = __('RESTORE_SCHEDULED');
|
|
|
|
} else {
|
|
|
|
$_SESSION['error_msg'] = implode('<br>', $output);
|
|
|
|
if (empty($_SESSION['error_msg'])) {
|
|
|
|
$_SESSION['error_msg'] = __('Error: vesta did not return any output.');
|
|
|
|
}
|
|
|
|
if ($return_var == 4) {
|
2013-11-02 16:43:40 +02:00
|
|
|
$_SESSION['error_msg'] = __('RESTORE_EXISTS');
|
2015-12-11 21:14:49 +02:00
|
|
|
}
|
2013-03-28 01:12:57 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
header("Location: /list/backup/?backup=" . $_POST['backup']);
|