| | |
| | | 1 => 'notifyimportancehigh' |
| | | ); |
| | | |
| | | const VERSION = '8.4'; |
| | | const VERSION = '8.7'; |
| | | const PROGNAME = 'Roundcube (Managesieve)'; |
| | | const PORT = 4190; |
| | | |
| | |
| | | else if ($action == 'act' && !$error) { |
| | | if (isset($this->script[$fid])) { |
| | | $rule = $this->script[$fid]; |
| | | $disabled = $rule['disabled'] ? true : false; |
| | | $disabled = !empty($rule['disabled']); |
| | | $rule['disabled'] = !$disabled; |
| | | $result = $this->sieve->script->update_rule($fid, $rule); |
| | | |
| | |
| | | } |
| | | } |
| | | else if ($action == 'setget') { |
| | | $this->rc->request_security_check(rcube_utils::INPUT_GET); |
| | | |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | $script = $this->sieve->get_script($script_name); |
| | | |
| | |
| | | $lastindexes = rcube_utils::get_input_value('_rule_index_last', rcube_utils::INPUT_POST); |
| | | $dateheaders = rcube_utils::get_input_value('_rule_date_header', rcube_utils::INPUT_POST); |
| | | $dateparts = rcube_utils::get_input_value('_rule_date_part', rcube_utils::INPUT_POST); |
| | | $message = rcube_utils::get_input_value('_rule_message', rcube_utils::INPUT_POST); |
| | | $dup_handles = rcube_utils::get_input_value('_rule_duplicate_handle', rcube_utils::INPUT_POST, true); |
| | | $dup_headers = rcube_utils::get_input_value('_rule_duplicate_header', rcube_utils::INPUT_POST, true); |
| | | $dup_uniqueids = rcube_utils::get_input_value('_rule_duplicate_uniqueid', rcube_utils::INPUT_POST, true); |
| | | $dup_seconds = rcube_utils::get_input_value('_rule_duplicate_seconds', rcube_utils::INPUT_POST); |
| | | $dup_lasts = rcube_utils::get_input_value('_rule_duplicate_last', rcube_utils::INPUT_POST); |
| | | $act_types = rcube_utils::get_input_value('_action_type', rcube_utils::INPUT_POST, true); |
| | | $mailboxes = rcube_utils::get_input_value('_action_mailbox', rcube_utils::INPUT_POST, true); |
| | | $act_targets = rcube_utils::get_input_value('_action_target', rcube_utils::INPUT_POST, true); |
| | |
| | | $addresses = rcube_utils::get_input_value('_action_addresses', rcube_utils::INPUT_POST, true); |
| | | $intervals = rcube_utils::get_input_value('_action_interval', rcube_utils::INPUT_POST); |
| | | $interval_types = rcube_utils::get_input_value('_action_interval_type', rcube_utils::INPUT_POST); |
| | | $from = rcube_utils::get_input_value('_action_from', rcube_utils::INPUT_POST); |
| | | $subject = rcube_utils::get_input_value('_action_subject', rcube_utils::INPUT_POST, true); |
| | | $flags = rcube_utils::get_input_value('_action_flags', rcube_utils::INPUT_POST); |
| | | $varnames = rcube_utils::get_input_value('_action_varname', rcube_utils::INPUT_POST); |
| | |
| | | foreach ($sizeitems as $item) |
| | | $items[] = $item; |
| | | |
| | | $this->form['disabled'] = $_POST['_disabled'] ? true : false; |
| | | $this->form['join'] = $join=='allof' ? true : false; |
| | | $this->form['disabled'] = !empty($_POST['_disabled']); |
| | | $this->form['join'] = $join == 'allof'; |
| | | $this->form['name'] = $name; |
| | | $this->form['tests'] = array(); |
| | | $this->form['actions'] = array(); |
| | |
| | | $this->form['tests'][$i]['content'] = $trans_type; |
| | | } |
| | | } |
| | | else if ($header == 'message') { |
| | | $test = $this->strip_value($message[$idx]); |
| | | |
| | | if (preg_match('/^not/', $test)) { |
| | | $this->form['tests'][$i]['not'] = true; |
| | | $test = substr($test, 3); |
| | | } |
| | | |
| | | $this->form['tests'][$i]['test'] = $test; |
| | | |
| | | if ($test == 'duplicate') { |
| | | $this->form['tests'][$i]['last'] = !empty($dup_lasts[$idx]); |
| | | $this->form['tests'][$i]['handle'] = trim($dup_handles[$idx]); |
| | | $this->form['tests'][$i]['header'] = trim($dup_headers[$idx]); |
| | | $this->form['tests'][$i]['uniqueid'] = trim($dup_uniqueids[$idx]); |
| | | $this->form['tests'][$i]['seconds'] = trim($dup_seconds[$idx]); |
| | | |
| | | if ($this->form['tests'][$i]['seconds'] |
| | | && preg_match('/[^0-9]/', $this->form['tests'][$i]['seconds']) |
| | | ) { |
| | | $this->errors['tests'][$i]['duplicate_seconds'] = $this->plugin->gettext('forbiddenchars'); |
| | | } |
| | | |
| | | if ($this->form['tests'][$i]['header'] && $this->form['tests'][$i]['uniqueid']) { |
| | | $this->errors['tests'][$i]['duplicate_uniqueid'] = $this->plugin->gettext('duplicate.conflict.err'); |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | $cust_header = $headers = $this->strip_value(array_shift($cust_headers)); |
| | | $mod = $this->strip_value($mods[$idx]); |
| | |
| | | $interval_type = $interval_types[$idx] == 'seconds' ? 'seconds' : 'days'; |
| | | |
| | | $this->form['actions'][$i]['reason'] = str_replace("\r\n", "\n", $reason); |
| | | $this->form['actions'][$i]['from'] = $from[$idx]; |
| | | $this->form['actions'][$i]['subject'] = $subject[$idx]; |
| | | $this->form['actions'][$i]['addresses'] = array_shift($addresses); |
| | | $this->form['actions'][$i][$interval_type] = $intervals[$idx]; |
| | | // @TODO: vacation :mime, :from, :handle |
| | | // @TODO: vacation :mime, :handle |
| | | |
| | | foreach ((array)$this->form['actions'][$i]['addresses'] as $aidx => $address) { |
| | | $this->form['actions'][$i]['addresses'][$aidx] = $address = trim($address); |
| | |
| | | $this->errors['actions'][$i]['addresses'] = $this->plugin->gettext('noemailwarning'); |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!empty($this->form['actions'][$i]['from']) && !rcube_utils::check_email($this->form['actions'][$i]['from'])) { |
| | | $this->errors['actions'][$i]['from'] = $this->plugin->gettext('noemailwarning'); |
| | | } |
| | | |
| | | if ($this->form['actions'][$i]['reason'] == '') |
| | |
| | | $this->rc->output->show_message('managesieve.filtersaveerror', 'error'); |
| | | // $this->rc->output->send(); |
| | | } |
| | | } |
| | | else { |
| | | $this->rc->output->show_message('managesieve.filterformerror', 'warning'); |
| | | } |
| | | } |
| | | |
| | |
| | | $select_header->add($header, $index); |
| | | } |
| | | $select_header->add($this->plugin->gettext('...'), '...'); |
| | | if (in_array('body', $this->exts)) |
| | | if (in_array('body', $this->exts)) { |
| | | $select_header->add($this->plugin->gettext('body'), 'body'); |
| | | } |
| | | $select_header->add($this->plugin->gettext('size'), 'size'); |
| | | if (in_array('date', $this->exts)) { |
| | | $select_header->add($this->plugin->gettext('datetest'), 'date'); |
| | | $select_header->add($this->plugin->gettext('currdate'), 'currentdate'); |
| | | } |
| | | if (in_array('duplicate', $this->exts)) { |
| | | $select_header->add($this->plugin->gettext('message'), 'message'); |
| | | } |
| | | |
| | | if (isset($rule['test'])) { |
| | |
| | | } |
| | | else if (in_array($rule['test'], array('size', 'body', 'date', 'currentdate'))) { |
| | | $test = $rule['test']; |
| | | } |
| | | else if (in_array($rule['test'], array('duplicate'))) { |
| | | $test = 'message'; |
| | | } |
| | | else if ($rule['test'] != 'true') { |
| | | $test = '...'; |
| | |
| | | |
| | | // matching type select (operator) |
| | | $select_op = new html_select(array('name' => "_rule_op[]", 'id' => 'rule_op'.$id, |
| | | 'style' => 'display:' .($rule['test']!='size' ? 'inline' : 'none'), |
| | | 'style' => 'display:' .(!in_array($rule['test'], array('size', 'duplicate')) ? 'inline' : 'none'), |
| | | 'class' => 'operator_selector', |
| | | 'onchange' => 'rule_op_select(this, '.$id.')')); |
| | | $select_op->add(rcube::Q($this->plugin->gettext('filtercontains')), 'contains'); |
| | |
| | | $tout .= $select_dp->show($rule['test'] == 'currentdate' || $rule['test'] == 'date' ? $rule['part'] : ''); |
| | | } |
| | | |
| | | // message test select (e.g. duplicate) |
| | | if (in_array('duplicate', $this->exts)) { |
| | | $select_msg = new html_select(array('name' => "_rule_message[]", 'id' => 'rule_message'.$id, |
| | | 'style' => in_array($rule['test'], array('duplicate')) ? '' : 'display:none', |
| | | 'class' => 'message_selector', |
| | | )); |
| | | |
| | | $select_msg->add(rcube::Q($this->plugin->gettext('duplicate')), 'duplicate'); |
| | | $select_msg->add(rcube::Q($this->plugin->gettext('notduplicate')), 'notduplicate'); |
| | | |
| | | $tout .= $select_msg->show($test); |
| | | } |
| | | |
| | | $tout .= $select_op->show($test); |
| | | $tout .= $this->list_input($id, 'rule_target', $target, |
| | | $rule['test'] != 'size' && $rule['test'] != 'exists', |
| | | $rule['test'] != 'size' && $rule['test'] != 'exists' && $rule['test'] != 'duplicate', |
| | | $this->error_class($id, 'test', 'target', 'rule_target')) . "\n"; |
| | | |
| | | $select_size_op = new html_select(array('name' => "_rule_size_op[]", 'id' => 'rule_size_op'.$id)); |
| | |
| | | 'onchange' => 'rule_mod_select(' .$id .')')); |
| | | $select_mod->add(rcube::Q($this->plugin->gettext('none')), ''); |
| | | $select_mod->add(rcube::Q($this->plugin->gettext('address')), 'address'); |
| | | if (in_array('envelope', $this->exts)) |
| | | if (in_array('envelope', $this->exts)) { |
| | | $select_mod->add(rcube::Q($this->plugin->gettext('envelope')), 'envelope'); |
| | | } |
| | | |
| | | $select_type = new html_select(array('name' => "_rule_mod_type[]", 'id' => 'rule_mod_type'.$id)); |
| | | $select_type->add(rcube::Q($this->plugin->gettext('allparts')), 'all'); |
| | |
| | | $select_type->add(rcube::Q($this->plugin->gettext('detail')), 'detail'); |
| | | } |
| | | |
| | | $need_mod = !in_array($rule['test'], array('size', 'body', 'date', 'currentdate')); |
| | | $need_mod = !in_array($rule['test'], array('size', 'body', 'date', 'currentdate', 'duplicate')); |
| | | $mout = '<div id="rule_mod' .$id. '" class="adv"' . (!$need_mod ? ' style="display:none"' : '') . '>'; |
| | | $mout .= ' <span class="label">' . rcube::Q($this->plugin->gettext('modifier')) . ' </span>'; |
| | | $mout .= $select_mod->show($rule['test']); |
| | |
| | | } |
| | | |
| | | // Comparators |
| | | $mout .= '<div id="rule_comp' .$id. '" class="adv"' . ($rule['test'] == 'size' ? ' style="display:none"' : '') . '>'; |
| | | $need_comp = $rule['test'] != 'size' && $rule['test'] != 'duplicate'; |
| | | $mout .= '<div id="rule_comp' .$id. '" class="adv"' . (!$need_comp ? ' style="display:none"' : '') . '>'; |
| | | $mout .= '<span class="label">' . rcube::Q($this->plugin->gettext('comparator')) . '</span>'; |
| | | $mout .= $select_comp->show($rule['comparator']); |
| | | $mout .= '</div>'; |
| | |
| | | $mout .= ' <input type="checkbox" name="_rule_index_last[]" id="rule_index_last'.$id |
| | | . '" value="1"' . (!empty($rule['last']) ? ' checked="checked"' : '') . ' />' |
| | | . '<label for="rule_index_last'.$id.'">'.rcube::Q($this->plugin->gettext('indexlast')).'</label>'; |
| | | $mout .= '</div>'; |
| | | } |
| | | |
| | | // Duplicate |
| | | if (in_array('duplicate', $this->exts)) { |
| | | $need_duplicate = $rule['test'] == 'duplicate'; |
| | | $mout .= '<div id="rule_duplicate_div' .$id. '" class="adv"'. (!$need_duplicate ? ' style="display:none"' : '') .'>'; |
| | | $mout .= '<span class="label">' . rcube::Q($this->plugin->gettext('duplicate.handle')) . '</span>'; |
| | | $mout .= '<input type="text" name="_rule_duplicate_handle[]" id="rule_duplicate_handle'.$id |
| | | . '" value="'. ($rule['handle'] ? rcube::JQ($rule['handle']) : '') |
| | | . '" size="30"' . $this->error_class($id, 'test', 'duplicate_handle', 'rule_duplicate_handle') .' /><br>'; |
| | | $mout .= '<span class="label">' . rcube::Q($this->plugin->gettext('duplicate.header')) . '</span>'; |
| | | $mout .= '<input type="text" name="_rule_duplicate_header[]" id="rule_duplicate_header'.$id |
| | | . '" value="'. ($rule['header'] ? rcube::JQ($rule['header']) : '') |
| | | . '" size="30"' . $this->error_class($id, 'test', 'duplicate_header', 'rule_duplicate_header') .' /><br>'; |
| | | $mout .= '<span class="label">' . rcube::Q($this->plugin->gettext('duplicate.uniqueid')) . '</span>'; |
| | | $mout .= '<input type="text" name="_rule_duplicate_uniqueid[]" id="rule_duplicate_uniqueid'.$id |
| | | . '" value="'. ($rule['uniqueid'] ? rcube::JQ($rule['uniqueid']) : '') |
| | | . '" size="30"' . $this->error_class($id, 'test', 'duplicate_uniqueid', 'rule_duplicate_uniqueid') .' /><br>'; |
| | | $mout .= '<span class="label">' . rcube::Q($this->plugin->gettext('duplicate.seconds')) . '</span>'; |
| | | $mout .= '<input type="text" name="_rule_duplicate_seconds[]" id="rule_duplicate_seconds'.$id |
| | | . '" value="'. rcube::JQ($rule['seconds']) |
| | | . '" size="6"' . $this->error_class($id, 'test', 'duplicate_seconds', 'rule_duplicate_seconds') .' />'; |
| | | $mout .= ' <input type="checkbox" name="_rule_duplicate_last['.$id.']" id="rule_duplicate_last'.$id |
| | | . '" value="1"' . (!empty($rule['last']) ? ' checked="checked"' : '') . ' />' |
| | | . '<label for="rule_duplicate_last'.$id.'">'.rcube::Q($this->plugin->gettext('duplicate.last')).'</label>'; |
| | | $mout .= '</div>'; |
| | | } |
| | | |
| | |
| | | $test = $rule['type']; |
| | | } |
| | | else if (in_array($rule['test'], $set)) { |
| | | $test = ($rule['not'] ? 'not' : '') . ($rule['type'] ? $rule['type'] : 'is'); |
| | | $test = ($rule['not'] ? 'not' : '') . ($rule['type'] ?: 'is'); |
| | | } |
| | | else { |
| | | $test = ($rule['not'] ? 'not' : '') . $rule['test']; |
| | |
| | | .'<input type="text" name="_action_subject['.$id.']" id="action_subject'.$id.'" ' |
| | | .'value="' . (is_array($action['subject']) ? rcube::Q(implode(', ', $action['subject']), 'strict', false) : $action['subject']) . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'subject', 'action_subject') .' />'; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->plugin->gettext('vacationfrom')) . '</span><br />' |
| | | .'<input type="text" name="_action_from['.$id.']" id="action_from'.$id.'" ' |
| | | .'value="' . $action['from'] . '" size="35" ' |
| | | . $this->error_class($id, 'action', 'from', 'action_from') .' />'; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->plugin->gettext('vacationaddr')) . '</span><br />' |
| | | . $this->list_input($id, 'action_addresses', $addresses, true, |
| | | $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30) |
| | |
| | | if (empty($filter['actions'])) { |
| | | continue; |
| | | } |
| | | $fname = $filter['name'] ? $filter['name'] : "#$i"; |
| | | $fname = $filter['name'] ?: "#$i"; |
| | | $result[] = array( |
| | | 'id' => $idx, |
| | | 'name' => $fname, |