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
133 lines (125 loc) · 2.27 KB
/
index.php
File metadata and controls
133 lines (125 loc) · 2.27 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
use function Hestiacp\quoteshellarg\quoteshellarg;
ob_start();
include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
// Check token
verify_csrf($_POST);
$action = $_POST["action"];
$snapshot = quoteshellarg($_POST["snapshot"]);
$web = [];
$dns = [];
$mail = [];
$db = [];
$cron = [];
$udir = [];
if (!empty($_POST["web"])) {
$web = quoteshellarg(implode(",", $_POST["web"]));
}
if (!empty($_POST["dns"])) {
$dns = quoteshellarg(implode(",", $_POST["dns"]));
}
if (!empty($_POST["mail"])) {
$mail = quoteshellarg(implode(",", $_POST["mail"]));
}
if (!empty($_POST["db"])) {
$db = quoteshellarg(implode(",", $_POST["db"]));
}
if (!empty($_POST["cron"])) {
$cron = "yes";
}
if (!empty($_POST["file"])) {
$udir = quoteshellarg(implode(",", $_POST["file"]));
}
if ($action == "restore") {
if (!empty($web)) {
exec(
HESTIA_CMD .
"v-schedule-user-restore-restic " .
$user .
" " .
$snapshot .
" " .
"web" .
" " .
$web,
$output,
$return_var,
);
}
if (!empty($dns)) {
exec(
HESTIA_CMD .
"v-schedule-user-restore-restic " .
$user .
" " .
$snapshot .
" " .
"dns" .
" " .
$dns,
$output,
$return_var,
);
}
if (!empty($mail)) {
exec(
HESTIA_CMD .
"v-schedule-user-restore-restic " .
$user .
" " .
$snapshot .
" " .
"db" .
" " .
$db,
$output,
$return_var,
);
if (!empty($dns)) {
exec(
HESTIA_CMD .
"v-schedule-user-restore-restic " .
$user .
" " .
$snapshot .
" " .
"dns" .
" " .
$dns,
$output,
$return_var,
);
}
}
if (!empty($cron)) {
exec(
HESTIA_CMD . "v-schedule-user-restore-restic " . $user . " " . $snapshot . " " . "cron",
$output,
$return_var,
);
}
if (!empty($file)) {
exec(
HESTIA_CMD .
"v-schedule-user-restore-restic " .
$user .
" " .
$snapshot .
" " .
"file" .
$file,
$output,
$return_var,
);
}
}
if ($return_var == 0) {
$_SESSION["error_msg"] = _(
"Task has been added to the queue. You will receive an email notification when your restore has been completed.",
);
} else {
$_SESSION["error_msg"] = implode("<br>", $output);
}
var_dump($_POST);
var_dump($output);
header("Location: /list/backup/incremental/?snapshot=" . $_POST["snapshot"]);