1a1a3b679SAndreas Boehler<?php 2a1a3b679SAndreas Boehler/** 3a1a3b679SAndreas Boehler * Helper Class for the tagrevisions plugin 4a1a3b679SAndreas Boehler * This helper does the actual work. 5a1a3b679SAndreas Boehler * 6a1a3b679SAndreas Boehler * Configurable in DokuWiki's configuration 7a1a3b679SAndreas Boehler */ 8a1a3b679SAndreas Boehler 9a1a3b679SAndreas Boehler// must be run within Dokuwiki 10a1a3b679SAndreas Boehlerif(!defined('DOKU_INC')) die(); 11a1a3b679SAndreas Boehler 12a1a3b679SAndreas Boehlerclass helper_plugin_davcal extends DokuWiki_Plugin { 13a1a3b679SAndreas Boehler 14a1a3b679SAndreas Boehler protected $sqlite = null; 15a1a3b679SAndreas Boehler 16a1a3b679SAndreas Boehler /** 17a1a3b679SAndreas Boehler * Constructor to load the configuration 18a1a3b679SAndreas Boehler */ 19a1a3b679SAndreas Boehler public function helper_plugin_davcal() { 20a1a3b679SAndreas Boehler $this->sqlite =& plugin_load('helper', 'sqlite'); 21a1a3b679SAndreas Boehler if(!$this->sqlite) 22a1a3b679SAndreas Boehler { 23a1a3b679SAndreas Boehler msg('This plugin requires the sqlite plugin. Please install it.'); 24a1a3b679SAndreas Boehler return; 25a1a3b679SAndreas Boehler } 26a1a3b679SAndreas Boehler 27a1a3b679SAndreas Boehler if(!$this->sqlite->init('davcal', DOKU_PLUGIN.'davcal/db/')) 28a1a3b679SAndreas Boehler { 29a1a3b679SAndreas Boehler return; 30a1a3b679SAndreas Boehler } 31a1a3b679SAndreas Boehler } 32a1a3b679SAndreas Boehler 33a1a3b679SAndreas Boehler public function setCalendarNameForPage($name, $description, $id = null, $userid = null) 34a1a3b679SAndreas Boehler { 35a1a3b679SAndreas Boehler if(is_null($id)) 36a1a3b679SAndreas Boehler { 37a1a3b679SAndreas Boehler global $ID; 38a1a3b679SAndreas Boehler $id = $ID; 39a1a3b679SAndreas Boehler } 40a1a3b679SAndreas Boehler if(is_null($userid)) 41a1a3b679SAndreas Boehler $userid = $_SERVER['REMOTE_USER']; 42a1a3b679SAndreas Boehler $calid = $this->getCalendarIdForPage($id); 43a1a3b679SAndreas Boehler if($calid === false) 44a1a3b679SAndreas Boehler return $this->createCalendarForPage($name, $description, $id, $userid); 45a1a3b679SAndreas Boehler 46a1a3b679SAndreas Boehler // Update the calendar name here 47a1a3b679SAndreas Boehler 48a1a3b679SAndreas Boehler } 49a1a3b679SAndreas Boehler 50a495d34cSAndreas Boehler public function savePersonalSettings($settings, $userid = null) 51a495d34cSAndreas Boehler { 52a495d34cSAndreas Boehler if(is_null($userid)) 53a495d34cSAndreas Boehler $userid = $_SERVER['REMOTE_USER']; 54a495d34cSAndreas Boehler $this->sqlite->query("BEGIN TRANSACTION"); 55a495d34cSAndreas Boehler 56*bd883736SAndreas Boehler $query = "DELETE FROM calendarsettings WHERE userid=".$this->sqlite->quote_string($userid); 57*bd883736SAndreas Boehler $this->sqlite->query($query); 58*bd883736SAndreas Boehler 59a495d34cSAndreas Boehler foreach($settings as $key => $value) 60a495d34cSAndreas Boehler { 61*bd883736SAndreas Boehler $query = "INSERT INTO calendarsettings (userid, key, value) VALUES (". 62a495d34cSAndreas Boehler $this->sqlite->quote_string($userid).", ". 63a495d34cSAndreas Boehler $this->sqlite->quote_string($key).", ". 64a495d34cSAndreas Boehler $this->sqlite->quote_string($value).")"; 65a495d34cSAndreas Boehler $res = $this->sqlite->query($query); 66a495d34cSAndreas Boehler if($res === false) 67a495d34cSAndreas Boehler return false; 68a495d34cSAndreas Boehler } 69a495d34cSAndreas Boehler $this->sqlite->query("COMMIT TRANSACTION"); 70a495d34cSAndreas Boehler return true; 71a495d34cSAndreas Boehler } 72a495d34cSAndreas Boehler 73a495d34cSAndreas Boehler public function getPersonalSettings($userid = null) 74a495d34cSAndreas Boehler { 75a495d34cSAndreas Boehler if(is_null($userid)) 76a495d34cSAndreas Boehler $userid = $_SERVER['REMOTE_USER']; 77*bd883736SAndreas Boehler // Some sane default settings 78*bd883736SAndreas Boehler $settings = array( 79*bd883736SAndreas Boehler 'timezone' => 'local', 80*bd883736SAndreas Boehler 'weeknumbers' => '0', 81*bd883736SAndreas Boehler 'workweek' => '0' 82*bd883736SAndreas Boehler ); 83a495d34cSAndreas Boehler $query = "SELECT key, value FROM calendarsettings WHERE userid=".$this->sqlite->quote_string($userid); 84a495d34cSAndreas Boehler $res = $this->sqlite->query($query); 85a495d34cSAndreas Boehler $arr = $this->sqlite->res2arr($res); 86a495d34cSAndreas Boehler foreach($arr as $row) 87a495d34cSAndreas Boehler { 88a495d34cSAndreas Boehler $settings[$row['key']] = $row['value']; 89a495d34cSAndreas Boehler } 90a495d34cSAndreas Boehler return $settings; 91a495d34cSAndreas Boehler } 92a495d34cSAndreas Boehler 93a1a3b679SAndreas Boehler public function getCalendarIdForPage($id = null) 94a1a3b679SAndreas Boehler { 95a1a3b679SAndreas Boehler if(is_null($id)) 96a1a3b679SAndreas Boehler { 97a1a3b679SAndreas Boehler global $ID; 98a1a3b679SAndreas Boehler $id = $ID; 99a1a3b679SAndreas Boehler } 100a1a3b679SAndreas Boehler 101a1a3b679SAndreas Boehler $query = "SELECT calid FROM pagetocalendarmapping WHERE page=".$this->sqlite->quote_string($id); 102a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 103a1a3b679SAndreas Boehler $row = $this->sqlite->res2row($res); 104a1a3b679SAndreas Boehler if(isset($row['calid'])) 105a1a3b679SAndreas Boehler return $row['calid']; 106a1a3b679SAndreas Boehler else 107a1a3b679SAndreas Boehler return false; 108a1a3b679SAndreas Boehler } 109a1a3b679SAndreas Boehler 110a1a3b679SAndreas Boehler public function getCalendarIdToPageMapping() 111a1a3b679SAndreas Boehler { 112a1a3b679SAndreas Boehler $query = "SELECT calid, page FROM pagetocalendarmapping"; 113a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 114a1a3b679SAndreas Boehler $arr = $this->sqlite->res2arr($res); 115a1a3b679SAndreas Boehler return $arr; 116a1a3b679SAndreas Boehler } 117a1a3b679SAndreas Boehler 118a1a3b679SAndreas Boehler public function getCalendarIdsForUser($principalUri) 119a1a3b679SAndreas Boehler { 120a1a3b679SAndreas Boehler $user = explode('/', $principalUri); 121a1a3b679SAndreas Boehler $user = end($user); 122a1a3b679SAndreas Boehler $mapping = $this->getCalendarIdToPageMapping(); 123a1a3b679SAndreas Boehler $calids = array(); 124a1a3b679SAndreas Boehler foreach($mapping as $row) 125a1a3b679SAndreas Boehler { 126a1a3b679SAndreas Boehler $id = $row['calid']; 127a1a3b679SAndreas Boehler $page = $row['page']; 128a1a3b679SAndreas Boehler $acl = auth_quickaclcheck($page); 129a1a3b679SAndreas Boehler if($acl >= AUTH_READ) 130a1a3b679SAndreas Boehler { 131a1a3b679SAndreas Boehler $write = $acl > AUTH_READ; 132a1a3b679SAndreas Boehler $calids[$id] = array('readonly' => !$write); 133a1a3b679SAndreas Boehler } 134a1a3b679SAndreas Boehler } 135a1a3b679SAndreas Boehler return $calids; 136a1a3b679SAndreas Boehler } 137a1a3b679SAndreas Boehler 138a1a3b679SAndreas Boehler public function createCalendarForPage($name, $description, $id = null, $userid = null) 139a1a3b679SAndreas Boehler { 140a1a3b679SAndreas Boehler if(is_null($id)) 141a1a3b679SAndreas Boehler { 142a1a3b679SAndreas Boehler global $ID; 143a1a3b679SAndreas Boehler $id = $ID; 144a1a3b679SAndreas Boehler } 145a1a3b679SAndreas Boehler if(is_null($userid)) 146a1a3b679SAndreas Boehler $userid = $_SERVER['REMOTE_USER']; 147a1a3b679SAndreas Boehler $values = array('principals/'.$userid, 148a1a3b679SAndreas Boehler $name, 149a1a3b679SAndreas Boehler str_replace(array('/', ' ', ':'), '_', $id), 150a1a3b679SAndreas Boehler $description, 151a1a3b679SAndreas Boehler 'VEVENT,VTODO', 15255a741c0SAndreas Boehler 0, 15355a741c0SAndreas Boehler 1); 15455a741c0SAndreas Boehler $query = "INSERT INTO calendars (principaluri, displayname, uri, description, components, transparent, synctoken) VALUES (".$this->sqlite->quote_and_join($values, ',').");"; 155a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 15655a741c0SAndreas Boehler if($res === false) 15755a741c0SAndreas Boehler return false; 158a1a3b679SAndreas Boehler $query = "SELECT id FROM calendars WHERE principaluri=".$this->sqlite->quote_string($values[0])." AND ". 159a1a3b679SAndreas Boehler "displayname=".$this->sqlite->quote_string($values[1])." AND ". 160a1a3b679SAndreas Boehler "uri=".$this->sqlite->quote_string($values[2])." AND ". 161a1a3b679SAndreas Boehler "description=".$this->sqlite->quote_string($values[3]); 162a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 163a1a3b679SAndreas Boehler $row = $this->sqlite->res2row($res); 164a1a3b679SAndreas Boehler if(isset($row['id'])) 165a1a3b679SAndreas Boehler { 166a1a3b679SAndreas Boehler $values = array($id, $row['id']); 167a1a3b679SAndreas Boehler $query = "INSERT INTO pagetocalendarmapping (page, calid) VALUES (".$this->sqlite->quote_and_join($values, ',').")"; 168a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 16955a741c0SAndreas Boehler return ($res !== false); 170a1a3b679SAndreas Boehler } 171a1a3b679SAndreas Boehler 172a1a3b679SAndreas Boehler return false; 173a1a3b679SAndreas Boehler } 174a1a3b679SAndreas Boehler 175a1a3b679SAndreas Boehler public function addCalendarEntryToCalendarForPage($id, $user, $params) 176a1a3b679SAndreas Boehler { 177*bd883736SAndreas Boehler $settings = $this->getPersonalSettings($user); 178*bd883736SAndreas Boehler if($settings['timezone'] !== '' && $settings['timezone'] !== 'local') 179*bd883736SAndreas Boehler $timezone = new \DateTimeZone($settings['timezone']); 180*bd883736SAndreas Boehler else 181*bd883736SAndreas Boehler $timezone = new \DateTimeZone('UTC'); 182a1a3b679SAndreas Boehler require_once('vendor/autoload.php'); 183a1a3b679SAndreas Boehler $vcalendar = new \Sabre\VObject\Component\VCalendar(); 184a1a3b679SAndreas Boehler $event = $vcalendar->add('VEVENT'); 185a1a3b679SAndreas Boehler $event->summary = $params['eventname']; 186*bd883736SAndreas Boehler $dtStart = new \DateTime($params['eventfrom'], $timezone); 187*bd883736SAndreas Boehler $dtEnd = new \DateTime($params['eventto'], $timezone); 188a1a3b679SAndreas Boehler $event->DTSTART = $dtStart; 189a1a3b679SAndreas Boehler $event->DTEND = $dtEnd; 190a1a3b679SAndreas Boehler $calid = $this->getCalendarIdForPage($id); 191a1a3b679SAndreas Boehler $uri = uniqid('dokuwiki-').'.ics'; 192a1a3b679SAndreas Boehler $now = new DateTime(); 193a1a3b679SAndreas Boehler $eventStr = $vcalendar->serialize(); 194a1a3b679SAndreas Boehler 195a1a3b679SAndreas Boehler $values = array($calid, 196a1a3b679SAndreas Boehler $uri, 197a1a3b679SAndreas Boehler $eventStr, 198a1a3b679SAndreas Boehler $now->getTimestamp(), 199a1a3b679SAndreas Boehler 'VEVENT', 200a1a3b679SAndreas Boehler $event->DTSTART->getDateTime()->getTimeStamp(), 201a1a3b679SAndreas Boehler $event->DTEND->getDateTime()->getTimeStamp(), 202a1a3b679SAndreas Boehler strlen($eventStr), 203a1a3b679SAndreas Boehler md5($eventStr), 204a1a3b679SAndreas Boehler uniqid() 205a1a3b679SAndreas Boehler ); 206a1a3b679SAndreas Boehler 207a1a3b679SAndreas Boehler $query = "INSERT INTO calendarobjects (calendarid, uri, calendardata, lastmodified, componenttype, firstoccurence, lastoccurence, size, etag, uid) VALUES (".$this->sqlite->quote_and_join($values, ',').")"; 208a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 20955a741c0SAndreas Boehler if($res !== false) 21055a741c0SAndreas Boehler { 21155a741c0SAndreas Boehler $this->updateSyncTokenLog($calid, $uri, 'added'); 212a1a3b679SAndreas Boehler return true; 213a1a3b679SAndreas Boehler } 21455a741c0SAndreas Boehler return false; 21555a741c0SAndreas Boehler } 216a1a3b679SAndreas Boehler 217a1a3b679SAndreas Boehler public function getEventsWithinDateRange($id, $user, $startDate, $endDate) 218a1a3b679SAndreas Boehler { 219*bd883736SAndreas Boehler $settings = $this->getPersonalSettings($user); 220*bd883736SAndreas Boehler if($settings['timezone'] !== '' && $settings['timezone'] !== 'local') 221*bd883736SAndreas Boehler $timezone = new \DateTimeZone($settings['timezone']); 222*bd883736SAndreas Boehler else 223*bd883736SAndreas Boehler $timezone = new \DateTimeZone('UTC'); 224a1a3b679SAndreas Boehler $data = array(); 225a1a3b679SAndreas Boehler require_once('vendor/autoload.php'); 226a1a3b679SAndreas Boehler $calid = $this->getCalendarIdForPage($id); 227a1a3b679SAndreas Boehler $startTs = new \DateTime($startDate); 228a1a3b679SAndreas Boehler $endTs = new \DateTime($endDate); 229a1a3b679SAndreas Boehler $query = "SELECT calendardata, componenttype, uid FROM calendarobjects WHERE calendarid=". 230a1a3b679SAndreas Boehler $this->sqlite->quote_string($calid)." AND firstoccurence > ". 231a1a3b679SAndreas Boehler $this->sqlite->quote_string($startTs->getTimestamp())." AND firstoccurence < ". 232a1a3b679SAndreas Boehler $this->sqlite->quote_string($endTs->getTimestamp()); 233a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 234a1a3b679SAndreas Boehler $arr = $this->sqlite->res2arr($res); 235a1a3b679SAndreas Boehler foreach($arr as $row) 236a1a3b679SAndreas Boehler { 237a1a3b679SAndreas Boehler if(isset($row['calendardata'])) 238a1a3b679SAndreas Boehler { 239a1a3b679SAndreas Boehler $vcal = \Sabre\VObject\Reader::read($row['calendardata']); 240a1a3b679SAndreas Boehler $start = $vcal->VEVENT->DTSTART->getDateTime(); 241a1a3b679SAndreas Boehler $end = $vcal->VEVENT->DTEND->getDateTime(); 242*bd883736SAndreas Boehler $start->setTimezone($timezone); 243*bd883736SAndreas Boehler $end->setTimezone($timezone); 244a1a3b679SAndreas Boehler $summary = (string)$vcal->VEVENT->summary; 245*bd883736SAndreas Boehler $data[] = array("title" => $summary, "start" => $start->format(\DateTime::ATOM), 246*bd883736SAndreas Boehler "end" => $end->format(\DateTime::ATOM), 247a1a3b679SAndreas Boehler "id" => $row['uid']); 248a1a3b679SAndreas Boehler } 249a1a3b679SAndreas Boehler } 250a1a3b679SAndreas Boehler return $data; 251a1a3b679SAndreas Boehler } 252a1a3b679SAndreas Boehler 253a1a3b679SAndreas Boehler public function getEventWithUid($uid) 254a1a3b679SAndreas Boehler { 25555a741c0SAndreas Boehler $query = "SELECT calendardata, calendarid, componenttype, uri FROM calendarobjects WHERE uid=". 256a1a3b679SAndreas Boehler $this->sqlite->quote_string($uid); 257a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 258a1a3b679SAndreas Boehler $row = $this->sqlite->res2row($res); 259a1a3b679SAndreas Boehler return $row; 260a1a3b679SAndreas Boehler } 261a1a3b679SAndreas Boehler 262a1a3b679SAndreas Boehler public function editCalendarEntryForPage($id, $user, $params) 263a1a3b679SAndreas Boehler { 264*bd883736SAndreas Boehler $settings = $this->getPersonalSettings($user); 265*bd883736SAndreas Boehler if($settings['timezone'] !== '' && $settings['timezone'] !== 'local') 266*bd883736SAndreas Boehler $timezone = new \DateTimeZone($settings['timezone']); 267*bd883736SAndreas Boehler else 268*bd883736SAndreas Boehler $timezone = new \DateTimeZone('UTC'); 26955a741c0SAndreas Boehler $uid = $params['uid']; 27055a741c0SAndreas Boehler $event = $this->getEventWithUid($uid); 271a1a3b679SAndreas Boehler require_once('vendor/autoload.php'); 272a1a3b679SAndreas Boehler if(!isset($event['calendardata'])) 273a1a3b679SAndreas Boehler return false; 27455a741c0SAndreas Boehler $uri = $event['uri']; 27555a741c0SAndreas Boehler $calid = $event['calendarid']; 276a1a3b679SAndreas Boehler $vcal = \Sabre\VObject\Reader::read($event['calendardata']); 277a1a3b679SAndreas Boehler $vcal->VEVENT->summary = $params['eventname']; 278*bd883736SAndreas Boehler $dtStart = new \DateTime($params['eventfrom'], $timezone); 279*bd883736SAndreas Boehler $dtEnd = new \DateTime($params['eventto'], $timezone); 280a1a3b679SAndreas Boehler $vcal->VEVENT->DTSTART = $dtStart; 281a1a3b679SAndreas Boehler $vcal->VEVENT->DTEND = $dtEnd; 282a1a3b679SAndreas Boehler $now = new DateTime(); 283a1a3b679SAndreas Boehler $eventStr = $vcal->serialize(); 284a1a3b679SAndreas Boehler 285a1a3b679SAndreas Boehler $query = "UPDATE calendarobjects SET calendardata=".$this->sqlite->quote_string($eventStr). 286a1a3b679SAndreas Boehler ", lastmodified=".$this->sqlite->quote_string($now->getTimestamp()). 287a1a3b679SAndreas Boehler ", firstoccurence=".$this->sqlite->quote_string($dtStart->getTimestamp()). 288a1a3b679SAndreas Boehler ", lastoccurence=".$this->sqlite->quote_string($dtEnd->getTimestamp()). 289a1a3b679SAndreas Boehler ", size=".strlen($eventStr). 290a1a3b679SAndreas Boehler ", etag=".$this->sqlite->quote_string(md5($eventStr)). 29155a741c0SAndreas Boehler " WHERE uid=".$this->sqlite->quote_string($uid); 292a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 29355a741c0SAndreas Boehler if($res !== false) 29455a741c0SAndreas Boehler { 29555a741c0SAndreas Boehler $this->updateSyncTokenLog($calid, $uri, 'modified'); 296a1a3b679SAndreas Boehler return true; 297a1a3b679SAndreas Boehler } 29855a741c0SAndreas Boehler return false; 29955a741c0SAndreas Boehler } 300a1a3b679SAndreas Boehler 301a1a3b679SAndreas Boehler public function deleteCalendarEntryForPage($id, $params) 302a1a3b679SAndreas Boehler { 303a1a3b679SAndreas Boehler $uid = $params['uid']; 30455a741c0SAndreas Boehler $event = $this->getEventWithUid($uid); 3052c14b82bSAndreas Boehler $calid = $event['calendarid']; 30655a741c0SAndreas Boehler $uri = $event['uri']; 307a1a3b679SAndreas Boehler $query = "DELETE FROM calendarobjects WHERE uid=".$this->sqlite->quote_string($uid); 308a1a3b679SAndreas Boehler $res = $this->sqlite->query($query); 30955a741c0SAndreas Boehler if($res !== false) 31055a741c0SAndreas Boehler { 31155a741c0SAndreas Boehler $this->updateSyncTokenLog($calid, $uri, 'deleted'); 31255a741c0SAndreas Boehler } 313a1a3b679SAndreas Boehler return true; 314a1a3b679SAndreas Boehler } 315a1a3b679SAndreas Boehler 31655a741c0SAndreas Boehler public function getSyncTokenForCalendar($calid) 31755a741c0SAndreas Boehler { 31855a741c0SAndreas Boehler $query = "SELECT synctoken FROM calendars WHERE id=".$this->sqlite->quote_string($calid); 31955a741c0SAndreas Boehler $res = $this->sqlite->query($query); 32055a741c0SAndreas Boehler $row = $this->sqlite->res2row($res); 32155a741c0SAndreas Boehler if(isset($row['synctoken'])) 32255a741c0SAndreas Boehler return $row['synctoken']; 32355a741c0SAndreas Boehler return false; 32455a741c0SAndreas Boehler } 32555a741c0SAndreas Boehler 32655a741c0SAndreas Boehler public function operationNameToOperation($operationName) 32755a741c0SAndreas Boehler { 32855a741c0SAndreas Boehler switch($operationName) 32955a741c0SAndreas Boehler { 33055a741c0SAndreas Boehler case 'added': 33155a741c0SAndreas Boehler return 1; 33255a741c0SAndreas Boehler break; 33355a741c0SAndreas Boehler case 'modified': 33455a741c0SAndreas Boehler return 2; 33555a741c0SAndreas Boehler break; 33655a741c0SAndreas Boehler case 'deleted': 33755a741c0SAndreas Boehler return 3; 33855a741c0SAndreas Boehler break; 33955a741c0SAndreas Boehler } 34055a741c0SAndreas Boehler return false; 34155a741c0SAndreas Boehler } 34255a741c0SAndreas Boehler 34355a741c0SAndreas Boehler private function updateSyncTokenLog($calid, $uri, $operation) 34455a741c0SAndreas Boehler { 34555a741c0SAndreas Boehler $currentToken = $this->getSyncTokenForCalendar($calid); 34655a741c0SAndreas Boehler $operationCode = $this->operationNameToOperation($operation); 34755a741c0SAndreas Boehler if(($operationCode === false) || ($currentToken === false)) 34855a741c0SAndreas Boehler return false; 34955a741c0SAndreas Boehler $values = array($uri, 35055a741c0SAndreas Boehler $currentToken, 35155a741c0SAndreas Boehler $calid, 35255a741c0SAndreas Boehler $operationCode 35355a741c0SAndreas Boehler ); 35455a741c0SAndreas Boehler $query = "INSERT INTO calendarchanges (uri, synctoken, calendarid, operation) VALUES(". 35555a741c0SAndreas Boehler $this->sqlite->quote_and_join($values, ',').")"; 35655a741c0SAndreas Boehler $res = $this->sqlite->query($query); 35755a741c0SAndreas Boehler if($res === false) 35855a741c0SAndreas Boehler return false; 35955a741c0SAndreas Boehler $currentToken++; 36055a741c0SAndreas Boehler $query = "UPDATE calendars SET synctoken=".$this->sqlite->quote_string($currentToken)." WHERE id=". 36155a741c0SAndreas Boehler $this->sqlite->quote_string($calid); 36255a741c0SAndreas Boehler $res = $this->sqlite->query($query); 36355a741c0SAndreas Boehler return ($res !== false); 36455a741c0SAndreas Boehler } 36555a741c0SAndreas Boehler 366a1a3b679SAndreas Boehler} 367