X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fevent.php;h=a9b82ed50bc90b82606464bdf6fde93c242e7b12;hb=465e1d6a5ca86794d3359536fcf2735889fbbc03;hp=584a7076768337537f7f548921e0b6b1cf0f06d2;hpb=9a3e773a9a0464a309e4891f40c1105c8e2fed33;p=friendica.git diff --git a/include/event.php b/include/event.php index 584a707676..a9b82ed50b 100644 --- a/include/event.php +++ b/include/event.php @@ -261,13 +261,10 @@ function event_store($arr) { $contact = $c[0]; } - // Existing event being modified. - if ($arr['id']) { // has the event actually changed? - $r = q("SELECT * FROM `event` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($arr['id']), intval($arr['uid']) @@ -275,7 +272,6 @@ function event_store($arr) { if ((! DBM::is_result($r)) || ($r[0]['edited'] === $arr['edited'])) { // Nothing has changed. Grab the item id to return. - $r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1", intval($arr['id']), intval($arr['uid']) @@ -284,8 +280,7 @@ function event_store($arr) { } // The event changed. Update it. - - $r = q("UPDATE `event` SET + q("UPDATE `event` SET `edited` = '%s', `start` = '%s', `finish` = '%s', @@ -309,6 +304,7 @@ function event_store($arr) { intval($arr['id']), intval($arr['uid']) ); + $r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1", intval($arr['id']), intval($arr['uid']) @@ -336,8 +332,7 @@ function event_store($arr) { return $item_id; } else { // New event. Store it. - - $r = q("INSERT INTO `event` (`uid`,`cid`,`guid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`, + q("INSERT INTO `event` (`uid`,`cid`,`guid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`, `adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ", intval($arr['uid']), @@ -403,21 +398,7 @@ function event_store($arr) { $item_arr['object'] .= '' . "\n"; $item_id = item_store($item_arr); - - $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", - intval($arr['uid']) - ); - //if (DBM::is_result($r)) - // $plink = System::baseUrl() . '/display/' . $r[0]['nickname'] . '/' . $item_id; - - if ($item_id) { - //q("UPDATE `item` SET `plink` = '%s', `event-id` = %d WHERE `uid` = %d AND `id` = %d", - // dbesc($plink), - // intval($event['id']), - // intval($arr['uid']), - // intval($item_id) - //); q("UPDATE `item` SET `event-id` = %d WHERE `uid` = %d AND `id` = %d", intval($event['id']), intval($arr['uid']), @@ -526,10 +507,10 @@ function event_remove_duplicates($dates) { /** * @brief Get an event by its event ID. * - * @param type $owner_uid The User ID of the owner of the event - * @param type $event_params An assoziative array with - * int 'event_id' => The ID of the event in the event table - * @param type $sql_extra + * @param int $owner_uid The User ID of the owner of the event + * @param array $event_params An assoziative array with + * int 'event_id' => The ID of the event in the event table + * @param string $sql_extra * @return array Query result */ function event_by_id($owner_uid = 0, $event_params, $sql_extra = '') { @@ -675,9 +656,12 @@ function process_events($arr) { * @param string $timezone The timezone of the user (not implemented yet). * * @return string Content according to selected export format. + * + * @todo Implement timezone support */ -function event_format_export ($events, $format = 'ical', $timezone) { - if (! ((is_array($events)) && count($events))) { +function event_format_export($events, $format = 'ical', $timezone) +{ + if (!((is_array($events)) && count($events))) { return; }