]> git.mjollnir.org Git - moodle.git/commitdiff
calendar/ical MDL-17964 Better hostname for UID, merged from 1.9
authormoodler <moodler>
Tue, 20 Jan 2009 06:22:51 +0000 (06:22 +0000)
committermoodler <moodler>
Tue, 20 Jan 2009 06:22:51 +0000 (06:22 +0000)
calendar/export.php
calendar/export_execute.php

index 508296f0bada03872fa043694c7b674ad31d1ee4..cb9d276dc931e8b7cac979dc39559dfed57ade1f 100644 (file)
@@ -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');
index 3b09af47fc616be4374c358f7c6a7cfd36b918c2..40d72cdb5932c88c0ae0090b4abd547beda8e66c 100644 (file)
@@ -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