| 1 | <?php |
| 2 | /*************************************************************************** |
| 3 | * Copyright (C) 2003-2006 Polytechnique.org * |
| 4 | * http://opensource.polytechnique.org/ * |
| 5 | * * |
| 6 | * This program is free software; you can redistribute it and/or modify * |
| 7 | * it under the terms of the GNU General Public License as published by * |
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
| 9 | * (at your option) any later version. * |
| 10 | * * |
| 11 | * This program is distributed in the hope that it will be useful, * |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
| 14 | * GNU General Public License for more details. * |
| 15 | * * |
| 16 | * You should have received a copy of the GNU General Public License * |
| 17 | * along with this program; if not, write to the Free Software * |
| 18 | * Foundation, Inc., * |
| 19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
| 20 | ***************************************************************************/ |
| 21 | |
| 22 | require_once("xorg.inc.php"); |
| 23 | new_nonhtml_page('vcard.tpl', AUTH_COOKIE); |
| 24 | require_once("xorg.misc.inc.php"); |
| 25 | require_once("user.func.inc.php"); |
| 26 | |
| 27 | function format_adr($params, &$smarty) |
| 28 | { |
| 29 | // $adr1, $adr2, $adr3, $postcode, $city, $region, $country |
| 30 | extract($params['adr']); |
| 31 | $adr = $adr1; |
| 32 | $adr = trim("$adr\n$adr2"); |
| 33 | $adr = trim("$adr\n$adr3"); |
| 34 | return quoted_printable_encode(";;$adr;$city;$region;$postcode;$country"); |
| 35 | } |
| 36 | |
| 37 | $page->register_modifier('qp_enc', 'quoted_printable_encode'); |
| 38 | $page->register_function('format_adr', 'format_adr'); |
| 39 | |
| 40 | $login = get_user_forlife(Env::get('x')); |
| 41 | $user = get_user_details($login); |
| 42 | |
| 43 | // alias virtual |
| 44 | $res = $globals->xdb->query( |
| 45 | "SELECT alias |
| 46 | FROM virtual |
| 47 | INNER JOIN virtual_redirect USING(vid) |
| 48 | INNER JOIN auth_user_quick ON ( user_id = {?} AND emails_alias_pub = 'public' ) |
| 49 | WHERE ( redirect={?} OR redirect={?} ) |
| 50 | AND alias LIKE '%@{$globals->mail->alias_dom}'", |
| 51 | Session::getInt('uid'), $user['forlife'].'@'.$globals->mail->domain, $user['forlife'].'@'.$globals->mail->domain2); |
| 52 | $user['virtualalias'] = $res->fetchOneCell(); |
| 53 | |
| 54 | $page->assign_by_ref('vcard', $user); |
| 55 | |
| 56 | header("Pragma: "); |
| 57 | header("Cache-Control: "); |
| 58 | header("Content-type: text/x-vcard\n"); |
| 59 | header("Content-Transfer-Encoding: Quoted-Printable\n"); |
| 60 | |
| 61 | $page->run(); |
| 62 | ?> |