diff options
author | Bart Visscher <bartv@thisnet.nl> | 2011-12-18 22:58:20 +0100 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2011-12-18 23:10:42 +0100 |
commit | 4eb36b0ecf40266ceb2abf0f5bc17dad4bde6951 (patch) | |
tree | 1c9a177a152e8c6e4155e7766f7ea5cfd991cf97 /apps/calendar/ajax/editevent.php | |
parent | 3d1accab701730fbd2b0cb89cb8c727301f5d756 (diff) | |
download | nextcloud-server-4eb36b0ecf40266ceb2abf0f5bc17dad4bde6951.tar.gz nextcloud-server-4eb36b0ecf40266ceb2abf0f5bc17dad4bde6951.zip |
Calendar: refactor common ajax functions to OC_Calendar_App
Diffstat (limited to 'apps/calendar/ajax/editevent.php')
-rw-r--r-- | apps/calendar/ajax/editevent.php | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/editevent.php index e3c84520481..f00ab1d960b 100644 --- a/apps/calendar/ajax/editevent.php +++ b/apps/calendar/ajax/editevent.php @@ -7,9 +7,6 @@ */ require_once('../../../lib/base.php'); - -$l10n = new OC_L10N('calendar'); - if(!OC_USER::isLoggedIn()) { die('<script type="text/javascript">document.location = oc_webroot;</script>'); } @@ -23,26 +20,12 @@ if($errarr){ }else{ $id = $_POST['id']; $cal = $_POST['calendar']; - $data = OC_Calendar_Object::find($id); - if (!$data) - { - OC_JSON::error(); - exit; - } - $calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']); - if($calendar['userid'] != OC_User::getUser()){ - OC_JSON::error(); - exit; - } + $data = OC_Calendar_App::getEventObject($id); $vcalendar = OC_VObject::parse($data['calendardata']); - $last_modified = $vcalendar->VEVENT->__get('LAST-MODIFIED'); - if($last_modified && $_POST['lastmodified'] != $last_modified->getDateTime()->format('U')){ - OC_JSON::error(array('modified'=>true)); - exit; - } - + OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']); OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar); + $result = OC_Calendar_Object::edit($id, $vcalendar->serialize()); if ($data['calendarid'] != $cal) { OC_Calendar_Object::moveToCalendar($id, $cal); |