+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2006 Polytechnique.org *
- * http://opensource.polytechnique.org/ *
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
- * GNU General Public License for more details. *
- * *
- * You should have received a copy of the GNU General Public License *
- * along with this program; if not, write to the Free Software *
- * Foundation, Inc., *
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_nonhtml_page('vcard.tpl', AUTH_COOKIE);
-require_once("xorg.misc.inc.php");
-require_once("user.func.inc.php");
-
-function format_adr($params, &$smarty)
-{
- // $adr1, $adr2, $adr3, $postcode, $city, $region, $country
- extract($params['adr']);
- $adr = $adr1;
- $adr = trim("$adr\n$adr2");
- $adr = trim("$adr\n$adr3");
- return quoted_printable_encode(";;$adr;$city;$region;$postcode;$country");
-}
-
-$page->register_modifier('qp_enc', 'quoted_printable_encode');
-$page->register_function('format_adr', 'format_adr');
-
-$login = get_user_forlife(Env::get('x'));
-$user = get_user_details($login);
-
-// alias virtual
-$res = $globals->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}'",
- Session::getInt('uid'), $user['forlife'].'@'.$globals->mail->domain, $user['forlife'].'@'.$globals->mail->domain2);
-$user['virtualalias'] = $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");
-
-$page->run();
-?>
function handlers()
{
return array(
- 'photo' => $this->make_hook('photo', AUTH_PUBLIC),
- 'photo/change' => $this->make_hook('photo_change', AUTH_MDP),
- 'trombi' => $this->make_hook('trombi', AUTH_COOKIE),
+ 'photo' => $this->make_hook('photo', AUTH_PUBLIC),
+ 'photo/change' => $this->make_hook('photo_change', AUTH_MDP),
+
+ 'trombi' => $this->make_hook('trombi', AUTH_COOKIE),
+
+ 'vcard' => $this->make_hook('vcard', AUTH_COOKIE),
);
}
return PL_OK;
}
+
+ function format_adr($params, &$smarty)
+ {
+ // $adr1, $adr2, $adr3, $postcode, $city, $region, $country
+ extract($params['adr']);
+ $adr = $adr1;
+ $adr = trim("$adr\n$adr2");
+ $adr = trim("$adr\n$adr3");
+ return quoted_printable_encode(";;$adr;$city;$region;$postcode;$country");
+ }
+
+ function handler_vcard(&$page, $x = null)
+ {
+ if (is_null($x)) {
+ return PL_NOT_FOUND;
+ }
+
+ global $globals;
+
+ if (substr($x, -4) == '.vcf') {
+ $x = substr($x, 0, strlen($x) - 4);
+ }
+
+ new_nonhtml_page('vcard.tpl', AUTH_COOKIE);
+ require_once 'xorg.misc.inc.php';
+ require_once 'user.func.inc.php';
+
+ $page->register_modifier('qp_enc', 'quoted_printable_encode');
+ $page->register_function('format_adr', array($this, 'format_adr'));
+
+ $login = get_user_forlife($x);
+ $user = get_user_details($login);
+
+ // alias virtual
+ $res = $globals->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}'",
+ Session::getInt('uid'),
+ $user['forlife'].'@'.$globals->mail->domain,
+ $user['forlife'].'@'.$globals->mail->domain2);
+
+ $user['virtualalias'] = $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");
+
+ return PL_OK;
+ }
}
?>
{$x.prenom} {if $x.nom_usage eq ""}{$x.nom}{else}{$x.nom_usage} ({$x.nom}){/if}
{if $logged}
{if $x.nickname} (aka {$x.nickname}){/if}
- <a href="vcard.php/{$x.forlife}.vcf?x={$x.forlife}">
+ <a href="vcard/{$x.forlife}.vcf">
<img src="images/vcard.png" alt="Afficher la carte de visite" title="Afficher la carte de visite"/>
</a>
{if !$x.is_contact}
<a href="{rel}/fiche.php?user={$c.forlife}" class="popup2">{*
*}<img src="{rel}/images/loupe.gif" alt="Afficher la fiche" title="Afficher la fiche" /></a>
{if !$c.dcd}
- <a href="{rel}/vcard.php/{$c.forlife}.vcf?x={$c.forlife}">{*
+ <a href="{rel}/vcard/{$c.forlife}.vcf">{*
*}<img src="{rel}/images/vcard.png" alt="Afficher la carte de visite" title="Afficher la carte de visite" /></a>
<a href="{rel}/carnet/contacts?action={$show_action}&user={$c.forlife}">{*
*}<img src="{rel}/images/{$show_action}.gif" alt="{if $show_action eq "ajouter"}Ajouter à mes{else}Retirer de mes{/if} contacts"
<td>
{if $m.x}
<a href="https://www.polytechnique.org/fiche.php?user={$m.email}"><img src="{rel}/images/loupe.gif" alt="[fiche]" /></a>
- <a href="https://www.polytechnique.org/vcard.php/{$m.email}.vcf/?x={$m.email}"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
+ <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
<a href="mailto:{$m.email}@polytechnique.org"><img src="{rel}/images/mail.png" alt="mail" /></a>
{else}
<a href="mailto:{$m.email}"><img src="{rel}/images/mail.png" alt="mail" /></a>
<td>{$m.promo}</td>
<td>
<a href="https://www.polytechnique.org/fiche.php?user={$m.email}"><img src="{rel}/images/loupe.gif" alt="[fiche]" /></a>
- <a href="https://www.polytechnique.org/vcard.php/{$m.email}.vcf/?x={$m.email}"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
+ <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
<a href="mailto:{$m.email}@polytechnique.org"><img src="{rel}/images/mail.png" alt="mail" /></a>
</td>
<td>{$m.montant}</td>
<td>
{if $m.x}
<a href="https://www.polytechnique.org/fiche.php?user={$m.email}"><img src="{rel}/images/loupe.gif" alt="[fiche]" /></a>
- <a href="https://www.polytechnique.org/vcard.php/{$m.email}.vcf/?x={$m.email}"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
+ <a href="https://www.polytechnique.org/vcard/{$m.email}.vcf"><img src="{rel}/images/vcard.png" alt="[vcard]" /></a>
<a href="mailto:{$m.email}@polytechnique.org"><img src="{rel}/images/mail.png" alt="mail" /></a>
{else}
<a href="mailto:{$m.email}"><img src="{rel}/images/mail.png" alt="mail"></a>