edit_mail.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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. <button type="submit" class="button" form="main-form">
  11. <i class="fas fa-floppy-disk icon-purple"></i><?= tohtml( _("Save")) ?>
  12. </button>
  13. </div>
  14. </div>
  15. </div>
  16. <!-- End toolbar -->
  17. <div class="container">
  18. <form
  19. x-data="{
  20. sslEnabled: <?= tohtml($v_ssl == "yes" ? "true" : "false") ?>,
  21. letsEncryptEnabled: <?= tohtml($v_letsencrypt == "yes" ? "true" : "false") ?>,
  22. hasSmtpRelay: <?= tohtml($v_smtp_relay == "true" ? "true" : "false") ?>
  23. }"
  24. id="main-form"
  25. name="v_edit_mail"
  26. method="post"
  27. class="<?= tohtml($v_status) ?> js-enable-inputs-on-submit"
  28. >
  29. <input type="hidden" name="token" value="<?= tohtml($_SESSION["token"]) ?>">
  30. <input type="hidden" name="save" value="save">
  31. <div class="form-container">
  32. <h1 class="u-mb20"><?= tohtml( _("Edit Mail Domain")) ?></h1>
  33. <?php show_alert_message($_SESSION); ?>
  34. <div class="u-mb20">
  35. <label for="v_domain" class="form-label"><?= tohtml( _("Domain")) ?></label>
  36. <input type="text" class="form-control" name="v_domain" id="v_domain" value="<?= tohtml(trim($v_domain, "'")) ?>" disabled required>
  37. <input type="hidden" name="v_domain" value="<?= tohtml(trim($v_domain, "'")) ?>">
  38. </div>
  39. <?php if ($_SESSION["WEBMAIL_SYSTEM"]) { ?>
  40. <div class="u-mb10">
  41. <label for="v_webmail" class="form-label"><?= tohtml( _("Webmail Client")) ?></label>
  42. <select class="form-select" name="v_webmail" id="v_webmail" tabindex="6">
  43. <?php foreach ($webmail_clients as $client){
  44. echo "\t\t\t\t<option value=\"".htmlentities($client)."\"";
  45. if (( htmlentities(trim($v_webmail,"'")) == $client )) {
  46. echo ' selected' ;
  47. }
  48. echo ">".htmlentities(ucfirst($client))."</option>\n";
  49. }
  50. ?>
  51. <option value="disabled" <?php if (htmlentities(trim($v_webmail,"'")) == 'disabled') { echo "selected"; }?>><?= tohtml( _("Disabled")) ?></option>
  52. </select>
  53. </div>
  54. <?php } ?>
  55. <div class="u-mb10">
  56. <label for="v_catchall" class="form-label"><?= tohtml( _("Catch-All Email")) ?></label>
  57. <input type="email" class="form-control" name="v_catchall" id="v_catchall" value="<?= tohtml(trim($v_catchall, "'")) ?>">
  58. </div>
  59. <div class="u-mb20">
  60. <label for="v_rate" class="form-label">
  61. <?= tohtml( _("Rate Limit")) ?> <span class="optional">(<?= tohtml( _("email / hour / account")) ?>)</span>
  62. </label>
  63. <input type="text" class="form-control" name="v_rate" id="v_rate" value="<?= tohtml(trim($v_rate, "'")) ?>" <?php if ($_SESSION['userContext'] != "admin"){ echo "disabled"; }?>>
  64. </div>
  65. <?php if (!empty($_SESSION["ANTISPAM_SYSTEM"])) { ?>
  66. <div class="form-check u-mb10">
  67. <input class="form-check-input" type="checkbox" name="v_antispam" id="v_antispam" <?php if ($v_antispam == 'yes') echo 'checked'; ?>>
  68. <label for="v_antispam">
  69. <?= tohtml( _("Spam Filter")) ?>
  70. </label>
  71. </div>
  72. <div class="form-check u-mb10">
  73. <input class="form-check-input" type="checkbox" name="v_reject" id="v_reject" <?php if ($v_reject == 'yes') echo 'checked'; ?>>
  74. <label for="v_reject">
  75. <?= tohtml( _("Reject Spam")) ?>
  76. </label>
  77. </div>
  78. <?php } ?>
  79. <?php if (!empty($_SESSION["ANTIVIRUS_SYSTEM"])) { ?>
  80. <div class="form-check u-mb10">
  81. <input class="form-check-input" type="checkbox" name="v_antivirus" id="v_antivirus" <?php if ($v_antivirus == 'yes') echo 'checked'; ?>>
  82. <label for="v_antivirus">
  83. <?= tohtml( _("Anti-Virus")) ?>
  84. </label>
  85. </div>
  86. <?php } ?>
  87. <div class="form-check u-mb10">
  88. <input class="form-check-input" type="checkbox" name="v_dkim" id="v_dkim" <?php if ($v_dkim == 'yes') echo 'checked'; ?>>
  89. <label for="v_dkim">
  90. <?= tohtml( _("DKIM Support")) ?>
  91. </label>
  92. </div>
  93. <div class="form-check u-mb10">
  94. <input x-model="sslEnabled" class="form-check-input" type="checkbox" name="v_ssl" id="v_ssl">
  95. <label for="v_ssl">
  96. <?= tohtml( _("Enable SSL for this domain")) ?>
  97. </label>
  98. </div>
  99. <div x-cloak x-show="sslEnabled" class="u-pl30">
  100. <div class="form-check u-mb10">
  101. <input x-model="letsEncryptEnabled" class="form-check-input" type="checkbox" name="v_letsencrypt" id="v_letsencrypt">
  102. <label for="v_letsencrypt">
  103. <?= tohtml( _("Use Let's Encrypt to obtain SSL certificate")) ?>
  104. </label>
  105. </div>
  106. <div class="alert alert-info u-mb20" role="alert">
  107. <i class="fas fa-exclamation"></i>
  108. <div>
  109. <p><?php echo $v_webmail_alias; ?></p>
  110. <p><?= tohtml(sprintf(_("To enable Let's Encrypt SSL, ensure that DNS records exist for mail.%s and %s!"), $v_domain, $v_webmail_alias)) ?></p>
  111. </div>
  112. </div>
  113. <div x-cloak x-show="!letsEncryptEnabled">
  114. <div class="u-mb10">
  115. <label for="v_ssl_crt" class="form-label">
  116. <?= tohtml( _("SSL Certificate")) ?>
  117. <span x-cloak x-show="!letsEncryptEnabled" id="generate-csr" > / <a class="form-link" target="_blank" href="/generate/ssl/?<?= tohtml(http_build_query(["domain" => $v_domain])) ?>"><?= tohtml( _("Generate Self-Signed SSL Certificate")) ?></a></span>
  118. </label>
  119. <textarea x-bind:disabled="letsEncryptEnabled" class="form-control u-min-height100 u-console" name="v_ssl_crt" id="v_ssl_crt"><?= tohtml(trim($v_ssl_crt, "'")) ?></textarea>
  120. </div>
  121. <div class="u-mb10">
  122. <label for="v_ssl_key" class="form-label"><?= tohtml( _("SSL Private Key")) ?></label>
  123. <textarea x-bind:disabled="letsEncryptEnabled" class="form-control u-min-height100 u-console" name="v_ssl_key" id="v_ssl_key"><?= tohtml(trim($v_ssl_key, "'")) ?></textarea>
  124. </div>
  125. <div class="u-mb20">
  126. <label for="v_ssl_ca" class="form-label">
  127. <?= tohtml( _("SSL Certificate Authority / Intermediate")) ?> <span class="optional">(<?= tohtml( _("Optional")) ?>)</span>
  128. </label>
  129. <textarea x-bind:disabled="letsEncryptEnabled" class="form-control u-min-height100 u-console" name="v_ssl_ca" id="v_ssl_ca"><?= tohtml(trim($v_ssl_ca, "'")) ?></textarea>
  130. </div>
  131. </div>
  132. <?php if ($v_ssl != "no") { ?>
  133. <ul class="values-list u-mb20">
  134. <li class="values-list-item">
  135. <span class="values-list-label"><?= tohtml( _("Issued To")) ?></span>
  136. <span class="values-list-value"><?= tohtml($v_ssl_subject) ?></span>
  137. </li>
  138. <?php if ($v_ssl_aliases) {
  139. $v_ssl_aliases = str_replace(",", ", ", $v_ssl_aliases); ?>
  140. <li class="values-list-item">
  141. <span class="values-list-label"><?= tohtml( _("Alternate")) ?></span>
  142. <span class="values-list-value"><?= tohtml($v_ssl_aliases) ?></span>
  143. </li>
  144. <?php } ?>
  145. <li class="values-list-item">
  146. <span class="values-list-label"><?= tohtml( _("Not Before")) ?></span>
  147. <span class="values-list-value"><?= tohtml($v_ssl_not_before) ?></span>
  148. </li>
  149. <li class="values-list-item">
  150. <span class="values-list-label"><?= tohtml( _("Not After")) ?></span>
  151. <span class="values-list-value"><?= tohtml($v_ssl_not_after) ?></span>
  152. </li>
  153. <li class="values-list-item">
  154. <span class="values-list-label"><?= tohtml( _("Signature")) ?></span>
  155. <span class="values-list-value"><?= tohtml($v_ssl_signature) ?></span>
  156. </li>
  157. <li class="values-list-item">
  158. <span class="values-list-label"><?= tohtml( _("Key Size")) ?></span>
  159. <span class="values-list-value"><?= tohtml($v_ssl_pub_key) ?></span>
  160. </li>
  161. <li class="values-list-item">
  162. <span class="values-list-label"><?= tohtml( _("Issued By")) ?></span>
  163. <span class="values-list-value"><?= tohtml($v_ssl_issuer) ?></span>
  164. </li>
  165. </ul>
  166. <?php } ?>
  167. </div>
  168. <div class="form-check u-mb10">
  169. <input x-model="hasSmtpRelay" class="form-check-input" type="checkbox" name="v_smtp_relay" id="v_smtp_relay">
  170. <label for="v_smtp_relay">
  171. <?= tohtml( _("SMTP Relay")) ?>
  172. </label>
  173. </div>
  174. <div x-cloak x-show="hasSmtpRelay" id="smtp_relay_table" class="u-pl30">
  175. <div class="u-mb10">
  176. <label for="v_smtp_relay_host" class="form-label"><?= tohtml( _("Host")) ?></label>
  177. <input type="text" class="form-control" name="v_smtp_relay_host" id="v_smtp_relay_host" value="<?= tohtml(trim($v_smtp_relay_host, "'")) ?>">
  178. </div>
  179. <div class="u-mb10">
  180. <label for="v_smtp_relay_port" class="form-label"><?= tohtml( _("Port")) ?></label>
  181. <input type="text" class="form-control" name="v_smtp_relay_port" id="v_smtp_relay_port" value="<?= tohtml(trim($v_smtp_relay_port, "'")) ?>">
  182. </div>
  183. <div class="u-mb10">
  184. <label for="v_smtp_relay_user" class="form-label"><?= tohtml( _("Username")) ?></label>
  185. <input type="text" class="form-control" name="v_smtp_relay_user" id="v_smtp_relay_user" value="<?= tohtml(trim($v_smtp_relay_user, "'")) ?>">
  186. </div>
  187. <div class="u-mb10">
  188. <label for="v_smtp_relay_pass" class="form-label"><?= tohtml( _("Password")) ?></label>
  189. <input type="text" class="form-control" name="v_smtp_relay_pass" id="v_smtp_relay_pass">
  190. </div>
  191. </div>
  192. </div>
  193. </form>
  194. </div>