From b41b47b01dd748fa8fa3da881a819a7e375e6b75 Mon Sep 17 00:00:00 2001 From: Krakozaber Date: Tue, 6 Oct 2015 15:59:56 +0400 Subject: [PATCH] fix update remote calendar --- controller/calendarcontroller.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/controller/calendarcontroller.php b/controller/calendarcontroller.php index b713f28..2e4e665 100755 --- a/controller/calendarcontroller.php +++ b/controller/calendarcontroller.php @@ -503,7 +503,7 @@ public function refreshSubscribedCalendar($calendarid) { $getProtocol = explode('://', $calendar['externuri']); $protocol = $getProtocol[0]; - $opts = array($protocol => array('method' => 'POST', 'header' => "Content-Type: text/calendar\r\n", 'timeout' => 60)); + $opts = array($protocol => array('method' => 'GET', 'header' => "Content-Type: text/calendar\r\n", 'timeout' => 60)); $aMeta = $this -> stream_last_modified(trim($calendar['externuri'])); @@ -515,7 +515,7 @@ public function refreshSubscribedCalendar($calendarid) { $import = new Import($file); $import -> setUserID($this -> userId); $import -> setTimeZone(CalendarApp::$tz); - //$import -> setOverwrite(false); + $import -> setOverwrite(true); $import->setCheckModifiedDate(true); $import->setImportFromUri(true); $import -> setCalendarID($calendarid); @@ -835,8 +835,8 @@ private function stream_last_modified($url) { $bAccess = false; $modtime = ''; for ($j = 0; isset($meta['wrapper_data'][$j]); $j++) { - if (strstr(strtolower($meta['wrapper_data'][$j]), 'content-type')) { - $checkContentType = substr($meta['wrapper_data'][$j], 13); + if (preg_match('/^ {0,}content-type {0,}:/i',$meta['wrapper_data'][$j])) { + $checkContentType = preg_replace('/.+?: {0,}/i','',$meta['wrapper_data'][$j]); list($contentType,$charset) = explode(';',$checkContentType); if(trim(strtolower($contentType)) === 'text/calendar'){ $bAccess = true;