From 4c4fe693d7d3e892e28fb99bd6f1cc65a3e66ccc Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Mon, 05 Sep 2011 03:40:18 -0400
Subject: [PATCH] Fix wrong vCard type parameter mobile (#1488067)

---
 CHANGELOG                       |    1 +
 program/include/rcube_vcard.php |   14 +++++++-------
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index da20a2d..416bbf3 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+- Fixed wrong vCard type parameter mobile (#1488067)
 - Fixed vCard WORKFAX issue (#1488046)
 - Add vCard's Profile URL support (#1488062)
 - jQuery 1.6.3
diff --git a/program/include/rcube_vcard.php b/program/include/rcube_vcard.php
index ec3ad9c..283da1d 100644
--- a/program/include/rcube_vcard.php
+++ b/program/include/rcube_vcard.php
@@ -51,7 +51,7 @@
     'edit'        => 'X-AB-EDIT',
   );
   private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile', 'WORK,FAX' => 'workfax');
-  private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORK,FAX', 'WORKFAX' => 'WORK,FAX');
+  private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORK,FAX');
   private $addresstypemap = array('BUSINESS' => 'WORK');
   private $immap = array('X-JABBER' => 'jabber', 'X-ICQ' => 'icq', 'X-MSN' => 'msn', 'X-AIM' => 'aim', 'X-YAHOO' => 'yahoo', 'X-SKYPE' => 'skype', 'X-SKYPE-USERNAME' => 'skype');
 
@@ -252,7 +252,7 @@
   public function set($field, $value, $type = 'HOME')
   {
     $field = strtolower($field);
-    $type = strtoupper($type);
+    $type_uc = strtoupper($type);
     $typemap = array_flip($this->typemap);
 
     switch ($field) {
@@ -301,7 +301,7 @@
         break;
 
       case 'email':
-        $this->raw['EMAIL'][] = array(0 => $value, 'type' => array_filter(array('INTERNET', $type)));
+        $this->raw['EMAIL'][] = array(0 => $value, 'type' => array_filter(array('INTERNET', $type_uc)));
         $this->email[] = $value;
         break;
 
@@ -318,8 +318,8 @@
         break;
 
       case 'address':
-        if ($this->addresstypemap[$type])
-          $type = $this->addresstypemap[$type];
+        if ($this->addresstypemap[$type_uc])
+          $type = $this->addresstypemap[$type_uc];
 
         $value = $value[0] ? $value : array('', '', $value['street'], $value['locality'], $value['region'], $value['zipcode'], $value['country']);
 
@@ -328,8 +328,8 @@
           break;
 
       default:
-        if ($field == 'phone' && $this->phonetypemap[$type])
-          $type = $this->phonetypemap[$type];
+        if ($field == 'phone' && $this->phonetypemap[$type_uc])
+          $type = $this->phonetypemap[$type_uc];
 
         if (($tag = self::$fieldmap[$field]) && (is_array($value) || strlen($value))) {
           $index = count($this->raw[$tag]);

--
Gitblit v1.9.1