Skip to content

Commit f806344

Browse files
author
Thom Pol
committed
Fix limit check for per domain relaying (#6088)
1 parent d867872 commit f806344

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

interface/web/mail/mail_domain_edit.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,20 @@ function onShowEnd() {
192192

193193
// Check wether per domain relaying is enabled or not
194194
$global_config = $app->getconf->get_global_config('mail');
195-
if($global_config['show_per_domain_relay_options'] == 'n') {
195+
if($global_config['show_per_domain_relay_options'] == 'y') {
196196
$app->tpl->setVar("show_per_domain_relay_options", 1);
197197
} else {
198198
$app->tpl->setVar("show_per_domain_relay_options", 0);
199199
}
200200

201+
// Get the limits of the client
202+
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
203+
$client = $app->db->queryOneRecord("SELECT limit_relayhost FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
204+
if ($client["limit_relayhost"] == 'y' || $_SESSION["s"]["user"]["typ"] == 'admin') {
205+
$app->tpl->setVar("limit_relayhost", 1);
206+
} else {
207+
$app->tpl->setVar("limit_relayhost", 0);
208+
}
201209

202210
// Get the spamfilter policys for the user
203211
$tmp_user = $app->db->queryOneRecord("SELECT policy_id FROM spamfilter_users WHERE email = ?", '@' . $this->dataRecord["domain"]);
@@ -273,7 +281,7 @@ function onSubmit() {
273281
if($_SESSION["s"]["user"]["typ"] != 'admin') {
274282
// Get the limits of the client
275283
$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
276-
$client = $app->db->queryOneRecord("SELECT client.mail_servers, limit_maildomain, default_mailserver, limit_relayhost FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
284+
$client = $app->db->queryOneRecord("SELECT client.mail_servers, limit_maildomain, default_mailserver FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = ?", $client_group_id);
277285
// When the record is updated
278286
if($this->id > 0) {
279287
// restore the server ID if the user is not admin and record is edited

interface/web/mail/templates/mail_domain_edit.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
</select></div>
7777
</div>
7878
<tmpl_if name="show_per_domain_relay_options">
79-
<tmpl_if name="limit_relayhost" op="==" value="y">
79+
<tmpl_if name="limit_relayhost">
8080
<div class="form-group">
8181
<label for="relay_host" class="col-sm-3 control-label">{tmpl_var name='relayhost_txt'}</label>
8282
<div class="col-sm-9">

0 commit comments

Comments
 (0)