add_mail.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <!-- Begin toolbar -->
  2. <div class="toolbar">
  3. <div class="toolbar-inner">
  4. <div class="toolbar-buttons">
  5. <a class="button button-secondary button-back js-button-back" href="/list/mail/">
  6. <i class="fas fa-arrow-left icon-blue"></i><?= tohtml( _("Back")) ?>
  7. </a>
  8. </div>
  9. <div class="toolbar-buttons">
  10. <?php if (($_SESSION["role"] == "admin" && $accept === "true") || $user_plain !== "admin") { ?>
  11. <button type="submit" class="button" form="main-form">
  12. <i class="fas fa-floppy-disk icon-purple"></i><?= tohtml( _("Save")) ?>
  13. </button>
  14. <?php } ?>
  15. </div>
  16. </div>
  17. </div>
  18. <!-- End toolbar -->
  19. <div class="container">
  20. <form
  21. x-data="{
  22. hasSmtpRelay: <?= tohtml($v_smtp_relay == "true" ? "true" : "false") ?>
  23. }"
  24. id="main-form"
  25. name="v_add_mail"
  26. method="post"
  27. >
  28. <input type="hidden" name="token" value="<?= tohtml($_SESSION["token"]) ?>">
  29. <input type="hidden" name="ok" value="Add">
  30. <div class="form-container">
  31. <h1 class="u-mb20"><?= tohtml( _("Add Mail Domain")) ?></h1>
  32. <?php show_alert_message($_SESSION); ?>
  33. <?php if ($_SESSION["role"] == "admin" && $accept !== "true") { ?>
  34. <div class="alert alert-danger" role="alert">
  35. <i class="fas fa-exclamation"></i>
  36. <p><?= htmlify_trans(
  37. sprintf(
  38. _("It is strongly advised to {create a standard user account} before adding %s to the server due to the increased privileges the admin account possesses and potential security risks."),
  39. _("a mail domain"),
  40. ),
  41. "</a>",
  42. '<a href="/add/user/">',
  43. ) ?></p>
  44. </div>
  45. <?php } ?>
  46. <?php if ($_SESSION["role"] == "admin" && empty($accept)) { ?>
  47. <div class="u-side-by-side u-mt20">
  48. <a href="/add/user/" class="button u-width-full u-mr10"><?= tohtml( _("Add User")) ?></a>
  49. <a href="/add/mail/?<?= tohtml(http_build_query(["accept" => 'true'])) ?>" class="button button-danger u-width-full u-ml10"><?= tohtml( _("Continue")) ?></a>
  50. </div>
  51. <?php } ?>
  52. <?php if (($_SESSION["role"] == "admin" && $accept === "true") || $_SESSION["role"] !== "admin") { ?>
  53. <div class="u-mb20">
  54. <label for="v_domain" class="form-label"><?= tohtml( _("Domain")) ?></label>
  55. <input type="text" class="form-control" name="v_domain" id="v_domain" value="<?= tohtml(trim($v_domain, "'")) ?>" required>
  56. </div>
  57. <?php if ($_SESSION["WEBMAIL_SYSTEM"]) { ?>
  58. <div class="u-mb20">
  59. <label for="v_webmail" class="form-label"><?= tohtml( _("Webmail Client")) ?></label>
  60. <select class="form-select" name="v_webmail" id="v_webmail" tabindex="6">
  61. <?php foreach ($webmail_clients as $client) {
  62. echo "\t\t\t\t<option value=\"" . htmlentities($client) . "\"";
  63. if ($v_webmail == $client) {
  64. echo " selected";
  65. }
  66. echo ">" . htmlentities(ucfirst($client)) . "</option>\n";
  67. } ?>
  68. <option value="" <?php if (empty($v_webmail) || $v_webmail == "disabled") {
  69. echo "selected";
  70. } ?>><?= tohtml( _("Disabled")) ?></option>
  71. </select>
  72. </div>
  73. <?php } ?>
  74. <?php if (!empty($_SESSION["ANTISPAM_SYSTEM"])) { ?>
  75. <div class="form-check u-mb10">
  76. <input class="form-check-input" type="checkbox" name="v_antispam" id="v_antispam" <?php if (empty($v_antispam) || $v_antispam == "yes") {
  77. echo "checked";
  78. } ?>>
  79. <label for="v_antispam">
  80. <?= tohtml( _("Spam Filter")) ?>
  81. </label>
  82. </div>
  83. <div class="form-check u-mb10">
  84. <input class="form-check-input" type="checkbox" name="v_reject" id="v_reject" <?php if (empty($v_reject) || $v_reject == "yes") {
  85. echo "checked";
  86. } ?>>
  87. <label for="v_reject">
  88. <?= tohtml( _("Reject Spam")) ?>
  89. </label>
  90. </div>
  91. <?php } ?>
  92. <?php if (!empty($_SESSION["ANTIVIRUS_SYSTEM"])) { ?>
  93. <div class="form-check u-mb10">
  94. <input class="form-check-input" type="checkbox" name="v_antivirus" id="v_antivirus" <?php if (empty($v_antivirus) || $v_antivirus == "yes") {
  95. echo "checked";
  96. } ?>>
  97. <label for="v_antivirus">
  98. <?= tohtml( _("Anti-Virus")) ?>
  99. </label>
  100. </div>
  101. <?php } ?>
  102. <div class="form-check u-mb10">
  103. <input class="form-check-input" type="checkbox" name="v_dkim" id="v_dkim" <?php if (empty($v_dkim) || $v_dkim == "yes") {
  104. echo "checked";
  105. } ?>>
  106. <label for="v_dkim">
  107. <?= tohtml( _("DKIM Support")) ?>
  108. </label>
  109. </div>
  110. <div class="form-check u-mb10">
  111. <input x-model="hasSmtpRelay" class="form-check-input" type="checkbox" name="v_smtp_relay" id="v_smtp_relay">
  112. <label for="v_smtp_relay">
  113. <?= tohtml( _("SMTP Relay")) ?>
  114. </label>
  115. </div>
  116. <div x-cloak x-show="hasSmtpRelay" id="smtp_relay_table" class="u-pl30">
  117. <div class="u-mb10">
  118. <label for="v_smtp_relay_host" class="form-label"><?= tohtml( _("Host")) ?></label>
  119. <input type="text" class="form-control" name="v_smtp_relay_host" id="v_smtp_relay_host" value="<?= tohtml(trim($v_smtp_relay_host, "'")) ?>">
  120. </div>
  121. <div class="u-mb10">
  122. <label for="v_smtp_relay_port" class="form-label"><?= tohtml( _("Port")) ?></label>
  123. <input type="text" class="form-control" name="v_smtp_relay_port" id="v_smtp_relay_port" value="<?= tohtml(trim($v_smtp_relay_port, "'")) ?>">
  124. </div>
  125. <div class="u-mb10">
  126. <label for="v_smtp_relay_user" class="form-label"><?= tohtml( _("Username")) ?></label>
  127. <input type="text" class="form-control" name="v_smtp_relay_user" id="v_smtp_relay_user" value="<?= tohtml(trim($v_smtp_relay_user, "'")) ?>">
  128. </div>
  129. <div class="u-mb10">
  130. <label for="v_smtp_relay_pass" class="form-label"><?= tohtml( _("Password")) ?></label>
  131. <input type="text" class="form-control" name="v_smtp_relay_pass" id="v_smtp_relay_pass">
  132. </div>
  133. </div>
  134. <?php } ?>
  135. </div>
  136. </form>
  137. </div>