$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'])
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'])
}
// The event changed. Update it.
-
- $r = q("UPDATE `event` SET
+ q("UPDATE `event` SET
`edited` = '%s',
`start` = '%s',
`finish` = '%s',
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'])
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']),
$item_arr['object'] .= '</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']),
/**
* @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 = '') {
* @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;
}