From: x2003bruneau Date: Fri, 18 Aug 2006 13:10:25 +0000 (+0000) Subject: Add nickname in vcard X-Git-Tag: xorg/0.9.11~95 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=d865c4a016f684116c4ffd9af78b05ee2fb46797;p=platal.git Add nickname in vcard Fix comment git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@821 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/modules/profile.php b/modules/profile.php index 4b30004..5e9fcb9 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -649,8 +649,15 @@ class ProfileModule extends PLModule $adr = trim($adr1); $adr = trim("$adr\n$adr2"); $adr = trim("$adr\n$adr3"); - $adr = explode("\n", quoted_printable_encode(";;$adr;$city;$region;$postcode;$country")); - return implode("\n", array_map('trim', $adr)); + 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) @@ -669,11 +676,15 @@ class ProfileModule extends PLModule require_once 'xorg.misc.inc.php'; require_once 'user.func.inc.php'; - $page->register_modifier('qp_enc', 'quoted_printable_encode'); + $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( @@ -688,7 +699,7 @@ class ProfileModule extends PLModule $user['forlife'].'@'.$globals->mail->domain2); $user['virtualalias'] = $res->fetchOneCell(); - + // get photo $res = XDB::query( "SELECT attach diff --git a/templates/vcard.tpl b/templates/vcard.tpl index 34afc0c..8f5b626 100644 --- a/templates/vcard.tpl +++ b/templates/vcard.tpl @@ -27,6 +27,9 @@ FN;ENCODING=QUOTED-PRINTABLE:{"`$vcard.prenom` `$vcard.nom_usage` (`$vcard.nom`) FN;ENCODING=QUOTED-PRINTABLE:{"`$vcard.prenom` `$vcard.nom`"|qp_enc} {/if} N;ENCODING=QUOTED-PRINTABLE:{$vcard.nom|qp_enc};{$vcard.prenom|qp_enc};{$vcard.nom_usage|qp_enc};; +{if $vcard.nickname} +NICKNAME;ENCODING=QUOTED-PRINTABLE:{$vcard.nickname} +{/if} EMAIL;TYPE=internet:{$vcard.bestalias}@{#globals.mail.domain#} {if $vcard.bestalias neq $vcard.forlife} EMAIL;TYPE=internet:{$vcard.forlife}@{#globals.mail.domain#} @@ -66,10 +69,10 @@ ADR;TYPE=home{if $adr.courier},postal{/if};ENCODING=QUOTED-PRINTABLE:{format_adr {if $vcard.web} URL;ENCODING=QUOTED-PRINTABLE:{$vcard.web|qp_enc} {/if} -{if strlen(trim($vcard.libre)) == 0} +{if strlen(trim($vcard.freetext)) == 0} NOTE;ENCODING=QUOTED-PRINTABLE:{"(X`$vcard.promo`)"|qp_enc} {else} -NOTE;ENCODING=QUOTED-PRINTABLE:{"(X`$vcard.promo`)\n`$vcard.libre`"|qp_enc} +NOTE;ENCODING=QUOTED-PRINTABLE:{"(X`$vcard.promo`)\n`$vcard.freetext`"|qp_enc} {/if} {if $vcard.photo} PHOTO;BASE64:{$vcard.photo|base64_encode}