Skip to content

Commit e7e3b7f

Browse files
committed
Merge branch 'stable-3.1' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.1
2 parents a08a291 + 3ce6d76 commit e7e3b7f

File tree

2 files changed

+29
-29
lines changed

2 files changed

+29
-29
lines changed

interface/lib/classes/remote.d/client.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function client_template_additional_get($session_id, $client_id) {
257257

258258
if(@is_numeric($client_id)) {
259259
$sql = "SELECT * FROM `client_template_assigned` WHERE `client_id` = ?";
260-
return $app->db->queryOneRecord($sql, $client_id);
260+
return $app->db->queryAllRecords($sql, $client_id);
261261
} else {
262262
throw new SoapFault('The ID must be an integer.');
263263
return array();

server/plugins-available/rspamd_plugin.inc.php

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class rspamd_plugin {
3333
var $plugin_name = 'rspamd_plugin';
3434
var $class_name = 'rspamd_plugin';
3535
var $users_config_dir = '/etc/rspamd/local.d/users/';
36-
36+
3737
//* This function is called during ispconfig installation to determine
3838
// if a symlink shall be created for this plugin.
3939
function onInstall() {
@@ -98,7 +98,7 @@ private function isValidEmail($email) {
9898

9999
return true;
100100
}
101-
101+
102102
/*
103103
This function is called when the plugin is loaded
104104
*/
@@ -114,17 +114,17 @@ function onLoad() {
114114
$app->plugins->registerEvent('spamfilter_wblist_insert', $this->plugin_name, 'spamfilter_wblist_insert');
115115
$app->plugins->registerEvent('spamfilter_wblist_update', $this->plugin_name, 'spamfilter_wblist_update');
116116
$app->plugins->registerEvent('spamfilter_wblist_delete', $this->plugin_name, 'spamfilter_wblist_delete');
117-
117+
118118
//* global mail access filters
119119
$app->plugins->registerEvent('mail_access_insert', $this->plugin_name, 'spamfilter_wblist_insert');
120120
$app->plugins->registerEvent('mail_access_update', $this->plugin_name, 'spamfilter_wblist_update');
121121
$app->plugins->registerEvent('mail_access_delete', $this->plugin_name, 'spamfilter_wblist_delete');
122-
122+
123123
//* server ip
124124
$app->plugins->registerEvent('server_ip_insert', $this->plugin_name, 'server_ip');
125125
$app->plugins->registerEvent('server_ip_update', $this->plugin_name, 'server_ip');
126126
$app->plugins->registerEvent('server_ip_delete', $this->plugin_name, 'server_ip');
127-
127+
128128
//* spamfilter_users
129129
$app->plugins->registerEvent('spamfilter_users_insert', $this->plugin_name, 'user_settings_update');
130130
$app->plugins->registerEvent('spamfilter_users_update', $this->plugin_name, 'user_settings_update');
@@ -141,11 +141,11 @@ function onLoad() {
141141

142142
function user_settings_update($event_name, $data) {
143143
global $app, $conf;
144-
144+
145145
if(!is_dir('/etc/rspamd')) {
146146
return;
147147
}
148-
148+
149149
$use_data = 'new';
150150
if(substr($event_name, -7) === '_delete') {
151151
$mode = 'delete';
@@ -159,7 +159,7 @@ function user_settings_update($event_name, $data) {
159159
// get the config
160160
$app->uses('getconf,system,functions');
161161
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
162-
162+
163163
$type = false;
164164
$identifier = false;
165165
$entry_id = false;
@@ -180,7 +180,7 @@ function user_settings_update($event_name, $data) {
180180
$app->log('Invalid event name for rspamd_plugin: ' . $event_name, LOGLEVEL_WARN);
181181
return;
182182
}
183-
183+
184184
$is_domain = false;
185185
$email_address = $data[$use_data][$identifier];
186186
$settings_name = $email_address;
@@ -199,13 +199,13 @@ function user_settings_update($event_name, $data) {
199199
$email_address = '@' . $email_address;
200200
$is_domain = true;
201201
}
202-
202+
203203
if($settings_name == '') {
204204
// missing settings file name
205205
$app->log('Empty rspamd identifier in rspamd_plugin from identifier: ' . $use_data . '/' . $identifier, LOGLEVEL_WARN);
206206
return;
207207
}
208-
208+
209209
$settings_file = $this->users_config_dir . str_replace('@', '_', $settings_name) . '.conf';
210210
//$app->log('Settings file for rspamd is ' . $settings_file, LOGLEVEL_WARN);
211211
if($mode === 'delete') {
@@ -219,11 +219,11 @@ function user_settings_update($event_name, $data) {
219219
} elseif($is_domain === true) {
220220
$settings_priority = 18;
221221
}
222-
222+
223223
// get policy for entry
224224
if($type === 'spamfilter_user') {
225225
$policy = $app->db->queryOneRecord("SELECT * FROM spamfilter_policy WHERE id = ?", intval($data['new']['policy_id']));
226-
226+
227227
$check = $app->db->queryOneRecord('SELECT `greylisting` FROM `mail_user` WHERE `server_id` = ? AND `email` = ? UNION SELECT `greylisting` FROM `mail_forwarding` WHERE `server_id` = ? AND `source` = ? ORDER BY (`greylisting` = ?) DESC', $conf['server_id'], $email_address, $conf['server_id'], $email_address, 'y');
228228
if($check) {
229229
$greylisting = $check['greylisting'];
@@ -233,16 +233,16 @@ function user_settings_update($event_name, $data) {
233233
} else {
234234
$search_for_policy[] = $email_address;
235235
$search_for_policy[] = substr($email_address, strpos($email_address, '@'));
236-
236+
237237
$policy = $app->db->queryOneRecord("SELECT p.* FROM spamfilter_users as u INNER JOIN spamfilter_policy as p ON (p.id = u.policy_id) WHERE u.server_id = ? AND u.email IN ? ORDER BY u.priority DESC", $conf['server_id'], $search_for_policy);
238-
238+
239239
$greylisting = $data[$use_data]['greylisting'];
240240
}
241-
241+
242242
if(!is_dir($this->users_config_dir)){
243243
$app->system->mkdirpath($this->users_config_dir);
244244
}
245-
245+
246246
if(!$this->isValidEmail($app->functions->idn_encode($email_address))) {
247247
if(is_file($settings_file)) {
248248
unlink($settings_file);
@@ -285,7 +285,7 @@ function user_settings_update($event_name, $data) {
285285
}
286286

287287
$tpl->setVar('rspamd_spam_tag_level', floatval($policy['rspamd_spam_tag_level']));
288-
$tpl->setVar('rspamd_spam_tag_method', floatval($policy['rspamd_spam_tag_method']));
288+
$tpl->setVar('rspamd_spam_tag_method', $policy['rspamd_spam_tag_method']);
289289
$tpl->setVar('rspamd_spam_kill_level', floatval($policy['rspamd_spam_kill_level']));
290290
$tpl->setVar('rspamd_virus_kill_level', floatval($policy['rspamd_spam_kill_level']) + 1000);
291291

@@ -324,7 +324,7 @@ function spamfilter_wblist_update($event_name, $data) {
324324

325325
$app->uses('getconf,system,functions');
326326
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
327-
327+
328328
if(is_dir('/etc/rspamd')) {
329329
$global_filter = false;
330330
//* Create the config file
@@ -354,12 +354,12 @@ function spamfilter_wblist_update($event_name, $data) {
354354
);
355355
}
356356
}
357-
357+
358358
if($data['new']['active'] == 'y' && is_array($filter) && !empty($filter)){
359359
if(!is_dir($this->users_config_dir)){
360360
$app->system->mkdirpath($this->users_config_dir);
361361
}
362-
362+
363363
$app->load('tpl');
364364

365365
$filter_from = $filter['from'];
@@ -407,13 +407,13 @@ function spamfilter_wblist_update($event_name, $data) {
407407
} elseif(is_file($wblist_file)) {
408408
unlink($wblist_file);
409409
}
410-
410+
411411
if($mail_config['content_filter'] == 'rspamd' && is_file('/etc/init.d/rspamd')) {
412412
$app->services->restartServiceDelayed('rspamd', 'reload');
413413
}
414414
}
415415
}
416-
416+
417417
function spamfilter_wblist_delete($event_name, $data) {
418418
global $app, $conf;
419419

@@ -439,17 +439,17 @@ function spamfilter_wblist_delete($event_name, $data) {
439439

440440
function server_ip($event_name, $data) {
441441
global $app, $conf;
442-
442+
443443
// get the config
444444
$app->uses("getconf,system");
445445
$app->load('tpl');
446446

447447
$mail_config = $app->getconf->get_server_config($conf['server_id'], 'mail');
448-
448+
449449
if(is_dir('/etc/rspamd')) {
450450
$tpl = new tpl();
451451
$tpl->newTemplate('rspamd_users.conf.master');
452-
452+
453453
$whitelist_ips = array();
454454
$ips = $app->db->queryAllRecords("SELECT * FROM server_ip WHERE server_id = ?", $conf['server_id']);
455455
if(is_array($ips) && !empty($ips)){
@@ -459,13 +459,13 @@ function server_ip($event_name, $data) {
459459
}
460460
$tpl->setLoop('whitelist_ips', $whitelist_ips);
461461
$app->system->file_put_contents('/etc/rspamd/local.d/users.conf', $tpl->grab());
462-
462+
463463
if($mail_config['content_filter'] == 'rspamd'){
464464
$app->services->restartServiceDelayed('rspamd', 'reload');
465465
}
466466
}
467467
}
468-
468+
469469
private function _is_valid_ip_address($ip) {
470470
if(function_exists('filter_var')) {
471471
if(!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_IPV6)) {

0 commit comments

Comments
 (0)