aboutsummaryrefslogtreecommitdiffstats
path: root/mod/events.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/events.php')
-rwxr-xr-xmod/events.php26
1 files changed, 25 insertions, 1 deletions
diff --git a/mod/events.php b/mod/events.php
index c2bacfe44..08527b930 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -8,7 +8,7 @@ require_once('include/items.php');
function events_post(&$a) {
- logger('post: ' . print_r($_REQUEST,true));
+ logger('post: ' . print_r($_REQUEST,true), LOGGER_DATA);
if(! local_channel())
return;
@@ -282,6 +282,10 @@ function events_content(&$a) {
$mode = 'edit';
$event_id = argv(2);
}
+ if(argc() > 2 && argv(1) == 'ical') {
+ $mode = 'ical';
+ $event_id = argv(2);
+ }
if(argc() > 2 && argv(1) === 'add') {
$mode = 'add';
$item_id = intval(argv(2));
@@ -306,6 +310,26 @@ function events_content(&$a) {
killme();
}
+
+ if($mode === 'ical') {
+ $r = q("select * from event where event_hash = '%s' and uid = %d limit 1",
+ dbesc($event_id),
+ intval(local_channel())
+ );
+ if($r) {
+ header('Content-type: text/calendar');
+ header('content-disposition: attachment; filename="' . t('event') . '-' . $event_id . '.ics"' );
+ echo ical_wrapper($r);
+ killme();
+ }
+ else {
+ notice( t('Event not found.') . EOL );
+ return;
+ }
+ }
+
+
+
if($mode == 'view') {