From f8c96f737c1916377e361e3fbaa8a415c4101ca4 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Thu, 07 Jun 2012 04:34:56 -0400
Subject: [PATCH] Enable attachments drag&drop upload for default skin

---
 program/include/rcube_addressbook.php |   31 +++++++------------------------
 1 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/program/include/rcube_addressbook.php b/program/include/rcube_addressbook.php
index b56b58a..f5b32cd 100644
--- a/program/include/rcube_addressbook.php
+++ b/program/include/rcube_addressbook.php
@@ -17,9 +17,6 @@
  +-----------------------------------------------------------------------+
  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
  +-----------------------------------------------------------------------+
-
- $Id$
-
 */
 
 
@@ -211,11 +208,14 @@
      */
     public function validate(&$save_data, $autofix = false)
     {
+        $rcmail = rcmail::get_instance();
+
         // check validity of email addresses
         foreach ($this->get_col_values('email', $save_data, true) as $email) {
             if (strlen($email)) {
-                if (!check_email(rcube_idn_to_ascii($email))) {
-                    $this->set_error(self::ERROR_VALIDATE, rcube_label(array('name' => 'emailformaterror', 'vars' => array('email' => $email))));
+                if (!rcube_utils::check_email(rcube_utils::idn_to_ascii($email))) {
+                    $error = $rcmail->gettext(array('name' => 'emailformaterror', 'vars' => array('email' => $email)));
+                    $this->set_error(self::ERROR_VALIDATE, $error);
                     return false;
                 }
             }
@@ -444,29 +444,12 @@
      *
      * @param string Input string (UTF-8)
      * @return string Normalized string
+     * @deprecated since 0.9-beta
      */
     protected static function normalize_string($str)
     {
-        // split by words
-        $arr = explode(" ", preg_replace(
-            array('/[\s;\+\-\/]+/i', '/(\d)[-.\s]+(\d)/', '/\s\w{1,3}\s/'),
-            array(' ', '\\1\\2', ' '),
-            $str));
-
-        foreach ($arr as $i => $part) {
-            if (utf8_encode(utf8_decode($part)) == $part) {  // is latin-1 ?
-                $arr[$i] = utf8_encode(strtr(strtolower(strtr(utf8_decode($part),
-                    '��������������������������������������������������',
-                    'ccaaaaeeeeiiiaeooouuuyooaiounnaaaaaeeeiiioooouuuyy')),
-                    array('�' => 'ss', 'ae' => 'a', 'oe' => 'o', 'ue' => 'u')));
-            }
-            else
-                $arr[$i] = mb_strtolower($part);
-        }
-
-        return join(" ", $arr);
+        return rcube_utils::normalize_string($str);
     }
-
 
     /**
      * Compose a valid display name from the given structured contact data

--
Gitblit v1.9.1