Merge branch 'master' of github.com:roundcube/roundcubemail

pull/65/head
Aleksander Machniak 11 years ago
commit 24e88e91f7

@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Call resize handler in intervals to prevent lags and double onresize calls in Chrome (#1489005)
- Fix javascript error in IE9 when loading form with placeholders into an iframe (#1489008)
- Fix handling of some conditional comment tags in HTML message (#1489004) - Fix handling of some conditional comment tags in HTML message (#1489004)
- Add rel="noreferrer" for links in displayed messages (#1484686) - Add rel="noreferrer" for links in displayed messages (#1484686)
- Fix so forward as attachment works if additional attachment is added by message_compose hook (#1489000) - Fix so forward as attachment works if additional attachment is added by message_compose hook (#1489000)

@ -873,6 +873,7 @@ class rcmail_output_html extends rcmail_output
// include a file // include a file
case 'include': case 'include':
$old_base_path = $this->base_path; $old_base_path = $this->base_path;
if (!empty($attrib['skin_path'])) $attrib['skinpath'] = $attrib['skin_path'];
if ($path = $this->get_skin_file($attrib['file'], $skin_path, $attrib['skinpath'])) { if ($path = $this->get_skin_file($attrib['file'], $skin_path, $attrib['skinpath'])) {
$this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); // set base_path to core skin directory (not plugin's skin) $this->base_path = preg_replace('!plugins/\w+/!', '', $skin_path); // set base_path to core skin directory (not plugin's skin)
$path = realpath($path); $path = realpath($path);

@ -178,6 +178,11 @@ function rcube_webmail()
parent.rcmail.env.frame_lock = null; parent.rcmail.env.frame_lock = null;
} }
// Makes that reference to document.activeElement do not throw
// "unspecified error" in IE9 (#1489008)
if (this.env.framed && bw.ie)
document.documentElement.focus();
// enable general commands // enable general commands
this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref', this.enable_command('close', 'logout', 'mail', 'addressbook', 'settings', 'save-pref',
'compose', 'undo', 'about', 'switch-task', 'menu-open', 'menu-save', true); 'compose', 'undo', 'about', 'switch-task', 'menu-open', 'menu-save', true);

@ -720,10 +720,12 @@ jQuery.fn.placeholder = function(text) {
var elem = $(this); var elem = $(this);
this.title = text; this.title = text;
// Try HTML5 placeholder attribute first
if ('placeholder' in this) { if ('placeholder' in this) {
elem.attr('placeholder', text); // Try HTML5 placeholder attribute first elem.attr('placeholder', text);
} }
else { // Fallback to Javascript emulation of placeholder // Fallback to Javascript emulation of placeholder
else {
this._placeholder = text; this._placeholder = text;
elem.blur(function(e) { elem.blur(function(e) {
if ($.trim(elem.val()) == "") if ($.trim(elem.val()) == "")
@ -740,7 +742,8 @@ jQuery.fn.placeholder = function(text) {
elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active); elem[(active ? 'addClass' : 'removeClass')]('placeholder').attr('spellcheck', active);
}); });
if (this != document.activeElement) // Do not blur currently focused element // Do not blur currently focused element
if (this != document.activeElement)
elem.blur(); elem.blur();
} }
}); });

@ -444,17 +444,20 @@ class rcube_db
* *
* @param mixed $result Optional query handle * @param mixed $result Optional query handle
* @return mixed Number of rows or false on failure * @return mixed Number of rows or false on failure
* @deprecated This method shows very poor performance and should be avoided.
*/ */
public function num_rows($result = null) public function num_rows($result = null)
{ {
if ($result || ($result === null && ($result = $this->last_result))) { if ($result || ($result === null && ($result = $this->last_result))) {
// repeat query with SELECT COUNT(*) ... // repeat query with SELECT COUNT(*) ...
if (preg_match('/^SELECT\s+(?:ALL\s+|DISTINCT\s+)?(?:.*?)\s+FROM\s+(.*)$/i', $result->queryString, $m)) { if (preg_match('/^SELECT\s+(?:ALL\s+|DISTINCT\s+)?(?:.*?)\s+FROM\s+(.*)$/ims', $result->queryString, $m)) {
$query = $this->dbh->query('SELECT COUNT(*) FROM ' . $m[1], PDO::FETCH_NUM); $query = $this->dbh->query('SELECT COUNT(*) FROM ' . $m[1], PDO::FETCH_NUM);
return $query ? intval($query->fetchColumn(0)) : false; return $query ? intval($query->fetchColumn(0)) : false;
} }
else { else {
return count($result->fetchAll()); $num = count($result->fetchAll());
$result->execute(); // re-execute query because there's no seek(0)
return $num;
} }
} }

@ -769,11 +769,35 @@ class rcube_mime
// fallback to some well-known types most important for daily emails // fallback to some well-known types most important for daily emails
if (empty($mime_types)) { if (empty($mime_types)) {
$mime_extensions = @include(RCUBE_CONFIG_DIR . '/mimetypes.php'); $mime_extensions = (array) @include(RCUBE_CONFIG_DIR . '/mimetypes.php');
$mime_extensions += array('gif' => 'image/gif', 'png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'tif' => 'image/tiff');
foreach ($mime_extensions as $ext => $mime) foreach ($mime_extensions as $ext => $mime) {
$mime_types[$mime][] = $ext; $mime_types[$mime][] = $ext;
}
}
// Add some known aliases that aren't included by some mime.types (#1488891)
// the order is important here so standard extensions have higher prio
$aliases = array(
'image/gif' => array('gif'),
'image/png' => array('png'),
'image/x-png' => array('png'),
'image/jpeg' => array('jpg', 'jpeg', 'jpe'),
'image/jpg' => array('jpg', 'jpeg', 'jpe'),
'image/pjpeg' => array('jpg', 'jpeg', 'jpe'),
'image/tiff' => array('tif'),
'message/rfc822' => array('eml'),
'text/x-mail' => array('eml'),
);
foreach ($aliases as $mime => $exts) {
$mime_types[$mime] = array_unique(array_merge((array) $mime_types[$mime], $exts));
foreach ($exts as $ext) {
if (!isset($mime_extensions[$ext])) {
$mime_extensions[$ext] = $mime;
}
}
} }
return $mimetype ? $mime_types[$mimetype] : $mime_extensions; return $mimetype ? $mime_types[$mimetype] : $mime_extensions;

@ -287,28 +287,36 @@ function rcube_mail_ui()
/** /**
* Update UI on window resize * Update UI on window resize
*/ */
function resize() function resize(e)
{ {
if (rcmail.env.task == 'mail') { // resize in intervals to prevent lags and double onresize calls in Chrome (#1489005)
if (rcmail.env.action == 'show' || rcmail.env.action == 'preview') var interval = e ? 10 : 0;
layout_messageview();
else if (rcmail.env.action == 'compose')
layout_composeview();
}
// make iframe footer buttons float if scrolling is active if (rcmail.resize_timeout)
$('body.iframe .footerleft').each(function(){ window.clearTimeout(rcmail.resize_timeout);
var footer = $(this),
body = $(document.body), rcmail.resize_timeout = window.setTimeout(function() {
floating = footer.hasClass('floating'), if (rcmail.env.task == 'mail') {
overflow = body.outerHeight(true) > $(window).height(); if (rcmail.env.action == 'show' || rcmail.env.action == 'preview')
layout_messageview();
if (overflow != floating) { else if (rcmail.env.action == 'compose')
var action = overflow ? 'addClass' : 'removeClass'; layout_composeview();
footer[action]('floating');
body[action]('floatingbuttons');
} }
});
// make iframe footer buttons float if scrolling is active
$('body.iframe .footerleft').each(function(){
var footer = $(this),
body = $(document.body),
floating = footer.hasClass('floating'),
overflow = body.outerHeight(true) > $(window).height();
if (overflow != floating) {
var action = overflow ? 'addClass' : 'removeClass';
footer[action]('floating');
body[action]('floatingbuttons');
}
});
}, interval);
} }
/** /**

Loading…
Cancel
Save