nextcloud/apps/calendar/ajax/newevent.php

29 lines
719 B
PHP
Raw Normal View History

2011-08-12 16:29:45 +04:00
<?php
2011-09-24 00:59:24 +04:00
/**
* Copyright (c) 2011 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.
*/
require_once('../../../lib/base.php');
2011-09-15 23:20:42 +04:00
$l10n = new OC_L10N('calendar');
2011-09-15 23:20:42 +04:00
if(!OC_USER::isLoggedIn()) {
die("<script type=\"text/javascript\">document.location = oc_webroot;</script>");
}
2011-08-12 16:29:45 +04:00
2011-09-15 23:20:42 +04:00
$errarr = OC_Calendar_Object::validateRequest($_POST);
if($errarr){
//show validate errors
OC_JSON::error($errarr);
exit;
}else{
2011-09-15 23:20:42 +04:00
$cal = $_POST['calendar'];
$vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
$result = OC_Calendar_Object::add($cal, $vcalendar->serialize());
OC_JSON::success();
}
2011-09-15 01:29:35 +04:00
?>