Fix missing URLs at the end of the default footer message
[platal.git] / modules / profile.php
index d710722..ec07500 100644 (file)
@@ -29,7 +29,7 @@ class ProfileModule extends PLModule
 
             'fiche.php'        => $this->make_hook('fiche',      AUTH_PUBLIC),
             'profile'          => $this->make_hook('profile',    AUTH_PUBLIC),
-            'profile/private'  => $this->make_hook('profile',    AUTH_MDP),
+            'profile/private'  => $this->make_hook('profile',    AUTH_COOKIE),
             'profile/edit'     => $this->make_hook('p_edit',     AUTH_MDP),
             'profile/orange'   => $this->make_hook('p_orange',   AUTH_MDP),
             'profile/usage'    => $this->make_hook('p_usage',    AUTH_MDP),
@@ -271,9 +271,8 @@ class ProfileModule extends PLModule
             XDB::execute('REPLACE INTO groupex.membres (uid,asso_id)
                                      VALUES ({?}, {?})',
                                  S::v('uid'), $asso_id);
-            require_once 'lists.inc.php';
-            $client =& lists_xmlrpc(S::v('uid'), S::v('password'));
-            $client->subscribe("promo".S::v('promo'));
+            $mmlist = new MMList(S::v('uid'), S::v('password'));
+            $mmlist->subscribe("promo".S::v('promo'));
         }
 
         if (is_ax_key_missing()) {
@@ -636,8 +635,6 @@ class ProfileModule extends PLModule
 
     function handler_trombi(&$page, $promo = null)
     {
-        require_once 'trombi.inc.php';
-
         $page->changeTpl('trombipromo.tpl');
         $page->assign('xorg_title', 'Polytechnique.org - Trombi Promo');
 
@@ -647,7 +644,7 @@ class ProfileModule extends PLModule
 
         $this->promo = $promo = intval($promo);
 
-        if ($promo >= 1900 && $promo < intval(date('Y'))
+        if ($promo >= 1900 && ($promo < intval(date('Y')) || ($promo == intval(date('Y')) && intval(date('m')) >= 9))
         || ($promo == -1 && S::has_perms()))
         {
             $trombi = new Trombi(array($this, '_trombi_getlist'));
@@ -659,24 +656,6 @@ class ProfileModule extends PLModule
         }
     }
 
-    function format_adr($params, &$smarty)
-    {
-        // $adr1, $adr2, $adr3, $postcode, $city, $region, $country
-        extract($params['adr']);
-        $adr = trim($adr1);
-        $adr = trim("$adr\n$adr2");
-        $adr = trim("$adr\n$adr3");
-        return $this->quoted_printable_encode(";;$adr;$city;$region;$postcode;$country");
-    }
-
-    function quoted_printable_encode($text)
-    {
-        return implode("\n", 
-                       array_map('trim',
-                                 explode("\n", 
-                                         quoted_printable_encode($text))));
-    }
-
     function handler_vcard(&$page, $x = null)
     {
         if (is_null($x)) {
@@ -689,49 +668,9 @@ class ProfileModule extends PLModule
             $x = substr($x, 0, strlen($x) - 4);
         }
 
-        $page->changeTpl('vcard.tpl', NO_SKIN);
-        require_once 'xorg.misc.inc.php';
-        require_once 'user.func.inc.php';
-
-        $page->register_modifier('qp_enc', array($this, 'quoted_printable_encode'));
-        $page->register_function('format_adr', array($this, 'format_adr'));
-
-        $login = get_user_forlife($x);
-        $user  = get_user_details($login);
-        
-        if (strlen(trim($user['freetext']))) {
-            $user['freetext'] = html_entity_decode($user['freetext']);
-        }
-
-        // alias virtual
-        $res = XDB::query(
-                "SELECT alias
-                   FROM virtual
-             INNER JOIN virtual_redirect USING(vid)
-             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['forlife'].'@'.$globals->mail->domain,
-                $user['forlife'].'@'.$globals->mail->domain2);
-
-        $user['virtualalias'] = $res->fetchOneCell();
-        
-        // get photo
-        $res = XDB::query(
-                "SELECT attach
-                   FROM photo   AS p
-             INNER JOIN aliases AS a ON (a.id = p.uid AND a.type = 'a_vie')
-                  WHERE a.alias = {?}", $login);
-        if ($res->numRows()) {
-            $user['photo'] = $res->fetchOneCell();
-        }
-        $page->assign_by_ref('vcard', $user);
-
-        header("Pragma: ");
-        header("Cache-Control: ");
-        header("Content-type: text/x-vcard\n");
-        header("Content-Transfer-Encoding: Quoted-Printable\n");
+        require_once('vcard.inc.php');
+        $vcard = new VCard($x);
+        $vcard->do_page($page);
     }
 
     function handler_admin_trombino(&$page, $uid = null, $action = null) {