From afef5f231df63d7653d6c5b9d819ea61b0ee782f Mon Sep 17 00:00:00 2001 From: Jeroen van Disseldorp Date: Fri, 15 Feb 2008 07:02:30 +1300 Subject: [PATCH] Only set timezone if we have a reasonable looking one. --- inc/caldav-PUT-functions.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index a6d71a6c..e3114396 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -347,7 +347,10 @@ function putCalendarResource( &$request, $author, $caldav_context ) { if ( !$qry->Exec("PUT") ) rollback_on_error( $caldav_context, $request->user_no, $request->path); } - $sql = ( $ic->tz_locn == '' ? '' : "SET TIMEZONE TO ".qpg($ic->tz_locn).";" ); + if ( preg_match(':^(Africa|America|Antarctica|Arctic|Asia|Atlantic|Australia|Brazil|Canada|Chile|Etc|Europe|Indian|Mexico|Mideast|Pacific|US)/[a-z]+$:i', $ic->tz_locn ) ) { + // We only set the timezone if it looks reasonable enough for us + $sql = ( $ic->tz_locn == '' ? '' : "SET TIMEZONE TO ".qpg($ic->tz_locn).";" ); + } $dtstart = $ic->Get('DTSTART'); if ( (!isset($dtstart) || $dtstart == "") && $ic->Get('DUE') != "" ) {