From a15bd91d1733e8198169a1a492f0268691b7152a Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 23 Jun 2011 18:25:33 -0700 Subject: don't update an event that hasn't changed. --- include/event.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/event.php') diff --git a/include/event.php b/include/event.php index 8078a9a5e..f79266e33 100644 --- a/include/event.php +++ b/include/event.php @@ -213,6 +213,22 @@ function event_store($arr) { 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((! count($r)) || ($r[0]['edited'] === $arr['edited'])) { + $r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1", + intval($arr['id']), + intval($arr['uid']) + ); + return((count($r)) ? $r[0]['id'] : 0); + } + + $r = q("UPDATE `event` SET `edited` = '%s', `start` = '%s', -- cgit v1.2.3 From 8ffcd4323b883b66d9249c9742fb26a5c5f91605 Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 23 Jun 2011 18:56:24 -0700 Subject: never enough comments --- include/event.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'include/event.php') diff --git a/include/event.php b/include/event.php index f79266e33..1032022b3 100644 --- a/include/event.php +++ b/include/event.php @@ -212,6 +212,8 @@ function event_store($arr) { $contact = $c[0]; + // Existing event being modified + if($arr['id']) { // has the event actually changed? @@ -221,6 +223,9 @@ function event_store($arr) { intval($arr['uid']) ); if((! count($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']) @@ -228,6 +233,7 @@ function event_store($arr) { return((count($r)) ? $r[0]['id'] : 0); } + // The event changed. Update it. $r = q("UPDATE `event` SET `edited` = '%s', @@ -276,7 +282,7 @@ function event_store($arr) { dbesc($arr['allow_gid']), dbesc($arr['deny_cid']), dbesc($arr['deny_gid']), - dbesc(datetime_convert()), + dbesc($arr['edited']), intval($r[0]['id']), intval($arr['uid']) ); @@ -288,6 +294,8 @@ function event_store($arr) { } else { + // New event. Store it. + $r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`, `adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`) VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ", -- cgit v1.2.3 From 6e5532149a08b264e958202fa971d35b446fac3b Mon Sep 17 00:00:00 2001 From: Friendika Date: Thu, 30 Jun 2011 23:27:16 -0700 Subject: missing minutes in event listings --- include/event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/event.php') diff --git a/include/event.php b/include/event.php index 1032022b3..aab195d24 100644 --- a/include/event.php +++ b/include/event.php @@ -8,7 +8,7 @@ function format_event_html($ev) { if(! ((is_array($ev)) && count($ev))) return ''; - $bd_format = t('l F d, Y \@ g A') ; // Friday January 18, 2011 @ 8 AM + $bd_format = t('l F d, Y \@ g:i A') ; // Friday January 18, 2011 @ 8 AM $o = '
' . "\r\n"; -- cgit v1.2.3