diff --git a/ispconfig3_account/ispconfig3_account.php b/ispconfig3_account/ispconfig3_account.php index 84f70d9..252bf36 100644 --- a/ispconfig3_account/ispconfig3_account.php +++ b/ispconfig3_account/ispconfig3_account.php @@ -105,7 +105,7 @@ function template_object_identityform($args) $email_pattern = '//U'; preg_match($email_pattern, $args['content'], $test); - $email = isset($test[1]) ? $test[1] : ''; + $email = $test[1] ?? ''; $args['content'] = preg_replace($email_pattern, $emails->show($email), $args['content']); return $args; diff --git a/ispconfig3_autoselect/ispconfig3_autoselect.php b/ispconfig3_autoselect/ispconfig3_autoselect.php index de4bc9b..a382e96 100644 --- a/ispconfig3_autoselect/ispconfig3_autoselect.php +++ b/ispconfig3_autoselect/ispconfig3_autoselect.php @@ -35,14 +35,16 @@ function load_con_config() { $config = $this->api->dir . 'ispconfig3_account/config/config.inc.php'; if (file_exists($config)) { - if (!$this->rcmail->config->load_from_file($config)) + if (!$this->rcmail->config->load_from_file($config)) { rcube::raise_error(['code' => 527, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Failed to load config from $config"], true, false); + } } else if (file_exists($config . ".dist")) { - if (!$this->rcmail->config->load_from_file($config . '.dist')) + if (!$this->rcmail->config->load_from_file($config . '.dist')) { rcube::raise_error(['code' => 527, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Failed to load config from $config"], true, false); + } } } @@ -55,8 +57,9 @@ function template_object_loginform($args) function authenticate($args) { - if (isset($_POST['_user'], $_POST['_pass'])) + if (isset($_POST['_user'], $_POST['_pass'])) { $args['host'] = $this->getHost(rcube_utils::get_input_value('_user', rcube_utils::INPUT_POST)); + } return $args; } diff --git a/ispconfig3_filter/ispconfig3_filter.php b/ispconfig3_filter/ispconfig3_filter.php index a4313a7..510c3e4 100644 --- a/ispconfig3_filter/ispconfig3_filter.php +++ b/ispconfig3_filter/ispconfig3_filter.php @@ -314,7 +314,7 @@ function gen_table($attrib) } $rule_table->set_row_attribs($row_attribs); - $this->_rule_row($rule_table, $filter_value['rulename'], $filter_value['active'], $filter_value['filter_id'], $attrib); + $this->_rule_row($rule_table, $filter_value['rulename'], $filter_value['active'], $filter_value['filter_id']); } if (empty($filter)) { @@ -334,7 +334,7 @@ function gen_table($attrib) return $out; } - private function _rule_row($rule_table, $name, $active, $id, $attrib) + private function _rule_row($rule_table, $name, $active, $id) { $rule_table->add(['class' => 'rule', 'onclick' => 'filter_edit(' . $id . ');'], $name); @@ -359,7 +359,5 @@ private function _rule_row($rule_table, $name, $active, $id, $attrib) 'title' => 'delete' ]); $rule_table->add(['class' => 'control'], $del_button); - - return $rule_table; } } diff --git a/ispconfig3_spam/ispconfig3_spam.php b/ispconfig3_spam/ispconfig3_spam.php index 5385eed..1fcd8ea 100644 --- a/ispconfig3_spam/ispconfig3_spam.php +++ b/ispconfig3_spam/ispconfig3_spam.php @@ -1,4 +1,5 @@ [ 'policy_tag' => 'spam_tag_level', 'policy_tag2' => 'spam_tag2_level', @@ -26,29 +27,25 @@ function init() $this->add_texts('localization/'); $this->require_plugin('ispconfig3_account'); - $this->register_action('plugin.ispconfig3_spam', array($this, 'init_html')); - $this->register_action('plugin.ispconfig3_spam.save', array($this, 'save')); + $this->register_action('plugin.ispconfig3_spam', [$this, 'init_html']); + $this->register_action('plugin.ispconfig3_spam.save', [$this, 'save']); if (strpos($this->rcmail->action, 'plugin.ispconfig3_spam') === 0) { - $this->api->output->add_handler('spam_form', array($this, 'gen_form')); - $this->api->output->add_handler('sectionname_spam', array($this, 'prefs_section_name')); - $this->api->output->add_handler('spam_table', array($this, 'gen_table')); + $this->api->output->add_handler('spam_form', [$this, 'gen_form']); + $this->api->output->add_handler('sectionname_spam', [$this, 'prefs_section_name']); + $this->api->output->add_handler('spam_table', [$this, 'gen_table']); $this->include_script('spam.js'); $this->include_stylesheet($this->local_skin_path() . '/spam.css'); - $this->soap = new SoapClient(null, array( + $this->soap = new SoapClient(null, [ 'location' => $this->rcmail->config->get('soap_url') . 'index.php', 'uri' => $this->rcmail->config->get('soap_url'), $this->rcmail->config->get('soap_validate_cert') ?: - 'stream_context' => stream_context_create( - array('ssl' => array( - 'verify_peer' => false, - 'verify_peer_name' => false, - 'allow_self_signed' => true - ) - )) - )); + 'stream_context' => stream_context_create(['ssl' => [ + 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true + ]]) + ]); } } @@ -67,38 +64,36 @@ function save() { $policy_id = rcube_utils::get_input_value('_spampolicy_name', rcube_utils::INPUT_POST); $move_junk = rcube_utils::get_input_value('_spammove', rcube_utils::INPUT_POST); - - if (!$move_junk) - $move_junk = 'n'; - else - $move_junk = 'y'; + $move_junk = (!$move_junk) ? 'n': 'y'; try { $session_id = $this->soap->login($this->rcmail->config->get('remote_soap_user'), $this->rcmail->config->get('remote_soap_pass')); - $mail_user = $this->soap->mail_user_get($session_id, array('login' => $this->rcmail->user->data['username'])); + $mail_user = $this->soap->mail_user_get($session_id, ['login' => $this->rcmail->user->data['username']]); // Alternatively also search the email field, this can differ from the login field for legacy reasons. if (empty($mail_user)) { - $mail_user = $this->soap->mail_user_get($session_id, array('email' => $this->rcmail->user->data['username'])); + $mail_user = $this->soap->mail_user_get($session_id, ['email' => $this->rcmail->user->data['username']]); } - $spam_user = $this->soap->mail_spamfilter_user_get($session_id, array('email' => $mail_user[0]['email'])); + $spam_user = $this->soap->mail_spamfilter_user_get($session_id, ['email' => $mail_user[0]['email']]); $uid = $this->soap->client_get_id($session_id, $mail_user[0]['sys_userid']); if ($spam_user[0]['id'] == '') { - $params = array('server_id' => $mail_user[0]['server_id'], - 'priority' => '5', - 'policy_id' => $policy_id, - 'email' => $mail_user[0]['email'], - 'fullname' => $mail_user[0]['email'], - 'local' => 'Y'); - - $add = $this->soap->mail_spamfilter_user_add($session_id, $uid, $params); + $params = [ + 'server_id' => $mail_user[0]['server_id'], + 'priority' => '5', + 'policy_id' => $policy_id, + 'email' => $mail_user[0]['email'], + 'fullname' => $mail_user[0]['email'], + 'local' => 'Y' + ]; + + $this->soap->mail_spamfilter_user_add($session_id, $uid, $params); } else { $params = $spam_user[0]; $params['policy_id'] = $policy_id; - $update = $this->soap->mail_spamfilter_user_update($session_id, $uid, $spam_user[0]['id'], $params); + $this->soap->mail_spamfilter_user_update($session_id, $uid, $spam_user[0]['id'], $params); } $params = $mail_user[0]; @@ -106,17 +101,21 @@ function save() $ispconfig_version = $this->soap->server_get_app_version($session_id); if (version_compare($ispconfig_version['ispc_app_version'], '3.1dev', '<')) { - $startdate = array('year' => substr($params['autoresponder_start_date'], 0, 4), + $startdate = [ + 'year' => substr($params['autoresponder_start_date'], 0, 4), 'month' => substr($params['autoresponder_start_date'], 5, 2), 'day' => substr($params['autoresponder_start_date'], 8, 2), 'hour' => substr($params['autoresponder_start_date'], 11, 2), - 'minute' => substr($params['autoresponder_start_date'], 14, 2)); + 'minute' => substr($params['autoresponder_start_date'], 14, 2) + ]; - $enddate = array('year' => substr($params['autoresponder_end_date'], 0, 4), + $enddate = [ + 'year' => substr($params['autoresponder_end_date'], 0, 4), 'month' => substr($params['autoresponder_end_date'], 5, 2), 'day' => substr($params['autoresponder_end_date'], 8, 2), 'hour' => substr($params['autoresponder_end_date'], 11, 2), - 'minute' => substr($params['autoresponder_end_date'], 14, 2)); + 'minute' => substr($params['autoresponder_end_date'], 14, 2) + ]; $params['autoresponder_end_date'] = $enddate; $params['autoresponder_start_date'] = $startdate; @@ -124,7 +123,7 @@ function save() $params['move_junk'] = $move_junk; - $update = $this->soap->mail_user_update($session_id, $uid, $mail_user[0]['mailuser_id'], $params); + $this->soap->mail_user_update($session_id, $uid, $mail_user[0]['mailuser_id'], $params); $this->soap->logout($session_id); $this->rcmail->output->command('display_message', $this->gettext('successfullysaved'), 'confirmation'); @@ -139,59 +138,60 @@ function save() function gen_form($attrib) { - $policy_name = array(); - $policy_id = array(); + $policy_name = []; + $policy_id = []; $enabled = 0; $form_id = $attrib['id'] ?: 'form'; - $out = $this->rcmail->output->request_form(array( + $out = $this->rcmail->output->request_form([ 'id' => $form_id, 'name' => $form_id, 'method' => 'post', 'task' => 'settings', 'action' => 'plugin.ispconfig3_spam.save', 'noclose' => true - ) + $attrib); + ] + $attrib); $out .= '