summaryrefslogtreecommitdiff
path: root/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-03-14 13:36:43 +0100
committerAleksander Machniak <alec@alec.pl>2014-03-14 13:36:43 +0100
commit50a57e9b755e80885c7a608924e6e860b28be541 (patch)
treeddc3ee86be643c58103263b45bad56b6b3b60b09 /plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
parent5ce23011850e095476a6b35abaf45bcd4d42c062 (diff)
Added optional separate interface for out-of-office management (#1488266)
Diffstat (limited to 'plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php')
-rw-r--r--plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php71
1 files changed, 39 insertions, 32 deletions
diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
index c366afac8..c73d50323 100644
--- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
+++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php
@@ -24,21 +24,21 @@
class rcube_sieve_engine
{
- private $rc;
- private $sieve;
- private $errors;
- private $form;
- private $tips = array();
- private $script = array();
- private $exts = array();
- private $list;
- private $active = array();
- private $headers = array(
+ protected $rc;
+ protected $sieve;
+ protected $errors;
+ protected $form;
+ protected $tips = array();
+ protected $script = array();
+ protected $exts = array();
+ protected $list;
+ protected $active = array();
+ protected $headers = array(
'subject' => 'Subject',
'from' => 'From',
'to' => 'To',
);
- private $addr_headers = array(
+ protected $addr_headers = array(
// Required
"from", "to", "cc", "bcc", "sender", "resent-from", "resent-to",
// Additional (RFC 822 / RFC 2822)
@@ -53,7 +53,7 @@ class rcube_sieve_engine
"x-beenthere",
);
- const VERSION = '7.2';
+ const VERSION = '8.0';
const PROGNAME = 'Roundcube (Managesieve)';
const PORT = 4190;
@@ -70,7 +70,7 @@ class rcube_sieve_engine
/**
* Loads configuration, initializes plugin (including sieve connection)
*/
- function start()
+ function start($mode = null)
{
// register UI objects
$this->rc->output->add_handlers(array(
@@ -137,13 +137,16 @@ class rcube_sieve_engine
$this->rc->session->remove('managesieve_current');
}
- if (!empty($_GET['_set']) || !empty($_POST['_set'])) {
- $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true);
- }
- else if (!empty($_SESSION['managesieve_current'])) {
- $script_name = $_SESSION['managesieve_current'];
+ if ($mode != 'vacation') {
+ if (!empty($_GET['_set']) || !empty($_POST['_set'])) {
+ $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true);
+ }
+ else if (!empty($_SESSION['managesieve_current'])) {
+ $script_name = $_SESSION['managesieve_current'];
+ }
}
- else {
+
+ if ($script_name === null || $script_name === '') {
// get (first) active script
if (!empty($this->active[0])) {
$script_name = $this->active[0];
@@ -911,9 +914,12 @@ class rcube_sieve_engine
break;
case 'vacation':
+
$reason = $this->strip_value($reasons[$idx]);
$interval_type = $interval_types[$idx] == 'seconds' ? 'seconds' : 'days';
-
+console('---------------');
+console($_POST);
+console($reason);
$this->form['actions'][$i]['reason'] = str_replace("\r\n", "\n", $reason);
$this->form['actions'][$i]['subject'] = $subject[$idx];
$this->form['actions'][$i]['addresses'] = array_shift($addresses);
@@ -980,7 +986,7 @@ class rcube_sieve_engine
}
if (!$this->errors && !$error) {
- // zapis skryptu
+ // save the script
if (!isset($this->script[$fid])) {
$fid = $this->sieve->script->add_rule($this->form);
$new = true;
@@ -1016,7 +1022,7 @@ class rcube_sieve_engine
$this->send();
}
- private function send()
+ protected function send()
{
// Handle form action
if (isset($_GET['_framed']) || isset($_POST['_framed'])) {
@@ -1026,7 +1032,8 @@ class rcube_sieve_engine
else {
$this->rc->output->send('managesieve.filteredit');
}
- } else {
+ }
+ else {
$this->rc->output->set_pagetitle($this->plugin->gettext('filters'));
$this->rc->output->send('managesieve.managesieve');
}
@@ -1809,12 +1816,12 @@ class rcube_sieve_engine
return $out;
}
- private function genid()
+ protected function genid()
{
return preg_replace('/[^0-9]/', '', microtime(true));
}
- private function strip_value($str, $allow_html = false, $trim = true)
+ protected function strip_value($str, $allow_html = false, $trim = true)
{
if (is_array($str)) {
foreach ($str as $idx => $val) {
@@ -1835,7 +1842,7 @@ class rcube_sieve_engine
return $trim ? trim($str) : $str;
}
- private function error_class($id, $type, $target, $elem_prefix='')
+ protected function error_class($id, $type, $target, $elem_prefix='')
{
// TODO: tooltips
if (($type == 'test' && ($str = $this->errors['tests'][$id][$target])) ||
@@ -1848,7 +1855,7 @@ class rcube_sieve_engine
return '';
}
- private function add_tip($id, $str, $error=false)
+ protected function add_tip($id, $str, $error=false)
{
if ($error)
$str = html::span('sieve error', $str);
@@ -1856,7 +1863,7 @@ class rcube_sieve_engine
$this->tips[] = array($id, $str);
}
- private function print_tips()
+ protected function print_tips()
{
if (empty($this->tips))
return;
@@ -1865,7 +1872,7 @@ class rcube_sieve_engine
$this->rc->output->add_script($script, 'foot');
}
- private function list_input($id, $name, $value, $enabled, $class, $size=null)
+ protected function list_input($id, $name, $value, $enabled, $class, $size=null)
{
$value = (array) $value;
$value = array_map(array('rcube', 'Q'), $value);
@@ -1881,7 +1888,7 @@ class rcube_sieve_engine
/**
* Validate input for date part elements
*/
- private function validate_date_part($type, $value)
+ protected function validate_date_part($type, $value)
{
// we do simple validation of date/part format
switch ($type) {
@@ -1926,7 +1933,7 @@ class rcube_sieve_engine
*
* @return string Mailbox name
*/
- private function mod_mailbox($mailbox, $mode = 'out')
+ protected function mod_mailbox($mailbox, $mode = 'out')
{
$delimiter = $_SESSION['imap_delimiter'];
$replace_delimiter = $this->rc->config->get('managesieve_replace_delimiter');
@@ -2218,7 +2225,7 @@ class rcube_sieve_engine
/**
* Initializes internal script data
*/
- private function init_script()
+ protected function init_script()
{
$this->script = $this->sieve->script->as_array();