From: Michael Date: Wed, 21 Mar 2018 20:16:43 +0000 (+0000) Subject: Event: Prevent SQL errors with events without end X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e74f186b3488dfe2eb607f21f7f3c53e8a392333;p=friendica.git Event: Prevent SQL errors with events without end --- diff --git a/include/event.php b/include/event.php index 0b6eb1020f..45fa7bcd59 100644 --- a/include/event.php +++ b/include/event.php @@ -243,12 +243,18 @@ function event_store($arr) { $arr['created'] = (($arr['created']) ? DateTimeFormat::utc($arr['created']) : DateTimeFormat::utcNow()); $arr['edited'] = (($arr['edited']) ? DateTimeFormat::utc($arr['edited']) : DateTimeFormat::utcNow()); + $arr['start'] = (($arr['start']) ? DateTimeFormat::utc($arr['start']) : NULL_DATE); + $arr['finish'] = (($arr['finish']) ? DateTimeFormat::utc($arr['finish']) : NULL_DATE); $arr['type'] = (($arr['type']) ? $arr['type'] : 'event' ); $arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0); $arr['uri'] = (x($arr, 'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(), $arr['uid'])); $arr['private'] = ((x($arr, 'private')) ? intval($arr['private']) : 0); $arr['guid'] = get_guid(32); + if ($arr['finish'] < NULL_DATE) { + $arr['finish'] = NULL_DATE; + } + if ($arr['cid']) { $c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($arr['cid']),