From 09c59abf8576f52b40e1787ef3c0204f795ab9f5 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Tue, 31 May 2011 12:17:23 -0400
Subject: [PATCH] Case-insensitive matching in autocompletion (#1487933); replace old string offset syntax

---
 CHANGELOG                           |    1 +
 program/include/main.inc            |   18 +++++++++---------
 program/steps/mail/autocomplete.inc |    2 +-
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 4bb90ee..1f492c9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Case-insensitive matching in autocompletion (#1487933)
 - Added option to force spellchecking before sending a message (#1485458)
 - Fix handling of "<" character in contact data, search fields and folder names (#1487864)
 - Fix saving "<" character in identity name and organization fields (#1487864)
diff --git a/program/include/main.inc b/program/include/main.inc
index 98b8bcb..1ded902 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1090,28 +1090,28 @@
   // an alternative would be to convert the date() format string to fit with strftime()
   $out = '';
   for($i=0; $i<strlen($format); $i++) {
-    if ($format{$i}=='\\')  // skip escape chars
+    if ($format[$i]=='\\')  // skip escape chars
       continue;
 
     // write char "as-is"
-    if ($format{$i}==' ' || $format{$i-1}=='\\')
-      $out .= $format{$i};
+    if ($format[$i]==' ' || $format{$i-1}=='\\')
+      $out .= $format[$i];
     // weekday (short)
-    else if ($format{$i}=='D')
+    else if ($format[$i]=='D')
       $out .= rcube_label(strtolower(date('D', $timestamp)));
     // weekday long
-    else if ($format{$i}=='l')
+    else if ($format[$i]=='l')
       $out .= rcube_label(strtolower(date('l', $timestamp)));
     // month name (short)
-    else if ($format{$i}=='M')
+    else if ($format[$i]=='M')
       $out .= rcube_label(strtolower(date('M', $timestamp)));
     // month name (long)
-    else if ($format{$i}=='F')
+    else if ($format[$i]=='F')
       $out .= rcube_label('long'.strtolower(date('M', $timestamp)));
-    else if ($format{$i}=='x')
+    else if ($format[$i]=='x')
       $out .= strftime('%x %X', $timestamp);
     else
-      $out .= date($format{$i}, $timestamp);
+      $out .= date($format[$i], $timestamp);
   }
 
   if ($today) {
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index 85f3cf3..145fb18 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -53,7 +53,7 @@
         foreach ($email_arr as $email) {
           $contact = format_email_recipient($email, $sql_arr['name']);
           // skip entries that don't match
-          if ($email_cnt > 1 && strpos($contact, $search) === false) {
+          if ($email_cnt > 1 && stripos($contact, $search) === false) {
             continue;
           }
           // when we've got more than one book, we need to skip duplicates

--
Gitblit v1.9.1