diff options
-rw-r--r-- | CHANGELOG | 6 | ||||
-rw-r--r-- | config/defaults.inc.php | 4 | ||||
-rw-r--r-- | plugins/markasjunk/markasjunk.php | 31 | ||||
-rw-r--r-- | plugins/markasjunk/package.xml | 7 | ||||
-rw-r--r-- | plugins/newmail_notifier/newmail_notifier.js | 9 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube.php | 9 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_config.php | 24 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_imap.php | 21 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_imap_generic.php | 49 | ||||
-rw-r--r-- | program/lib/Roundcube/rcube_storage.php | 2 | ||||
-rw-r--r-- | program/steps/mail/compose.inc | 20 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 5 | ||||
-rw-r--r-- | program/steps/settings/func.inc | 13 | ||||
-rw-r--r-- | skins/larry/templates/compose.html | 12 | ||||
-rw-r--r-- | skins/larry/templates/mail.html | 2 |
15 files changed, 129 insertions, 85 deletions
@@ -1,6 +1,12 @@ CHANGELOG Roundcube Webmail =========================== +- Fix issue where legacy config was overriden by default config (#1489288) +- Add temp_dir_ttl configuration option (#1489304) +- Fix newmail_notifier issue where favicon wasn't changed back to default (#1489313) +- Allow setting INBOX as Sent folder (#1489219) +- Fix setting of Junk and NonJunk flags by markasjunk plugin (#1489285) +- Fix lack of Reply-To address in header of forwarded message body (#1489298) - Fix bugs when invoking contact creation form when read-only addressbook is selected (#1489296) - Fix identity selection on reply (#1489291) - Fix so additional headers are added to all messages sent (#1489284) diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 54d0b1d27..512455275 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -257,6 +257,10 @@ $config['log_dir'] = 'logs/'; // use this folder to store temp files (must be writeable for apache user) $config['temp_dir'] = 'temp/'; +// expire files in temp_dir after 48 hours +// possible units: s, m, h, d, w +$config['temp_dir_ttl'] = '48h'; + // enforce connections over https // with this option enabled, all non-secure connections will be redirected. // set the port for the ssl connection as value of this option if it differs from the default 443 diff --git a/plugins/markasjunk/markasjunk.php b/plugins/markasjunk/markasjunk.php index 76b14c140..4448b506c 100644 --- a/plugins/markasjunk/markasjunk.php +++ b/plugins/markasjunk/markasjunk.php @@ -19,6 +19,7 @@ class markasjunk extends rcube_plugin $rcmail = rcmail::get_instance(); $this->register_action('plugin.markasjunk', array($this, 'request_action')); + $this->add_hook('storage_init', array($this, 'storage_init')); if ($rcmail->action == '' || $rcmail->action == 'show') { $skin_path = $this->local_skin_path(); @@ -38,24 +39,36 @@ class markasjunk extends rcube_plugin } } + function storage_init($args) + { + $flags = array( + 'JUNK' => 'Junk', + 'NONJUNK' => 'NonJunk', + ); + + // register message flags + $args['message_flags'] = array_merge((array)$args['message_flags'], $flags); + + return $args; + } + function request_action() { $this->add_texts('localization'); - $GLOBALS['IMAP_FLAGS']['JUNK'] = 'Junk'; - $GLOBALS['IMAP_FLAGS']['NONJUNK'] = 'NonJunk'; - $uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST); $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST); - - $rcmail = rcmail::get_instance(); - $rcmail->storage->unset_flag($uids, 'NONJUNK'); - $rcmail->storage->set_flag($uids, 'JUNK'); - + + $rcmail = rcmail::get_instance(); + $storage = $rcmail->get_storage(); + + $storage->unset_flag($uids, 'NONJUNK'); + $storage->set_flag($uids, 'JUNK'); + if (($junk_mbox = $rcmail->config->get('junk_mbox')) && $mbox != $junk_mbox) { $rcmail->output->command('move_messages', $junk_mbox); } - + $rcmail->output->command('display_message', $this->gettext('reportedasjunk'), 'confirmation'); $rcmail->output->send(); } diff --git a/plugins/markasjunk/package.xml b/plugins/markasjunk/package.xml index a5b4bf92c..95597481a 100644 --- a/plugins/markasjunk/package.xml +++ b/plugins/markasjunk/package.xml @@ -13,11 +13,10 @@ <email>roundcube@gmail.com</email> <active>yes</active> </lead> - <date>2010-03-29</date> - <time>13:20:00</time> + <date>2013-08-29</date> <version> - <release>1.1</release> - <api>1.1</api> + <release>1.2</release> + <api>1.2</api> </version> <stability> <release>stable</release> diff --git a/plugins/newmail_notifier/newmail_notifier.js b/plugins/newmail_notifier/newmail_notifier.js index c398424b6..b00f33d10 100644 --- a/plugins/newmail_notifier/newmail_notifier.js +++ b/plugins/newmail_notifier/newmail_notifier.js @@ -30,9 +30,9 @@ function newmail_notifier_run(prop) function newmail_notifier_stop(prop) { // revert original favicon - if (rcmail.env.favicon_href && (!prop || prop.action != 'check-recent')) { + if (rcmail.env.favicon_href && rcmail.env.favicon_changed && (!prop || prop.action != 'check-recent')) { $('<link rel="shortcut icon" href="'+rcmail.env.favicon_href+'"/>').replaceAll('link[rel="shortcut icon"]'); - rcmail.env.favicon_href = null; + rcmail.env.favicon_changed = 0; } // Remove IE icon overlay if we're pinned to Taskbar @@ -54,7 +54,10 @@ function newmail_notifier_basic() var link = $('<link rel="shortcut icon" href="plugins/newmail_notifier/favicon.ico"/>'), oldlink = $('link[rel="shortcut icon"]', w.document); - rcmail.env.favicon_href = oldlink.attr('href'); + if (!rcmail.env.favicon_href) + rcmail.env.favicon_href = oldlink.attr('href'); + + rcmail.env.favicon_changed = 1; link.replaceAll(oldlink); // Add IE icon overlay if we're pinned to Taskbar diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index af9c069cf..d9c3dd8b9 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -498,7 +498,14 @@ class rcube public function gc_temp() { $tmp = unslashify($this->config->get('temp_dir')); - $expire = time() - 172800; // expire in 48 hours + + // expire in 48 hours by default + $temp_dir_ttl = $this->config->get('temp_dir_ttl', '48h'); + $temp_dir_ttl = get_offset_sec($temp_dir_ttl); + if ($temp_dir_ttl < 6*3600) + $temp_dir_ttl = 6*3600; // 6 hours sensible lower bound. + + $expire = time() - $temp_dir_ttl; if ($tmp && ($dir = opendir($tmp))) { while (($fname = readdir($dir)) !== false) { diff --git a/program/lib/Roundcube/rcube_config.php b/program/lib/Roundcube/rcube_config.php index 62567a0e0..90e1394cf 100644 --- a/program/lib/Roundcube/rcube_config.php +++ b/program/lib/Roundcube/rcube_config.php @@ -282,8 +282,8 @@ class rcube_config */ public function merge($prefs) { + $prefs = $this->fix_legacy_props($prefs); $this->prop = array_merge($this->prop, $prefs, $this->userprefs); - $this->fix_legacy_props(); } @@ -295,6 +295,8 @@ class rcube_config */ public function set_user_prefs($prefs) { + $prefs = $this->fix_legacy_props($prefs); + // Honor the dont_override setting for any existing user preferences $dont_override = $this->get('dont_override'); if (is_array($dont_override) && !empty($dont_override)) { @@ -316,8 +318,6 @@ class rcube_config $this->userprefs = $prefs; $this->prop = array_merge($this->prop, $prefs); - $this->fix_legacy_props(); - // override timezone settings with client values if ($this->prop['timezone'] == 'auto') { $this->prop['_timezone_value'] = isset($_SESSION['timezone']) ? $this->client_timezone() : $this->prop['_timezone_value']; @@ -330,7 +330,7 @@ class rcube_config /** * Getter for all config options * - * @return array Hash array containg all config properties + * @return array Hash array containing all config properties */ public function all() { @@ -482,16 +482,22 @@ class rcube_config /** * Convert legacy options into new ones + * + * @param array $props Hash array with config props + * + * @return array Converted config props */ - private function fix_legacy_props() + private function fix_legacy_props($props) { foreach ($this->legacy_props as $new => $old) { - if (isset($this->prop[$old])) { - if (!isset($this->prop[$new])) { - $this->prop[$new] = $this->prop[$old]; + if (isset($props[$old])) { + if (!isset($props[$new])) { + $props[$new] = $props[$old]; } - unset($this->prop[$old]); + unset($props[$old]); } } + + return $props; } } diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index c5346c8aa..689a6266d 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -70,7 +70,7 @@ class rcube_imap extends rcube_storage protected $search_sort_field = ''; protected $search_threads = false; protected $search_sorted = false; - protected $options = array('auth_method' => 'check'); + protected $options = array('auth_type' => 'check'); protected $caching = false; protected $messages_caching = false; protected $threading = false; @@ -391,10 +391,10 @@ class rcube_imap extends rcube_storage public function check_permflag($flag) { $flag = strtoupper($flag); - $imap_flag = $this->conn->flags[$flag]; $perm_flags = $this->get_permflags($this->folder); + $imap_flag = $this->conn->flags[$flag]; - return in_array_nocase($imap_flag, $perm_flags); + return $imap_flag && !empty($perm_flags) && in_array_nocase($imap_flag, $perm_flags); } @@ -410,17 +410,7 @@ class rcube_imap extends rcube_storage if (!strlen($folder)) { return array(); } -/* - Checking PERMANENTFLAGS is rather rare, so we disable caching of it - Re-think when we'll use it for more than only MDNSENT flag - $cache_key = 'mailboxes.permanentflags.' . $folder; - $permflags = $this->get_cache($cache_key); - - if ($permflags !== null) { - return explode(' ', $permflags); - } -*/ if (!$this->check_connection()) { return array(); } @@ -435,10 +425,7 @@ class rcube_imap extends rcube_storage if (!is_array($permflags)) { $permflags = array(); } -/* - // Store permflags as string to limit cached object size - $this->update_cache($cache_key, implode(' ', $permflags)); -*/ + return $permflags; } diff --git a/program/lib/Roundcube/rcube_imap_generic.php b/program/lib/Roundcube/rcube_imap_generic.php index e1193749b..bce4cd4e2 100644 --- a/program/lib/Roundcube/rcube_imap_generic.php +++ b/program/lib/Roundcube/rcube_imap_generic.php @@ -704,22 +704,11 @@ class rcube_imap_generic */ function connect($host, $user, $password, $options=null) { - // set options - if (is_array($options)) { - $this->prefs = $options; - } - // set auth method - if (!empty($this->prefs['auth_type'])) { - $auth_method = strtoupper($this->prefs['auth_type']); - } else { - $auth_method = 'CHECK'; - } + // configure + $this->set_prefs($options); - if (!empty($this->prefs['disabled_caps'])) { - $this->prefs['disabled_caps'] = array_map('strtoupper', (array)$this->prefs['disabled_caps']); - } - - $result = false; + $auth_method = $this->prefs['auth_type']; + $result = false; // initialize connection $this->error = ''; @@ -896,6 +885,36 @@ class rcube_imap_generic } /** + * Initializes environment + */ + protected function set_prefs($prefs) + { + // set preferences + if (is_array($prefs)) { + $this->prefs = $prefs; + } + + // set auth method + if (!empty($this->prefs['auth_type'])) { + $this->prefs['auth_type'] = strtoupper($this->prefs['auth_type']); + } + else { + $this->prefs['auth_type'] = 'CHECK'; + } + + // disabled capabilities + if (!empty($this->prefs['disabled_caps'])) { + $this->prefs['disabled_caps'] = array_map('strtoupper', (array)$this->prefs['disabled_caps']); + } + + // additional message flags + if (!empty($this->prefs['message_flags'])) { + $this->flags = array_merge($this->flags, $this->prefs['message_flags']); + unset($this->prefs['message_flags']); + } + } + + /** * Checks connection status * * @return bool True if connection is active and user is logged in, False otherwise. diff --git a/program/lib/Roundcube/rcube_storage.php b/program/lib/Roundcube/rcube_storage.php index de8334551..e697b2c73 100644 --- a/program/lib/Roundcube/rcube_storage.php +++ b/program/lib/Roundcube/rcube_storage.php @@ -39,7 +39,7 @@ abstract class rcube_storage protected $default_charset = 'ISO-8859-1'; protected $default_folders = array('INBOX'); protected $search_set; - protected $options = array('auth_method' => 'check'); + protected $options = array('auth_type' => 'check'); protected $page_size = 10; protected $threading = false; diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 9dadfe4ad..7068a25fd 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -947,10 +947,10 @@ function rcmail_create_forward_body($body, $bodyIsHtml) $prefix .= rcube_label('from') . ': ' . $MESSAGE->get_header('from') . "\n"; $prefix .= rcube_label('to') . ': ' . $MESSAGE->get_header('to') . "\n"; - if ($MESSAGE->headers->cc) - $prefix .= rcube_label('cc') . ': ' . $MESSAGE->get_header('cc') . "\n"; - if ($MESSAGE->headers->replyto && $MESSAGE->headers->replyto != $MESSAGE->headers->from) - $prefix .= rcube_label('replyto') . ': ' . $MESSAGE->get_header('replyto') . "\n"; + if ($cc = $MESSAGE->headers->get('cc')) + $prefix .= rcube_label('cc') . ': ' . $cc . "\n"; + if (($replyto = $MESSAGE->headers->get('reply-to')) && $replyto != $MESSAGE->get_header('from')) + $prefix .= rcube_label('replyto') . ': ' . $replyto . "\n"; $prefix .= "\n"; $body = trim($body, "\r\n"); @@ -973,15 +973,13 @@ function rcmail_create_forward_body($body, $bodyIsHtml) rcube_label('from'), Q($MESSAGE->get_header('from'), 'replace'), rcube_label('to'), Q($MESSAGE->get_header('to'), 'replace')); - if ($MESSAGE->headers->cc) + if ($cc = $MESSAGE->headers->get('cc')) $prefix .= sprintf("<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>", - rcube_label('cc'), - Q($MESSAGE->get_header('cc'), 'replace')); + rcube_label('cc'), Q($cc, 'replace')); - if ($MESSAGE->headers->replyto && $MESSAGE->headers->replyto != $MESSAGE->headers->from) + if (($replyto = $MESSAGE->headers->get('reply-to')) && $replyto != $MESSAGE->get_header('from')) $prefix .= sprintf("<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">%s: </th><td>%s</td></tr>", - rcube_label('replyto'), - Q($MESSAGE->get_header('replyto'), 'replace')); + rcube_label('replyto'), Q($replyto, 'replace')); $prefix .= "</tbody></table><br>"; } @@ -1422,7 +1420,7 @@ function rcmail_compose_attachment_form($attrib) $out = html::div($attrib, $OUTPUT->form_tag(array('id' => $attrib['id'].'Frm', 'name' => 'uploadform', 'method' => 'post', 'enctype' => 'multipart/form-data'), - html::div(null, rcmail_compose_attachment_field(array('size' => $attrib['attachmentfieldsize']))) . + html::div(null, rcmail_compose_attachment_field()) . html::div('hint', rcube_label(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))) . (get_boolean($attrib['buttons']) ? html::div('buttons', $button->show(rcube_label('close'), array('class' => 'button', 'onclick' => "$('#$attrib[id]').hide()")) . ' ' . diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index e14d25ee3..018a31b84 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -177,7 +177,9 @@ function rcmail_message_list_smart_column_name() $sent_mbox = $RCMAIL->config->get('sent_mbox'); $drafts_mbox = $RCMAIL->config->get('drafts_mbox'); - if (strpos($mbox.$delim, $sent_mbox.$delim) === 0 || strpos($mbox.$delim, $drafts_mbox.$delim) === 0) { + if ((strpos($mbox.$delim, $sent_mbox.$delim) === 0 || strpos($mbox.$delim, $drafts_mbox.$delim) === 0) + && strtoupper($mbox) != 'INBOX' + ) { return 'to'; } @@ -1924,7 +1926,6 @@ function rcmail_message_import_form($attrib = array()) $fileinput = new html_inputfield(array( 'type' => 'file', 'name' => '_file[]', - 'size' => $attrib['attachmentfieldsize'], 'multiple' => 'multiple', 'accept' => ".eml, .mbox, message/rfc822, text/*", )); diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index f6ea79ec6..fdc07be9e 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -987,11 +987,12 @@ function rcmail_user_prefs($current = null) 'maxlength' => 30, 'folder_filter' => 'mail', 'folder_rights' => 'w', - // #1486114, #1488279 - 'onchange' => "if ($(this).val() == 'INBOX') $(this).val('')", )); } + // #1486114, #1488279, #1489219 + $onchange = "if ($(this).val() == 'INBOX') $(this).val('')"; + if (!isset($no_override['drafts_mbox'])) { if (!$current) { continue 2; @@ -999,7 +1000,7 @@ function rcmail_user_prefs($current = null) $blocks['main']['options']['drafts_mbox'] = array( 'title' => Q(rcube_label('drafts')), - 'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox")), + 'content' => $select->show($config['drafts_mbox'], array('name' => "_drafts_mbox", 'onchange' => $onchange)), ); } @@ -1010,7 +1011,7 @@ function rcmail_user_prefs($current = null) $blocks['main']['options']['sent_mbox'] = array( 'title' => Q(rcube_label('sent')), - 'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox")), + 'content' => $select->show($config['sent_mbox'], array('name' => "_sent_mbox", 'onchange' => '')), ); } @@ -1021,7 +1022,7 @@ function rcmail_user_prefs($current = null) $blocks['main']['options']['junk_mbox'] = array( 'title' => Q(rcube_label('junk')), - 'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox")), + 'content' => $select->show($config['junk_mbox'], array('name' => "_junk_mbox", 'onchange' => $onchange)), ); } @@ -1032,7 +1033,7 @@ function rcmail_user_prefs($current = null) $blocks['main']['options']['trash_mbox'] = array( 'title' => Q(rcube_label('trash')), - 'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox")), + 'content' => $select->show($config['trash_mbox'], array('name' => "_trash_mbox", 'onchange' => $onchange)), ); } break; diff --git a/skins/larry/templates/compose.html b/skins/larry/templates/compose.html index 09eafe73b..806939a42 100644 --- a/skins/larry/templates/compose.html +++ b/skins/larry/templates/compose.html @@ -85,25 +85,25 @@ </tr><tr id="compose-cc"> <td class="title top"> <label for="_cc"><roundcube:label name="cc" /></label> - <a href="#cc" onclick="return UI.hide_header_row('cc');" class="iconbutton cancel" title="<roundcube:label name='delete' />" />x</a> + <a href="#cc" onclick="return UI.hide_header_row('cc');" class="iconbutton cancel" title="<roundcube:label name='delete' />">x</a> </td> <td class="editfield"><roundcube:object name="composeHeaders" part="cc" form="form" id="_cc" cols="70" rows="1" tabindex="3" /></td> </tr><tr id="compose-bcc"> <td class="title top"> <label for="_bcc"><roundcube:label name="bcc" /></label> - <a href="#bcc" onclick="return UI.hide_header_row('bcc');" class="iconbutton cancel" title="<roundcube:label name='delete' />" />x</a> + <a href="#bcc" onclick="return UI.hide_header_row('bcc');" class="iconbutton cancel" title="<roundcube:label name='delete' />">x</a> </td> - <td colspan="2" class="editfield"><roundcube:object name="composeHeaders" part="bcc" form="form" id="_bcc" cols="70" rows="1" tabindex="4" /></td> + <td class="editfield"><roundcube:object name="composeHeaders" part="bcc" form="form" id="_bcc" cols="70" rows="1" tabindex="4" /></td> </tr><tr id="compose-replyto"> <td class="title top"> <label for="_replyto"><roundcube:label name="replyto" /></label> - <a href="#replyto" onclick="return UI.hide_header_row('replyto');" class="iconbutton cancel" title="<roundcube:label name='delete' />" />x</a> + <a href="#replyto" onclick="return UI.hide_header_row('replyto');" class="iconbutton cancel" title="<roundcube:label name='delete' />">x</a> </td> <td class="editfield"><roundcube:object name="composeHeaders" part="replyto" form="form" id="_replyto" size="70" tabindex="5" /></td> </tr><tr id="compose-followupto"> <td class="title top"> <label for="_followupto"><roundcube:label name="followupto" /></label> - <a href="#followupto" onclick="return UI.hide_header_row('followupto');" class="iconbutton cancel" title="<roundcube:label name='delete' />" />x</a> + <a href="#followupto" onclick="return UI.hide_header_row('followupto');" class="iconbutton cancel" title="<roundcube:label name='delete' />">x</a> </td> <td class="editfield"><roundcube:object name="composeHeaders" part="followupto" form="form" id="_followupto" size="70" tabindex="7" /></td> </tr><tr> @@ -185,7 +185,7 @@ </div><!-- end mainscreen --> <div id="upload-dialog" class="propform popupdialog" title="<roundcube:label name='addattachment' />"> - <roundcube:object name="composeAttachmentForm" id="uploadform" attachmentFieldSize="40" buttons="no" /> + <roundcube:object name="composeAttachmentForm" id="uploadform" buttons="no" /> <div class="formbuttons"> <roundcube:button command="send-attachment" type="input" class="button mainaction" label="upload" /> <roundcube:button name="close" type="input" class="button" label="cancel" onclick="UI.show_uploadform()" /> diff --git a/skins/larry/templates/mail.html b/skins/larry/templates/mail.html index 5f465d767..f2c52c820 100644 --- a/skins/larry/templates/mail.html +++ b/skins/larry/templates/mail.html @@ -228,7 +228,7 @@ </div> <div id="upload-dialog" class="propform popupdialog" title="<roundcube:label name='importmessages' />"> - <roundcube:object name="messageimportform" id="uploadform" attachmentFieldSize="40" buttons="no" /> + <roundcube:object name="messageimportform" id="uploadform" buttons="no" /> <div class="formbuttons"> <roundcube:button command="import-messages" type="input" class="button mainaction" label="upload" /> <roundcube:button name="close" type="input" class="button" label="cancel" onclick="UI.show_uploadform()" /> |