diff options
-rw-r--r-- | INSTALL | 2 | ||||
-rw-r--r-- | plugins/http_authentication/http_authentication.php | 17 | ||||
-rw-r--r-- | plugins/managesieve/Changelog | 1 | ||||
-rw-r--r-- | plugins/managesieve/managesieve.js | 16 | ||||
-rw-r--r-- | plugins/managesieve/managesieve.php | 62 | ||||
-rw-r--r-- | program/js/app.js | 26 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_db_mysql.php | 4 |
7 files changed, 92 insertions, 36 deletions
@@ -14,7 +14,7 @@ REQUIREMENTS * PHP Version 5.2.1 or greater including - PCRE, DOM, JSON, XML, Session, Sockets (required) - PHP Data Objects (PDO) with driver for either MySQL, PostgreSQL or SQLite (required) - Note: MySQL database driver requires PHP 5.3 or newer. + Note: MySQL database driver requires PHP 5.3.7 or newer. - Libiconv, Zip (recommended) - Fileinfo, Mcrypt, mbstring (optional) * PEAR packages distributed with Roundcube or external: diff --git a/plugins/http_authentication/http_authentication.php b/plugins/http_authentication/http_authentication.php index 83f29c84f..39d70153a 100644 --- a/plugins/http_authentication/http_authentication.php +++ b/plugins/http_authentication/http_authentication.php @@ -19,12 +19,14 @@ */ class http_authentication extends rcube_plugin { + private $redirect_query; function init() { $this->add_hook('startup', array($this, 'startup')); $this->add_hook('authenticate', array($this, 'authenticate')); $this->add_hook('logout_after', array($this, 'logout')); + $this->add_hook('login_after', array($this, 'login')); } function startup($args) @@ -34,8 +36,9 @@ class http_authentication extends rcube_plugin $rcmail->add_shutdown_function(array('http_authentication', 'shutdown')); // handle login action - if (empty($args['action']) && empty($_SESSION['user_id'])) { - $args['action'] = 'login'; + if (empty($_SESSION['user_id'])) { + $args['action'] = 'login'; + $this->redirect_query = $_SERVER['QUERY_STRING']; } // Set user password in session (see shutdown() method for more info) else if (!empty($_SESSION['user_id']) && empty($_SESSION['password']) @@ -90,5 +93,15 @@ class http_authentication extends rcube_plugin // We'll set it back on startup (#1486553) rcmail::get_instance()->session->remove('password'); } + + function login($args) + { + // Redirect to the previous QUERY_STRING + if($this->redirect_query){ + header('Location: ./?' . $this->redirect_query); + exit; + } + return $args; + } } diff --git a/plugins/managesieve/Changelog b/plugins/managesieve/Changelog index 974495acd..559390f34 100644 --- a/plugins/managesieve/Changelog +++ b/plugins/managesieve/Changelog @@ -7,6 +7,7 @@ - Fix issue in displaying filter form when managesieve_kolab_master=true and sieve variables extension is supported by the server (#1489599) - Fix wrong action folder selection if managesieve_domains is not empty (#1489617) +- Fix filter creation from an email when preview frame is disabled (#1489647) * version 7.1 [2013-11-22] ----------------------------------------------------------- diff --git a/plugins/managesieve/managesieve.js b/plugins/managesieve/managesieve.js index 8e344ad54..6b36127d3 100644 --- a/plugins/managesieve/managesieve.js +++ b/plugins/managesieve/managesieve.js @@ -801,9 +801,17 @@ rcube_webmail.prototype.managesieve_tip_register = function(tips) /********* Mail UI methods *********/ /*********************************************************/ -rcube_webmail.prototype.managesieve_create = function() +rcube_webmail.prototype.managesieve_create = function(force) { - if (!rcmail.env.sieve_headers || !rcmail.env.sieve_headers.length) + if (!force && this.env.action != 'show' && !$('#'+this.env.contentframe).is(':visible')) { + var uid = this.message_list.get_single_selection(), + lock = this.set_busy(true, 'loading'); + + this.http_post('plugin.managesieve-action', {_uid: uid}, lock); + return; + } + + if (!this.env.sieve_headers || !this.env.sieve_headers.length) return; var i, html, buttons = {}, dialog = $("#sievefilterform"); @@ -816,9 +824,9 @@ rcube_webmail.prototype.managesieve_create = function() // build dialog window content html = '<fieldset><legend>'+this.gettext('managesieve.usedata')+'</legend><ul>'; - for (i in rcmail.env.sieve_headers) + for (i in this.env.sieve_headers) html += '<li><input type="checkbox" name="headers[]" id="sievehdr'+i+'" value="'+i+'" checked="checked" />' - +'<label for="sievehdr'+i+'">'+rcmail.env.sieve_headers[i][0]+':</label> '+rcmail.env.sieve_headers[i][1]+'</li>'; + +'<label for="sievehdr'+i+'">'+this.env.sieve_headers[i][0]+':</label> '+this.env.sieve_headers[i][1]+'</li>'; html += '</ul></fieldset>'; dialog.html(html); diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index 7a7faee4c..aa74c52b0 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -137,30 +137,12 @@ class managesieve extends rcube_plugin $this->mail_headers_done = true; - $headers = $args['headers']; - $ret = array(); - - if ($headers->subject) - $ret[] = array('Subject', rcube_mime::decode_header($headers->subject)); - - // @TODO: List-Id, others? - foreach (array('From', 'To') as $h) { - $hl = strtolower($h); - if ($headers->$hl) { - $list = rcube_mime::decode_address_list($headers->$hl); - foreach ($list as $item) { - if ($item['mailto']) { - $ret[] = array($h, $item['mailto']); - } - } - } - } + $headers = $this->parse_headers($args['headers']); if ($this->rc->action == 'preview') - $this->rc->output->command('parent.set_env', array('sieve_headers' => $ret)); + $this->rc->output->command('parent.set_env', array('sieve_headers' => $headers)); else - $this->rc->output->set_env('sieve_headers', $ret); - + $this->rc->output->set_env('sieve_headers', $headers); return $args; } @@ -170,6 +152,18 @@ class managesieve extends rcube_plugin */ function managesieve_actions() { + // handle fetching email headers for the new filter form + if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_GPC)) { + $mailbox = $this->rc->get_storage()->get_folder(); + $message = new rcube_message($uid, $mailbox); + $headers = $this->parse_headers($message->headers); + + $this->rc->output->set_env('sieve_headers', $headers); + $this->rc->output->command('managesieve_create', true); + $this->rc->output->send(); + } + + // handle other action $this->init_ui(); $engine = $this->get_engine(); $engine->actions(); @@ -210,4 +204,30 @@ class managesieve extends rcube_plugin return $this->engine; } + + /** + * Extract mail headers for new filter form + */ + private function parse_headers($headers) + { + $result = array(); + + if ($headers->subject) + $result[] = array('Subject', rcube_mime::decode_header($headers->subject)); + + // @TODO: List-Id, others? + foreach (array('From', 'To') as $h) { + $hl = strtolower($h); + if ($headers->$hl) { + $list = rcube_mime::decode_address_list($headers->$hl); + foreach ($list as $item) { + if ($item['mailto']) { + $result[] = array($h, $item['mailto']); + } + } + } + } + + return $result; + } } diff --git a/program/js/app.js b/program/js/app.js index dad4223b2..28a1b38ab 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -650,11 +650,16 @@ function rcube_webmail() var form = this.gui_objects.messageform, win = this.open_window(''); - this.save_compose_form_local(); - $("input[name='_action']", form).val('compose'); - form.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 }); - form.target = win.name; - form.submit(); + if (win) { + this.save_compose_form_local(); + $("input[name='_action']", form).val('compose'); + form.action = this.url('mail/compose', { _id: this.env.compose_id, _extwin: 1 }); + form.target = win.name; + form.submit(); + } + else { + // this.display_message(this.get_label('windowopenerror'), 'error'); + } } else { this.open_window(this.env.permaurl, true); @@ -3094,7 +3099,12 @@ function rcube_webmail() // close compose step in opener if (opener_rc && opener_rc.env.action == 'compose') { - setTimeout(function(){ opener.history.back(); }, 100); + setTimeout(function(){ + if (opener.history.length > 1) + opener.history.back(); + else + opener_rc.redirect(opener_rc.get_task_url('mail')); + }, 100); this.env.opened_extwin = true; } @@ -3618,6 +3628,10 @@ function rcube_webmail() this.env.draft_id = id; $("input[name='_draft_saveid']").val(id); + // reset history of hidden iframe used for saving draft (#1489643) + if (window.frames['savetarget'] && window.frames['savetarget'].history) { + window.frames['savetarget'].history.back(); + } } // always remove local copy upon saving as draft diff --git a/program/lib/Roundcube/rcube_db_mysql.php b/program/lib/Roundcube/rcube_db_mysql.php index d3d0ac5c8..e6417cc0a 100644 --- a/program/lib/Roundcube/rcube_db_mysql.php +++ b/program/lib/Roundcube/rcube_db_mysql.php @@ -128,11 +128,11 @@ class rcube_db_mysql extends rcube_db $result = array(); if (!empty($dsn['key'])) { - $result[PDO::MYSQL_ATTR_KEY] = $dsn['key']; + $result[PDO::MYSQL_ATTR_SSL_KEY] = $dsn['key']; } if (!empty($dsn['cipher'])) { - $result[PDO::MYSQL_ATTR_CIPHER] = $dsn['cipher']; + $result[PDO::MYSQL_ATTR_SSL_CIPHER] = $dsn['cipher']; } if (!empty($dsn['cert'])) { |