summaryrefslogtreecommitdiffstats
path: root/apps/calendar/ajax
diff options
context:
space:
mode:
authorFrank Karlitschek <frank@owncloud.org>2012-08-26 17:30:07 +0200
committerFrank Karlitschek <frank@owncloud.org>2012-08-26 17:30:07 +0200
commit72e9a2ce57ee88503db83614cec5ccda71f0b58e (patch)
tree8bc301ca22d9ca08ea54426bcb61f62bd1c1cb75 /apps/calendar/ajax
parent32bad688bdb4fea55eba9d4255fc55f1c60a0aca (diff)
downloadnextcloud-server-72e9a2ce57ee88503db83614cec5ccda71f0b58e.tar.gz
nextcloud-server-72e9a2ce57ee88503db83614cec5ccda71f0b58e.zip
moved to apps repository
Diffstat (limited to 'apps/calendar/ajax')
-rw-r--r--apps/calendar/ajax/cache/rescan.php15
-rw-r--r--apps/calendar/ajax/cache/status.php22
-rw-r--r--apps/calendar/ajax/calendar/activation.php25
-rw-r--r--apps/calendar/ajax/calendar/delete.php25
-rw-r--r--apps/calendar/ajax/calendar/edit.form.php19
-rw-r--r--apps/calendar/ajax/calendar/edit.php24
-rw-r--r--apps/calendar/ajax/calendar/new.form.php22
-rw-r--r--apps/calendar/ajax/calendar/new.php42
-rw-r--r--apps/calendar/ajax/calendar/overview.php12
-rw-r--r--apps/calendar/ajax/calendar/update.php49
-rw-r--r--apps/calendar/ajax/categories/rescan.php43
-rw-r--r--apps/calendar/ajax/changeview.php21
-rw-r--r--apps/calendar/ajax/event/delete.php21
-rw-r--r--apps/calendar/ajax/event/edit.form.php272
-rw-r--r--apps/calendar/ajax/event/edit.php46
-rw-r--r--apps/calendar/ajax/event/move.php47
-rw-r--r--apps/calendar/ajax/event/new.form.php75
-rw-r--r--apps/calendar/ajax/event/new.php25
-rw-r--r--apps/calendar/ajax/event/resize.php39
-rw-r--r--apps/calendar/ajax/events.php30
-rw-r--r--apps/calendar/ajax/import/calendarcheck.php18
-rw-r--r--apps/calendar/ajax/import/dialog.php13
-rw-r--r--apps/calendar/ajax/import/dropimport.php32
-rw-r--r--apps/calendar/ajax/import/import.php151
-rw-r--r--apps/calendar/ajax/settings/getfirstday.php11
-rw-r--r--apps/calendar/ajax/settings/gettimezonedetection.php11
-rw-r--r--apps/calendar/ajax/settings/guesstimezone.php26
-rw-r--r--apps/calendar/ajax/settings/setfirstday.php16
-rw-r--r--apps/calendar/ajax/settings/settimeformat.php16
-rw-r--r--apps/calendar/ajax/settings/settimezone.php26
-rw-r--r--apps/calendar/ajax/settings/timeformat.php11
-rw-r--r--apps/calendar/ajax/settings/timezonedetection.php16
-rw-r--r--apps/calendar/ajax/share/activation.php11
-rw-r--r--apps/calendar/ajax/share/changepermission.php50
-rw-r--r--apps/calendar/ajax/share/dropdown.php18
-rw-r--r--apps/calendar/ajax/share/share.php61
-rw-r--r--apps/calendar/ajax/share/unshare.php53
37 files changed, 0 insertions, 1414 deletions
diff --git a/apps/calendar/ajax/cache/rescan.php b/apps/calendar/ajax/cache/rescan.php
deleted file mode 100644
index 3417f1ae4b4..00000000000
--- a/apps/calendar/ajax/cache/rescan.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <georg@ownCloud.com>
- * 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');
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-foreach($calendars as $calendar){
- OC_Calendar_Repeat::cleancalendar($calendar['id']);
- OC_Calendar_Repeat::generatecalendar($calendar['id']);
-}
-OCP\JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/cache/status.php b/apps/calendar/ajax/cache/status.php
deleted file mode 100644
index d2806d47895..00000000000
--- a/apps/calendar/ajax/cache/status.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <georg@ownCloud.com>
- * 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');
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-$allcached = true;
-foreach($calendars as $calendar){
- if(!OC_Calendar_Repeat::is_calendar_cached($calendar['id'])){
- $allcached = false;
- }
-}
-$l = new OC_L10N('calendar');
-if(!$allcached){
- OCP\JSON::error(array('message'=>'Not all calendars are completely cached', 'l10n'=>$l->t('Not all calendars are completely cached')));
-}else{
- OCP\JSON::success(array('message'=>'Everything seems to be completely cached', 'l10n'=>$l->t('Everything seems to be completely cached')));
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/activation.php b/apps/calendar/ajax/calendar/activation.php
deleted file mode 100644
index f4aadc5b017..00000000000
--- a/apps/calendar/ajax/calendar/activation.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-$calendarid = $_POST['calendarid'];
-$calendar = OC_Calendar_App::getCalendar($calendarid, true);
-if(!$calendar){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
-$calendar = OC_Calendar_App::getCalendar($calendarid);
-OCP\JSON::success(array(
- 'active' => $calendar['active'],
- 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
-)); \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/delete.php b/apps/calendar/ajax/calendar/delete.php
deleted file mode 100644
index 089255cae39..00000000000
--- a/apps/calendar/ajax/calendar/delete.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-$cal = $_POST["calendarid"];
-$calendar = OC_Calendar_App::getCalendar($cal, true);
-if(!$calendar){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-$del = OC_Calendar_Calendar::deleteCalendar($cal);
-if($del == true){
- OCP\JSON::success();
-}else{
- OCP\JSON::error(array('error'=>'dberror'));
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/edit.form.php b/apps/calendar/ajax/calendar/edit.form.php
deleted file mode 100644
index 3916c527637..00000000000
--- a/apps/calendar/ajax/calendar/edit.form.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-
-$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
-$calendar = OC_Calendar_App::getCalendar($_POST['calendarid']);
-$tmpl = new OCP\Template("calendar", "part.editcalendar");
-$tmpl->assign('new', false);
-$tmpl->assign('calendarcolor_options', $calendarcolor_options);
-$tmpl->assign('calendar', $calendar);
-$tmpl->printPage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/edit.php b/apps/calendar/ajax/calendar/edit.php
deleted file mode 100644
index 3f69666b58c..00000000000
--- a/apps/calendar/ajax/calendar/edit.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
-$calendar = OC_Calendar_App::getCalendar($_GET['calendarid'], true);
-if(!$calendar){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-$tmpl = new OCP\Template("calendar", "part.editcalendar");
-$tmpl->assign('new', false);
-$tmpl->assign('calendarcolor_options', $calendarcolor_options);
-$tmpl->assign('calendar', $calendar);
-$tmpl->printPage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/new.form.php b/apps/calendar/ajax/calendar/new.form.php
deleted file mode 100644
index 0783b6168f8..00000000000
--- a/apps/calendar/ajax/calendar/new.form.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-$calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions();
-$calendar = array(
- 'id' => 'new',
- 'displayname' => '',
- 'calendarcolor' => '',
-);
-$tmpl = new OCP\Template('calendar', 'part.editcalendar');
-$tmpl->assign('new', true);
-$tmpl->assign('calendarcolor_options', $calendarcolor_options);
-$tmpl->assign('calendar', $calendar);
-$tmpl->printPage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/new.php b/apps/calendar/ajax/calendar/new.php
deleted file mode 100644
index 67d12822378..00000000000
--- a/apps/calendar/ajax/calendar/new.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?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.
- */
-
-// Check if we are a user
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-if(trim($_POST['name']) == ''){
- OCP\JSON::error(array('message'=>'empty'));
- exit;
-}
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-foreach($calendars as $cal){
- if($cal['displayname'] == $_POST['name']){
- OCP\JSON::error(array('message'=>'namenotavailable'));
- exit;
- }
-}
-
-$userid = OCP\USER::getUser();
-$calendarid = OC_Calendar_Calendar::addCalendar($userid, strip_tags($_POST['name']), 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
-OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
-
-$calendar = OC_Calendar_Calendar::find($calendarid);
-$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
-$tmpl->assign('calendar', $calendar);
-if(OC_Calendar_Share::allUsersSharedwith($calendarid, OC_Calendar_Share::CALENDAR) == array()){
- $shared = false;
-}else{
- $shared = true;
-}
-$tmpl->assign('shared', $shared);
-OCP\JSON::success(array(
- 'page' => $tmpl->fetchPage(),
- 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
-));
diff --git a/apps/calendar/ajax/calendar/overview.php b/apps/calendar/ajax/calendar/overview.php
deleted file mode 100644
index 1d8e49ea5f2..00000000000
--- a/apps/calendar/ajax/calendar/overview.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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.
- */
-$l10n = OC_L10N::get('calendar');
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-$output = new OCP\Template("calendar", "part.choosecalendar");
-$output -> printpage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/calendar/update.php b/apps/calendar/ajax/calendar/update.php
deleted file mode 100644
index c09b1008c9c..00000000000
--- a/apps/calendar/ajax/calendar/update.php
+++ /dev/null
@@ -1,49 +0,0 @@
-<?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.
- */
-
-
-
-// Check if we are a user
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-if(trim($_POST['name']) == ''){
- OCP\JSON::error(array('message'=>'empty'));
- exit;
-}
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-foreach($calendars as $cal){
- if($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']){
- OCP\JSON::error(array('message'=>'namenotavailable'));
- exit;
- }
-}
-
-$calendarid = $_POST['id'];
-$calendar = OC_Calendar_App::getCalendar($calendarid, true);
-if(!$calendar){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-OC_Calendar_Calendar::editCalendar($calendarid, strip_tags($_POST['name']), null, null, null, $_POST['color']);
-OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
-
-$calendar = OC_Calendar_App::getCalendar($calendarid);
-$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
-$tmpl->assign('calendar', $calendar);
-if(OC_Calendar_Share::allUsersSharedwith($calendarid, OC_Calendar_Share::CALENDAR) == array()){
- $shared = false;
-}else{
- $shared = true;
-}
-$tmpl->assign('shared', $shared);
-OCP\JSON::success(array(
- 'page' => $tmpl->fetchPage(),
- 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar),
-));
diff --git a/apps/calendar/ajax/categories/rescan.php b/apps/calendar/ajax/categories/rescan.php
deleted file mode 100644
index 08c32865b6f..00000000000
--- a/apps/calendar/ajax/categories/rescan.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
- * 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();
-
-foreach ($_POST as $key=>$element) {
- debug('_POST: '.$key.'=>'.print_r($element, true));
-}
-
-function bailOut($msg) {
- OCP\JSON::error(array('data' => array('message' => $msg)));
- OCP\Util::writeLog('calendar','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
- exit();
-}
-function debug($msg) {
- OCP\Util::writeLog('calendar','ajax/categories/rescan.php: '.$msg, OCP\Util::DEBUG);
-}
-
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-if(count($calendars) == 0) {
- bailOut(OC_Calendar_App::$l10n->t('No calendars found.'));
-}
-$events = array();
-foreach($calendars as $calendar) {
- $calendar_events = OC_Calendar_Object::all($calendar['id']);
- $events = $events + $calendar_events;
-}
-if(count($events) == 0) {
- bailOut(OC_Calendar_App::$l10n->t('No events found.'));
-}
-
-OC_Calendar_App::scanCategories($events);
-$categories = OC_Calendar_App::getCategoryOptions();
-
-OCP\JSON::success(array('data' => array('categories'=>$categories))); \ No newline at end of file
diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php
deleted file mode 100644
index 819025543a5..00000000000
--- a/apps/calendar/ajax/changeview.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-$view = $_POST['v'];
-switch($view){
- case 'agendaWeek':
- case 'month';
- case 'list':
- break;
- default:
- OCP\JSON::error(array('message'=>'unexpected parameter: ' . $view));
- exit;
-}
-OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
-OCP\JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/event/delete.php b/apps/calendar/ajax/event/delete.php
deleted file mode 100644
index 17e45c001e8..00000000000
--- a/apps/calendar/ajax/event/delete.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-$id = $_POST['id'];
-$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
-if($access != 'owner' && $access != 'rw'){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-$result = OC_Calendar_Object::delete($id);
-OCP\JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/event/edit.form.php b/apps/calendar/ajax/event/edit.form.php
deleted file mode 100644
index 27512481538..00000000000
--- a/apps/calendar/ajax/event/edit.form.php
+++ /dev/null
@@ -1,272 +0,0 @@
-<?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.
- */
-
-
-
-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, 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::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"));
- $dtend->setDateTime($newDT);
- 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;
- break;
- case Sabre_VObject_Property_DateTime::DATE:
- $startdate = $dtstart->getDateTime()->format('d-m-Y');
- $starttime = '';
- $dtend->getDateTime()->modify('-1 day');
- $enddate = $dtend->getDateTime()->format('d-m-Y');
- $endtime = '';
- $allday = true;
- break;
-}
-
-$summary = $vevent->getAsString('SUMMARY');
-$location = $vevent->getAsString('LOCATION');
-$categories = $vevent->getAsString('CATEGORIES');
-$description = $vevent->getAsString('DESCRIPTION');
-$last_modified = $vevent->__get('LAST-MODIFIED');
-if ($last_modified){
- $lastmodified = $last_modified->getDateTime()->format('U');
-}else{
- $lastmodified = 0;
-}
-if($data['repeating'] == 1){
- $rrule = explode(';', $vevent->getAsString('RRULE'));
- $rrulearr = array();
- foreach($rrule as $rule){
- list($attr, $val) = explode('=', $rule);
- $rrulearr[$attr] = $val;
- }
- if(!isset($rrulearr['INTERVAL']) || $rrulearr['INTERVAL'] == ''){
- $rrulearr['INTERVAL'] = 1;
- }
- if(array_key_exists('BYDAY', $rrulearr)){
- if(substr_count($rrulearr['BYDAY'], ',') == 0){
- if(strlen($rrulearr['BYDAY']) == 2){
- $repeat['weekdays'] = array($rrulearr['BYDAY']);
- }elseif(strlen($rrulearr['BYDAY']) == 3){
- $repeat['weekofmonth'] = substr($rrulearr['BYDAY'], 0, 1);
- $repeat['weekdays'] = array(substr($rrulearr['BYDAY'], 1, 2));
- }elseif(strlen($rrulearr['BYDAY']) == 4){
- $repeat['weekofmonth'] = substr($rrulearr['BYDAY'], 0, 2);
- $repeat['weekdays'] = array(substr($rrulearr['BYDAY'], 2, 2));
- }
- }else{
- $byday_days = explode(',', $rrulearr['BYDAY']);
- foreach($byday_days as $byday_day){
- if(strlen($byday_day) == 2){
- $repeat['weekdays'][] = $byday_day;
- }elseif(strlen($byday_day) == 3){
- $repeat['weekofmonth'] = substr($byday_day , 0, 1);
- $repeat['weekdays'][] = substr($byday_day , 1, 2);
- }elseif(strlen($byday_day) == 4){
- $repeat['weekofmonth'] = substr($byday_day , 0, 2);
- $repeat['weekdays'][] = substr($byday_day , 2, 2);
- }
- }
- }
- }
- if(array_key_exists('BYMONTHDAY', $rrulearr)){
- if(substr_count($rrulearr['BYMONTHDAY'], ',') == 0){
- $repeat['bymonthday'][] = $rrulearr['BYMONTHDAY'];
- }else{
- $bymonthdays = explode(',', $rrulearr['BYMONTHDAY']);
- foreach($bymonthdays as $bymonthday){
- $repeat['bymonthday'][] = $bymonthday;
- }
- }
- }
- if(array_key_exists('BYYEARDAY', $rrulearr)){
- if(substr_count($rrulearr['BYYEARDAY'], ',') == 0){
- $repeat['byyearday'][] = $rrulearr['BYYEARDAY'];
- }else{
- $byyeardays = explode(',', $rrulearr['BYYEARDAY']);
- foreach($byyeardays as $yearday){
- $repeat['byyearday'][] = $yearday;
- }
- }
- }
- if(array_key_exists('BYWEEKNO', $rrulearr)){
- if(substr_count($rrulearr['BYWEEKNO'], ',') == 0){
- $repeat['byweekno'][] = (string) $rrulearr['BYWEEKNO'];
- }else{
- $byweekno = explode(',', $rrulearr['BYWEEKNO']);
- foreach($byweekno as $weekno){
- $repeat['byweekno'][] = (string) $weekno;
- }
- }
- }
- if(array_key_exists('BYMONTH', $rrulearr)){
- $months = OC_Calendar_App::getByMonthOptions();
- if(substr_count($rrulearr['BYMONTH'], ',') == 0){
- $repeat['bymonth'][] = $months[$month];
- }else{
- $bymonth = explode(',', $rrulearr['BYMONTH']);
- foreach($bymonth as $month){
- $repeat['bymonth'][] = $months[$month];
- }
- }
- }
- switch($rrulearr['FREQ']){
- case 'DAILY':
- $repeat['repeat'] = 'daily';
- break;
- case 'WEEKLY':
- if($rrulearr['INTERVAL'] % 2 == 0){
- $repeat['repeat'] = 'biweekly';
- $rrulearr['INTERVAL'] = $rrulearr['INTERVAL'] / 2;
- }elseif($rrulearr['BYDAY'] == 'MO,TU,WE,TH,FR'){
- $repeat['repeat'] = 'weekday';
- }else{
- $repeat['repeat'] = 'weekly';
- }
- break;
- case 'MONTHLY':
- $repeat['repeat'] = 'monthly';
- if(array_key_exists('BYDAY', $rrulearr)){
- $repeat['month'] = 'weekday';
- }else{
- $repeat['month'] = 'monthday';
- }
- break;
- case 'YEARLY':
- $repeat['repeat'] = 'yearly';
- if(array_key_exists('BYMONTH', $rrulearr)){
- $repeat['year'] = 'bydaymonth';
- }elseif(array_key_exists('BYWEEKNO', $rrulearr)){
- $repeat['year'] = 'byweekno';
- }else{
- $repeat['year'] = 'byyearday';
- }
- }
- $repeat['interval'] = $rrulearr['INTERVAL'];
- if(array_key_exists('COUNT', $rrulearr)){
- $repeat['end'] = 'count';
- $repeat['count'] = $rrulearr['COUNT'];
- }elseif(array_key_exists('UNTIL', $rrulearr)){
- $repeat['end'] = 'date';
- $endbydate_day = substr($rrulearr['UNTIL'], 6, 2);
- $endbydate_month = substr($rrulearr['UNTIL'], 4, 2);
- $endbydate_year = substr($rrulearr['UNTIL'], 0, 4);
- $repeat['date'] = $endbydate_day . '-' . $endbydate_month . '-' . $endbydate_year;
- }else{
- $repeat['end'] = 'never';
- }
- if(array_key_exists('weekdays', $repeat)){
- $repeat_weekdays_ = array();
- $days = OC_Calendar_App::getWeeklyOptions();
- foreach($repeat['weekdays'] as $weekday){
- $repeat_weekdays_[] = $days[$weekday];
- }
- $repeat['weekdays'] = $repeat_weekdays_;
- }
-}else{
- $repeat['repeat'] = 'doesnotrepeat';
-}
-if($access == 'owner'){
- $calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-}else{
- $calendar_options = array(OC_Calendar_App::getCalendar($data['calendarid'], false));
-}
-$category_options = OC_Calendar_App::getCategoryOptions();
-$repeat_options = OC_Calendar_App::getRepeatOptions();
-$repeat_end_options = OC_Calendar_App::getEndOptions();
-$repeat_month_options = OC_Calendar_App::getMonthOptions();
-$repeat_year_options = OC_Calendar_App::getYearOptions();
-$repeat_weekly_options = OC_Calendar_App::getWeeklyOptions();
-$repeat_weekofmonth_options = OC_Calendar_App::getWeekofMonth();
-$repeat_byyearday_options = OC_Calendar_App::getByYearDayOptions();
-$repeat_bymonth_options = OC_Calendar_App::getByMonthOptions();
-$repeat_byweekno_options = OC_Calendar_App::getByWeekNoOptions();
-$repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions();
-
-if($access == 'owner' || $access == 'rw'){
- $tmpl = new OCP\Template('calendar', 'part.editevent');
-}elseif($access == 'r'){
- $tmpl = new OCP\Template('calendar', 'part.showevent');
-}
-
-$tmpl->assign('eventid', $id);
-$tmpl->assign('access', $access);
-$tmpl->assign('lastmodified', $lastmodified);
-$tmpl->assign('calendar_options', $calendar_options);
-$tmpl->assign('repeat_options', $repeat_options);
-$tmpl->assign('repeat_month_options', $repeat_month_options);
-$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
-$tmpl->assign('repeat_end_options', $repeat_end_options);
-$tmpl->assign('repeat_year_options', $repeat_year_options);
-$tmpl->assign('repeat_byyearday_options', $repeat_byyearday_options);
-$tmpl->assign('repeat_bymonth_options', $repeat_bymonth_options);
-$tmpl->assign('repeat_byweekno_options', $repeat_byweekno_options);
-$tmpl->assign('repeat_bymonthday_options', $repeat_bymonthday_options);
-$tmpl->assign('repeat_weekofmonth_options', $repeat_weekofmonth_options);
-
-$tmpl->assign('title', $summary);
-$tmpl->assign('location', $location);
-$tmpl->assign('categories', $categories);
-$tmpl->assign('calendar', $data['calendarid']);
-$tmpl->assign('allday', $allday);
-$tmpl->assign('startdate', $startdate);
-$tmpl->assign('starttime', $starttime);
-$tmpl->assign('enddate', $enddate);
-$tmpl->assign('endtime', $endtime);
-$tmpl->assign('description', $description);
-
-$tmpl->assign('repeat', $repeat['repeat']);
-if($repeat['repeat'] != 'doesnotrepeat'){
- $tmpl->assign('repeat_month', $repeat['month']);
- $tmpl->assign('repeat_weekdays', $repeat['weekdays']);
- $tmpl->assign('repeat_interval', $repeat['interval']);
- $tmpl->assign('repeat_end', $repeat['end']);
- $tmpl->assign('repeat_count', $repeat['count']);
- $tmpl->assign('repeat_weekofmonth', $repeat['weekofmonth']);
- $tmpl->assign('repeat_date', $repeat['date']);
- $tmpl->assign('repeat_year', $repeat['year']);
- $tmpl->assign('repeat_byyearday', $repeat['byyearday']);
- $tmpl->assign('repeat_bymonthday', $repeat['bymonthday']);
- $tmpl->assign('repeat_bymonth', $repeat['bymonth']);
- $tmpl->assign('repeat_byweekno', $repeat['byweekno']);
-} else {
- $tmpl->assign('repeat_month', 'monthday');
- $tmpl->assign('repeat_weekdays', array());
- $tmpl->assign('repeat_interval', 1);
- $tmpl->assign('repeat_end', 'never');
- $tmpl->assign('repeat_count', '10');
- $tmpl->assign('repeat_weekofmonth', 'auto');
- $tmpl->assign('repeat_date', '');
- $tmpl->assign('repeat_year', 'bydate');
-}
-$tmpl->printpage();
diff --git a/apps/calendar/ajax/event/edit.php b/apps/calendar/ajax/event/edit.php
deleted file mode 100644
index db78bf6e5e0..00000000000
--- a/apps/calendar/ajax/event/edit.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?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.
- */
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-$id = $_POST['id'];
-
-if(!array_key_exists('calendar', $_POST)){
- $cal = OC_Calendar_Object::getCalendarid($id);
- $_POST['calendar'] = $cal;
-}else{
- $cal = $_POST['calendar'];
-}
-
-$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
-if($access != 'owner' && $access != 'rw'){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-
-$errarr = OC_Calendar_Object::validateRequest($_POST);
-if($errarr){
- //show validate errors
- OCP\JSON::error($errarr);
- exit;
-}else{
- $data = OC_Calendar_App::getEventObject($id, false, false);
- $vcalendar = OC_VObject::parse($data['calendardata']);
-
- OC_Calendar_App::isNotModified($vcalendar->VEVENT, $_POST['lastmodified']);
- OC_Calendar_Object::updateVCalendarFromRequest($_POST, $vcalendar);
-
- OC_Calendar_Object::edit($id, $vcalendar->serialize());
- if ($data['calendarid'] != $cal) {
- OC_Calendar_Object::moveToCalendar($id, $cal);
- }
- OCP\JSON::success();
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/event/move.php b/apps/calendar/ajax/event/move.php
deleted file mode 100644
index f4e2b36376d..00000000000
--- a/apps/calendar/ajax/event/move.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?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.
- */
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-
-$id = $_POST['id'];
-$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
-if($access != 'owner' && $access != 'rw'){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
-$vevent = $vcalendar->VEVENT;
-
-$allday = $_POST['allDay'];
-$delta = new DateInterval('P0D');
-$delta->d = $_POST['dayDelta'];
-$delta->i = $_POST['minuteDelta'];
-OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']);
-
-$dtstart = $vevent->DTSTART;
-$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
-$start_type = $dtstart->getDateType();
-$end_type = $dtend->getDateType();
-if ($allday && $start_type != Sabre_VObject_Property_DateTime::DATE){
- $start_type = $end_type = Sabre_VObject_Property_DateTime::DATE;
- $dtend->setDateTime($dtend->getDateTime()->modify('+1 day'), $end_type);
-}
-if (!$allday && $start_type == Sabre_VObject_Property_DateTime::DATE){
- $start_type = $end_type = Sabre_VObject_Property_DateTime::LOCALTZ;
-}
-$dtstart->setDateTime($dtstart->getDateTime()->add($delta), $start_type);
-$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
-unset($vevent->DURATION);
-
-$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
-$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
-
-$result = OC_Calendar_Object::edit($id, $vcalendar->serialize());
-$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
-OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); \ No newline at end of file
diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php
deleted file mode 100644
index db04cdf2d49..00000000000
--- a/apps/calendar/ajax/event/new.form.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?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.
- */
-
-
-
-if(!OCP\User::isLoggedIn()) {
- die('<script type="text/javascript">document.location = oc_webroot;</script>');
-}
-OCP\JSON::checkAppEnabled('calendar');
-
-if (!isset($_POST['start'])){
- OCP\JSON::error();
- die;
-}
-$start = $_POST['start'];
-$end = $_POST['end'];
-$allday = $_POST['allday'];
-
-if (!$end){
- $duration = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'duration', '60');
- $end = $start + ($duration * 60);
-}
-$start = new DateTime('@'.$start);
-$end = new DateTime('@'.$end);
-$timezone = OC_Calendar_App::getTimezone();
-$start->setTimezone(new DateTimeZone($timezone));
-$end->setTimezone(new DateTimeZone($timezone));
-
-$calendar_options = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
-$repeat_options = OC_Calendar_App::getRepeatOptions();
-$repeat_end_options = OC_Calendar_App::getEndOptions();
-$repeat_month_options = OC_Calendar_App::getMonthOptions();
-$repeat_year_options = OC_Calendar_App::getYearOptions();
-$repeat_weekly_options = OC_Calendar_App::getWeeklyOptions();
-$repeat_weekofmonth_options = OC_Calendar_App::getWeekofMonth();
-$repeat_byyearday_options = OC_Calendar_App::getByYearDayOptions();
-$repeat_bymonth_options = OC_Calendar_App::getByMonthOptions();
-$repeat_byweekno_options = OC_Calendar_App::getByWeekNoOptions();
-$repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions();
-
-$tmpl = new OCP\Template('calendar', 'part.newevent');
-$tmpl->assign('access', 'owner');
-$tmpl->assign('calendar_options', $calendar_options);
-$tmpl->assign('repeat_options', $repeat_options);
-$tmpl->assign('repeat_month_options', $repeat_month_options);
-$tmpl->assign('repeat_weekly_options', $repeat_weekly_options);
-$tmpl->assign('repeat_end_options', $repeat_end_options);
-$tmpl->assign('repeat_year_options', $repeat_year_options);
-$tmpl->assign('repeat_byyearday_options', $repeat_byyearday_options);
-$tmpl->assign('repeat_bymonth_options', $repeat_bymonth_options);
-$tmpl->assign('repeat_byweekno_options', $repeat_byweekno_options);
-$tmpl->assign('repeat_bymonthday_options', $repeat_bymonthday_options);
-$tmpl->assign('repeat_weekofmonth_options', $repeat_weekofmonth_options);
-
-$tmpl->assign('eventid', 'new');
-$tmpl->assign('startdate', $start->format('d-m-Y'));
-$tmpl->assign('starttime', $start->format('H:i'));
-$tmpl->assign('enddate', $end->format('d-m-Y'));
-$tmpl->assign('endtime', $end->format('H:i'));
-$tmpl->assign('allday', $allday);
-$tmpl->assign('repeat', 'doesnotrepeat');
-$tmpl->assign('repeat_month', 'monthday');
-$tmpl->assign('repeat_weekdays', array());
-$tmpl->assign('repeat_interval', 1);
-$tmpl->assign('repeat_end', 'never');
-$tmpl->assign('repeat_count', '10');
-$tmpl->assign('repeat_weekofmonth', 'auto');
-$tmpl->assign('repeat_date', '');
-$tmpl->assign('repeat_year', 'bydate');
-$tmpl->printpage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/event/new.php b/apps/calendar/ajax/event/new.php
deleted file mode 100644
index bc0439cc315..00000000000
--- a/apps/calendar/ajax/event/new.php
+++ /dev/null
@@ -1,25 +0,0 @@
-<?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.
- */
-
-
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-$errarr = OC_Calendar_Object::validateRequest($_POST);
-if($errarr){
- //show validate errors
- OCP\JSON::error($errarr);
- exit;
-}else{
- $cal = $_POST['calendar'];
- $vcalendar = OC_Calendar_Object::createVCalendarFromRequest($_POST);
- $result = OC_Calendar_Object::add($cal, $vcalendar->serialize());
- OCP\JSON::success();
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/event/resize.php b/apps/calendar/ajax/event/resize.php
deleted file mode 100644
index 15b687b55da..00000000000
--- a/apps/calendar/ajax/event/resize.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?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.
- */
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-
-$id = $_POST['id'];
-
-$access = OC_Calendar_App::getaccess($id, OC_Calendar_App::EVENT);
-if($access != 'owner' && $access != 'rw'){
- OCP\JSON::error(array('message'=>'permission denied'));
- exit;
-}
-
-$vcalendar = OC_Calendar_App::getVCalendar($id, false, false);
-$vevent = $vcalendar->VEVENT;
-
-$delta = new DateInterval('P0D');
-$delta->d = $_POST['dayDelta'];
-$delta->i = $_POST['minuteDelta'];
-
-OC_Calendar_App::isNotModified($vevent, $_POST['lastmodified']);
-
-$dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent);
-$end_type = $dtend->getDateType();
-$dtend->setDateTime($dtend->getDateTime()->add($delta), $end_type);
-unset($vevent->DURATION);
-
-$vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Property_DateTime::UTC);
-$vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Property_DateTime::UTC);
-
-OC_Calendar_Object::edit($id, $vcalendar->serialize());
-$lastmodified = $vevent->__get('LAST-MODIFIED')->getDateTime();
-OCP\JSON::success(array('lastmodified'=>(int)$lastmodified->format('U'))); \ No newline at end of file
diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php
deleted file mode 100644
index ae55cbc02db..00000000000
--- a/apps/calendar/ajax/events.php
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011, 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\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-session_write_close();
-
-// Look for the calendar id
-$calendar_id = null;
-if (strval(intval($_GET['calendar_id'])) == strval($_GET['calendar_id'])) { // integer for sure.
- $id = intval($_GET['calendar_id']);
- $calendarrow = OC_Calendar_App::getCalendar($id, true, false); // Let's at least security check otherwise we might as well use OC_Calendar_Calendar::find()
- if($calendarrow !== false && is_int($calendar_id['userid']) && $id == $calendar_id['userid']) {
- $calendar_id = $id;
- }
-}
-$calendar_id = (is_null($calendar_id)?strip_tags($_GET['calendar_id']):$calendar_id);
-
-$start = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['start']):new DateTime('@' . $_GET['start']);
-$end = (version_compare(PHP_VERSION, '5.3.0', '>='))?DateTime::createFromFormat('U', $_GET['end']):new DateTime('@' . $_GET['end']);
-$events = OC_Calendar_App::getrequestedEvents($_GET['calendar_id'], $start, $end);
-$output = array();
-foreach($events as $event){
- $output = array_merge($output, OC_Calendar_App::generateEventOutput($event, $start, $end));
-}
-OCP\JSON::encodedPrint(OCP\Util::sanitizeHTML($output));
diff --git a/apps/calendar/ajax/import/calendarcheck.php b/apps/calendar/ajax/import/calendarcheck.php
deleted file mode 100644
index a91bab70573..00000000000
--- a/apps/calendar/ajax/import/calendarcheck.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?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\JSON::checkLoggedIn();
-OCP\App::checkAppEnabled('calendar');
-$calname = strip_tags($_POST['calname']);
-$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser());
-foreach($calendars as $calendar){
- if($calendar['displayname'] == $calname){
- OCP\JSON::success(array('message'=>'exists'));
- exit;
- }
-}
-OCP\JSON::error(); \ No newline at end of file
diff --git a/apps/calendar/ajax/import/dialog.php b/apps/calendar/ajax/import/dialog.php
deleted file mode 100644
index 18fe226172c..00000000000
--- a/apps/calendar/ajax/import/dialog.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?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\JSON::checkLoggedIn();
-OCP\App::checkAppEnabled('calendar');
-$tmpl = new OCP\Template('calendar', 'part.import');
-$tmpl->assign('path', $_POST['path']);
-$tmpl->assign('filename', $_POST['filename']);
-$tmpl->printpage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/import/dropimport.php b/apps/calendar/ajax/import/dropimport.php
deleted file mode 100644
index f46e7314098..00000000000
--- a/apps/calendar/ajax/import/dropimport.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-$data = $_POST['data'];
-$data = explode(',', $data);
-$data = end($data);
-$data = base64_decode($data);
-OCP\JSON::checkLoggedIn();
-OCP\App::checkAppEnabled('calendar');
-$import = new OC_Calendar_Import($data);
-$import->setUserID(OCP\User::getUser());
-$import->setTimeZone(OC_Calendar_App::$tz);
-$import->disableProgressCache();
-if(!$import->isValid()){
- OCP\JSON::error();
- exit;
-}
-$newcalendarname = strip_tags($import->createCalendarName());
-$newid = OC_Calendar_Calendar::addCalendar(OCP\User::getUser(),$newcalendarname,'VEVENT,VTODO,VJOURNAL',null,0,$import->createCalendarColor());
-$import->setCalendarID($newid);
-$import->import();
-$count = $import->getCount();
-if($count == 0){
- OC_Calendar_Calendar::deleteCalendar($newid);
- OCP\JSON::error(array('message'=>OC_Calendar_App::$l10n->t('The file contained either no events or all events are already saved in your calendar.')));
-}else{
- OCP\JSON::success(array('message'=>$count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in the new calendar') . ' ' . $newcalendarname, 'eventSource'=>OC_Calendar_Calendar::getEventSourceInfo(OC_Calendar_Calendar::find($newid))));
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/import/import.php b/apps/calendar/ajax/import/import.php
deleted file mode 100644
index b1dfc464d00..00000000000
--- a/apps/calendar/ajax/import/import.php
+++ /dev/null
@@ -1,151 +0,0 @@
-<?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\JSON::checkLoggedIn();
-OCP\App::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-session_write_close();
-if (isset($_POST['progresskey']) && isset($_POST['getprogress'])) {
- echo OCP\JSON::success(array('percent'=>OC_Cache::get($_POST['progresskey'])));
- exit;
-}
-$file = OC_Filesystem::file_get_contents($_POST['path'] . '/' . $_POST['file']);
-if(!$file){
- OCP\JSON::error(array('error'=>'404'));
-}
-$import = new OC_Calendar_Import($file);
-$import->setUserID(OCP\User::getUser());
-$import->setTimeZone(OC_Calendar_App::$tz);
-$import->enableProgressCache();
-$import->setProgresskey($_POST['progresskey']);
-if(!$import->isValid()){
- OCP\JSON::error(array('error'=>'notvalid'));
- exit;
-}
-$newcal = false;
-if($_POST['method'] == 'new'){
- $calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser());
- foreach($calendars as $calendar){
- if($calendar['displayname'] == $_POST['calname']){
- $id = $calendar['id'];
- $newcal = false;
- break;
- }
- $newcal = true;
- }
- if($newcal){
- $id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), strip_tags($_POST['calname']),'VEVENT,VTODO,VJOURNAL',null,0,strip_tags($_POST['calcolor']));
- OC_Calendar_Calendar::setCalendarActive($id, 1);
- }
-}else{
- $calendar = OC_Calendar_App::getCalendar($_POST['id']);
- if($calendar['userid'] != OCP\USER::getUser()){
- OCP\JSON::error(array('error'=>'missingcalendarrights'));
- exit();
- }
- $id = $_POST['id'];
-}
-$import->setCalendarID($id);
-try{
- $import->import();
-}catch (Exception $e) {
- OCP\JSON::error(array('message'=>OC_Calendar_App::$l10n->t('Import failed'), 'debug'=>$e->getMessage()));
- //write some log
-}
-$count = $import->getCount();
-if($count == 0){
- if($newcal){
- OC_Calendar_Calendar::deleteCalendar($id);
- }
- OCP\JSON::error(array('message'=>OC_Calendar_App::$l10n->t('The file contained either no events or all events are already saved in your calendar.')));
-}else{
- if($newcal){
- OCP\JSON::success(array('message'=>$count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in the new calendar') . ' ' . strip_tags($_POST['calname'])));
- }else{
- OCP\JSON::success(array('message'=>$count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in your calendar')));
- }
-}
-/* //////////////////////////// Attention: following code is quite painfull !!! ///////////////////////
-writeProgress('20');
-// normalize the newlines
-$file = str_replace(array("\r","\n\n"), array("\n","\n"), $file);
-$lines = explode("\n", $file);
-unset($file);
-writeProgress('30');
-// analyze the file, group components by uid, and keep refs to originating calendar object
-// $cals is array calendar objects, keys are 1st line# $cal, ie array( $cal => $caldata )
-// $caldata is array( 'first' => 1st component line#, 'last' => last comp line#, 'end' => end line# )
-// $caldata is used to create prefix/suffix strings when building import text
-// $uids is array of component arrays, keys are $uid, ie array( $uid => array( $beginlineno => $component ) )
-// $component is array( 'end' => end line#, 'cal'=> $cal )
-$comp=$uid=$cal=false;
-$cals=$uids=array();
-$i = 0;
-foreach($lines as $line) {
-
- if(strpos($line, ':')!==false) {
- list($attr, $val) = explode(':', strtoupper($line));
- if ($attr == 'BEGIN' && $val == 'VCALENDAR') {
- $cal = $i;
- $cals[$cal] = array('first'=>$i,'last'=>$i,'end'=>$i);
- } elseif ($attr =='BEGIN' && $cal!==false && isset($comps[$val])) {
- $comp = $val;
- $beginNo = $i;
- } elseif ($attr == 'END' && $cal!==false && $val == 'VCALENDAR') {
- if($comp!==false) {
- unset($cals[$cal]); // corrupt calendar, unset it
- } else {
- $cals[$cal]['end'] = $i;
- }
- $comp=$uid=$cal=false; // reset calendar
- } elseif ($attr == 'END' && $comp!==false && $val == $comp) {
- if(! $uid) {
- $uid = OC_Calendar_Object::createUID();
- }
- $uids[$uid][$beginNo] = array('end'=>$i, 'cal'=>$cal);
- if ($cals[$cal]['first'] == $cal) {
- $cals[$cal]['first'] = $beginNo;
- }
- $cals[$cal]['last'] = $i;
- $comp=$uid=false; // reset component
- } elseif ($attr =="UID" && $comp!==false) {
- list($attr, $uid) = explode(':', $line);
- }
- }
- $i++;
-}
-// import the calendar
-writeProgress('60');
-foreach($uids as $uid) {
- $prefix=$suffix=$content=array();
- foreach($uid as $begin=>$details) {
-
- $cal = $details['cal'];
- if(!isset($cals[$cal])) {
- continue; // from corrupt/incomplete calendar
- }
- $cdata = $cals[$cal];
- // if we have multiple components from different calendar objects,
- // we should really merge their elements (enhancement?) -- 1st one wins for now.
- if(! count($prefix)) {
- $prefix = array_slice($lines, $cal, $cdata['first'] - $cal);
- }
- if(! count($suffix)) {
- $suffix = array_slice($lines, $cdata['last']+1, $cdata['end'] - $cdata['last']);
- }
- $content = array_merge($content, array_slice($lines, $begin, $details['end'] - $begin + 1));
- }
- if(count($content)) {
- $import = join($nl, array_merge($prefix, $content, $suffix)) . $nl;
- OC_Calendar_Object::add($id, $import);
- }
-}
-// finished import
-writeProgress('100');
-sleep(3);
-OC_Cache::remove($progresskey);
-OCP\JSON::success();*/
diff --git a/apps/calendar/ajax/settings/getfirstday.php b/apps/calendar/ajax/settings/getfirstday.php
deleted file mode 100644
index bc995f7d6e8..00000000000
--- a/apps/calendar/ajax/settings/getfirstday.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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\JSON::checkLoggedIn();
-$firstday = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo');
-OCP\JSON::encodedPrint(array('firstday' => $firstday)); \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/gettimezonedetection.php b/apps/calendar/ajax/settings/gettimezonedetection.php
deleted file mode 100644
index 6bc9a07a1e9..00000000000
--- a/apps/calendar/ajax/settings/gettimezonedetection.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011, 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\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php
deleted file mode 100644
index 6b6b8bef9c1..00000000000
--- a/apps/calendar/ajax/settings/guesstimezone.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011, 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\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-
-$l = OC_L10N::get('calendar');
-
-$lat = $_POST['lat'];
-$lng = $_POST['lng'];
-
-$timezone = OC_Geo::timezone($lat, $lng);
-
-if($timezone == OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone')){
- OCP\JSON::success();
- exit;
-}
-OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone);
-$message = array('message'=> $l->t('New Timezone:') . $timezone);
-OCP\JSON::success($message); \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php
deleted file mode 100644
index 73cf0c19b78..00000000000
--- a/apps/calendar/ajax/settings/setfirstday.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?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\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-if(isset($_POST["firstday"])){
- OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]);
- OCP\JSON::success();
-}else{
- OCP\JSON::error();
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php
deleted file mode 100644
index 6136857e2fe..00000000000
--- a/apps/calendar/ajax/settings/settimeformat.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?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.
- */
-
-OCP\JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-if(isset($_POST["timeformat"])){
- OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]);
- OCP\JSON::success();
-}else{
- OCP\JSON::error();
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php
deleted file mode 100644
index 06db66d578e..00000000000
--- a/apps/calendar/ajax/settings/settimezone.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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.
- */
-
-// Init owncloud
-
-
-$l=OC_L10N::get('calendar');
-
-// Check if we are a user
-OCP\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-OCP\JSON::callCheck();
-
-// Get data
-if( isset( $_POST['timezone'] ) ){
- $timezone=$_POST['timezone'];
- OCP\Config::setUserValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone );
- OCP\JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
-}else{
- OCP\JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/timeformat.php b/apps/calendar/ajax/settings/timeformat.php
deleted file mode 100644
index eebb687dfac..00000000000
--- a/apps/calendar/ajax/settings/timeformat.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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.
- */
-
-OCP\JSON::checkLoggedIn();
-$timeformat = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24");
-OCP\JSON::encodedPrint(array("timeformat" => $timeformat)); \ No newline at end of file
diff --git a/apps/calendar/ajax/settings/timezonedetection.php b/apps/calendar/ajax/settings/timezonedetection.php
deleted file mode 100644
index 5f03f647b3a..00000000000
--- a/apps/calendar/ajax/settings/timezonedetection.php
+++ /dev/null
@@ -1,16 +0,0 @@
-<?php
-/**
- * Copyright (c) 2011, 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\JSON::checkLoggedIn();
-OCP\JSON::checkAppEnabled('calendar');
-if(array_key_exists('timezonedetection', $_POST) && $_POST['timezonedetection'] == 'on'){
- OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true');
-}else{
- OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false');
-}
-OCP\JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/share/activation.php b/apps/calendar/ajax/share/activation.php
deleted file mode 100644
index bce8693577b..00000000000
--- a/apps/calendar/ajax/share/activation.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-$id = strip_tags($_POST['id']);
-$activation = strip_tags($_POST['activation']);
-OC_Calendar_Share::set_active(OCP\USER::getUser(), $id, $activation);
-OCP\JSON::success();
diff --git a/apps/calendar/ajax/share/changepermission.php b/apps/calendar/ajax/share/changepermission.php
deleted file mode 100644
index 5aff7666f79..00000000000
--- a/apps/calendar/ajax/share/changepermission.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-OCP\JSON::callCheck();
-
-$id = strip_tags($_POST['id']);
-$idtype = strip_tags($_POST['idtype']);
-$permission = (int) strip_tags($_POST['permission']);
-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 = $_POST['sharewith'];
-$sharetype = strip_tags($_POST['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)){
- OCP\JSON::error(array('message'=>'user not found'));
- exit;
-}
-if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
- OCP\JSON::error(array('message'=>'group not found'));
- exit;
-}
-$success = OC_Calendar_Share::changepermission($sharewith, $sharetype, $id, $permission, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
-OCP\JSON::success(); \ No newline at end of file
diff --git a/apps/calendar/ajax/share/dropdown.php b/apps/calendar/ajax/share/dropdown.php
deleted file mode 100644
index 86cf4ac090e..00000000000
--- a/apps/calendar/ajax/share/dropdown.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-$user = OCP\USER::getUser();
-$calid = $_POST['calid'];
-$calendar = OC_Calendar_Calendar::find($calid);
-if($calendar['userid'] != $user){
- OCP\JSON::error();
- exit;
-}
-$tmpl = new OCP\Template('calendar', 'share.dropdown');
-$tmpl->assign('calid', $calid);
-$tmpl->printPage(); \ No newline at end of file
diff --git a/apps/calendar/ajax/share/share.php b/apps/calendar/ajax/share/share.php
deleted file mode 100644
index 77e1ab9d657..00000000000
--- a/apps/calendar/ajax/share/share.php
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-OCP\JSON::callCheck();
-
-$id = strip_tags($_POST['id']);
-$idtype = strip_tags($_POST['idtype']);
-switch($idtype){
- case 'calendar':
- case 'event':
- break;
- default:
- OCP\JSON::error(array('message'=>'unexpected 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 = $_POST['sharewith'];
-$sharetype = strip_tags($_POST['sharetype']);
-switch($sharetype){
- case 'user':
- case 'group':
- case 'public':
- break;
- default:
- OCP\JSON::error(array('message'=>'unexpected parameter'));
- exit;
-}
-if($sharetype == 'user' && !OCP\User::userExists($sharewith)){
- OCP\JSON::error(array('message'=>'user not found'));
- exit;
-}
-if($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
- OCP\JSON::error(array('message'=>'group not found'));
- exit;
-}
-if($sharetype == 'user' && OCP\USER::getUser() == $sharewith){
- OCP\JSON::error(array('message'=>'you can not share with yourself'));
-}
-$success = OC_Calendar_Share::share(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
-if($success){
- if($sharetype == 'public'){
- OCP\JSON::success(array('message'=>$success));
- }else{
- OCP\JSON::success(array('message'=>'shared'));
- }
-}else{
- OCP\JSON::error(array('message'=>'can not share'));
- exit;
-} \ No newline at end of file
diff --git a/apps/calendar/ajax/share/unshare.php b/apps/calendar/ajax/share/unshare.php
deleted file mode 100644
index c7c06113189..00000000000
--- a/apps/calendar/ajax/share/unshare.php
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php
-/**
- * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-OCP\JSON::callCheck();
-
-$id = strip_tags($_POST['id']);
-$idtype = strip_tags($_POST['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 = $_POST['sharewith'];
-$sharetype = strip_tags($_POST['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)){
- OCP\JSON::error(array('message'=>'user not found'));
- exit;
-}elseif($sharetype == 'group' && !OC_Group::groupExists($sharewith)){
- OCP\JSON::error(array('message'=>'group not found'));
- exit;
-}
-$success = OC_Calendar_Share::unshare(OCP\USER::getUser(), $sharewith, $sharetype, $id, (($idtype=='calendar') ? OC_Calendar_Share::CALENDAR : OC_Calendar_Share::EVENT));
-if($success){
- OCP\JSON::success();
-}else{
- OCP\JSON::error(array('message'=>'can not unshare'));
- exit;
-} \ No newline at end of file