From 97577a6e9d8c24b5bdcb2dc0f69ac9453a401514 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 12 Nov 2008 22:16:56 +1300 Subject: [PATCH] Cope better when we're given a timezone that we're not given a definition for. --- inc/caldav-PUT-functions.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/inc/caldav-PUT-functions.php b/inc/caldav-PUT-functions.php index fc75b19a..4700d8d0 100644 --- a/inc/caldav-PUT-functions.php +++ b/inc/caldav-PUT-functions.php @@ -279,6 +279,7 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { if ( isset($resource[$tzid]) ) { $tz = $resource[$tzid]; $tz_locn = $tz->GetPValue('X-LIC-LOCATION'); + } else { unset($tz); unset($tz_locn); @@ -294,12 +295,10 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) { $sql .= ( $tz_locn == '' ? '' : "SET TIMEZONE TO ".qpg($tz_locn).";" ); $last_tz_locn = $tz_locn; } - if ( isset($tz) ) { - $qry = new PgQuery("SELECT tz_locn FROM time_zone WHERE tz_id = ?", $tzid ); - if ( $qry->Exec() && $qry->rows == 0 ) { - $qry = new PgQuery("INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(?,?,?)", $tzid, $tz_locn, $tz->Render() ); - $qry->Exec(); - } + $qry = new PgQuery("SELECT tz_locn FROM time_zone WHERE tz_id = ?", $tzid ); + if ( $qry->Exec() && $qry->rows == 0 ) { + $qry = new PgQuery("INSERT INTO time_zone (tz_id, tz_locn, tz_spec) VALUES(?,?,?)", $tzid, $tz_locn, (isset($tz) ? $tz->Render() : null) ); + $qry->Exec(); } if ( !isset($tz_locn) || $tz_locn == "" ) $tz_locn = $tzid; }