+++ /dev/null
-<?php
-/***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************
- $Id: mescontacts_ldif.php,v 1.1 2004-11-04 15:33:27 x2000habouzit Exp $
- ***************************************************************************/
-
-require("auto.prepend.inc.php");
-new_nonhtml_page('carnet/mescontacts_ldif.tpl', AUTH_COOKIE);
-
-function ensure_adr(&$table) {
- $trim = Array();
- if(!empty($table['adr1'])) $trim[] = $table['adr1'];
- if(!empty($table['adr2'])) $trim[] = $table['adr2'];
- if(!empty($table['adr3'])) $trim[] = $table['adr3'];
- unset($table['adr1'], $table['adr2'], $table['adr3']);
- foreach($trim as $key=>$val)
- $table["adr$key"] = $val;
- $table['adr_fmt'] = implode("\n", $trim);
- return $table;
-}
-
-function ldif_encode($data,$force_64=false) {
- return base64_encode(utf8_encode($data));
-}
-$page->register_modifier('ldif_format', 'ldif_encode');
-$page->register_modifier('utf8', 'utf8_encode');
-
-
-/*
- * On construit la liste des contacts, et de l'entreprise à laquelle ils appartiennent
- */
-$contacts = Array();
-$req = $globals->db->query("SELECT contact AS id, date, prenom, nom, epouse, l.alias AS forlife, mobile, web, libre, promo,
- entreprise, adr1, adr2, adr3, cp, ville, gp.pays, gr.name, tel, fax,
- poste, f.fonction_fr AS fonction
- FROM contacts AS c
- LEFT JOIN auth_user_md5 AS a ON(a.user_id = c.contact)
- INNER JOIN aliases AS l ON(a.user_id = l.id AND type='a_vie')
- LEFT JOIN entreprises AS e ON(a.user_id = e.uid)
- LEFT JOIN fonctions_def AS f ON(e.fonction = f.id)
- LEFT JOIN geoloc_pays AS gp ON(e.pays = gp.a2)
- LEFT JOIN geoloc_region AS gr ON(e.pays = gr.a2 AND e.region = gr.region)
- WHERE c.uid ='{$_SESSION['uid']}'
- ORDER BY contact");
-while($line = mysql_fetch_assoc($req)) {
- $contacts[$line['id']] = ensure_adr($line);
- $contacts[$line['id']]['aliases'] = Array();
-}
-mysql_free_result($req);
-
-$req = $globals->db->query("SELECT a.id,a.alias
- FROM aliases AS a
- INNER JOIN contacts AS c ON a.id=c.contact
- WHERE c.uid='{$_SESSION['uid']}' AND a.type!='a_vie' AND a.type!='homonyme'");
-while(list($id,$alias) = mysql_fetch_row($req)) {
- $contacts[$id]['aliases'][] = $alias;
-}
-mysql_free_result($req);
-/*
- * On y ajoute les infos d'adresses
- */
-$req = $globals->db->query(
- "SELECT c.contact AS id, adr1, adr2, adr3, cp, ville, gp.pays, gr.name, tel, fax
- FROM contacts AS c
- INNER JOIN adresses AS a ON (a.uid = c.contact AND FIND_IN_SET('active', a.statut))
- LEFT JOIN geoloc_pays AS gp ON (a.pays = gp.a2)
- LEFT JOIN geoloc_region AS gr ON (a.pays = gr.a2 AND a.region = gr.region)
- WHERE c.uid = {$_SESSION['uid']}
- ORDER BY c.contact");
-
-while($line = mysql_fetch_assoc($req))
- $contacts[$line['id']]['home'] = ensure_adr($line);
-mysql_free_result($req);
-$page->assign_by_ref('contacts',$contacts);
-
-header("Pragma: ");
-header("Cache-Control: ");
-header("Content-type: text/x-ldif\n");
-
-$page->run();
-?>
+++ /dev/null
-{***************************************************************************
- * Copyright (C) 2003-2004 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 *
- ***************************************************************************
- $Id: mescontacts_ldif.tpl,v 1.1 2004-11-04 15:33:28 x2000habouzit Exp $
- ***************************************************************************}
-
-{foreach item=c from=$contacts}
-{******************************************************************************}
-{******************************************************************************}
-{if $c.epouse}
-dn: cn={"`$c.prenom` `c.epouse` (`$c.nom`)"|utf8},mail={$c.forlife}@polytechnique.org
-cn: {"`$c.prenom` `c.epouse`"|utf8}
-{else}
-dn: cn={"`$c.prenom` `$c.nom`"|utf8},mail={$c.forlife}@polytechnique.org
-cn: {"`$c.prenom` `$c.nom`"|utf8}
-{/if}
-sn: {$c.nom}
-givenname: {$c.prenom|utf8}
-uid: {$c.forlife}
-mail: {$c.forlife}@polytechnique.org
-{foreach from=$c.aliases item=alias}
-mailalternateaddress: {$alias}@polytechnique.org
-mozillasecondemail: {$alias}@polytechnique.org
-{/foreach}
-{if $c.mobile}
-mobile: {$c.mobile|utf8}
-cellphone: {$c.mobile|utf8}
-{/if}
-{if $vcard.web}
-homeurl:: {$vcard.web|ldif_format}
-workurl:: {$vcard.web|ldif_format}
-{/if}
-{******************************************************************************}
-{******************************************************************************}
-{if $c.entreprise}
-o:: {$c.entreprise|ldif_format}
-organization:: {$c.entreprise|ldif_format}
-organizationname:: {$c.entreprise|ldif_format}
-{if $c.fonction}
-ou:: {$c.fonction|ldif_format}
-{/if}
-{if $c.poste}
-title:: {$c.poste|ldif_format}
-{/if}
-{if $c.tel}
-telephonenumber: {$c.tel|utf8}
-{/if}
-{if $c.cp}
-postalcode: {$c.cp|utf8}
-{/if}
-{if $c.pays}
-countryname:: {$c.pays|ldif_format}
-c:: {$c.pays|ldif_format}
-{/if}
-{if $c.ville}
-l:: {$c.ville|ldif_format}
-{/if}
-{if $c.name}
-st:: {$c.name|ldif_format}
-{/if}
-{if $c.adr_fmt}
-streetaddress:: {$c.adr_fmt|ldif_format}
-{/if}
-{if $c.adr0}
-postaladdress:: {$c.adr0|ldif_format}
-{/if}
-{if $c.adr1}
-mozillapostaladdress2:: {$c.adr1|ldif_format}
-{/if}
-{if $c.adr2}
-mozillapostaladdress2:: {$c.adr2|ldif_format}
-{/if}
-{if $c.fax}
-facsimiletelephonenumber: {$c.faxx|utf8}
-{/if}
-{/if}
-{******************************************************************************}
-{******************************************************************************}
-{if $c.home.adr_fmt}
-streethomeaddress:: {$c.home.adr_fmt|ldif_format}
-{/if}
-{if $c.home.courrier}
-{if $c.home.adr0}
-homepostaladdress:: {$c.home.adr0|ldif_format}
-{/if}
-{if $c.home.adr1}
-mozillahomepostaladdress2:: {$c.home.adr1|ldif_format}
-{/if}
-{if $c.home.adr2}
-mozillahomepostaladdress2:: {$c.home.adr2|ldif_format}
-{/if}
-{if $c.home.cp}
-mozillahomepostalcode: {$c.home.cp|utf8}
-{/if}
-{/if}
-{if $c.home.ville}
-mozillahomelocalityname:: {$c.home.ville|ldif_format}
-{/if}
-{if $c.home.name}
-mozillahomestate:: {$c.home.name|ldif_format}
-{/if}
-{if $c.home.pays}
-mozillahomecountryname:: {$c.home.name|ldif_format}
-{/if}
-{******************************************************************************}
-{******************************************************************************}
-description:: {"(X`$c.promo`)\n`$c.libre`"|ldif_format}
-modifytimestamp: {$c.date|date_format:"%Y%m%dT000000Z"}
-objectclass: top
-objectclass: person
-objectclass: organizationalPerson
-
-{/foreach}
-{* vim:set et sw=2 sts=2 sws=2: *}