|
@@ -1,6 +1,8 @@
|
|
|
<?php
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
|
|
|
+use JeroenDesloovere\VCard\VCard;
|
|
|
+
|
|
|
/**
|
|
|
* VCard Generator
|
|
|
* @package chamilo.social
|
|
@@ -9,33 +11,31 @@
|
|
|
|
|
|
require_once __DIR__.'/../inc/global.inc.php';
|
|
|
|
|
|
-use JeroenDesloovere\VCard\VCard;
|
|
|
-
|
|
|
api_block_anonymous_users();
|
|
|
|
|
|
if (isset($_REQUEST['userId'])) {
|
|
|
$userId = intval($_REQUEST['userId']);
|
|
|
} else {
|
|
|
- api_not_allowed();
|
|
|
+ api_not_allowed(true);
|
|
|
}
|
|
|
|
|
|
// Return User Info to vCard Export
|
|
|
$userInfo = api_get_user_info($userId, true, false, true);
|
|
|
|
|
|
// Pre-Loaded User Info
|
|
|
-$firstname = $userInfo['firstname'];
|
|
|
-$lastname = $userInfo['lastname'];
|
|
|
-$email = $userInfo['email'];
|
|
|
-$phone = $userInfo['phone'];
|
|
|
$language = get_lang('Language').': '.$userInfo['language'];
|
|
|
|
|
|
// Instance the vCard Class
|
|
|
$vcard = new VCard();
|
|
|
|
|
|
// Adding the User Info to the vCard
|
|
|
-$vcard->addName($lastname, $firstname);
|
|
|
-$vcard->addEmail($email);
|
|
|
-$vcard->addPhoneNumber($phone, 'CELL');
|
|
|
+$vcard->addName($userInfo['firstname'], $userInfo['lastname']);
|
|
|
+
|
|
|
+if (api_get_setting('show_email_addresses') == 'true') {
|
|
|
+ $vcard->addEmail($userInfo['email']);
|
|
|
+}
|
|
|
+
|
|
|
+$vcard->addPhoneNumber($userInfo['phone'], 'CELL');
|
|
|
$vcard->addNote($language);
|
|
|
|
|
|
// Generate the vCard
|