forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
58 lines (49 loc) · 1.39 KB
/
index.php
File metadata and controls
58 lines (49 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
ob_start();
include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
// Check token
verify_csrf($_GET);
$backup = quoteshellarg($_GET['backup']);
$web = 'no';
$dns = 'no';
$mail = 'no';
$db = 'no';
$cron = 'no';
$udir = 'no';
if ($_GET['type'] == 'web') {
$web = quoteshellarg($_GET['object']);
}
if ($_GET['type'] == 'dns') {
$dns = quoteshellarg($_GET['object']);
}
if ($_GET['type'] == 'mail') {
$mail = quoteshellarg($_GET['object']);
}
if ($_GET['type'] == 'db') {
$db = quoteshellarg($_GET['object']);
}
if ($_GET['type'] == 'cron') {
$cron = 'yes';
}
if ($_GET['type'] == 'udir') {
$udir = quoteshellarg($_GET['object']);
}
if (!empty($_GET['type'])) {
$restore_cmd = HESTIA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir;
} else {
$restore_cmd = HESTIA_CMD."v-schedule-user-restore ".$user." ".$backup;
}
exec($restore_cmd, $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: Hestia did not return any output.');
}
if ($return_var == 4) {
$_SESSION['error_msg'] = _('RESTORE_EXISTS');
}
}
header("Location: /list/backup/?backup=" . $_GET['backup']);