From f75d51284b231175cea22561af18f39803bcf248 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 8 Jul 2012 11:57:07 +1200 Subject: [PATCH] Attempt to calculate PATH_INFO if it is not present. --- inc/CalDAVRequest.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 6c127e35..8ee774a1 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -143,7 +143,21 @@ class CalDAVRequest * 4. otherwise we query the defined relationships between users and use * the minimum privileges returned from that analysis. */ - $this->path = (isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "/"); + if ( isset($_SERVER['PATH_INFO']) ) { + $this->path = $_SERVER['PATH_INFO']; + } + else { + $this->path = "/"; + if ( isset($_SERVER['REQUEST_URI']) ) { + $path = preg_replace( '{^(.*?\.php/?)}', '/', $_SERVER['REQUEST_URI'], $matches ); + if ( !empty($matches[1]) ) { + $this->path = $path; + } + else { + dbg_error_log('LOG', 'Server is not supplying PATH_INFO and REQUEST_URI does not include a PHP program. Wildly guessing "/"!!!'); + } + } + } $this->path = rawurldecode($this->path); /** Allow a request for .../calendar.ics to translate into the calendar URL */