<?php /** * Copyright (c) 2012 Georg Ehrke <ownclouddev at georgswebsite dot de> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\User::checkLoggedIn(); OCP\App::checkAppEnabled('calendar'); $cal = isset($_GET['calid']) ? $_GET['calid'] : null; $event = isset($_GET['eventid']) ? $_GET['eventid'] : null; if (!is_null($cal)) { $calendar = OC_Calendar_App::getCalendar($cal, true); if (!$calendar) { header('HTTP/1.0 403 Forbidden'); exit; } header('Content-Type: text/calendar'); header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $calendar['displayname']) . '.ics'); echo OC_Calendar_Export::export($cal, OC_Calendar_Export::CALENDAR); } elseif (!is_null($event)) { $data = OC_Calendar_App::getEventObject($_GET['eventid'], true); if (!$data) { header('HTTP/1.0 403 Forbidden'); exit; } header('Content-Type: text/calendar'); header('Content-Disposition: inline; filename=' . str_replace(' ', '-', $data['summary']) . '.ics'); echo OC_Calendar_Export::export($event, OC_Calendar_Export::EVENT); }
<?php /** * ownCloud - Addressbook * * @author Jakob Sack * @copyright 2011 Jakob Sack mail@jakobsack.de * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this library. If not, see <http://www.gnu.org/licenses/>. * */ // Init owncloud OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('tasks'); OCP\JSON::callCheck(); $id = $_POST['id']; $task = OC_Calendar_App::getEventObject($id); OC_Calendar_Object::delete($id); OCP\JSON::success(array('data' => array('id' => $id)));
var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')); ?> '; var totalurl = '<?php echo OCP\Util::linkToRemote('caldav'); ?> calendars'; var firstDay = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'; ?> '; $(document).ready(function() { <?php if (array_key_exists('showevent', $_)) { $data = OC_Calendar_App::getEventObject($_['showevent']); $date = substr($data['startdate'], 0, 10); list($year, $month, $day) = explode('-', $date); echo '$(\'#calendar_holder\').fullCalendar(\'gotoDate\', ' . $year . ', ' . --$month . ', ' . $day . ');'; echo '$(\'#dialog_holder\').load(OC.filePath(\'calendar\', \'ajax\', \'editeventform.php\') + \'?id=\' + ' . $_['showevent'] . ' , Calendar.UI.startEventDialog);'; } ?> }); </script> <div id="controls"> <div> <form> <div id="view"> <input type="button" value="<?php echo $l->t('Week'); ?>
<?php /** * Copyright (c) 2011 Bart Visscher <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ if (!OCP\User::isLoggedIn()) { die('<script type="text/javascript">document.location = oc_webroot;</script>'); } OCP\JSON::checkAppEnabled('calendar'); $id = $_POST['id']; $data = OC_Calendar_App::getEventObject($id, false, false); if (!$data) { OCP\JSON::error(array('data' => array('message' => OC_Calendar_App::$l10n->t('Wrong calendar')))); exit; } $permissions = OC_Calendar_App::getPermissions($id, OC_Calendar_App::EVENT); $object = OC_VObject::parse($data['calendardata']); $vevent = $object->VEVENT; $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); switch ($dtstart->getDateType()) { case Sabre_VObject_Property_DateTime::UTC: $timeOffset = $_SESSION['timezone'] * 60; $newDT = $dtstart->getDateTime(); $newDT->add(new DateInterval("PT" . $timeOffset . "M")); $dtstart->setDateTime($newDT); $newDT = $dtend->getDateTime(); $newDT->add(new DateInterval("PT" . $timeOffset . "M"));
public static function check_access($share, $id, $type) { $group_where = self::group_sql(OC_Group::getUserGroups($share)); $stmt = OCP\DB::prepare("SELECT * FROM *PREFIX*calendar_share_" . $type . " WHERE (" . $type . "id = ? AND (share = ? AND sharetype = 'user') " . $group_where . ")"); $result = $stmt->execute(array($id, $share)); $rows = $result->numRows(); if ($rows > 0) { return true; } elseif ($type == self::EVENT) { $event = OC_Calendar_App::getEventObject($id, false, false); return self::check_access($share, $event['calendarid'], self::CALENDAR); } else { return false; } }
OCP\JSON::callCheck(); $id = strip_tags($_GET['id']); $idtype = strip_tags($_GET['idtype']); switch ($idtype) { case 'calendar': case 'event': break; default: OCP\JSON::error(array('message' => 'unexspected parameter')); exit; } if ($idtype == 'calendar' && !OC_Calendar_App::getCalendar($id)) { OCP\JSON::error(array('message' => 'permission denied')); exit; } if ($idtype == 'event' && !OC_Calendar_App::getEventObject($id)) { OCP\JSON::error(array('message' => 'permission denied')); exit; } $sharewith = $_GET['sharewith']; $sharetype = strip_tags($_GET['sharetype']); switch ($sharetype) { case 'user': case 'group': case 'public': break; default: OCP\JSON::error(array('message' => 'unexspected parameter')); exit; } if ($sharetype == 'user' && !OCP\User::userExists($sharewith)) {
/** * @NoAdminRequired */ public function setTaskCalendar() { $taskId = $this->params('taskID'); $calendarId = $this->params('calendarID'); $response = new JSONResponse(); try { $data = \OC_Calendar_App::getEventObject($taskId); if ($data['calendarid'] != $calendarId) { \OC_Calendar_Object::moveToCalendar($taskId, $calendarId); } } catch (\Exception $e) { // throw new BusinessLayerException($e->getMessage()); } return $response; }
<?php /** * Copyright (c) 2011 Bart Visscher <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ if (!OCP\User::isLoggedIn()) { die('<script type="text/javascript">document.location = oc_webroot;</script>'); } OCP\JSON::checkAppEnabled('calendar'); $id = $_GET['id']; $data = OC_Calendar_App::getEventObject($id, true, true); if (!$data) { OCP\JSON::error(array('data' => array('message' => self::$l10n->t('Wrong calendar')))); exit; } $access = OC_Calendar_App::getaccess($id, OC_Calendar_Share::EVENT); $object = OC_VObject::parse($data['calendardata']); $vevent = $object->VEVENT; $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); switch ($dtstart->getDateType()) { case Sabre_VObject_Property_DateTime::LOCALTZ: case Sabre_VObject_Property_DateTime::LOCAL: $startdate = $dtstart->getDateTime()->format('d-m-Y'); $starttime = $dtstart->getDateTime()->format('H:i'); $enddate = $dtend->getDateTime()->format('d-m-Y'); $endtime = $dtend->getDateTime()->format('H:i'); $allday = false;
<?php $token = strip_tags($_GET['t']); $shared = OC_Calendar_Share::getElementByToken($token); $nl = "\n\r"; if ($shared['type'] == OC_Calendar_Share::CALENDAR) { $calendar = OC_Calendar_App::getCalendar($shared['id'], false); $calobjects = OC_Calendar_Object::all($shared['id']); header('Content-Type: text/Calendar'); header('Content-Disposition: inline; filename=' . $calendar['displayname'] . '.ics'); foreach ($calobjects as $calobject) { echo $calobject['calendardata'] . $nl; } } elseif ($shared['type'] == OC_Calendar_Share::EVENT) { $data = OC_Calendar_App::getEventObject($shared['id'], false); $calendarid = $data['calendarid']; $calendar = OC_Calendar_App::getCalendar($calendarid); header('Content-Type: text/Calendar'); header('Content-Disposition: inline; filename=' . $data['summary'] . '.ics'); echo $data['calendardata']; } else { header('Error 404: Not Found'); }
/** * set calendar id of task by id * * @param int $taskID * @param int $calendarID * @return bool * @throws \Exception */ public function setCalendarId($taskID, $calendarID) { $data = \OC_Calendar_App::getEventObject($taskID); if ($data['calendarid'] != $calendarID) { return \OC_Calendar_Object::moveToCalendar($taskID, $calendarID); } else { return true; } }
<?php /** * Copyright (c) 2013 Visitha Baddegama <*****@*****.**> * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. */ OCP\JSON::checkLoggedIn(); OCP\JSON::checkAppEnabled('calendar'); OCP\JSON::callCheck(); $eventId = $_POST['eventId']; //check if user is actually allowed to access event $event = OC_Calendar_App::getEventObject($eventId); if ($event === false || $event === null) { \OCP\JSON::error(); exit; } $summary = $event['summary']; $location = $_POST['location']; $description = $_POST['description']; $dtstart = $_POST['dtstart']; $dtend = $_POST['dtend']; try { OC_Calendar_App::sendEmails($eventId, $summary, $location, $description, $dtstart, $dtend); \OCP\JSON::success(); } catch (Exception $e) { \OCP\Util::writeLog('calendar', 'sending mail failed (' . $e->getMessage() . ')', \OCP\Util::WARN); \OCP\JSON::error(); }