Permalink
Browse files

Merging from HEAD:

Changing some hardwired 1s to SITEID. Is the madness ever going to end?
Use 1 as a magic number in code, pay the price...

I think I also improved the security around there.
  • Loading branch information...
1 parent 4dde75c commit dc9ec4e135e0a88a06fb55e03ece03b1ab4939a0 defacer committed Aug 23, 2005
Showing with 4 additions and 4 deletions.
  1. +4 −4 calendar/view.php
View
@@ -84,8 +84,8 @@
// If a course has been supplied in the URL, change the filters to show that one
if (!empty($_GET['course'])) {
- if ($course = get_record('course', 'id', $_GET['course'])) {
- if ($course->id == 1) {
+ if ($course = get_record('course', 'id', intval($_GET['course']))) {
+ if ($course->id == SITEID) {
// If coming from the home page, show all courses
$SESSION->cal_courses_shown = calendar_get_default_courses(true);
calendar_set_referring_course(0);
@@ -108,7 +108,7 @@
// Let's see if we are supposed to provide a referring course link
// but NOT for the "main page" course
- if ($SESSION->cal_course_referer > 1 &&
+ if ($SESSION->cal_course_referer != SITEID &&
($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) {
// If we know about the referring course, show a return link and ALSO require login!
require_login();
@@ -558,7 +558,7 @@ function calendar_course_filter_selector($getvars = '') {
unset($courses[SITEID]);
- $courseoptions[1] = get_string('fulllistofcourses');
+ $courseoptions[SITEID] = get_string('fulllistofcourses');
foreach ($courses as $course) {
$courseoptions[$course->id] = $course->shortname;
}

0 comments on commit dc9ec4e

Please sign in to comment.