From 08cebf196e6ff5b89844920a2897cb02bff92c93 Mon Sep 17 00:00:00 2001 From: defacer Date: Wed, 2 Jun 2004 08:13:26 +0000 Subject: [PATCH] Fix all requires() to use absolute paths (Sun boxes have problems with relative paths, it seems). Also, login is required to view the calendar of any course other than the site. --- calendar/event.php | 6 +++--- calendar/preferences.php | 7 +++---- calendar/set.php | 2 +- calendar/view.php | 7 ++++--- course/view.php | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/calendar/event.php b/calendar/event.php index 7031a87d45..eb4ba6db9f 100644 --- a/calendar/event.php +++ b/calendar/event.php @@ -39,9 +39,9 @@ ///////////////////////////////////////////////////////////////////////////// require_once('../config.php'); - require_once('lib.php'); - require_once('../course/lib.php'); - require_once('../mod/forum/lib.php'); + require_once($CFG->dirroot.'/calendar/lib.php'); + require_once($CFG->dirroot.'/course/lib.php'); + require_once($CFG->dirroot.'/mod/forum/lib.php'); require_login(); diff --git a/calendar/preferences.php b/calendar/preferences.php index 194f3f4b63..5a134a3e74 100644 --- a/calendar/preferences.php +++ b/calendar/preferences.php @@ -1,9 +1,8 @@ dirroot.'/calendar/lib.php'); if (isset($SESSION->cal_course_referer)) { if (! $course = get_record("course", "id", $SESSION->cal_course_referer)) { @@ -17,7 +16,7 @@ /// If data submitted, then process and store. - if ($form = data_submitted()) { + if ($form = data_submitted()) { print_header(); foreach ($form as $preference => $value) { switch ($preference) { diff --git a/calendar/set.php b/calendar/set.php index 78d40f5bd8..470bd73639 100644 --- a/calendar/set.php +++ b/calendar/set.php @@ -39,7 +39,7 @@ ///////////////////////////////////////////////////////////////////////////// require_once('../config.php'); - require_once('lib.php'); + require_once($CFG->dirroot.'/calendar/lib.php'); require_variable($_GET['from']); require_variable($_GET['var']); diff --git a/calendar/view.php b/calendar/view.php index eb6042c586..243eebdf3b 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -41,8 +41,8 @@ // Display the calendar page. require_once('../config.php'); - require_once('../course/lib.php'); - require_once('lib.php'); + require_once($CFG->dirroot.'/course/lib.php'); + require_once($CFG->dirroot.'/calendar/lib.php'); optional_variable($_GET['view'], 'upcoming'); optional_variable($_GET['course'], 0); @@ -117,7 +117,8 @@ // but NOT for the "main page" course if($SESSION->cal_course_referer > 1 && ($shortname = get_field('course', 'shortname', 'id', $SESSION->cal_course_referer)) !== false) { - // If we know about the referring course, show a return link + // If we know about the referring course, show a return link and ALSO require login! + require_login(); $nav = ''.$shortname.' -> '.$nav; } diff --git a/course/view.php b/course/view.php index c945d5431b..029261194c 100644 --- a/course/view.php +++ b/course/view.php @@ -2,9 +2,9 @@ // Display the course home page. - require_once("../config.php"); - require_once("lib.php"); - require_once("$CFG->libdir/blocklib.php"); + require_once('../config.php'); + require_once('lib.php'); + require_once($CFG->libdir.'/blocklib.php'); optional_variable($id); optional_variable($name); @@ -25,7 +25,7 @@ require_login($course->id); - require_once('../calendar/lib.php'); /// This is after login because it needs $USER + require_once($CFG->dirroot.'/calendar/lib.php'); /// This is after login because it needs $USER add_to_log($course->id, "course", "view", "view.php?id=$course->id", "$course->id"); -- 2.39.5