From: moodler Date: Tue, 20 Jan 2009 06:22:51 +0000 (+0000) Subject: calendar/ical MDL-17964 Better hostname for UID, merged from 1.9 X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=04f1715ee26a555a4e0afd5bccab14962ba6d80d;p=moodle.git calendar/ical MDL-17964 Better hostname for UID, merged from 1.9 --- diff --git a/calendar/export.php b/calendar/export.php index 508296f0ba..cb9d276dc9 100644 --- a/calendar/export.php +++ b/calendar/export.php @@ -11,6 +11,8 @@ $mon = optional_param('cal_m', 0, PARAM_INT); $yr = optional_param('cal_y', 0, PARAM_INT); if ($courseid = optional_param('course', 0, PARAM_INT)) { $course = $DB->get_record('course', array('id'=>$courseid)); +} else { + $course = NULL; } require_login(); @@ -30,7 +32,7 @@ $pagetitle = get_string('export', 'calendar'); $navlinks = array(); $now = usergetdate(time()); -if ($course->id != SITEID) { +if (!empty($courseid) && $course->id != SITEID) { $navlinks[] = array('name' => $course->shortname, 'link' => "$CFG->wwwroot/course/view.php?id=$course->id", 'type' => 'misc'); diff --git a/calendar/export_execute.php b/calendar/export_execute.php index 3b09af47fc..40d72cdb59 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -124,8 +124,11 @@ foreach($events as $event) { continue; } } + $hostaddress = str_replace('http://', '', $CFG->wwwroot); + $hostaddress = str_replace('https://', '', $hostaddress); + $ev = new iCalendar_event; - $ev->add_property('uid', $event->id.'@'.$_SERVER['HTTP_HOST']); + $ev->add_property('uid', $event->id.'@'.$hostaddress); $ev->add_property('summary', $event->name); $ev->add_property('description', $event->description); $ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL