MDL-17203 new option for disabling of calendar export

This commit is contained in:
skodak 2008-12-31 14:10:44 +00:00
parent 81f2bb8122
commit dbf9d4cb37
5 changed files with 22 additions and 9 deletions

View file

@ -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');
}

View file

@ -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

View file

@ -165,17 +165,19 @@
//Link to calendar export page
echo '<div class="bottom">';
print_single_button('export.php', array('course'=>$courseid), get_string('exportcalendar', 'calendar'));
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);
if (!empty($USER->id)) {
$authtoken = sha1($USER->username . $USER->password);
$usernameencoded = urlencode($USER->username);
echo "<a href=\"export_execute.php?preset_what=all&amp;preset_time=recentupcoming&amp;username=$usernameencoded&amp;authtoken=$authtoken\">"
.'<img src="'.$CFG->pixpath.'/i/ical.gif" height="14" width="36" '
.'alt="'.get_string('ical', 'calendar').'" '
.'title="'.get_string('quickdownloadcalendar', 'calendar').'" />'
.'</a>';
echo "<a href=\"export_execute.php?preset_what=all&amp;preset_time=recentupcoming&amp;username=$usernameencoded&amp;authtoken=$authtoken\">"
.'<img src="'.$CFG->pixpath.'/i/ical.gif" height="14" width="36" '
.'alt="'.get_string('ical', 'calendar').'" '
.'title="'.get_string('quickdownloadcalendar', 'calendar').'" />'
.'</a>';
}
}
echo '</div>';