| | |
| | | +-----------------------------------------------------------------------+ |
| | | | program/include/rcube_vcard.php | |
| | | | | |
| | | | This file is part of the RoundCube Webmail client | |
| | | | Copyright (C) 2008-2009, RoundCube Dev. - Switzerland | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2008-2009, Roundcube Dev. - Switzerland | |
| | | | Licensed under the GNU GPL | |
| | | | | |
| | | | PURPOSE: | |
| | |
| | | $tmp = $this->email[0]; |
| | | $this->email[0] = $this->email[$pref_index]; |
| | | $this->email[$pref_index] = $tmp; |
| | | } |
| | | |
| | | // make sure displayname is not empty (required by RFC2426) |
| | | if (!strlen($this->displayname)) { |
| | | // the same method is used in steps/mail/addcontact.inc |
| | | $this->displayname = ucfirst(preg_replace('/[\.\-]/', ' ', |
| | | substr($this->email[0], 0, strpos($this->email[0], '@')))); |
| | | } |
| | | } |
| | | |
| | |
| | | if ($in_vcard_block && !empty($line)) |
| | | $vcard_block .= $line . "\n"; |
| | | |
| | | if (trim($line) == 'END:VCARD') { |
| | | $line = trim($line); |
| | | |
| | | if (preg_match('/^END:VCARD$/i', $line)) { |
| | | // parse vcard |
| | | $obj = new rcube_vcard(self::cleanup($vcard_block), $charset); |
| | | if (!empty($obj->displayname)) |
| | |
| | | |
| | | $in_vcard_block = false; |
| | | } |
| | | else if (trim($line) == 'BEGIN:VCARD') { |
| | | else if (preg_match('/^BEGIN:VCARD$/i', $line)) { |
| | | $vcard_block = $line . "\n"; |
| | | $in_vcard_block = true; |
| | | } |