From 1d9ddf9d336f7b903fd2748350d07c1366b92f41 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 8 Oct 2019 21:25:30 +0200 Subject: [PATCH] Fix PHP Fatal error: Uncaught Error: Using $this when not in object (#6959) --- .../lib/Roundcube/rcube_sieve_engine.php | 2 +- .../lib/Roundcube/rcube_sieve_vacation.php | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index da39cebd1..7c74d6988 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -2237,7 +2237,7 @@ class rcube_sieve_engine 'type' => 'text', 'name' => '_action_interval[' . $id . ']', 'id' => 'action_interval' . $id, - 'value' => rcube_sieve_vacation::vacation_interval($action), + 'value' => rcube_sieve_vacation::vacation_interval($action, $this->exts), 'size' => 2, 'class' => $this->error_class($id, 'action', 'interval', 'action_interval'), )); diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php index 931750110..bcb62735d 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_vacation.php @@ -125,7 +125,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine return $this->sieve->error(); } - private function vacation_rule() + protected function vacation_rule() { if ($this->script_name === false || $this->script_name === null || !$this->sieve->load($this->script_name)) { return; @@ -164,7 +164,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine $this->vacation['list'] = $list; } - private function vacation_post() + protected function vacation_post() { if (empty($_POST)) { return; @@ -388,7 +388,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine } } - $interval_txt = $interval->show(self::vacation_interval($this->vacation)); + $interval_txt = $interval->show(self::vacation_interval($this->vacation, $this->exts)); if ($seconds_extension) { $interval_select = new html_select(array('name' => 'vacation_interval_type')); $interval_select->add($this->plugin->gettext('days'), 'days'); @@ -521,7 +521,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine return $out; } - public static function build_regexp_tests($date_from, $date_to, &$error) + protected static function build_regexp_tests($date_from, $date_to, &$error) { $tests = array(); $dt_from = rcube_utils::anytodatetime($date_from); @@ -562,7 +562,7 @@ class rcube_sieve_vacation extends rcube_sieve_engine return $tests; } - public static function parse_regexp_tests($tests) + protected static function parse_regexp_tests($tests) { $rx_from = '/^\(([0-9]{2}).*\)\s([A-Za-z]+)\s([0-9]{4})/'; $rx_to = '/^\(.*([0-9]{2})\)\s([A-Za-z]+)\s([0-9]{4})/'; @@ -588,10 +588,10 @@ class rcube_sieve_vacation extends rcube_sieve_engine /** * Get current vacation interval */ - public static function vacation_interval(&$vacation) + public static function vacation_interval(&$vacation, $extensions = array()) { $rcube = rcube::get_instance(); - $seconds_extension = in_array('vacation-seconds', $this->exts); + $seconds_extension = in_array('vacation-seconds', $extensions); if (isset($vacation['seconds'])) { $interval = $vacation['seconds'];