diff --git a/modules/sievefilters/modules.php b/modules/sievefilters/modules.php index 7141264c44..3022e081ea 100644 --- a/modules/sievefilters/modules.php +++ b/modules/sievefilters/modules.php @@ -208,67 +208,67 @@ function get_blocked_senders($mailbox, $mailbox_id, $icon_svg, $icon_block_domai try { $client = $factory->init($user_config, $mailbox); $scripts = $client->listScripts(); - } catch (Exception $e) { - Hm_Msgs::add("ERRSieve: {$e->getMessage()}"); - return ''; - } - if (array_search('blocked_senders', $scripts, true) === false) { - return ''; - } - $current_script = $client->getScript('blocked_senders'); - $blocked_list_actions = []; - if ($current_script != '') { - $script_split = preg_split('#\r?\n#', $current_script, 0); - if (!isset($script_split[1])) { - return ''; - } - $base64_obj = str_replace("# ", "", $script_split[1]); - $blocked_list = json_decode(base64_decode($base64_obj)); - if (!$blocked_list) { + if (array_search('blocked_senders', $scripts, true) === false) { return ''; } - if (isset($script_split[2])) { - $base64_obj_actions = str_replace("# ", "", $script_split[2]); - $blocked_list_actions = json_decode(base64_decode($base64_obj_actions), true); - } - foreach ($blocked_list as $blocked_sender) { - if (explode('@', $blocked_sender)[0] == '') { - $blocked_sender = '*'.$blocked_sender; + $current_script = $client->getScript('blocked_senders'); + $blocked_list_actions = []; + if ($current_script != '') { + $script_split = preg_split('#\r?\n#', $current_script, 0); + if (!isset($script_split[1])) { + return ''; + } + $base64_obj = str_replace("# ", "", $script_split[1]); + $blocked_list = json_decode(base64_decode($base64_obj)); + if (!$blocked_list) { + return ''; + } + if (isset($script_split[2])) { + $base64_obj_actions = str_replace("# ", "", $script_split[2]); + $blocked_list_actions = json_decode(base64_decode($base64_obj_actions), true); + } + foreach ($blocked_list as $blocked_sender) { + if (explode('@', $blocked_sender)[0] == '') { + $blocked_sender = '*'.$blocked_sender; + } + $blocked_senders[] = $blocked_sender; } - $blocked_senders[] = $blocked_sender; } - } - $actions_map = [ - 'blocked' => $module->trans('Move To Blocked'), - 'reject_with_message' => $module->trans('Reject With Message'), - 'reject_default' => $module->trans('Reject'), - 'discard' => $module->trans('Discard'), - 'default' => $module->trans('Default'), - ]; - $ret = ''; - foreach ($blocked_senders as $sender) { - $reject_message = $blocked_list_actions[$sender]['reject_message']; - $ret .= '