Merge commit 'origin/master' into hruid.
[platal.git] / include / vcard.inc.php
index 1a84dc8..a26153e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2008 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -19,7 +19,6 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once('xorg.misc.inc.php');
 require_once('user.func.inc.php');
 
 class VCardIterator implements PlIterator
@@ -37,7 +36,7 @@ class VCardIterator implements PlIterator
 
     public function add_user($user)
     {
-        $this->user_list[] = get_user_forlife($user);
+        $this->user_list[] = User::get($user);
         $this->count++;
     }
 
@@ -63,7 +62,7 @@ class VCardIterator implements PlIterator
         }
         global $globals;
         $login = array_shift($this->user_list);
-        $user  = get_user_details($login);
+        $user  = get_user_details($login->login());
 
         if (strlen(trim($user['freetext']))) {
             $user['freetext'] = pl_entity_decode($user['freetext']);
@@ -84,7 +83,7 @@ class VCardIterator implements PlIterator
              INNER JOIN auth_user_quick  ON ( user_id = {?} AND emails_alias_pub = 'public' )
                   WHERE ( redirect={?} OR redirect={?} )
                         AND alias LIKE '%@{$globals->mail->alias_dom}'",
-                S::v('uid'),
+                $user['user_id'],
                 $user['forlife'].'@'.$globals->mail->domain,
                 $user['forlife'].'@'.$globals->mail->domain2);
 
@@ -94,10 +93,9 @@ class VCardIterator implements PlIterator
         // get photo
         if ($this->photos) {
             $res = XDB::query(
-                    "SELECT attach, attachmime
-                       FROM photo   AS p
-                 INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie')
-                      WHERE a.alias = {?}", $login);
+                    "SELECT  attach, attachmime
+                       FROM  photo AS p
+                      WHERE  u.user_id = {?}", $login->id());
             if ($res->numRows()) {
                 $user['photo'] = $res->fetchOneAssoc();
             }