PostfixAdmin - web based virtual user administration interface for Postfix mail servers https://postfixadmin.github.io/postfixadmin/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.0 KiB

  1. <?php
  2. /**
  3. * Postfix Admin
  4. *
  5. * LICENSE
  6. * This source file is subject to the GPL license that is bundled with
  7. * this package in the file LICENSE.TXT.
  8. *
  9. * Further details on the project are available at :
  10. * http://www.postfixadmin.com or http://postfixadmin.sf.net
  11. *
  12. * @version $Id$
  13. * @license GNU GPL v2 or later.
  14. *
  15. * File: edit-domain.php
  16. * Updates the properties of a domain.
  17. * Template File: admin_edit-domain.php
  18. *
  19. * Template Variables:
  20. *
  21. * tDescription
  22. * tAliases
  23. * tMailboxes
  24. * tMaxquota
  25. * tActive
  26. *
  27. * Form POST \ GET Variables:
  28. *
  29. * fDescription
  30. * fAliases
  31. * fMailboxes
  32. * fMaxquota
  33. * fActive
  34. */
  35. require_once('common.php');
  36. authentication_require_role('global-admin');
  37. if ($_SERVER['REQUEST_METHOD'] == "GET")
  38. {
  39. if (isset ($_GET['domain']))
  40. {
  41. $domain = escape_string ($_GET['domain']);
  42. $domain_properties = get_domain_properties ($domain);
  43. $tDescription = $domain_properties['description'];
  44. $tAliases = $domain_properties['aliases'];
  45. $tMailboxes = $domain_properties['mailboxes'];
  46. $tMaxquota = $domain_properties['maxquota'];
  47. $tTransport = $domain_properties['transport'];
  48. $tBackupmx = $domain_properties['backupmx'];
  49. $tActive = $domain_properties['active'];
  50. }
  51. }
  52. if ($_SERVER['REQUEST_METHOD'] == "POST")
  53. {
  54. if (isset ($_GET['domain'])) $domain = escape_string ($_GET['domain']);
  55. if (isset ($_POST['fDescription'])) $fDescription = escape_string ($_POST['fDescription']);
  56. if (isset ($_POST['fAliases'])) $fAliases = intval($_POST['fAliases']);
  57. if (isset ($_POST['fMailboxes'])) $fMailboxes = intval($_POST['fMailboxes']);
  58. if (isset ($_POST['fMaxquota'])) {
  59. $fMaxquota = intval($_POST['fMaxquota']);
  60. } else {
  61. $fMaxquota = 0;
  62. }
  63. if (isset ($_POST['fTransport'])) $fTransport = escape_string ($_POST['fTransport']);
  64. if (isset ($_POST['fBackupmx'])) $fBackupmx = escape_string ($_POST['fBackupmx']);
  65. if (isset ($_POST['fActive'])) $fActive = escape_string ($_POST['fActive']);
  66. if ($fBackupmx == "on")
  67. {
  68. $fAliases = -1;
  69. $fMailboxes = -1;
  70. $fMaxquota = -1;
  71. $fBackupmx = 1;
  72. $sqlBackupmx = db_get_boolean(True);
  73. }
  74. else
  75. {
  76. $fBackupmx = 0;
  77. $sqlBackupmx = db_get_boolean(False);
  78. }
  79. if ($fActive == "on") {
  80. $sqlActive = db_get_boolean(True);
  81. }
  82. else {
  83. $sqlActive = db_get_boolean(False);
  84. }
  85. $result = db_query ("UPDATE $table_domain SET description='$fDescription',aliases=$fAliases,mailboxes=$fMailboxes,maxquota=$fMaxquota,transport='$fTransport',backupmx='$sqlBackupmx',active='$sqlActive',modified=NOW() WHERE domain='$domain'");
  86. if ($result['rows'] == 1)
  87. {
  88. header ("Location: list-domain.php");
  89. exit;
  90. }
  91. else
  92. {
  93. $tMessage = $PALANG['pAdminEdit_domain_result_error'];
  94. }
  95. }
  96. include ("templates/header.php");
  97. include ("templates/menu.php");
  98. include ("templates/admin_edit-domain.php");
  99. include ("templates/footer.php");
  100. /* vim: set expandtab softtabstop=3 tabstop=3 shiftwidth=3: */
  101. ?>