- if((! $toplevel) && ($linking)) {
- $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($b['parent']),
- intval($b['uid'])
- );
- if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
- $reply = substr($r[0]['uri'],4);
- elseif(count($r) && substr($r[0]['extid'],0,4) === 'fb::')
- $reply = substr($r[0]['extid'],4);
- else
- return;
- logger('facebook reply id=' . $reply);
- }
+ if((! $toplevel) && ($linking)) {
+ $r = q("SELECT * FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($b['parent']),
+ intval($b['uid'])
+ );
+ if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
+ $reply = substr($r[0]['uri'],4);
+ elseif(count($r) && substr($r[0]['extid'],0,4) === 'fb::')
+ $reply = substr($r[0]['extid'],4);
+ else
+ return;
+
+ $u = q("SELECT * FROM user where uid = %d limit 1",
+ intval($b['uid'])
+ );
+ if(! count($u))
+ return;
+
+ // only accept comments from the item owner. Other contacts are unknown to FB.
+
+ if(! link_compare($b['author-link'], $a->get_baseurl() . '/profile/' . $u[0]['nickname']))
+ return;
+
+
+ logger('facebook reply id=' . $reply);
+ }
+
+ if(strstr($b['postopts'],'facebook') || ($b['private']) || ($reply)) {