From 0ad072dea5088eb22643c69730765221e0e17c05 Mon Sep 17 00:00:00 2001 From: defacer Date: Mon, 11 Apr 2005 23:24:23 +0000 Subject: [PATCH] Simplify the code a bit and move the visible = 1 SQL check out of the main part of the WHERE statement. This might be actually fixing an operator precedence logic bug. --- calendar/lib.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/calendar/lib.php b/calendar/lib.php index 8b71b511358..3c3ec0fe076 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -511,11 +511,6 @@ function calendar_sql_where($tstart, $tend, $users, $groups, $courses, $withdura return false; } - if ($ignorehidden) { - if (!empty($whereclause)) $whereclause .= ' AND'; - $whereclause .= ' visible = 1'; - } - if($withduration) { $timeclause = 'timestart + timeduration >= '.$tstart.' AND timestart <= '.$tend; } @@ -531,7 +526,11 @@ function calendar_sql_where($tstart, $tend, $users, $groups, $courses, $withdura $whereclause = $timeclause; } - return empty($whereclause) ? false : $whereclause; + if ($ignorehidden) { + $whereclause .= ' AND visible = 1'; + } + + return $whereclause; } function calendar_top_controls($type, $data) {