thomascube
2011-09-05 31e00cb7e94188b5d8f4c1d9a113b13be9dc91a7
Fix vCard WORKFAX issue (#1488046)

2 files modified
31 ■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/include/rcube_vcard.php 30 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Fixed vCard WORKFAX issue (#1488046)
- Add vCard's Profile URL support (#1488062)
- jQuery 1.6.3
- Fix imap_cache setting to values other than 'db' (#1488060)
program/include/rcube_vcard.php
@@ -50,8 +50,8 @@
    'spouse'      => 'X-SPOUSE',
    'edit'        => 'X-AB-EDIT',
  );
  private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile');
  private $phonetypemap = array('HOME1' => 'HOME', 'BUSINESS1' => 'WORK', 'BUSINESS2' => 'WORK2', 'BUSINESSFAX' => 'WORKFAX');
  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 $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');
@@ -158,7 +158,8 @@
          $subtype = '';
          if (!empty($raw['type'])) {
            $subtype = $typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]);
            $combined = join(',', self::array_filter((array)$raw['type'], 'internet,pref', true));
            $subtype = $typemap[$combined] ? $typemap[$combined] : ($typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]));
            while ($k < count($raw['type']) && ($subtype == 'internet' || $subtype == 'pref'))
              $subtype = $typemap[$raw['type'][++$k]] ? $typemap[$raw['type'][$k]] : strtolower($raw['type'][$k]);
          }
@@ -334,7 +335,7 @@
          $index = count($this->raw[$tag]);
          $this->raw[$tag][$index] = (array)$value;
          if ($type)
            $this->raw[$tag][$index]['type'] = array(($typemap[$type] ? $typemap[$type] : $type));
            $this->raw[$tag][$index]['type'] = explode(',', ($typemap[$type] ? $typemap[$type] : $type));
        }
        break;
    }
@@ -711,6 +712,27 @@
    return true;
  }
  /**
   * Extract array values by a filter
   *
   * @param array Array to filter
   * @param keys Array or comma separated list of values to keep
   * @param boolean Invert key selection: remove the listed values
   * @return array The filtered array
   */
  private static function array_filter($arr, $values, $inverse = false)
  {
    if (!is_array($values))
      $values = explode(',', $values);
    $result = array();
    $keep = array_flip((array)$values);
    foreach ($arr as $key => $val)
      if ($inverse != isset($keep[strtolower($val)]))
        $result[$key] = $val;
    return $result;
  }
  /**
   * Returns UNICODE type based on BOM (Byte Order Mark)