index.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. use function Hestiacp\quoteshellarg\quoteshellarg;
  3. // Init
  4. ob_start();
  5. include $_SERVER["DOCUMENT_ROOT"] . "/inc/main.php";
  6. // Check token
  7. verify_csrf($_GET);
  8. // Mail domain
  9. if (!empty($_GET["domain"]) && empty($_GET["account"])) {
  10. $v_domain = quoteshellarg($_GET["domain"]);
  11. exec(HESTIA_CMD . "v-unsuspend-mail-domain " . $user . " " . $v_domain, $output, $return_var);
  12. if ($return_var != 0) {
  13. $error = implode("<br>", $output);
  14. if (empty($error)) {
  15. $error = _("Error: Hestia did not return any output.");
  16. }
  17. $_SESSION["error_msg"] = $error;
  18. }
  19. unset($output);
  20. $back = getenv("HTTP_REFERER");
  21. if (!empty($back)) {
  22. header("Location: " . $back);
  23. exit();
  24. }
  25. header("Location: /list/mail/");
  26. exit();
  27. }
  28. // Mail account
  29. if (!empty($_GET["domain"]) && !empty($_GET["account"])) {
  30. $v_username = quoteshellarg($user);
  31. $v_domain = quoteshellarg($_GET["domain"]);
  32. $v_account = quoteshellarg($_GET["account"]);
  33. exec(
  34. HESTIA_CMD . "v-unsuspend-mail-account " . $user . " " . $v_domain . " " . $v_account,
  35. $output,
  36. $return_var,
  37. );
  38. if ($return_var != 0) {
  39. $error = implode("<br>", $output);
  40. if (empty($error)) {
  41. $error = _("Error: Hestia did not return any output.");
  42. }
  43. $_SESSION["error_msg"] = $error;
  44. }
  45. unset($output);
  46. $back = getenv("HTTP_REFERER");
  47. if (!empty($back)) {
  48. header("Location: " . $back);
  49. exit();
  50. }
  51. header("Location: /list/mail/?domain=" . $_GET["domain"]);
  52. exit();
  53. }
  54. $back = getenv("HTTP_REFERER");
  55. if (!empty($back)) {
  56. header("Location: " . $back);
  57. exit();
  58. }
  59. header("Location: /list/mail/");
  60. exit();