| | |
| | | 1 => 'notifyimportancehigh' |
| | | ); |
| | | |
| | | const VERSION = '8.2'; |
| | | const VERSION = '8.3'; |
| | | const PROGNAME = 'Roundcube (Managesieve)'; |
| | | const PORT = 4190; |
| | | |
| | |
| | | case rcube_sieve::ERROR_CONNECTION: |
| | | case rcube_sieve::ERROR_LOGIN: |
| | | $this->rc->output->show_message('managesieve.filterconnerror', 'error'); |
| | | rcube::raise_error(array('code' => 403, 'type' => 'php', |
| | | 'file' => __FILE__, 'line' => __LINE__, |
| | | 'message' => "Unable to connect to managesieve on $host:$port"), true, false); |
| | | break; |
| | | |
| | | default: |
| | |
| | | $plugin['socket_options'] |
| | | ); |
| | | |
| | | return $this->sieve->error(); |
| | | $error = $this->sieve->error(); |
| | | |
| | | if ($error) { |
| | | rcube::raise_error(array( |
| | | 'code' => 403, |
| | | 'file' => __FILE__, |
| | | 'line' => __LINE__, |
| | | 'message' => "Unable to connect to managesieve on $host:$port" |
| | | ), true, false); |
| | | } |
| | | |
| | | return $error; |
| | | } |
| | | |
| | | /** |
| | |
| | | * |
| | | * @return int Connection status: 0 on success, >0 on failure |
| | | */ |
| | | public function load_script($script_name = null) |
| | | protected function load_script($script_name = null) |
| | | { |
| | | // Get list of scripts |
| | | $list = $this->list_scripts(); |
| | |
| | | } |
| | | else if ($action == 'setget') { |
| | | $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); |
| | | $script = $this->sieve->get_script($script_name); |
| | | $script = $this->sieve->get_script($script_name); |
| | | |
| | | if (PEAR::isError($script)) |
| | | if (is_a($script, 'PEAR_Error')) { |
| | | exit; |
| | | } |
| | | |
| | | $browser = new rcube_browser; |
| | | |
| | |
| | | } |
| | | |
| | | if (isset($rule['test'])) { |
| | | if (in_array($rule['test'], array('header', 'address', 'envelope')) |
| | | && !is_array($rule['arg1']) |
| | | && ($header = strtolower($rule['arg1'])) |
| | | && isset($this->headers[$header]) |
| | | ) { |
| | | $test = $header; |
| | | if (in_array($rule['test'], array('header', 'address', 'envelope'))) { |
| | | if (is_array($rule['arg1']) && count($rule['arg1']) == 1) { |
| | | $rule['arg1'] = $rule['arg1'][0]; |
| | | } |
| | | |
| | | $matches = ($header = strtolower($rule['arg1'])) && isset($this->headers[$header]); |
| | | $test = $matches ? $header : '...'; |
| | | } |
| | | else if ($rule['test'] == 'exists' |
| | | && !is_array($rule['arg']) |
| | | && ($header = strtolower($rule['arg'])) |
| | | && isset($this->headers[$header]) |
| | | ) { |
| | | $test = $header; |
| | | else if ($rule['test'] == 'exists') { |
| | | if (is_array($rule['arg']) && count($rule['arg']) == 1) { |
| | | $rule['arg'] = $rule['arg'][0]; |
| | | } |
| | | |
| | | $matches = ($header = strtolower($rule['arg'])) && isset($this->headers[$header]); |
| | | $test = $matches ? $header : '...'; |
| | | } |
| | | else if (in_array($rule['test'], array('size', 'body', 'date', 'currentdate'))) { |
| | | $test = $rule['test']; |
| | |
| | | foreach ($rules['actions'] as $action) { |
| | | if ($action['type'] == 'include' && empty($action['global'])) { |
| | | $name = preg_replace($filename_regex, '', $action['target']); |
| | | $this->active[] = $name; |
| | | // make sure the script exist |
| | | if (in_array($name, $this->list)) { |
| | | $this->active[] = $name; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | protected function init_script() |
| | | { |
| | | $this->script = $this->sieve->script->as_array(); |
| | | |
| | | if (!$this->script) { |
| | | if (!$this->sieve->script) { |
| | | return; |
| | | } |
| | | |
| | | $this->script = $this->sieve->script->as_array(); |
| | | |
| | | $headers = array(); |
| | | $exceptions = array('date', 'currentdate', 'size', 'body'); |
| | | |