do ical export before checking logged in channel
This commit is contained in:
parent
fd7b668a16
commit
a322254f2a
@ -146,7 +146,7 @@ function format_ical_text($s) {
|
||||
require_once('include/bbcode.php');
|
||||
require_once('include/html2plain.php');
|
||||
|
||||
return(wordwrap(str_replace(',','\\,',html2plain(bbcode($s))),72,"\r\n ",true));
|
||||
return(wordwrap(str_replace(array(',',';','\\'),array('\\,','\\;','\\\\'),html2plain(bbcode($s))),72,"\r\n ",true));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user