gunnar: server/kolab-freebusy/freebusy freebusy.php, 1.3, 1.4 pfb.php, 1.3, 1.4

cvs at kolab.org cvs at kolab.org
Mon Aug 13 10:53:35 CEST 2007


Author: gunnar

Update of /kolabrepository/server/kolab-freebusy/freebusy
In directory doto:/tmp/cvs-serv11773/freebusy

Modified Files:
	freebusy.php pfb.php 
Log Message:
kolab/issue1606 (Allow to run kolab-resource-handlers with PHP cgi)
https://www.intevation.de/roundup/kolab/issue1606

Index: freebusy.php
===================================================================
RCS file: /kolabrepository/server/kolab-freebusy/freebusy/freebusy.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- freebusy.php	8 Aug 2007 15:45:49 -0000	1.3
+++ freebusy.php	13 Aug 2007 08:53:33 -0000	1.4
@@ -48,9 +48,52 @@
 
 logInit( 'freebusy' );
 
+$imapuser     = isset($_SERVER['PHP_AUTH_USER'])?$_SERVER['PHP_AUTH_USER']:false;
+$imappw       = isset($_SERVER['PHP_AUTH_PW'])?$_SERVER['PHP_AUTH_PW']:false;
+
+// This part allows you to use the PHP scripts with CGI rather than as
+// an apache module. This will of course slow down things but on the
+// other hand it allows you to reduce the memory footprint of the 
+// apache server. The default is to use PHP as a module and the CGI 
+// version requires specific Apache configuration.
+//
+// The line you need to add to your configuration of the /freebusy 
+// location of your server looks like this:
+//
+//    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
+//
+// The complete section will probably look like this then:
+//
+//  <IfModule mod_rewrite.c>
+//    RewriteEngine On
+//    # FreeBusy list handling
+//    RewriteBase /freebusy
+//    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
+//    RewriteRule ^([^/]+)\.ifb       freebusy.php?uid=$1		    [L]
+//    RewriteRule ^([^/]+)\.vfb       freebusy.php?uid=$1		    [L]
+//    RewriteRule ^([^/]+)\.xfb       freebusy.php?uid=$1&extended=1        [L]
+//    RewriteRule ^trigger/(.+)\.pfb  pfb.php?folder=$1&cache=0             [L]
+//    RewriteRule ^(.+)\.pfb          pfb.php?folder=$1&cache=1             [L]
+//    RewriteRule ^trigger/(.+)\.xpfb pfb.php?folder=$1&cache=0&extended=1  [L]
+//    RewriteRule ^(.+)\.xpfb         pfb.php?folder=$1&cache=1&extended=1  [L]
+//  </IfModule>
+if( empty($imapuser) && isset($_ENV['REDIRECT_REDIRECT_REMOTE_USER']) ) {
+  $a = base64_decode( substr($_ENV['REDIRECT_REDIRECT_REMOTE_USER'], 6)) ;
+
+  if ( (strlen($a) == 0) || ( strcasecmp($a, ":" )  == 0 ))
+    {
+      $imapuser = false;
+      $imappw   = false;
+    }
+  else
+    {
+      list($name, $password) = explode(':', $a, 2);
+      $imapuser = $name;
+      $imappw   =  $password;
+    }
+ }
+
 $user = trim($_REQUEST['uid']);
-$imapuser     = $_SERVER['PHP_AUTH_USER'];
-$imappw       = $_SERVER['PHP_AUTH_PW'];
 
 $req_cache    = false;
 $req_extended = false;

Index: pfb.php
===================================================================
RCS file: /kolabrepository/server/kolab-freebusy/freebusy/pfb.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pfb.php	8 Aug 2007 15:45:49 -0000	1.3
+++ pfb.php	13 Aug 2007 08:53:33 -0000	1.4
@@ -64,6 +64,49 @@
 
 $imapuser     = isset($_SERVER['PHP_AUTH_USER'])?$_SERVER['PHP_AUTH_USER']:false;
 $imappw       = isset($_SERVER['PHP_AUTH_PW'])?$_SERVER['PHP_AUTH_PW']:false;
+
+// This part allows you to use the PHP scripts with CGI rather than as
+// an apache module. This will of course slow down things but on the
+// other hand it allows you to reduce the memory footprint of the 
+// apache server. The default is to use PHP as a module and the CGI 
+// version requires specific Apache configuration.
+//
+// The line you need to add to your configuration of the /freebusy 
+// location of your server looks like this:
+//
+//    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
+//
+// The complete section will probably look like this then:
+//
+//  <IfModule mod_rewrite.c>
+//    RewriteEngine On
+//    # FreeBusy list handling
+//    RewriteBase /freebusy
+//    RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
+//    RewriteRule ^([^/]+)\.ifb       freebusy.php?uid=$1		    [L]
+//    RewriteRule ^([^/]+)\.vfb       freebusy.php?uid=$1		    [L]
+//    RewriteRule ^([^/]+)\.xfb       freebusy.php?uid=$1&extended=1        [L]
+//    RewriteRule ^trigger/(.+)\.pfb  pfb.php?folder=$1&cache=0             [L]
+//    RewriteRule ^(.+)\.pfb          pfb.php?folder=$1&cache=1             [L]
+//    RewriteRule ^trigger/(.+)\.xpfb pfb.php?folder=$1&cache=0&extended=1  [L]
+//    RewriteRule ^(.+)\.xpfb         pfb.php?folder=$1&cache=1&extended=1  [L]
+//  </IfModule>
+if( empty($imapuser) && isset($_ENV['REDIRECT_REDIRECT_REMOTE_USER']) ) {
+  $a = base64_decode( substr($_ENV['REDIRECT_REDIRECT_REMOTE_USER'], 6)) ;
+
+  if ( (strlen($a) == 0) || ( strcasecmp($a, ":" )  == 0 ))
+    {
+      $imapuser = false;
+      $imappw   = false;
+    }
+  else
+    {
+      list($name, $password) = explode(':', $a, 2);
+      $imapuser = $name;
+      $imappw   =  $password;
+    }
+ }
+
 $req_cache    = isset($_REQUEST['cache'])?(bool)$_REQUEST['cache']:false;
 $req_folder   = isset($_REQUEST['folder'])?$_REQUEST['folder']:false;
 $req_extended = isset($_REQUEST['extended'])?(bool)$_REQUEST['extended']:false;





More information about the commits mailing list