0) { drupal_set_message(t('The following error occured: '. t(xmlrpc_error_msg())), 'error'); } else { // ok, we have the data, now do the exporting! if (drupal_strlen($user_information['first_name']) > 0 && drupal_strlen($user_information['last_name']) > 0) { $vcard->setName($user_information['last_name'], $user_information['first_name'], '', '', ''); $vcard->setFormattedName($user_information['first_name'] .' '. $user_information['last_name']); } elseif (drupal_strlen($user_information['first_name']) > 0) { $vcard->setName('', $user_information['first_name'], '', '', ''); $vcard->setFormattedname($user_information['first_name']); } elseif (drupal_strlen($user_information['last_name']) > 0) { $vcard->setName($user_information['last_name'], '', '', '', ''); $vcard->setFormattedname($user_information['last_name']); } else { $vcard->setName($username, '', '', '', ''); $vcard->setFormattedname($username); } $vcard->addNickname($username); // birthday if (!empty($user_information['birthday'])) { $birthday = explode(' ', $user_information['birthday']); $birthday = explode('/', $birthday[0]); $birthday = $birthday[2] .'-'. $birthday[0] .'-'. $birthday[1]; $vcard->setBirthday($birthday); } // homepage if (!empty($user_information['homepage'])) { $vcard->setURL($user_information['homepage']); } // timezone if (!empty($user_information['timezone'])) { $vcard->setTZ($user_information['timezone']); } $vcard->send($username .'.vcf', 'attachment', 'utf-8'); exit; } } else { // PEAR module not installed! drupal_set_message(t('The following error occured: PEAR.Contact_Vcard_Build not installed'), 'error'); } drupal_goto('users/'. $username); } /** * Ensures the vcard PEAR library is available and returns the vCard builder * object. * * @return vCard object, null if library is not available. */ function _vcard_init() { if (@include_once('Contact_Vcard_Build.php')) { $vcard = new Contact_Vcard_Build(); } return $vcard ? $vcard : FALSE; }