index.php 1.3 KB

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