summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2007-09-05 19:50:05 +0000
committerthomascube <thomas@roundcube.net>2007-09-05 19:50:05 +0000
commit0d1dd7c80c5ab8a3879294e6e6bb4c20f7054241 (patch)
tree0850dc93c3e85fc37b130a967f326596ad52b700
parent1094cda9a04bd52a06dd662bc5d648b4105cff1a (diff)
Fix message list selection + new pngbehavior + use strpos() instead of strstr()
-rw-r--r--.htaccess1
-rw-r--r--CHANGELOG7
-rw-r--r--program/include/main.inc12
-rw-r--r--skins/default/pngbehavior.htc104
4 files changed, 78 insertions, 46 deletions
diff --git a/.htaccess b/.htaccess
index c2bfaf1a4..0826245bd 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,4 +1,5 @@
# AddDefaultCharset UTF-8
+AddType text/x-component .htc
<IfModule mod_php4.c>
php_flag display_errors Off
diff --git a/CHANGELOG b/CHANGELOG
index ce6cb8011..dd3c33e4f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,13 @@
CHANGELOG RoundCube Webmail
---------------------------
+2007/09/05 (thomasb)
+----------
+- Fix message list selection (#1484550)
+- Better fix lowercased usernames (#1484473)
+- Update pngbehavior Script as suggested in #1484490
+
+
2007/08/29 (richs)
----------
- Fixed moving/deleting messages when more than 1 is selected
diff --git a/program/include/main.inc b/program/include/main.inc
index ccbc57958..ae00752a1 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -532,7 +532,6 @@ function rcmail_login($user, $pass, $host=NULL)
{
global $CONFIG, $IMAP, $DB, $sess_user_lang;
$user_id = NULL;
- $user = strtolower($user); // fix case: #1484473
if (!$host)
$host = $CONFIG['default_host'];
@@ -573,7 +572,7 @@ function rcmail_login($user, $pass, $host=NULL)
Inspired by Marco <P0L0_notspam_binware.org>
*/
// Check if we need to add domain
- if (!empty($CONFIG['username_domain']) && !strstr($user, '@'))
+ if (!empty($CONFIG['username_domain']) && !strpos($user, '@'))
{
if (is_array($CONFIG['username_domain']) && isset($CONFIG['username_domain'][$host]))
$user .= '@'.$CONFIG['username_domain'][$host];
@@ -581,6 +580,9 @@ function rcmail_login($user, $pass, $host=NULL)
$user .= '@'.$CONFIG['username_domain'];
}
+ // lowercase username if it's an e-mail address (#1484473)
+ if (strpos($user, '@'))
+ $user = strtolower($user);
// query if user already registered
$sql_result = $DB->query("SELECT user_id, username, language, preferences
@@ -598,7 +600,7 @@ function rcmail_login($user, $pass, $host=NULL)
}
// try to resolve email address from virtuser table
- if (!empty($CONFIG['virtuser_file']) && strstr($user, '@'))
+ if (!empty($CONFIG['virtuser_file']) && strpos($user, '@'))
$user = rcmail_email2user($user);
@@ -671,7 +673,7 @@ function rcmail_create_user($user, $host)
$user_email = '';
// try to resolve user in virtusertable
- if (!empty($CONFIG['virtuser_file']) && strstr($user, '@')==FALSE)
+ if (!empty($CONFIG['virtuser_file']) && !strpos($user, '@'))
$user_email = rcmail_user2email($user);
$DB->query("INSERT INTO ".get_table_name('users')."
@@ -687,7 +689,7 @@ function rcmail_create_user($user, $host)
$mail_domain = rcmail_mail_domain($host);
if ($user_email=='')
- $user_email = strstr($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain);
+ $user_email = strpos($user, '@') ? $user : sprintf('%s@%s', $user, $mail_domain);
$user_name = $user!=$user_email ? $user : '';
diff --git a/skins/default/pngbehavior.htc b/skins/default/pngbehavior.htc
index f19aad33e..54ee96890 100644
--- a/skins/default/pngbehavior.htc
+++ b/skins/default/pngbehavior.htc
@@ -1,52 +1,74 @@
<public:component>
<public:attach event="onpropertychange" onevent="propertyChanged()" />
+<public:attach event="onbeforeprint" for="window" onevent="beforePrint()" />
+<public:attach event="onafterprint" for="window" onevent="afterPrint()" />
<script>
-var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32";
-var realSrc = null;
-var blankSrc = "skins/default/images/blank.gif";
-
+/*
+ * PNG Behavior
+ *
+ * This script was created by Erik Arvidsson (erik(at)eae.net)
+ * for WebFX (http://webfx.eae.net)
+ * Copyright 2002
+ *
+ * For usage see license at http://webfx.eae.net/license.html
+ *
+ * Version: 1.01a
+ *
+ */
+
+var IS_PNG = /\.png$/i;
+var supported = /MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == 'Win32';
+var realSrc, realHeight, realWidth;
+var blankSrc = 'skins/default/images/blank.gif';
if (supported) fixImage();
-
function propertyChanged() {
- if (!supported) return;
-
- var pName = event.propertyName;
- if (pName != "src") return;
- // if not set to blank
- if ( ! new RegExp(blankSrc).test(src))
+ if (supported && event.propertyName == 'src') {
+ var i = element.src.lastIndexOf(blankSrc);
+ if (i == -1 || i != element.src.length - blankSrc.length) {
fixImage();
-};
-
+ }
+ }
+}
function fixImage() {
- // get src
- var src = element.src;
-
- // check for real change
- if (src == realSrc) {
+ if (realSrc && element.src == realSrc) {
+ // this is an attempt to set the image to itself!
+ // pointless - leave the filter as-is, restore the blank image
+ element.src = blankSrc;
+ } else {
+ // set the image to something different
+ if (IS_PNG.test(element.src)) {
+ // fixable PNG
+ realSrc = element.src;
+ realWidth = element.width;
+ realHeight = element.height;
element.src = blankSrc;
- return;
- }
-
- if ( ! new RegExp(blankSrc).test(src)) {
- // backup old src
- realSrc = src;
- element._original_src = realSrc;
- }
-
- // test for png
- if ( realSrc && /\.png$/.test( realSrc.toLowerCase() ) ) {
- // set blank image
- element.src = blankSrc;
- // set filter
- element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
- src + "',sizingMethod='crop')";
- }
- else {
- // remove filter
- element.runtimeStyle.filter = "";
- }
+ element.style.width = realWidth + 'px';
+ element.style.height = realHeight + 'px';
+ element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + encodeURI(realSrc) + "',sizingMethod='scale')";
+ } else {
+ // ordinary image - make sure the fix is removed
+ if (realSrc) {
+ realSrc = null;
+ element.runtimeStyle.filter = '';
+ }
+ }
+ }
+}
+function beforePrint() {
+ if (realSrc) {
+ supported = false;
+ element.src = realSrc;
+ element.runtimeStyle.filter = '';
+ supported = true;
+ }
+}
+function afterPrint() {
+ if (realSrc) {
+ var rs = realSrc;
+ realSrc = null;
+ element.src = rs;
+ }
}
-
</script>
-</public:component> \ No newline at end of file
+</public:component>