index.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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($_POST);
  9. $action = $_POST['action'];
  10. $backup = escapeshellarg($_POST['backup']);
  11. $web = 'no';
  12. $dns = 'no';
  13. $mail = 'no';
  14. $db = 'no';
  15. $cron = 'no';
  16. $udir = 'no';
  17. if (!empty($_POST['web'])) {
  18. $web = escapeshellarg(implode(",", $_POST['web']));
  19. }
  20. if (!empty($_POST['dns'])) {
  21. $dns = escapeshellarg(implode(",", $_POST['dns']));
  22. }
  23. if (!empty($_POST['mail'])) {
  24. $mail = escapeshellarg(implode(",", $_POST['mail']));
  25. }
  26. if (!empty($_POST['db'])) {
  27. $db = escapeshellarg(implode(",", $_POST['db']));
  28. }
  29. if (!empty($_POST['cron'])) {
  30. $cron = 'yes';
  31. }
  32. if (!empty($_POST['udir'])) {
  33. $udir = escapeshellarg(implode(",", $_POST['udir']));
  34. }
  35. if ($action == 'restore') {
  36. exec(HESTIA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $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. }
  49. header("Location: /list/backup/?backup=" . $_POST['backup']);