<?php /** * Copyright (c) 2011 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. */ require_once '../../lib/base.php'; OC_JSON::checkLoggedIn(); OC_Util::checkAppEnabled('calendar'); if ($_GET["import"] == "existing") { $calid = $_GET["calid"]; $calendar = OC_Calendar_Calendar::findCalendar($calid); if ($calendar['userid'] != OC_User::getUser()) { OC_JSON::error(); exit; } if ($_GET["path"] != "") { $filename = $_GET["path"] . "/" . $_GET["file"]; } else { $filename = "/" . $_GET["file"]; } } else { $id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']); OC_Calendar_Calendar::setCalendarActive($id, 1); $calid = $id; if ($_POST["path"] != "") { $filename = $_POST["path"] . "/" . $_POST["file"]; } else { $filename = "/" . $_POST["file"];
* 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>'); } OC_JSON::checkAppEnabled('calendar'); $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); $category_options = OC_Calendar_Object::getCategoryOptions($l10n); $repeat_options = OC_Calendar_Object::getRepeatOptions($l10n); $id = $_GET['id']; $data = OC_Calendar_Object::find($id); $calendar = OC_Calendar_Calendar::findCalendar($data['calendarid']); if ($calendar['userid'] != OC_User::getUser()) { echo $l10n->t('Wrong calendar'); exit; } $object = Sabre_VObject_Reader::read($data['calendardata']); $vevent = $object->VEVENT; $dtstart = $vevent->DTSTART; $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); switch ($dtstart->getDateType()) { case Sabre_VObject_Element_DateTime::LOCALTZ: case Sabre_VObject_Element_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');
<?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. */ require_once '../../../lib/base.php'; $l10n = new OC_L10N('calendar'); if (!OC_USER::isLoggedIn()) { die("<script type=\"text/javascript\">document.location = oc_webroot;</script>"); } $calendarcolor_options = array('ff0000', '00ff00', 'ffff00', '808000', 'ffa500', 'ff7f50', 'ee82ee', 'ecc255'); OC_JSON::checkAppEnabled('calendar'); $calendar = OC_Calendar_Calendar::findCalendar($_GET['calendarid']); $tmpl = new OC_Template("calendar", "part.editcalendar"); $tmpl->assign('new', false); $tmpl->assign('calendarcolor_options', $calendarcolor_options); $tmpl->assign('calendar', $calendar); $tmpl->printPage();
public static function validateRequest($request) { $errnum = 0; $errarr = array('title' => 'false', 'cal' => 'false', 'from' => 'false', 'fromtime' => 'false', 'to' => 'false', 'totime' => 'false', 'endbeforestart' => 'false'); if ($request['title'] == '') { $errarr['title'] = 'true'; $errnum++; } $calendar = OC_Calendar_Calendar::findCalendar($request['calendar']); if ($calendar['userid'] != OC_User::getUser()) { $errarr['cal'] = 'true'; $errnum++; } if (isset($request['categories']) && !is_array($request['categories'])) { $errors['categories'] = $l10n->t('Not an array'); } $fromday = substr($request['from'], 0, 2); $frommonth = substr($request['from'], 3, 2); $fromyear = substr($request['from'], 6, 4); if (!checkdate($frommonth, $fromday, $fromyear)) { $errarr['from'] = 'true'; $errnum++; } $allday = isset($request['allday']); if (!$allday && self::checkTime(urldecode($request['fromtime']))) { $errarr['fromtime'] = 'true'; $errnum++; } $today = substr($request['to'], 0, 2); $tomonth = substr($request['to'], 3, 2); $toyear = substr($request['to'], 6, 4); if (!checkdate($tomonth, $today, $toyear)) { $errarr['to'] = 'true'; $errnum++; } if (!$allday && self::checkTime(urldecode($request['totime']))) { $errarr['totime'] = 'true'; $errnum++; } if ($today < $fromday && $frommonth == $tomonth && $fromyear == $toyear) { $errarr['endbeforestart'] = 'true'; $errnum++; } if ($today == $fromday && $frommonth > $tomonth && $fromyear == $toyear) { $errarr['endbeforestart'] = 'true'; $errnum++; } if ($today == $fromday && $frommonth == $tomonth && $fromyear > $toyear) { $errarr['endbeforestart'] = 'true'; $errnum++; } if ($fromday == $today && $frommonth == $tomonth && $fromyear == $toyear) { list($tohours, $tominutes) = explode(':', $request['totime']); list($fromhours, $fromminutes) = explode(':', $request['fromtime']); if ($tohours < $fromhours) { $errarr['endbeforestart'] = 'true'; $errnum++; } if ($tohours == $fromhours && $tominutes < $fromminutes) { $errarr['endbeforestart'] = 'true'; $errnum++; } } if ($errnum) { return $errarr; } return false; }
<?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. */ require_once "../../../lib/base.php"; if (!OC_USER::isLoggedIn()) { die("<script type=\"text/javascript\">document.location = oc_webroot;</script>"); } OC_JSON::checkAppEnabled('calendar'); $calendarid = $_POST['calendarid']; OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']); $cal = OC_Calendar_Calendar::findCalendar($calendarid); echo $cal['active'];