Fix photo edition by other users (Closes #1160)
[platal.git] / include / vcard.inc.php
index 3653c9a..2a1402a 100644 (file)
@@ -19,8 +19,6 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once('user.func.inc.php');
-
 class VCard extends PlVCard
 {
     private $profile_list = array();
@@ -85,7 +83,7 @@ class VCard extends PlVCard
         }
 
         // Homes
-        $adrs = $pf->getAddresses(Profile::ADDRESS_PERSO);
+        $adrs = $pf->iterAddresses(Profile::ADDRESS_PERSO);
         while ($adr = $adrs->next()) {
             // TODO : find a way to fetch only the "street" part of the address
             $group = $entry->addHome($adr['text'], null, null, $adr['postalCode'],
@@ -100,7 +98,7 @@ class VCard extends PlVCard
         }
 
         // Pro
-        $adrs = $pf->getAddresses(Profile::ADDRESS_PRO);
+        $adrs = $pf->iterAddresses(Profile::ADDRESS_PRO);
         while ($adr = $adrs->next()) {
             // TODO : link address to company
             $group = $entry->addWork(null, null, null, null,
@@ -131,8 +129,7 @@ class VCard extends PlVCard
         if (!is_null($user)) {
             $groups = $user->groups();
             if (count($groups)) {
-                require_once "directory.enums.inc.php";
-                $gn = DirEnum::getOptionsArray(DirEnum::GROUPESX);
+                $gn = DirEnum::getOptions(DirEnum::GROUPESX);
                 $gns = array();
                 foreach (array_keys($groups) as $gid) {
                     $gns[$gid] = $gn[$gid];
@@ -144,8 +141,7 @@ class VCard extends PlVCard
         $binets = $pf->getBinets();
 
         if (count($binets)) {
-            require_once "directory.enums.inc.php";
-            $bn = DirEnum::getOptionsArray(DirEnum::BINETS);
+            $bn = DirEnum::getOptions(DirEnum::BINETS);
             $bns = array();
             foreach ($binets as $bid) {
                 $bns[$bid] = $bn[$bid];
@@ -153,8 +149,7 @@ class VCard extends PlVCard
             $entry->set('X-BINETS', join(', ', $bid));
         }
         if (!empty($pf->section)) {
-            require_once "directory.enums.inc.php";
-            $sections = DirEnum::getOptionsArray(DirEnum::SECTIONS);
+            $sections = DirEnum::getOptions(DirEnum::SECTIONS);
             $entry->set('X-SECTION', $sections[$pf->section]);
         }