diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-08-19 16:50:32 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-08-19 16:50:32 -0700 |
commit | a4caaefd32ca68f45f7526dde61d17e8ca3dc3af (patch) | |
tree | 6d428adcffc2956b0a2e5688bbbb33ec7917ce23 /mod/events.php | |
parent | 4e3d295c909405da61d7ccd6c7bd99bd35c9feec (diff) | |
download | volse-hubzilla-a4caaefd32ca68f45f7526dde61d17e8ca3dc3af.tar.gz volse-hubzilla-a4caaefd32ca68f45f7526dde61d17e8ca3dc3af.tar.bz2 volse-hubzilla-a4caaefd32ca68f45f7526dde61d17e8ca3dc3af.zip |
event integration improvements
Diffstat (limited to 'mod/events.php')
-rwxr-xr-x | mod/events.php | 26 |
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') { |