index.php 1.4 KB

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