mirror of
https://github.com/friendica/friendica
synced 2024-12-23 13:20:21 +00:00
Event: Prevent SQL errors with events without end
This commit is contained in:
parent
6b7f5960dc
commit
e74f186b34
1 changed files with 6 additions and 0 deletions
|
@ -243,12 +243,18 @@ function event_store($arr) {
|
||||||
|
|
||||||
$arr['created'] = (($arr['created']) ? DateTimeFormat::utc($arr['created']) : DateTimeFormat::utcNow());
|
$arr['created'] = (($arr['created']) ? DateTimeFormat::utc($arr['created']) : DateTimeFormat::utcNow());
|
||||||
$arr['edited'] = (($arr['edited']) ? DateTimeFormat::utc($arr['edited']) : 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['type'] = (($arr['type']) ? $arr['type'] : 'event' );
|
||||||
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
|
$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['uri'] = (x($arr, 'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(), $arr['uid']));
|
||||||
$arr['private'] = ((x($arr, 'private')) ? intval($arr['private']) : 0);
|
$arr['private'] = ((x($arr, 'private')) ? intval($arr['private']) : 0);
|
||||||
$arr['guid'] = get_guid(32);
|
$arr['guid'] = get_guid(32);
|
||||||
|
|
||||||
|
if ($arr['finish'] < NULL_DATE) {
|
||||||
|
$arr['finish'] = NULL_DATE;
|
||||||
|
}
|
||||||
|
|
||||||
if ($arr['cid']) {
|
if ($arr['cid']) {
|
||||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||||
intval($arr['cid']),
|
intval($arr['cid']),
|
||||||
|
|
Loading…
Reference in a new issue