diff --git a/cal/cal.php b/cal/cal.php index f3823968..adef464b 100644 --- a/cal/cal.php +++ b/cal/cal.php @@ -45,11 +45,30 @@ function cal_addon_settings_post ( &$a, &$b ) { if (! local_user()) return; + + if (!x($_POST,'cal-submit')) + return; + + set_pconfig(local_user(),'cal','enable',intval($_POST['cal-enable'])); } function cal_addon_settings ( &$a, &$s ) { if (! local_user()) return; + + $enabled = get_pconfig(local_user(), 'cal', 'enable'); + $checked = (($enabled) ? ' checked="checked" ' : ''); + $url = $a->get_baseurl().'/cal/'.$a->user['nickname'].'/export/ical'; + + $s .= '
'.t('If this is enabled, you public events will be available at').' '.$url.'
'; + $s .= '