Close #407: RSS feed for Forums and MLs
[platal.git] / include / vcard.inc.php
index f876f4d..01ec339 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
+ *  Copyright (C) 2003-2007 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -41,7 +41,7 @@ class VCard
 
     function escape($text)
     {
-        return preg_replace('/[,;:]/', '\\\\$0', $text);
+        return preg_replace('/[,;]/', '\\\\$0', $text);
     }
 
     function format_adr($params, &$smarty)
@@ -61,6 +61,9 @@ class VCard
 
     function text_encode($text, $escape = true)
     {
+        if (is_array($text)) {
+            return implode(',', array_map(array($this, 'text_encode'), $text));
+        }
         if ($escape) {
             $text = $this->escape($text);
         }
@@ -98,7 +101,8 @@ class VCard
                 $user['forlife'].'@'.$globals->mail->domain2);
 
         $user['virtualalias'] = $res->fetchOneCell();
-
+        $user['gpxs_vcardjoin'] = join(',', array_map(array($this, 'text_encode'), $user['gpxs_name']));
+        $user['binets_vcardjoin'] = join(',', array_map(array($this, 'text_encode'), $user['binets']));
         // get photo
         if ($this->photos) {
             $res = XDB::query(
@@ -115,17 +119,17 @@ class VCard
 
     function do_page(&$page)
     {
-        $page->changeTpl('vcard.tpl', NO_SKIN);
+        $page->changeTpl('core/vcard.tpl', NO_SKIN);
         $page->register_modifier('vcard_enc',  array($this, 'text_encode'));
         $page->register_function('format_adr', array($this, 'format_adr'));
         $page->assign_by_ref('users', $this->users);
 
         header("Pragma: ");
         header("Cache-Control: ");
-        header("Content-type: text/x-vcard; charset=iso-8859-15");
+        header("Content-type: text/x-vcard; charset=UTF-8");
         header("Content-Transfer-Encoding: 8bit");
     }
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
 ?>