2011-08-12 16:29:45 +04:00
|
|
|
<?php
|
|
|
|
/*************************************************
|
|
|
|
* ownCloud - Calendar Plugin *
|
|
|
|
* *
|
|
|
|
* (c) Copyright 2011 Georg Ehrke *
|
|
|
|
* author: Georg Ehrke *
|
|
|
|
* email: ownclouddev at georgswebsite dot de *
|
|
|
|
* homepage: ownclouddev.georgswebsite.de *
|
|
|
|
* manual: ownclouddev.georgswebsite.de/manual *
|
|
|
|
* License: GNU AFFERO GENERAL PUBLIC LICENSE *
|
|
|
|
* *
|
|
|
|
* <http://www.gnu.org/licenses/> *
|
|
|
|
* If you are not able to view the License, *
|
|
|
|
* <http://www.gnu.org/licenses/> *
|
|
|
|
* <http://ownclouddev.georgswebsite.de/license/> *
|
|
|
|
* please write to the Free Software Foundation. *
|
|
|
|
* Address: *
|
|
|
|
* 59 Temple Place, Suite 330, Boston, *
|
|
|
|
* MA 02111-1307 USA *
|
|
|
|
*************************************************/
|
2011-08-28 22:13:40 +04:00
|
|
|
require_once('../../../lib/base.php');
|
2011-09-15 23:20:42 +04:00
|
|
|
|
2011-08-28 22:13:40 +04:00
|
|
|
$l10n = new OC_L10N('calendar');
|
2011-09-15 23:20:42 +04:00
|
|
|
|
2011-08-28 22:13:40 +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){
|
2011-08-28 22:13:40 +04:00
|
|
|
//show validate errors
|
|
|
|
$errarr["error"] = "true";
|
|
|
|
echo json_encode($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());
|
2011-08-31 22:41:18 +04:00
|
|
|
echo json_encode(array("success"=>"true"));
|
2011-08-28 22:13:40 +04:00
|
|
|
}
|
2011-09-15 01:29:35 +04:00
|
|
|
?>
|