index.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. // Init
  3. error_reporting(NULL);
  4. ob_start();
  5. session_start();
  6. include($_SERVER['DOCUMENT_ROOT']."/inc/main.php");
  7. $action = $_POST['action'];
  8. $backup = escapeshellarg($_POST['backup']);
  9. $web = 'no';
  10. $dns = 'no';
  11. $mail = 'no';
  12. $db = 'no';
  13. $cron = 'no';
  14. $udir = 'no';
  15. if (!empty($_POST['web'])) $web = escapeshellarg(implode(",",$_POST['web']));
  16. if (!empty($_POST['dns'])) $dns = escapeshellarg(implode(",",$_POST['dns']));
  17. if (!empty($_POST['mail'])) $mail = escapeshellarg(implode(",",$_POST['mail']));
  18. if (!empty($_POST['db'])) $db = escapeshellarg(implode(",",$_POST['db']));
  19. if (!empty($_POST['cron'])) $cron = 'yes';
  20. if (!empty($_POST['udir'])) $udir = escapeshellarg(implode(",",$_POST['udir']));
  21. if ($action == 'restore') {
  22. exec (VESTA_CMD."v-schedule-user-restore ".$user." ".$backup." ".$web." ".$dns." ".$mail." ".$db." ".$cron." ".$udir, $output, $return_var);
  23. if ($return_var == 0) {
  24. $_SESSION['restore_msg'] = __('RESTORE_SCHEDULED');
  25. } else {
  26. $_SESSION['restore_msg'] = implode('<br>', $output);
  27. if (empty($_SESSION['restore_msg'])) {
  28. $_SESSION['restore_msg'] = __('Error: vesta did not return any output.');
  29. }
  30. if ($return_var == 4) {
  31. $_SESSION['restore_msg'] = __('RESTORE_EXISTS');
  32. }
  33. }
  34. }
  35. header("Location: /list/backup/?backup=" . $_POST['backup']);