owncalendar/ajax/event/new.php

30 lines
710 B
PHP
Raw Normal View History

<?php
/**
2012-08-31 12:21:27 +00:00
* Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
* 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-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();
$errarr = OC_Calendar_Object::validateRequest($_POST);
2012-09-07 13:21:03 +00:00
if($errarr) {
//show validate errors
2012-05-03 10:23:29 +00:00
OCP\JSON::error($errarr);
exit;
}else{
$cal = $_POST['calendar'];
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
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
}