| | |
| | | 1 => 'notifyimportancehigh' |
| | | ); |
| | | |
| | | const VERSION = '8.3'; |
| | | const VERSION = '8.5'; |
| | | const PROGNAME = 'Roundcube (Managesieve)'; |
| | | const PORT = 4190; |
| | | |
| | |
| | | |
| | | $this->rc->output->command('managesieve_actionfill', $content, $id, $aid); |
| | | } |
| | | else if ($action == 'addresses') { |
| | | $aid = rcube_utils::get_input_value('_aid', rcube_utils::INPUT_POST); |
| | | |
| | | $this->rc->output->command('managesieve_vacation_addresses_update', $aid, $this->user_emails()); |
| | | } |
| | | |
| | | $this->rc->output->send(); |
| | | } |
| | |
| | | $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(); |
| | |
| | | $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'] == '') |
| | |
| | | $mout .= '<div id="rule_date_header_div' .$id. '" class="adv"'. ($rule['test'] != 'date' ? ' style="display:none"' : '') .'>'; |
| | | $mout .= '<span class="label">' . rcube::Q($this->plugin->gettext('dateheader')) . '</span>'; |
| | | $mout .= '<input type="text" name="_rule_date_header[]" id="rule_date_header'.$id |
| | | . '" value="'. Q($rule['test'] == 'date' ? $rule['header'] : '') |
| | | . '" value="'. rcube::Q($rule['test'] == 'date' ? $rule['header'] : '') |
| | | . '" size="15"' . $this->error_class($id, 'test', 'dateheader', 'rule_date_header') .' />'; |
| | | $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']; |
| | |
| | | . "</textarea>\n"; |
| | | |
| | | // vacation |
| | | $vsec = in_array('vacation-seconds', $this->exts); |
| | | $vsec = in_array('vacation-seconds', $this->exts); |
| | | $auto_addr = $this->rc->config->get('managesieve_vacation_addresses_init'); |
| | | $addresses = isset($action['addresses']) || !$auto_addr ? (array) $action['addresses'] : $this->user_emails(); |
| | | |
| | | $out .= '<div id="action_vacation' .$id.'" style="display:' .($action['type']=='vacation' ? 'inline' : 'none') .'">'; |
| | | $out .= '<span class="label">'. rcube::Q($this->plugin->gettext('vacationreason')) .'</span><br />' |
| | | .'<textarea name="_action_reason['.$id.']" id="action_reason' .$id. '" ' |
| | | .'rows="3" cols="35" '. $this->error_class($id, 'action', 'reason', 'action_reason') . '>' |
| | | . Q($action['reason'], 'strict', false) . "</textarea>\n"; |
| | | . rcube::Q($action['reason'], 'strict', false) . "</textarea>\n"; |
| | | $out .= '<br /><span class="label">' .rcube::Q($this->plugin->gettext('vacationsubject')) . '</span><br />' |
| | | .'<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', $action['addresses'], true, |
| | | $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30); |
| | | . $this->list_input($id, 'action_addresses', $addresses, true, |
| | | $this->error_class($id, 'action', 'addresses', 'action_addresses'), 30) |
| | | . html::a(array('href' => '#', 'onclick' => rcmail_output::JS_OBJECT_NAME . ".managesieve_vacation_addresses($id)"), |
| | | rcube::Q($this->plugin->gettext('filladdresses'))); |
| | | $out .= '<br /><span class="label">' . rcube::Q($this->plugin->gettext($vsec ? 'vacationinterval' : 'vacationdays')) . '</span><br />' |
| | | .'<input type="text" name="_action_interval['.$id.']" id="action_interval'.$id.'" ' |
| | | .'value="' .rcube::Q(isset($action['seconds']) ? $action['seconds'] : $action['days'], 'strict', false) . '" size="2" ' |
| | | .'value="' .rcube::Q(rcube_sieve_vacation::vacation_interval($action), 'strict', false) . '" size="2" ' |
| | | . $this->error_class($id, 'action', 'interval', 'action_interval') .' />'; |
| | | if ($vsec) { |
| | | $out .= ' <label><input type="radio" name="_action_interval_type['.$id.']" value="days"' |
| | |
| | | if (empty($filter['actions'])) { |
| | | continue; |
| | | } |
| | | $fname = $filter['name'] ? $filter['name'] : "#$i"; |
| | | $fname = $filter['name'] ?: "#$i"; |
| | | $result[] = array( |
| | | 'id' => $idx, |
| | | 'name' => $fname, |
| | |
| | | |
| | | $this->headers += $headers; |
| | | } |
| | | |
| | | /** |
| | | * Get all e-mail addresses of the user |
| | | */ |
| | | protected function user_emails() |
| | | { |
| | | $addresses = $this->rc->user->list_emails(); |
| | | |
| | | foreach ($addresses as $idx => $email) { |
| | | $addresses[$idx] = $email['email']; |
| | | } |
| | | |
| | | $addresses = array_unique($addresses); |
| | | sort($addresses); |
| | | |
| | | return $addresses; |
| | | } |
| | | } |