2011-08-12 16:29:45 +04:00
|
|
|
<?php
|
2011-09-24 00:59:24 +04:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
2011-09-15 23:20:42 +04:00
|
|
|
require_once('../../../lib/base.php');
|
2011-12-22 19:31:01 +04:00
|
|
|
OC_JSON::checkLoggedIn();
|
2011-10-01 01:05:10 +04:00
|
|
|
OC_JSON::checkAppEnabled('calendar');
|
2011-09-15 23:20:42 +04:00
|
|
|
|
|
|
|
$errarr = OC_Calendar_Object::validateRequest($_POST);
|
|
|
|
if($errarr){
|
|
|
|
//show validate errors
|
2011-09-24 00:22:59 +04:00
|
|
|
OC_JSON::error($errarr);
|
2011-09-15 23:20:42 +04:00
|
|
|
exit;
|
|
|
|
}else{
|
|
|
|
$id = $_POST['id'];
|
2011-09-16 02:08:15 +04:00
|
|
|
$cal = $_POST['calendar'];
|
2011-12-19 01:58:20 +04:00
|
|
|
$data = OC_Calendar_App::getEventObject($id);
|
2011-09-20 16:41:17 +04:00
|
|
|
$vcalendar = OC_VObject::parse($data['calendardata']);
|
2011-11-10 01:17:09 +04:00
|
|
|
|
2011-12-19 01:58:20 +04:00
|
|
|
OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']);
|
2011-09-15 23:20:42 +04:00
|
|
|
OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar);
|
2011-12-19 01:58:20 +04:00
|
|
|
|
2011-09-15 23:20:42 +04:00
|
|
|
$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
|
2011-09-16 02:08:15 +04:00
|
|
|
if ($data['calendarid'] != $cal) {
|
|
|
|
OC_Calendar_Object::moveToCalendar($id, $cal);
|
|
|
|
}
|
2011-09-24 00:22:59 +04:00
|
|
|
OC_JSON::success();
|
2011-09-15 23:20:42 +04:00
|
|
|
}
|
2011-09-24 00:22:59 +04:00
|
|
|
?>
|