X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvcard.inc.php;h=cba4092cd8e7101e9fe53188cc9a0a93465becc6;hb=77b7830984e6b5be75bb3b498cefeeb3f37a9635;hp=f858b8a80f9686be294c65f14844cb195c8b193b;hpb=5175057e1d9b2a93336148506a6074af21368433;p=platal.git diff --git a/include/vcard.inc.php b/include/vcard.inc.php index f858b8a..cba4092 100644 --- a/include/vcard.inc.php +++ b/include/vcard.inc.php @@ -1,6 +1,6 @@ mail->alias_dom}'", - S::v('uid'), + $user['user_id'], $user['forlife'].'@'.$globals->mail->domain, $user['forlife'].'@'.$globals->mail->domain2); @@ -127,9 +126,9 @@ class VCard public static function escape($text) { if (VCard::$windows) { - return preg_replace('/;/', '\\\\$0', $text); + return str_replace(';', '\\\\;', $text); } else { - return preg_replace('/[,;]/', '\\\\$0', $text); + return str_replace(array(';', ','), array('\\\\;', '\\\\,'), $text); } } @@ -141,11 +140,11 @@ class VCard $adr = trim("$adr\n$adr2"); $adr = trim("$adr\n$adr3"); return VCard::text_encode(';;' - . VCard::escape($adr) . ';' - . VCard::escape($city) . ';' - . VCard::escape($region) . ';' - . VCard::escape($postcode) . ';' - . VCard::escape($country), false); + . (VCard::$windows ? VCard::escape($adr) : $adr) . ';' + . (VCard::$windows ? VCard::escape($city) : $city) . ';' + . (VCard::$windows ? VCard::escape($region) : $region) . ';' + . (VCard::$windows ? VCard::escape($postcode) : $postcode) . ';' + . (VCard::$windows ? VCard::escape($country) : $country), false); } public static function text_encode($text, $escape = true) @@ -159,7 +158,7 @@ class VCard if (VCard::$windows) { $text = utf8_decode($text); } - return preg_replace("/(\r\n|\n|\r)/", '\n', $text); + return str_replace(array("\r\n", "\n", "\r"), '\n', $text); } public function do_page(&$page)