gunnar: server/php-kolab/Kolab_Filter/Filter resmgr.php,1.2,1.3

cvs at kolab.org cvs at kolab.org
Mon Aug 13 11:57:20 CEST 2007


Author: gunnar

Update of /kolabrepository/server/php-kolab/Kolab_Filter/Filter
In directory doto:/tmp/cvs-serv13666

Modified Files:
	resmgr.php 
Log Message:
Allow using Text::wrap or String::wrap (compatibility between old and new Horde).

Index: resmgr.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Filter/Filter/resmgr.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- resmgr.php	13 Aug 2007 09:45:14 -0000	1.2
+++ resmgr.php	13 Aug 2007 09:57:18 -0000	1.3
@@ -20,33 +20,47 @@
 
 require_once 'Kolab/Filter/misc.php';
 
-// What actions we can take when receiving an event request
-define('RM_ACT_ALWAYS_ACCEPT',              1);
-define('RM_ACT_REJECT_IF_CONFLICTS',        2);
-define('RM_ACT_MANUAL_IF_CONFLICTS',        3);
-define('RM_ACT_MANUAL',                     4);
-define('RM_ACT_ALWAYS_REJECT',              5);
-
-// What possible ITIP notification we can send
-define('RM_ITIP_DECLINE',                   1);
-define('RM_ITIP_ACCEPT',                    2);
-define('RM_ITIP_TENTATIVE',                 3);
-
 require_once 'Net/IMAP.php';
-require_once 'Horde/Auth.php';
 require_once 'Horde/iCalendar.php';
 require_once 'Horde/MIME.php';
 require_once 'Horde/MIME/Message.php';
 require_once 'Horde/MIME/Headers.php';
 require_once 'Horde/MIME/Part.php';
 require_once 'Horde/MIME/Structure.php';
-//include_once 'Horde/Kolab.php';
+
 require_once 'Horde/Text.php';
+
+if (!method_exists('Text', 'wrap')) {
+   require_once 'Horde/String.php';
+}
+
+// Required to be able to use the old Horde framework
+function wrap($text) 
+{
+    if (method_exists('Text', 'wrap')) {
+        return Text::wrap($text, 76, "\n");
+    } else {
+        return String::wrap($text, 76, "\n");
+    }
+}
+
 require_once 'Kolab/Freebusy/recurrence.class.php';
 
 if (version_compare(PHP_VERSION,'5', '>='))
   require_once('Kolab/Freebusy/domxml-php4-to-php5.php');
 
+// What actions we can take when receiving an event request
+define('RM_ACT_ALWAYS_ACCEPT',              1);
+define('RM_ACT_REJECT_IF_CONFLICTS',        2);
+define('RM_ACT_MANUAL_IF_CONFLICTS',        3);
+define('RM_ACT_MANUAL',                     4);
+define('RM_ACT_ALWAYS_REJECT',              5);
+
+// What possible ITIP notification we can send
+define('RM_ITIP_DECLINE',                   1);
+define('RM_ITIP_ACCEPT',                    2);
+define('RM_ITIP_TENTATIVE',                 3);
+
 // Globals
 $imap = NULL;
 $server = '';
@@ -557,9 +571,6 @@
     $itip_reply->setAttribute('ATTENDEE', 'MAILTO:' . $resource, $params);
     $vCal->addComponent($itip_reply);
 
-    //$mime = &new MIME_Part('multipart/alternative');
-    //$body = &new MIME_Part('text/plain', Text::wrap($message, 76, "\n"));
-
     $ics = &new MIME_Part('text/calendar', $vCal->exportvCalendar(), 'UTF-8' );
     //$ics->setName('event-reply.ics');
     $ics->setContentTypeParameter('method', 'REPLY');
@@ -1298,7 +1309,7 @@
 
     $kolabinfo = 'This is a Kolab Groupware object. To view this object you will need a client that understands the Kolab Groupware format. For a list of such clients please visit http://www.kolab.org/kolab2-clients.html';
 
-    $body = &new MIME_Part('text/plain', Text::wrap($kolabinfo, 76, "\n"));
+    $body = &new MIME_Part('text/plain', wrap($kolabinfo));
 
     $part = &new MIME_Part('application/x-vnd.kolab.event', $kolab_xml->dump_mem(true));
     $part->setName('kolab.event');
@@ -1400,7 +1411,7 @@
     }
 
     myLog("Sending confirmation of cancelation to $organiser");
-    $body = &new MIME_Part('text/plain', Text::wrap($body, 76, "\n"));
+    $body = &new MIME_Part('text/plain', wrap($body));
     $mime = &MIME_Message::convertMimePart($body);
     $mime->setTransferEncoding('quoted-printable');
     $mime->transferEncodeContents();





More information about the commits mailing list