Skip to content

Commit 3aa0c3c

Browse files
author
vogelor
committed
Fixed some bug if the domain module is active:
1) Edit a domain: The selected domain is also selected in the dropdown-list 2) Edit a domain: The admin can now select any domain not only his/her
1 parent baba989 commit 3aa0c3c

File tree

2 files changed

+107
-78
lines changed

2 files changed

+107
-78
lines changed

interface/web/mail/mail_domain_edit.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,40 @@ function onShowEnd() {
119119
/*
120120
* Now we have to check, if we should use the domain-module to select the domain
121121
* or not
122-
*/
122+
*/
123123
$app->uses('ini_parser,getconf');
124124
$settings = $app->getconf->get_global_config('domains');
125125
if ($settings['use_domain_module'] == 'y') {
126+
/*
127+
* The domain-module is in use.
128+
*/
126129
$client_group_id = $_SESSION["s"]["user"]["default_group"];
127-
$sql = "SELECT domain FROM domain WHERE sys_groupid =" . $client_group_id . " ORDER BY domain";
130+
/*
131+
* The admin can select ALL domains, the user only the domains assigned to him
132+
*/
133+
$sql = "SELECT domain FROM domain ";
134+
if ($_SESSION["s"]["user"]["typ"] != 'admin') {
135+
$sql .= "WHERE sys_groupid =" . $client_group_id;
136+
}
137+
$sql .= " ORDER BY domain";
128138
$domains = $app->db->queryAllRecords($sql);
129139
$domain_select = '';
130-
if(is_array($domains)) {
140+
if(is_array($domains) && sizeof($domains) > 0) {
141+
/* We have domains in the list, so create the drop-down-list */
131142
foreach( $domains as $domain) {
132-
$domain_select .= "<option value=" . $domain['domain'] . ">" . $domain['domain'] . "</option>\r\n";
143+
$domain_select .= "<option value=" . $domain['domain'] ;
144+
if ($domain['domain'] == $this->dataRecord["domain"]) {
145+
$domain_select .= " selected";
146+
}
147+
$domain_select .= ">" . $domain['domain'] . "</option>\r\n";
133148
}
134-
135-
} else {
149+
}
150+
else {
136151
/*
137152
* We have no domains in the domain-list. This means, we can not add ANY new domain.
138153
* To avoid, that the variable "domain_option" is empty and so the user can
139154
* free enter a domain, we have to create a empty option!
140-
*/
155+
*/
141156
$domain_select .= "<option value=''></option>\r\n";
142157
}
143158
$app->tpl->setVar("domain_option",$domain_select);

0 commit comments

Comments
 (0)