| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- <?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"]);
|