2011-09-23 00:09:03 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
require_once('../../../lib/base.php');
|
|
|
|
|
|
|
|
$l10n = new OC_L10N('calendar');
|
|
|
|
|
|
|
|
if(!OC_USER::isLoggedIn()) {
|
|
|
|
die('<script type="text/javascript">document.location = oc_webroot;</script>');
|
|
|
|
}
|
|
|
|
|
|
|
|
$id = $_POST['id'];
|
|
|
|
$data = OC_Calendar_Object::find($id);
|
|
|
|
if (!$data)
|
|
|
|
{
|
2011-09-24 00:22:59 +04:00
|
|
|
OC_JSON::error();
|
2011-09-23 00:09:03 +04:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']);
|
|
|
|
if($calendar['userid'] != OC_User::getUser()){
|
2011-09-24 00:22:59 +04:00
|
|
|
OC_JSON::error();
|
2011-09-23 00:09:03 +04:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$result = OC_Calendar_Object::delete($id);
|
2011-09-24 00:22:59 +04:00
|
|
|
OC_JSON::success();
|
2011-09-23 00:09:03 +04:00
|
|
|
?>
|