Ooops.
[platal.git] / classes / plvcard.php
index 67e56a1..81d132c 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2009 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -702,9 +702,11 @@ class PlVCardEntry
         if (!is_null($role)) {
             $this->addInGroup($group, 'ROLE', $role);
         }
-        $field =& $this->addInGroup($group, 'ADR',
-                                    new ADR_Field($postBox, $extra, $street, $city,
-                                                  $region, $postCode, $country));
+        if (!is_null($street)) {
+            $field =& $this->addInGroup($group, 'ADR',
+                                        new ADR_Field($postBox, $extra, $street, $city,
+                                                      $region, $postCode, $country));
+        }
         $field->TYPE = new PlFlagset();
         $field->TYPE->addFlag('work');
         return $group;
@@ -829,14 +831,11 @@ abstract class PlVCard
      */
     public function show()
     {
-        header("Pragma: ");
-        header("Cache-Control: ");
-
         /* XXX: RFC2425 defines the mime content-type text/directory.
          * VCard inherits this type as a profile type. Maybe test/x-vcard
          * could be better. To be checked.
          */
-        header("Content-type: text/directory; profile=vCard; charset=" . self::$charset);
+        pl_cached_dynamic_content_headers("text/directory; profile=vCard", "utf-8");
 
         $it = $this->fetch();
         while ($item = $it->next()) {