. * */ // Init owncloud require_once('../../../lib/base.php'); $l10n = new OC_L10N('tasks'); // Check if we are a user if( !OC_User::isLoggedIn()){ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('You need to log in!')))); exit(); } $id = $_GET['id']; $task = OC_Calendar_Object::find( $id ); if( $task === false ){ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('Can not find Task!')))); exit(); } $calendar = OC_Calendar_Calendar::findCalendar( $task['calendarid'] ); if( $calendar === false || $calendar['userid'] != OC_USER::getUser()){ echo json_encode( array( 'status' => 'error', 'data' => array( 'message' => $l10n->t('This is not your task!')))); exit(); } OC_Calendar_Object::delete($id); echo json_encode( array( 'status' => 'success', 'data' => array( 'id' => $id )));