aboutsummaryrefslogtreecommitdiffstats
path: root/apps/calendar/export.php
diff options
context:
space:
mode:
authorGeorg Ehrke <georg.stefan.germany@googlemail.com>2011-10-01 23:19:06 +0200
committerGeorg Ehrke <georg.stefan.germany@googlemail.com>2011-10-01 23:19:06 +0200
commit0ebe9ad70c65dbc733e42aa1b68ca7cd353df9bf (patch)
treee57ff24348335ded4f80febe7b9e2191f8b78889 /apps/calendar/export.php
parentf9824f61087f7a1c7f449c9fb09bcf3acd119aab (diff)
downloadnextcloud-server-0ebe9ad70c65dbc733e42aa1b68ca7cd353df9bf.tar.gz
nextcloud-server-0ebe9ad70c65dbc733e42aa1b68ca7cd353df9bf.zip
added function to export single events
Diffstat (limited to 'apps/calendar/export.php')
-rw-r--r--apps/calendar/export.php34
1 files changed, 24 insertions, 10 deletions
diff --git a/apps/calendar/export.php b/apps/calendar/export.php
index feb4755a3aa..b3e5ecd6834 100644
--- a/apps/calendar/export.php
+++ b/apps/calendar/export.php
@@ -10,15 +10,29 @@ require_once ("../../lib/base.php");
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
$cal = $_GET["calid"];
-$calendar = OC_Calendar_Calendar::findCalendar($cal);
-if($calendar["userid"] != OC_User::getUser()){
- header( 'Location: '.OC_Helper::linkTo('', 'index.php'));
- exit;
-}
-$calobjects = OC_Calendar_Object::all($cal);
-header("Content-Type: text/Calendar");
-header("Content-Disposition: inline; filename=calendar.ics");
-for($i = 0;$i <= count($calobjects); $i++){
- echo $calobjects[$i]["calendardata"] . "\n";
+$event = $_GET["eventid"];
+if(isset($cal)){
+ $calendar = OC_Calendar_Calendar::findCalendar($cal);
+ if($calendar["userid"] != OC_User::getUser()){
+ OC_JSON::error();
+ exit;
+ }
+ $calobjects = OC_Calendar_Object::all($cal);
+ header("Content-Type: text/Calendar");
+ header("Content-Disposition: inline; filename=calendar.ics");
+ for($i = 0;$i <= count($calobjects); $i++){
+ echo $calobjects[$i]["calendardata"] . "\n";
+ }
+}elseif(isset($event)){
+ $data = OC_Calendar_Object::find($_GET["eventid"]);
+ $calendarid = $data["calendarid"];
+ $calendar = OC_Calendar_Calendar::findCalendar($calendarid);
+ if($calendar["userid"] != OC_User::getUser()){
+ OC_JSON::error();
+ exit;
+ }
+ header("Content-Type: text/Calendar");
+ header("Content-Disposition: inline; filename=" . $data["summary"] . ".ics");
+ echo $data["calendardata"];
}
?>