Changeset 31e00cb in github


Ignore:
Timestamp:
Sep 5, 2011 3:28:32 AM (22 months ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.7, release-0.8
Children:
4c4fe69
Parents:
dbb0c2a
Message:

Fix vCard WORKFAX issue (#1488046)

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    rdbb0c2a r31e00cb  
    22=========================== 
    33 
     4- Fixed vCard WORKFAX issue (#1488046) 
    45- Add vCard's Profile URL support (#1488062) 
    56- jQuery 1.6.3 
  • program/include/rcube_vcard.php

    r359e19a r31e00cb  
    5151    'edit'        => 'X-AB-EDIT', 
    5252  ); 
    53   private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile'); 
    54   private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORKFAX'); 
     53  private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile', 'WORK,FAX' => 'workfax'); 
     54  private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORK,FAX', 'WORKFAX' => 'WORK,FAX'); 
    5555  private $addresstypemap = array('BUSINESS' => 'WORK'); 
    5656  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'); 
     
    159159 
    160160          if (!empty($raw['type'])) { 
    161             $subtype = $typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]); 
     161            $combined = join(',', self::array_filter((array)$raw['type'], 'internet,pref', true)); 
     162            $subtype = $typemap[$combined] ? $typemap[$combined] : ($typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k])); 
    162163            while ($k < count($raw['type']) && ($subtype == 'internet' || $subtype == 'pref')) 
    163164              $subtype = $typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]); 
     
    335336          $this->raw[$tag][$index] = (array)$value; 
    336337          if ($type) 
    337             $this->raw[$tag][$index]['type'] = array(($typemap[$type] ? $typemap[$type] : $type)); 
     338            $this->raw[$tag][$index]['type'] = explode(',', ($typemap[$type] ? $typemap[$type] : $type)); 
    338339        } 
    339340        break; 
     
    712713  } 
    713714 
     715  /** 
     716   * Extract array values by a filter 
     717   * 
     718   * @param array Array to filter 
     719   * @param keys Array or comma separated list of values to keep 
     720   * @param boolean Invert key selection: remove the listed values 
     721   * @return array The filtered array 
     722   */ 
     723  private static function array_filter($arr, $values, $inverse = false) 
     724  { 
     725    if (!is_array($values)) 
     726      $values = explode(',', $values); 
     727 
     728    $result = array(); 
     729    $keep = array_flip((array)$values); 
     730    foreach ($arr as $key => $val) 
     731      if ($inverse != isset($keep[strtolower($val)])) 
     732        $result[$key] = $val; 
     733 
     734    return $result; 
     735  } 
    714736 
    715737  /** 
Note: See TracChangeset for help on using the changeset viewer.