From e8c39ff49fdb12461b375db8ab6591ced646f613 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Thu, 9 Sep 2010 05:25:01 -0700 Subject: [PATCH] found the missing comment box bug --- include/notifier.php | 17 +++++++++++++++++ include/poller.php | 18 ++++++++++++------ mod/dfrn_notify.php | 15 +++++++++------ mod/item.php | 5 +++-- 4 files changed, 41 insertions(+), 14 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index b94c21e7..24e54373 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -162,6 +162,12 @@ } else { + require_once('include/items.php'); + + $verb = construct_verb($item); + $actobj = construct_activity($item); + + if($followup) { foreach($items as $item) { if($item['id'] == $item_id) { @@ -175,6 +181,10 @@ $item['created'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), + '$location' => xmlify($item['location']), + '$type' => 'text', + '$verb' => xmlify($verb), + '$actobj' => $actobj, '$content' => xmlify($item['body']), '$parent_id' => xmlify($item['parent-uri']), '$comment_allow' => 0 @@ -209,6 +219,9 @@ '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), '$location' => xmlify($item['location']), + '$type' => 'text', + '$verb' => xmlify($verb), + '$actobj' => $actobj, '$content' =>xmlify($item['body']), '$comment_allow' => (($item['last-child'] && strlen($contact['dfrn-id'])) ? 1 : 0) )); @@ -225,6 +238,10 @@ '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , 'Y-m-d\TH:i:s\Z')), '$content' =>xmlify($item['body']), + '$location' =>xmlify($item['location']), + '$type' => 'text', + '$verb' => xmlify($verb), + '$actobj' => $actobj, '$parent_id' => xmlify($item['parent-uri']), '$comment_allow' => (($item['last-child']) ? 1 : 0) )); diff --git a/include/poller.php b/include/poller.php index 1e0d6133..62bfdf8e 100644 --- a/include/poller.php +++ b/include/poller.php @@ -1,5 +1,6 @@ get_item_tags( NAMESPACE_DFRN, 'comment-allow'); if($allow && $allow[0]['data'] != $r[0]['last-child']) { - $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s'", + $r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d", dbesc(datetime_convert()), - dbesc($parent_uri) + dbesc($parent_uri), + intval($importer['uid']) ); $r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", intval($allow[0]['data']), diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index 433f69d1..1164bafe 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -129,10 +129,11 @@ function dfrn_notify_post(&$a) { $item = $r[0]; if($item['uri'] == $item['parent-uri']) { $r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s' - WHERE `parent-uri` = '%s'", + WHERE `parent-uri` = '%s' AND `uid` = %d", dbesc($when), dbesc(datetime_convert()), - dbesc($item['uri']) + dbesc($item['uri']), + intval($importer['importer_uid']) ); } else { @@ -151,9 +152,10 @@ function dfrn_notify_post(&$a) { intval($item['uid']) ); // who is the last child now? - $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 + $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d ORDER BY `edited` DESC LIMIT 1", - dbesc($item['parent-uri']) + dbesc($item['parent-uri']), + intval($importer['importer_uid']) ); if(count($r)) { q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1", @@ -261,8 +263,9 @@ function dfrn_notify_post(&$a) { if($importer['notify-flags'] & NOTIFY_COMMENT) { - $myconv = q("SELECT `author-link` FROM `item` WHERE `parent-uri` = '%s'", - dbesc($parent_uri) + $myconv = q("SELECT `author-link` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d", + dbesc($parent_uri), + intval($importer['importer_uid']) ); if(count($myconv)) { foreach($myconv as $conv) { diff --git a/mod/item.php b/mod/item.php index 08f65dca..20a2488c 100644 --- a/mod/item.php +++ b/mod/item.php @@ -287,8 +287,9 @@ function item_content(&$a) { intval($item['uid']) ); // who is the last child now? - $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 ORDER BY `edited` DESC LIMIT 1", - dbesc($item['parent-uri']) + $r = q("SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `uid` = %d ORDER BY `edited` DESC LIMIT 1", + dbesc($item['parent-uri']), + intval($item['uid']) ); if(count($r)) { q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d LIMIT 1",