events: fix select events query

select events that starts before display start date and/or ends
after display end date.
This commit is contained in:
fabrixxm 2012-06-07 08:28:10 -04:00
parent 6477c24919
commit 757037c3bf

4
mod/events.php Normal file → Executable file
View file

@ -230,8 +230,8 @@ function events_content(&$a) {
$r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`, $r = q("SELECT `event`.*, `item`.`id` AS `itemid`,`item`.`plink`,
`item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id` `item`.`author-name`, `item`.`author-avatar`, `item`.`author-link` FROM `event` LEFT JOIN `item` ON `item`.`event-id` = `event`.`id`
WHERE `event`.`uid` = %d WHERE `event`.`uid` = %d
AND (( `adjust` = 0 AND `start` >= '%s' AND `start` <= '%s' ) AND (( `adjust` = 0 AND `finish` >= '%s' AND `start` <= '%s' )
OR ( `adjust` = 1 AND `start` >= '%s' AND `start` <= '%s' )) ", OR ( `adjust` = 1 AND `finish` >= '%s' AND `start` <= '%s' )) ",
intval(local_user()), intval(local_user()),
dbesc($start), dbesc($start),
dbesc($finish), dbesc($finish),