+ // if the original post is on this site, update it.
+
+ $r = q("select `tag`,`id`,`uid` from item where `origin` = 1 AND `uri` = '%s' LIMIT 1",
+ dbesc($item['uri'])
+ );
+ if(count($r)) {
+ $x = q("SELECT `blocktags` FROM `user` WHERE `uid` = %d limit 1",
+ intval($r[0]['uid'])
+ );
+ if(count($x) && !$x[0]['blocktags'] && (! stristr($r[0]['tag'], ']' . $term . '['))) {
+ q("update item set tag = '%s' where id = %d limit 1",
+ dbesc($r[0]['tag'] . (strlen($r[0]['tag']) ? ',' : '') . '#[url=' . $a->get_baseurl() . '/search?search=' . $term . ']'. $term . '[/url]'),
+ intval($r[0]['id'])
+ );
+ }
+
+ }
+