diff options
Diffstat (limited to 'mod')
-rw-r--r-- | mod/editpost.php | 6 | ||||
-rwxr-xr-x | mod/events.php | 26 |
2 files changed, 31 insertions, 1 deletions
diff --git a/mod/editpost.php b/mod/editpost.php index 235ae9def..daca7c154 100644 --- a/mod/editpost.php +++ b/mod/editpost.php @@ -32,6 +32,12 @@ function editpost_content(&$a) { return; } + if($itm[0]['resource_type'] === 'event' && $itm[0]['resource_id']) { + goaway(z_root() . '/events/event/' . $itm[0]['resource_id']); + } + + + $plaintext = true; // if(feature_enabled(local_channel(),'richtext')) // $plaintext = false; 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') { |