index.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. ob_start();
  3. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  4. // Check token
  5. verify_csrf($_POST);
  6. $action = $_POST['action'];
  7. $backup = escapeshellarg($_POST['backup']);
  8. $web = 'no';
  9. $dns = 'no';
  10. $mail = 'no';
  11. $db = 'no';
  12. $cron = 'no';
  13. $udir = 'no';
  14. if (!empty($_POST['web'])) {
  15. $web = escapeshellarg(implode(",", $_POST['web']));
  16. }
  17. if (!empty($_POST['dns'])) {
  18. $dns = escapeshellarg(implode(",", $_POST['dns']));
  19. }
  20. if (!empty($_POST['mail'])) {
  21. $mail = escapeshellarg(implode(",", $_POST['mail']));
  22. }
  23. if (!empty($_POST['db'])) {
  24. $db = escapeshellarg(implode(",", $_POST['db']));
  25. }
  26. if (!empty($_POST['cron'])) {
  27. $cron = 'yes';
  28. }
  29. if (!empty($_POST['udir'])) {
  30. $udir = escapeshellarg(implode(",", $_POST['udir']));
  31. }
  32. if ($action == 'restore') {
  33. exec(HESTIA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
  34. if ($return_var == 0) {
  35. $_SESSION['error_msg'] = _('RESTORE_SCHEDULED');
  36. } else {
  37. $_SESSION['error_msg'] = implode('<br>', $output);
  38. if (empty($_SESSION['error_msg'])) {
  39. $_SESSION['error_msg'] = _('Error: Hestia did not return any output.');
  40. }
  41. if ($return_var == 4) {
  42. $_SESSION['error_msg'] = _('RESTORE_EXISTS');
  43. }
  44. }
  45. }
  46. header("Location: /list/backup/?backup=" . $_POST['backup']);