index.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. // DNS domain
  9. if (!empty($_GET["domain"]) && empty($_GET["record_id"])) {
  10. $v_domain = quoteshellarg($_GET["domain"]);
  11. exec(HESTIA_CMD . "v-unsuspend-dns-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/dns/");
  26. exit();
  27. }
  28. // DNS record
  29. if (!empty($_GET["domain"]) && !empty($_GET["record_id"])) {
  30. $v_domain = quoteshellarg($_GET["domain"]);
  31. $v_record_id = quoteshellarg($_GET["record_id"]);
  32. exec(
  33. HESTIA_CMD . "v-unsuspend-dns-record " . $user . " " . $v_domain . " " . $v_record_id,
  34. $output,
  35. $return_var,
  36. );
  37. if ($return_var != 0) {
  38. $error = implode("<br>", $output);
  39. if (empty($error)) {
  40. $error = _("Error: Hestia did not return any output.");
  41. }
  42. $_SESSION["error_msg"] = $error;
  43. }
  44. unset($output);
  45. $back = getenv("HTTP_REFERER");
  46. if (!empty($back)) {
  47. header("Location: " . $back);
  48. exit();
  49. }
  50. header("Location: /list/dns/?domain=" . $_GET["domain"]);
  51. exit();
  52. }
  53. $back = getenv("HTTP_REFERER");
  54. if (!empty($back)) {
  55. header("Location: " . $back);
  56. exit();
  57. }
  58. header("Location: /list/dns/");
  59. exit();