aboutsummaryrefslogtreecommitdiffstats
path: root/mod/events.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-08-20 04:51:03 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-08-20 04:51:03 -0700
commita322254f2aa02f662667eeb0bdd4e8646cd029c2 (patch)
tree6240d3cfcd212b075928edd601c3e73187663c7f /mod/events.php
parentfd7b668a16e34b5953a85b0b547e97ae36c2dd0c (diff)
downloadvolse-hubzilla-a322254f2aa02f662667eeb0bdd4e8646cd029c2.tar.gz
volse-hubzilla-a322254f2aa02f662667eeb0bdd4e8646cd029c2.tar.bz2
volse-hubzilla-a322254f2aa02f662667eeb0bdd4e8646cd029c2.zip
do ical export before checking logged in channel
Diffstat (limited to 'mod/events.php')
-rwxr-xr-xmod/events.php44
1 files changed, 21 insertions, 23 deletions
diff --git a/mod/events.php b/mod/events.php
index 7894f960b..630b8191f 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -228,6 +228,27 @@ function events_post(&$a) {
function events_content(&$a) {
+ if(argc() > 2 && argv(1) == 'ical') {
+ $event_id = argv(2);
+
+ require_once('include/security.php');
+ $sql_extra = permissions_sql(local_channel());
+
+ $r = q("select * from event where event_hash = '%s' $sql_extra limit 1",
+ dbesc($event_id)
+ );
+ 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(! local_channel()) {
notice( t('Permission denied.') . EOL);
return;
@@ -282,10 +303,6 @@ 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));
@@ -311,25 +328,6 @@ function events_content(&$a) {
}
- if($mode === 'ical') {
-
- require_once('include/security.php');
- $sql_extra = permissions_sql(local_channel());
-
- $r = q("select * from event where event_hash = '%s' $sql_extra limit 1",
- dbesc($event_id)
- );
- 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;
- }
- }