index.php 932 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. ob_start();
  4. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  5. if (empty($_POST["backup"])) {
  6. header("Location: /list/backup/incremental/");
  7. exit();
  8. }
  9. if (empty($_POST["action"])) {
  10. header("Location: /list/backup/incremental/");
  11. exit();
  12. }
  13. $backup = $_POST["backup"];
  14. $action = $_POST["action"];
  15. // Check token
  16. verify_csrf($_POST);
  17. switch ($action) {
  18. case "delete":
  19. $cmd = "v-delete-user-backup-restic";
  20. break;
  21. default:
  22. header("Location: /list/backup/");
  23. exit();
  24. }
  25. foreach ($backup as $value) {
  26. $value = quoteshellarg($value);
  27. exec(HESTIA_CMD . $cmd . " " . $user . " " . $value, $output, $return_var);
  28. if ($return_var != 0) {
  29. $_SESSION["error_msg"] = implode("<br>", $output);
  30. if (empty($_SESSION["error_msg"])) {
  31. $_SESSION["error_msg"] = _("Error: Hestia did not return any output.");
  32. }
  33. }
  34. }
  35. header("Location: /list/backup/incremental/");