From 5ff5933d0c67ab5c0c4a2c4d651804101397be1d Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sun, 17 Jun 2012 22:25:25 +1200 Subject: [PATCH] Allow a configurable path replacement regex. This can simplify migration from .../home/... to .../calendar/... for example. --- inc/CalDAVRequest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 92838995..204e6d07 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -150,6 +150,10 @@ class CalDAVRequest $this->path = $matches[1]. '/'; } + if ( isset($c->replace_path) && isset($c->replace_path['from']) && isset($c->replace_path['to']) ) { + $this->path = preg_replace($c->replace_path['from'], $c->replace_path['to'], $this->path); + } + // dbg_error_log( "caldav", "Sanitising path '%s'", $this->path ); $bad_chars_regex = '/[\\^\\[\\(\\\\]/'; if ( preg_match( $bad_chars_regex, $this->path ) ) {