From dbf9d4cb37fc411b857351554b7fa603aa525d6c Mon Sep 17 00:00:00 2001 From: skodak Date: Wed, 31 Dec 2008 14:10:44 +0000 Subject: [PATCH] MDL-17203 new option for disabling of calendar export --- admin/settings/appearance.php | 1 + calendar/export.php | 4 ++++ calendar/export_execute.php | 4 ++++ calendar/view.php | 24 +++++++++++++----------- lang/en_utf8/admin.php | 2 ++ 5 files changed, 24 insertions(+), 11 deletions(-) diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index f856a52984..dbd36c45c4 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -44,6 +44,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $temp->add(new admin_setting_special_calendar_weekend()); $temp->add(new admin_setting_configtext('calendar_lookahead',get_string('configlookahead','admin'),get_string('helpupcominglookahead', 'admin'),21,PARAM_INT)); $temp->add(new admin_setting_configtext('calendar_maxevents',get_string('configmaxevents','admin'),get_string('helpupcomingmaxevents', 'admin'),10,PARAM_INT)); + $temp->add(new admin_setting_configcheckbox('enablecalendarexport', get_string('enablecalendarexport', 'admin'), get_string('configenablecalendarexport','admin'), 1)); $ADMIN->add('appearance', $temp); // "htmleditor" settingpage diff --git a/calendar/export.php b/calendar/export.php index 1dccb7bdb8..e1a787a431 100644 --- a/calendar/export.php +++ b/calendar/export.php @@ -15,6 +15,10 @@ if ($courseid = optional_param('course', 0, PARAM_INT)) { require_login(); +if (empty($CFG->enablecalendarexport)) { + die('no export'); +} + if(!$site = get_site()) { redirect($CFG->wwwroot.'/'.$CFG->admin.'/index.php'); } diff --git a/calendar/export_execute.php b/calendar/export_execute.php index 63d820704b..73b4f71e86 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -8,6 +8,10 @@ require_once($CFG->libdir.'/bennu/bennu.inc.php'); $username = required_param('username', PARAM_TEXT); $authtoken = required_param('authtoken', PARAM_ALPHANUM); +if (empty($CFG->enablecalendarexport)) { + die('no export'); +} + //Fetch user information if (!$user = get_complete_user_data('username', $username)) { //No such user diff --git a/calendar/view.php b/calendar/view.php index 827e63cea2..f8fd374195 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -165,17 +165,19 @@ //Link to calendar export page echo '
'; - print_single_button('export.php', array('course'=>$courseid), get_string('exportcalendar', 'calendar')); - - if (!empty($USER->id)) { - $authtoken = sha1($USER->username . $USER->password); - $usernameencoded = urlencode($USER->username); - - echo "" - .'' - .''; + if (!empty($CFG->enablecalendarexport)) { + print_single_button('export.php', array('course'=>$courseid), get_string('exportcalendar', 'calendar')); + + if (!empty($USER->id)) { + $authtoken = sha1($USER->username . $USER->password); + $usernameencoded = urlencode($USER->username); + + echo "" + .'' + .''; + } } echo '
'; diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index b45d33fc31..02716108ff 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -114,6 +114,7 @@ $string['configemailchangeconfirmation'] = 'Require an email confirmation step w $string['configemoticons'] = 'Change the code on the left that relates to the name of the emoticon on the right. To add new emoticons, add a code and a name, then add an image as name.gif in /pix/s.'; $string['configenableajax'] = 'This setting allows you to control the use of AJAX (advanced client/server interfaces using Javascript) across the whole site. With this setting enabled users can still make a choice in their profile, otherwise AJAX is disabled for everybody.'; $string['configdisablecourseajax'] = 'Do not use AJAX when editing main course pages.'; +$string['configenablecalendarexport'] = 'Enable exporting or subscribing to calendars.'; $string['configenablecourserequests'] = 'This will allow any user to request a course be created.'; $string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.'; $string['configenablegroupings'] = 'This setting enables groupings of groups.'; @@ -354,6 +355,7 @@ $string['emailchangeconfirmation'] = 'Email change confirmation'; $string['emoticons'] = 'Emoticons'; $string['emptysettingvalue'] = 'Empty'; $string['enableajax'] = 'Enable AJAX'; +$string['enablecalendarexport'] = 'Enable calendar export'; $string['enablecourserequests'] = 'Enable course requests'; $string['enableglobalsearch'] = 'Enable global search'; $string['enablegroupings'] = 'Enable groupings'; -- 2.39.5