From 9fcf88d06d20076f1b228979e9ed4e8a56f39ef8 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 26 Oct 2010 10:28:10 -0400
Subject: [PATCH] Fixed: FS#1388 - Namevirtualhost directive is missing after update. 2nd try ;)
---
interface/web/mail/mail_domain_edit.php | 39 +++++++++++++++++++++++++++------------
1 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/interface/web/mail/mail_domain_edit.php b/interface/web/mail/mail_domain_edit.php
index d7237d1..f44348b 100644
--- a/interface/web/mail/mail_domain_edit.php
+++ b/interface/web/mail/mail_domain_edit.php
@@ -75,7 +75,7 @@
$sql = "SELECT groupid, name FROM sys_group WHERE client_id > 0 ORDER BY name";
} else {
$client_group_id = $_SESSION["s"]["user"]["default_group"];
- $sql = "SELECT client.client_id, limit_web_domain, default_webserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
+ $sql = "SELECT client.client_id, limit_web_domain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id";
}
$clients = $app->db->queryAllRecords($sql);
$client_select = '';
@@ -93,11 +93,11 @@
// Get the limits of the client
$client_group_id = $_SESSION["s"]["user"]["default_group"];
- $client = $app->db->queryOneRecord("SELECT client.client_id, contact_name FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name");
+ $client = $app->db->queryOneRecord("SELECT client.client_id, contact_name, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id order by contact_name");
- // Set the webserver to the default server of the client
- $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_webserver]");
- $app->tpl->setVar("server_id","<option value='$client[default_webserver]'>$tmp[server_name]</option>");
+ // Set the mailserver to the default server of the client
+ $tmp = $app->db->queryOneRecord("SELECT server_name FROM server WHERE server_id = $client[default_mailserver]");
+ $app->tpl->setVar("server_id","<option value='$client[default_mailserver]'>$tmp[server_name]</option>");
unset($tmp);
// Fill the client select field
@@ -119,25 +119,40 @@
/*
* Now we have to check, if we should use the domain-module to select the domain
* or not
- */
+ */
$app->uses('ini_parser,getconf');
$settings = $app->getconf->get_global_config('domains');
if ($settings['use_domain_module'] == 'y') {
+ /*
+ * The domain-module is in use.
+ */
$client_group_id = $_SESSION["s"]["user"]["default_group"];
- $sql = "SELECT domain FROM domain WHERE sys_groupid =" . $client_group_id . " ORDER BY domain";
+ /*
+ * The admin can select ALL domains, the user only the domains assigned to him
+ */
+ $sql = "SELECT domain FROM domain ";
+ if ($_SESSION["s"]["user"]["typ"] != 'admin') {
+ $sql .= "WHERE sys_groupid =" . $client_group_id;
+ }
+ $sql .= " ORDER BY domain";
$domains = $app->db->queryAllRecords($sql);
$domain_select = '';
- if(is_array($domains)) {
+ if(is_array($domains) && sizeof($domains) > 0) {
+ /* We have domains in the list, so create the drop-down-list */
foreach( $domains as $domain) {
- $domain_select .= "<option value=" . $domain['domain'] . ">" . $domain['domain'] . "</option>\r\n";
+ $domain_select .= "<option value=" . $domain['domain'] ;
+ if ($domain['domain'] == $this->dataRecord["domain"]) {
+ $domain_select .= " selected";
+ }
+ $domain_select .= ">" . $domain['domain'] . "</option>\r\n";
}
-
- } else {
+ }
+ else {
/*
* We have no domains in the domain-list. This means, we can not add ANY new domain.
* To avoid, that the variable "domain_option" is empty and so the user can
* free enter a domain, we have to create a empty option!
- */
+ */
$domain_select .= "<option value=''></option>\r\n";
}
$app->tpl->setVar("domain_option",$domain_select);
--
Gitblit v1.9.1