From 93db786cdc362b9d134f1e935a6406a22b899dfb Mon Sep 17 00:00:00 2001 From: defacer Date: Thu, 1 Apr 2004 08:58:29 +0000 Subject: [PATCH] Eloy's finding: If the user is not a teacher or a student anywhere, this caused an SQL error. It was handled correctly, but why an SQL query at all if we can optimize it away? Thanks Eloy! :) --- calendar/view.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/calendar/view.php b/calendar/view.php index 786c138faa..3931f616c9 100644 --- a/calendar/view.php +++ b/calendar/view.php @@ -552,9 +552,14 @@ function calendar_show_month_detailed($m, $y, $courses, $groups, $users) { $defaultcourses = array_diff_assoc($defaultcourses, array(1 => 1)); // Filter the site out $getcourses = array_keys($defaultcourses); - $select = 'id IN ('.implode(',', $getcourses).')'; + if(!empty($getcourses)) { + $select = 'id IN ('.implode(',', $getcourses).')'; + $coursesdata = get_records_select('course', $select, 'fullname'); + } + else { + $coursedata = false; + } - $coursesdata = get_records_select('course', $select, 'fullname'); echo '