2012-02-20 10:26:22 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2012-08-31 12:21:27 +00:00
|
|
|
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
2012-02-20 10:26:22 +00:00
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2012-09-07 12:32:45 +00:00
|
|
|
|
2012-02-20 10:26:22 +00:00
|
|
|
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::checkLoggedIn();
|
|
|
|
OCP\JSON::checkAppEnabled('calendar');
|
2012-07-20 18:12:36 +00:00
|
|
|
OCP\JSON::callCheck();
|
2012-02-20 10:26:22 +00:00
|
|
|
|
|
|
|
$errarr = OC_Calendar_Object::validateRequest($_POST);
|
2012-09-07 13:21:03 +00:00
|
|
|
if($errarr) {
|
2012-02-20 10:26:22 +00:00
|
|
|
//show validate errors
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::error($errarr);
|
2012-02-20 10:26:22 +00:00
|
|
|
exit;
|
|
|
|
}else{
|
|
|
|
$cal = $_POST['calendar'];
|
|
|
|
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
|
2012-09-01 20:40:02 +00:00
|
|
|
try {
|
|
|
|
OC_Calendar_Object::add($cal, $vcalendar->serialize());
|
|
|
|
} catch(Exception $e) {
|
|
|
|
OCP\JSON::error(array('message'=>$e->getMessage()));
|
|
|
|
exit;
|
|
|
|
}
|
2012-05-03 10:23:29 +00:00
|
|
|
OCP\JSON::success();
|
2012-06-16 07:48:07 +00:00
|
|
|
}
|