never enough comments

This commit is contained in:
Friendika 2011-06-23 18:56:24 -07:00
parent a15bd91d17
commit 8ffcd4323b

View file

@ -212,6 +212,8 @@ function event_store($arr) {
$contact = $c[0]; $contact = $c[0];
// Existing event being modified
if($arr['id']) { if($arr['id']) {
// has the event actually changed? // has the event actually changed?
@ -221,6 +223,9 @@ function event_store($arr) {
intval($arr['uid']) intval($arr['uid'])
); );
if((! count($r)) || ($r[0]['edited'] === $arr['edited'])) { 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", $r = q("SELECT * FROM `item` WHERE `event-id` = %d AND `uid` = %d LIMIT 1",
intval($arr['id']), intval($arr['id']),
intval($arr['uid']) intval($arr['uid'])
@ -228,6 +233,7 @@ function event_store($arr) {
return((count($r)) ? $r[0]['id'] : 0); return((count($r)) ? $r[0]['id'] : 0);
} }
// The event changed. Update it.
$r = q("UPDATE `event` SET $r = q("UPDATE `event` SET
`edited` = '%s', `edited` = '%s',
@ -276,7 +282,7 @@ function event_store($arr) {
dbesc($arr['allow_gid']), dbesc($arr['allow_gid']),
dbesc($arr['deny_cid']), dbesc($arr['deny_cid']),
dbesc($arr['deny_gid']), dbesc($arr['deny_gid']),
dbesc(datetime_convert()), dbesc($arr['edited']),
intval($r[0]['id']), intval($r[0]['id']),
intval($arr['uid']) intval($arr['uid'])
); );
@ -288,6 +294,8 @@ function event_store($arr) {
} }
else { else {
// New event. Store it.
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`desc`,`location`,`type`, $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`) `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' ) ", VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",