Revision: 1735
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1735&view=rev
Author:   cimorrison
Date:     2011-01-05 17:23:19 +0000 (Wed, 05 Jan 2011)

Log Message:
-----------
Added an ORGANIZER property

Modified Paths:
--------------
    mrbs/branches/ics_attachments/web/functions_ical.inc

Modified: mrbs/branches/ics_attachments/web/functions_ical.inc
===================================================================
--- mrbs/branches/ics_attachments/web/functions_ical.inc        2011-01-05 
09:51:08 UTC (rev 1734)
+++ mrbs/branches/ics_attachments/web/functions_ical.inc        2011-01-05 
17:23:19 UTC (rev 1735)
@@ -65,7 +65,7 @@
   return $result;
 }
 
-// Escape text for use in an iCalendar object
+// Escape text for use in an iCalendar text value
 function ical_escape_text($str)
 {
   // Escape '\'
@@ -81,6 +81,21 @@
   return $str;
 }
 
+// Escape text for use in an iCalendar quoted string
+function ical_escape_quoted_string($str)
+{
+  // From RFC 5545:
+  //    quoted-string = DQUOTE *QSAFE-CHAR DQUOTE
+
+  //    QSAFE-CHAR    = WSP / %x21 / %x23-7E / NON-US-ASCII
+  //    ; Any character except CONTROL and DQUOTE
+  
+  // We'll just get rid of any double quotes, replacing them with a space.
+  // (There is no way of escaping double quotes)
+  $str = str_replace('"', ' ', $str);
+  return $str;
+}
+
 // Create an iCalendar Recurrence Rule
 function create_rrule($data)
 {
@@ -209,6 +224,7 @@
   {
     $results[] = "STATUS:" . (($data['status'] & STATUS_TENTATIVE) ? 
"TENTATIVE" : "CONFIRMED");
   }
+  
   /*  
   Class is commented out for the moment.  To be useful it probably needs to go
   hand in hand with an ORGANIZER, otherwise people won't be able to see their 
own
@@ -217,6 +233,16 @@
   $results[] = "CLASS:" . (($data['status'] & STATUS_PRIVATE) ? "PRIVATE" : 
"PUBLIC");
   */
   
+  // ORGANIZER
+  $organizer_email = get_email_address($data['create_by']);
+  if (!empty($organizer_email))
+  {
+    $results[] = "ORGANIZER;CN=\"" . 
ical_escape_quoted_string($data['create_by']) . "\":mailto:$organizer_email";;
+  }
+  else
+  {
+    $results[] = "ORGANIZER:mailto:"; . $addresses['from'];
+  }
   // Put the people on the "to" list as required participants and those on the 
cc
   // list as non particpants.   In theory the email client can then decide 
whether
   // to enter the booking automaticaly on the user's calendar - although at the


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to