/** * Get a list of all the messages. * @see BackendDiff::GetMessageList() */ public function GetMessageList($folderid, $cutoffdate) { ZLog::Write(LOGLEVEL_DEBUG, sprintf("BackendCalDAV->GetMessageList('%s','%s')", $folderid, $cutoffdate)); /* Calculating the range of events we want to sync */ $begin = gmdate("Ymd\\THis\\Z", $cutoffdate); $finish = gmdate("Ymd\\THis\\Z", 2147483647); $path = $this->_caldav_path . substr($folderid, 1) . "/"; if ($folderid[0] == "C") { $msgs = $this->_caldav->GetEvents($begin, $finish, $path); } else { $msgs = $this->_caldav->GetTodos($begin, $finish, false, false, $path); } $messages = array(); foreach ($msgs as $e) { $id = $e['href']; $this->_collection[$id] = $e; $messages[] = $this->StatMessage($folderid, $id); } return $messages; }
require_once '/home/www/cron/functions.inc.php'; require_once '/home/www/cron/CalDAVClient.php'; // Load Settings Data $settings = settings(); date_default_timezone_set($settings['timezone']); if ($settings['oc_ical'] == true) { $url = parse_url($settings['oc_ical_url']); if ($url['scheme'] == "https") { $port = "443"; } else { $port = "80"; } $acc["davical"] = array("user" => $settings['oc_user'], "pass" => $settings['oc_pass'], "server" => $url['host'], "port" => $port, "uri" => $settings['oc_ical_url']); $account = $acc["davical"]; $cal = new CalDAVClient($account["uri"], $account["user"], $account["pass"], "", $account["server"], $account["port"]); $events = $cal->GetEvents($sta, $end); foreach ($events as $k => $event) { $ce = explode("VEVENT", $event['data']); $su = explode("SUMMARY:", $ce[1]); $su1 = explode("\n", $su[1]); preg_match("/DTSTART;(.*):(.*)/", $ce[1], $treffer); $sta = strtotime($treffer[2]); $end = strtotime($treffer[2]) + 60 * 1; $now = time(); if ($now >= $sta && $now <= $end) { $su2 = explode("_", trim($su1[0])); $lampID = trim($su2[0]); $action = trim($su2[1]); $stat = checkLightStatus($lampID); $co = getCodeById($lampID); $code = $co["code"];
define('LOGLEVEL', LOGLEVEL_DEBUG); define('LOGUSERLEVEL', LOGLEVEL_DEVICEID); // $username = "******"; // $password = "******"; // // define('CALDAV_SERVER', 'http://sogo-demo.inverse.ca'); // define('CALDAV_PORT', '80'); // define('CALDAV_PATH', '/SOGo/dav/%u/Calendar/'); // define('CALDAV_PERSONAL', 'personal'); // define('CALDAV_SUPPORTS_SYNC', true); $caldav_path = str_replace('%u', $username, CALDAV_PATH); $caldav = new CalDAVClient(CALDAV_SERVER . ":" . CALDAV_PORT . $caldav_path, $username, $password); printf("Connected %d\n", $caldav->CheckConnection()); // Show options supported by server $options = $caldav->DoOptionsRequest(); print_r($options); $calendars = $caldav->FindCalendars(); print_r($calendars); $path = $caldav_path . CALDAV_PERSONAL . "/"; $val = $caldav->GetCalendarDetails($path); print_r($val); $begin = gmdate("Ymd\\THis\\Z", time() - 24 * 7 * 60 * 60); $finish = gmdate("Ymd\\THis\\Z", 2147483647); $msgs = $caldav->GetEvents($begin, $finish, $path); print_r($msgs); // Initial sync $results = $caldav->GetSync($path, true, CALDAV_SUPPORTS_SYNC); print_r($results); sleep(60); $results = $caldav->GetSync($path, false, CALDAV_SUPPORTS_SYNC); print_r($results);
* $acc["google"] = array( * "user"=>"*****@*****.**", * "pass"=>"xxxxx", * "server"=>"ssl://www.google.com", * "port"=>"443", * "uri"=>"https://www.google.com/calendar/dav/kunsttherapie@gmail.com/events/", * ); **/ $acc["davical"] = array("user" => "rwr26", "pass" => "password", "server" => "ssl://calendar.cs.drexel.edu", "port" => "443", "uri" => "https://calendar.cs.drexel.edu/davical/caldav.php/rwr26/home/"); //******************************* $account = $acc["davical"]; //******************************* $cal = new CalDAVClient($account["uri"], $account["user"], $account["pass"], "", $account["server"], $account["port"]); $options = $cal->DoOptionsRequest(); echo print_r($options); $events = $cal->GetEvents("20090201T000000Z", "20120301T000000Z"); foreach ($events as $k => $event) { echo print_r("Data" . $event['data']); //echo print "\n---------------------------------------------\n"; } //echo print_r($events); //echo count($events); //echo $events["data"]; /* foreach ( $events as $k => $event ) { echo print_r($event['data']); echo print "\n---------------------------------------------\n"; } * */ //print_r($options); /*