2 require_once('include/items.php');
3 require_once('include/ostatus.php');
6 * @brief Adds the header elements for the DFRN protocol
8 * @param array $items Item elements
9 * @param array $owner Owner record
11 * @return string DFRN entries
13 function dfrn_entries($items,$owner) {
15 $doc = new DOMDocument('1.0', 'utf-8');
16 $doc->formatOutput = true;
18 $root = dfrn_add_header($doc, $owner, "dfrn:owner", "", false);
21 return trim($doc->saveXML());
23 foreach($items as $item) {
24 $entry = dfrn_entry($doc, "text", $item, $owner, $item["entry:comment-allow"], $item["entry:cid"]);
25 $root->appendChild($entry);
28 return(trim($doc->saveXML()));
32 * @brief Adds the header elements for the DFRN protocol
35 * @param string $dfrn_id
36 * @param string $owner_nick Owner nick name
37 * @param string $last_update Date of the last update
38 * @param int $direction
40 * @return string DFRN feed entries
42 function dfrn_feed(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0) {
44 $sitefeed = ((strlen($owner_nick)) ? false : true); // not yet implemented, need to rewrite huge chunks of following logic
45 $public_feed = (($dfrn_id) ? false : true);
46 $starred = false; // not yet implemented, possible security issues
49 if($public_feed && $a->argc > 2) {
50 for($x = 2; $x < $a->argc; $x++) {
51 if($a->argv[$x] == 'converse')
53 if($a->argv[$x] == 'starred')
55 if($a->argv[$x] === 'category' && $a->argc > ($x + 1) && strlen($a->argv[$x+1]))
56 $category = $a->argv[$x+1];
62 // default permissions - anonymous user
64 $sql_extra = " AND `item`.`allow_cid` = '' AND `item`.`allow_gid` = '' AND `item`.`deny_cid` = '' AND `item`.`deny_gid` = '' ";
66 $r = q("SELECT `contact`.*, `user`.`uid` AS `user_uid`, `user`.`nickname`, `user`.`timezone`, `user`.`page-flags`
67 FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
68 WHERE `contact`.`self` = 1 AND `user`.`nickname` = '%s' LIMIT 1",
76 $owner_id = $owner['user_uid'];
77 $owner_nick = $owner['nickname'];
87 $sql_extra = sprintf(" AND `issued-id` = '%s' ", dbesc($dfrn_id));
91 $sql_extra = sprintf(" AND `issued-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
92 $my_id = '1:' . $dfrn_id;
95 $sql_extra = sprintf(" AND `dfrn-id` = '%s' AND `duplex` = 1 ", dbesc($dfrn_id));
96 $my_id = '0:' . $dfrn_id;
103 $r = q("SELECT * FROM `contact` WHERE `blocked` = 0 AND `pending` = 0 AND `contact`.`uid` = %d $sql_extra LIMIT 1",
111 require_once('include/security.php');
112 $groups = init_groups_visitor($contact['id']);
115 for($x = 0; $x < count($groups); $x ++)
116 $groups[$x] = '<' . intval($groups[$x]) . '>' ;
117 $gs = implode('|', $groups);
120 $gs = '<<>>' ; // Impossible to match
122 $sql_extra = sprintf("
123 AND ( `allow_cid` = '' OR `allow_cid` REGEXP '<%d>' )
124 AND ( `deny_cid` = '' OR NOT `deny_cid` REGEXP '<%d>' )
125 AND ( `allow_gid` = '' OR `allow_gid` REGEXP '%s' )
126 AND ( `deny_gid` = '' OR NOT `deny_gid` REGEXP '%s')
128 intval($contact['id']),
129 intval($contact['id']),
140 $date_field = "`changed`";
141 $sql_order = "`item`.`parent` ".$sort.", `item`.`created` ASC";
143 if(! strlen($last_update))
144 $last_update = 'now -30 days';
146 if(isset($category)) {
147 $sql_post_table = sprintf("INNER JOIN (SELECT `oid` FROM `term` WHERE `term` = '%s' AND `otype` = %d AND `type` = %d AND `uid` = %d ORDER BY `tid` DESC) AS `term` ON `item`.`id` = `term`.`oid` ",
148 dbesc(protect_sprintf($category)), intval(TERM_OBJ_POST), intval(TERM_CATEGORY), intval($owner_id));
149 //$sql_extra .= file_tag_file_query('item',$category,'category');
154 $sql_extra .= " AND `contact`.`self` = 1 ";
157 $check_date = datetime_convert('UTC','UTC',$last_update,'Y-m-d H:i:s');
159 // AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' )
160 // dbesc($check_date),
162 $r = q("SELECT STRAIGHT_JOIN `item`.*, `item`.`id` AS `item_id`,
163 `contact`.`name`, `contact`.`network`, `contact`.`photo`, `contact`.`url`,
164 `contact`.`name-date`, `contact`.`uri-date`, `contact`.`avatar-date`,
165 `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
166 `contact`.`id` AS `contact-id`, `contact`.`uid` AS `contact-uid`,
167 `sign`.`signed_text`, `sign`.`signature`, `sign`.`signer`
168 FROM `item` $sql_post_table
169 INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
170 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
171 LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id`
172 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`parent` != 0
173 AND ((`item`.`wall` = 1) $visibility) AND `item`.$date_field > '%s'
175 ORDER BY $sql_order LIMIT 0, 300",
181 // Will check further below if this actually returned results.
182 // We will provide an empty feed if that is the case.
186 $doc = new DOMDocument('1.0', 'utf-8');
187 $doc->formatOutput = true;
189 $alternatelink = $owner['url'];
192 $alternatelink .= "/category/".$category;
195 $author = "dfrn:owner";
199 $root = dfrn_add_header($doc, $owner, $author, $alternatelink, true);
201 // This hook can't work anymore
202 // call_hooks('atom_feed', $atom);
204 if(! count($items)) {
205 $atom = trim($doc->saveXML());
207 call_hooks('atom_feed_end', $atom);
212 foreach($items as $item) {
214 // prevent private email from leaking.
215 if($item['network'] === NETWORK_MAIL)
218 // public feeds get html, our own nodes use bbcode
222 // catch any email that's in a public conversation and make sure it doesn't leak
230 $entry = dfrn_entry($doc, $type, $item, $owner, true);
231 $root->appendChild($entry);
235 $atom = trim($doc->saveXML());
237 call_hooks('atom_feed_end', $atom);
243 * @brief Create XML text for DFRN mail
245 * @param array $item message elements
246 * @param array $owner Owner record
248 * @return string DFRN mail
250 function dfrn_mail($item, $owner) {
251 $doc = new DOMDocument('1.0', 'utf-8');
252 $doc->formatOutput = true;
254 $root = dfrn_add_header($doc, $owner, "dfrn:owner", "", false);
256 $mail = $doc->createElement("dfrn:mail");
257 $sender = $doc->createElement("dfrn:sender");
259 xml_add_element($doc, $sender, "dfrn:name", $owner['name']);
260 xml_add_element($doc, $sender, "dfrn:uri", $owner['url']);
261 xml_add_element($doc, $sender, "dfrn:avatar", $owner['thumb']);
263 $mail->appendChild($sender);
265 xml_add_element($doc, $mail, "dfrn:id", $item['uri']);
266 xml_add_element($doc, $mail, "dfrn:in-reply-to", $item['parent-uri']);
267 xml_add_element($doc, $mail, "dfrn:sentdate", datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME));
268 xml_add_element($doc, $mail, "dfrn:subject", $item['title']);
269 xml_add_element($doc, $mail, "dfrn:content", $item['body']);
271 $root->appendChild($mail);
273 return(trim($doc->saveXML()));
277 * @brief Create XML text for DFRN suggestions
279 * @param array $item suggestion elements
280 * @param array $owner Owner record
282 * @return string DFRN suggestions
284 function dfrn_fsuggest($item, $owner) {
285 $doc = new DOMDocument('1.0', 'utf-8');
286 $doc->formatOutput = true;
288 $root = dfrn_add_header($doc, $owner, "dfrn:owner", "", false);
290 $suggest = $doc->createElement("dfrn:suggest");
292 xml_add_element($doc, $suggest, "dfrn:url", $item['url']);
293 xml_add_element($doc, $suggest, "dfrn:name", $item['name']);
294 xml_add_element($doc, $suggest, "dfrn:photo", $item['photo']);
295 xml_add_element($doc, $suggest, "dfrn:request", $item['request']);
296 xml_add_element($doc, $suggest, "dfrn:note", $item['note']);
298 $root->appendChild($suggest);
300 return(trim($doc->saveXML()));
304 * @brief Create XML text for DFRN relocations
306 * @param array $owner Owner record
307 * @param int $uid User ID
309 * @return string DFRN relocations
311 function dfrn_relocate($owner, $uid) {
315 /* get site pubkey. this could be a new installation with no site keys*/
316 $pubkey = get_config('system','site_pubkey');
318 $res = new_keypair(1024);
319 set_config('system','site_prvkey', $res['prvkey']);
320 set_config('system','site_pubkey', $res['pubkey']);
323 $rp = q("SELECT `resource-id` , `scale`, type FROM `photo`
324 WHERE `profile` = 1 AND `uid` = %d ORDER BY scale;", $uid);
326 $ext = Photo::supportedTypes();
328 $photos[$p['scale']] = $a->get_baseurl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
332 $doc = new DOMDocument('1.0', 'utf-8');
333 $doc->formatOutput = true;
335 $root = dfrn_add_header($doc, $owner, "dfrn:owner", "", false);
337 $relocate = $doc->createElement("dfrn:relocate");
339 xml_add_element($doc, $relocate, "dfrn:url", $owner['url']);
340 xml_add_element($doc, $relocate, "dfrn:name", $owner['name']);
341 xml_add_element($doc, $relocate, "dfrn:photo", $photos[4]);
342 xml_add_element($doc, $relocate, "dfrn:thumb", $photos[5]);
343 xml_add_element($doc, $relocate, "dfrn:micro", $photos[6]);
344 xml_add_element($doc, $relocate, "dfrn:request", $owner['request']);
345 xml_add_element($doc, $relocate, "dfrn:confirm", $owner['confirm']);
346 xml_add_element($doc, $relocate, "dfrn:notify", $owner['notify']);
347 xml_add_element($doc, $relocate, "dfrn:poll", $owner['poll']);
348 xml_add_element($doc, $relocate, "dfrn:sitepubkey", get_config('system','site_pubkey'));
350 $root->appendChild($relocate);
352 return(trim($doc->saveXML()));
356 * @brief Adds the header elements for the DFRN protocol
358 * @param object $doc XML document
359 * @param array $owner Owner record
360 * @param string $authorelement Element name for the author
361 * @param string $alternatelink link to profile or category
362 * @param bool $public Is it a header for public posts?
364 * @return object XML root object
366 function dfrn_add_header($doc, $owner, $authorelement, $alternatelink = "", $public = false) {
369 if ($alternatelink == "")
370 $alternatelink = $owner['url'];
372 $root = $doc->createElementNS(NS_ATOM, 'feed');
373 $doc->appendChild($root);
375 $root->setAttribute("xmlns:thr", NS_THR);
376 $root->setAttribute("xmlns:at", "http://purl.org/atompub/tombstones/1.0");
377 $root->setAttribute("xmlns:media", NS_MEDIA);
378 $root->setAttribute("xmlns:dfrn", "http://purl.org/macgirvin/dfrn/1.0");
379 $root->setAttribute("xmlns:activity", NS_ACTIVITY);
380 $root->setAttribute("xmlns:georss", NS_GEORSS);
381 $root->setAttribute("xmlns:poco", NS_POCO);
382 $root->setAttribute("xmlns:ostatus", NS_OSTATUS);
383 $root->setAttribute("xmlns:statusnet", NS_STATUSNET);
385 xml_add_element($doc, $root, "id", $a->get_baseurl()."/profile/".$owner["nick"]);
386 xml_add_element($doc, $root, "title", $owner["name"]);
388 $attributes = array("uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION);
389 xml_add_element($doc, $root, "generator", FRIENDICA_PLATFORM, $attributes);
391 $attributes = array("rel" => "license", "href" => "http://creativecommons.org/licenses/by/3.0/");
392 xml_add_element($doc, $root, "link", "", $attributes);
394 $attributes = array("rel" => "alternate", "type" => "text/html", "href" => $alternatelink);
395 xml_add_element($doc, $root, "link", "", $attributes);
397 ostatus_hublinks($doc, $root);
400 $attributes = array("rel" => "salmon", "href" => $a->get_baseurl()."/salmon/".$owner["nick"]);
401 xml_add_element($doc, $root, "link", "", $attributes);
403 $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-replies", "href" => $a->get_baseurl()."/salmon/".$owner["nick"]);
404 xml_add_element($doc, $root, "link", "", $attributes);
406 $attributes = array("rel" => "http://salmon-protocol.org/ns/salmon-mention", "href" => $a->get_baseurl()."/salmon/".$owner["nick"]);
407 xml_add_element($doc, $root, "link", "", $attributes);
410 if ($owner['page-flags'] == PAGE_COMMUNITY)
411 xml_add_element($doc, $root, "dfrn:community", 1);
413 xml_add_element($doc, $root, "updated", datetime_convert("UTC", "UTC", "now", ATOM_TIME));
415 $author = dfrn_add_author($doc, $owner, $authorelement);
416 $root->appendChild($author);
422 * @brief Adds the author elements for the DFRN protocol
424 * @param object $doc XML document
425 * @param array $owner Owner record
426 * @param string $authorelement Element name for the author
428 * @return object XML author object
430 function dfrn_add_author($doc, $owner, $authorelement) {
433 $author = $doc->createElement($authorelement);
435 $namdate = datetime_convert('UTC', 'UTC', $owner['name-date'].'+00:00' , ATOM_TIME);
436 $uridate = datetime_convert('UTC', 'UTC', $owner['uri-date'].'+00:00', ATOM_TIME);
437 $picdate = datetime_convert('UTC', 'UTC', $owner['avatar-date'].'+00:00', ATOM_TIME);
439 $attributes = array("dfrn:updated" => $namdate);
440 xml_add_element($doc, $author, "name", $owner["name"], $attributes);
442 $attributes = array("dfrn:updated" => $namdate);
443 xml_add_element($doc, $author, "uri", $a->get_baseurl().'/profile/'.$owner["nickname"], $attributes);
445 $attributes = array("rel" => "photo", "type" => "image/jpeg", "dfrn:updated" => $picdate,
446 "media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
447 xml_add_element($doc, $author, "link", "", $attributes);
449 $attributes = array("rel" => "avatar", "type" => "image/jpeg", "dfrn:updated" => $picdate,
450 "media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
451 xml_add_element($doc, $author, "link", "", $attributes);
453 $birthday = feed_birthday($owner['user_uid'], $owner['timezone']);
456 xml_add_element($doc, $author, "dfrn:birthday", $birthday);
462 * @brief Adds the author elements for the item entries of the DFRN protocol
464 * @param object $doc XML document
465 * @param string $element Element name for the author
466 * @param string $contact_url Link of the contact
467 * @param array $items Item elements
469 * @return object XML author object
471 function dfrn_add_entry_author($doc, $element, $contact_url, $item) {
474 $contact = get_contact_details_by_url($contact_url, $item["uid"]);
476 $r = q("SELECT `profile`.`about`, `profile`.`name`, `profile`.`homepage`, `contact`.`nick`, `contact`.`location` FROM `profile`
477 INNER JOIN `contact` ON `contact`.`uid` = `profile`.`uid`
478 INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
479 WHERE `contact`.`self` AND `profile`.`is-default` AND NOT `user`.`hidewall` AND `contact`.`nurl`='%s'",
480 dbesc(normalise_link($contact_url)));
484 $author = $doc->createElement($element);
485 xml_add_element($doc, $author, "name", $contact["name"]);
486 xml_add_element($doc, $author, "uri", $contact["url"]);
489 /// - Check real image type and image size
490 /// - Check which of these boths elements we really use
493 "type" => "image/jpeg",
495 "media:height" => 80,
496 "href" => $contact["photo"]);
497 xml_add_element($doc, $author, "link", "", $attributes);
501 "type" => "image/jpeg",
503 "media:height" => 80,
504 "href" => $contact["photo"]);
505 xml_add_element($doc, $author, "link", "", $attributes);
507 // Only show contact details when it is a user from our system and we are allowed to
509 xml_add_element($doc, $author, "poco:preferredUsername", $profile["nick"]);
510 xml_add_element($doc, $author, "poco:displayName", $profile["name"]);
511 xml_add_element($doc, $author, "poco:note", $profile["about"]);
513 if (trim($contact["location"]) != "") {
514 $element = $doc->createElement("poco:address");
515 xml_add_element($doc, $element, "poco:formatted", $profile["location"]);
516 $author->appendChild($element);
519 if (trim($profile["homepage"]) != "") {
520 $urls = $doc->createElement("poco:urls");
521 xml_add_element($doc, $urls, "poco:type", "homepage");
522 xml_add_element($doc, $urls, "poco:value", $profile["homepage"]);
523 xml_add_element($doc, $urls, "poco:primary", "true");
524 $author->appendChild($urls);
532 * @brief Adds the activity elements
534 * @param object $doc XML document
535 * @param string $element Element name for the activity
536 * @param string $activity activity value
538 * @return object XML activity object
540 function dfrn_create_activity($doc, $element, $activity) {
543 $entry = $doc->createElement($element);
545 $r = parse_xml_string($activity, false);
549 xml_add_element($doc, $entry, "activity:object-type", $r->type);
551 xml_add_element($doc, $entry, "id", $r->id);
553 xml_add_element($doc, $entry, "title", $r->title);
555 if(substr($r->link,0,1) === '<') {
556 if(strstr($r->link,'&') && (! strstr($r->link,'&')))
557 $r->link = str_replace('&','&', $r->link);
559 $r->link = preg_replace('/\<link(.*?)\"\>/','<link$1"/>',$r->link);
561 $data = parse_xml_string($r->link, false);
562 foreach ($data->attributes() AS $parameter => $value)
563 $attributes[$parameter] = $value;
565 $attributes = array("rel" => "alternate", "type" => "text/html", "href" => $r->link);
567 xml_add_element($doc, $entry, "link", "", $attributes);
570 xml_add_element($doc, $entry, "content", bbcode($r->content), array("type" => "html"));
579 * @brief Adds the attachments elements
581 * @param object $doc XML document
582 * @param object $root XML root
583 * @param array $item Item element
585 * @return object XML attachment object
587 function dfrn_get_attachment($doc, $root, $item) {
588 $arr = explode('[/attach],',$item['attach']);
590 foreach($arr as $r) {
592 $cnt = preg_match('|\[attach\]href=\"(.*?)\" length=\"(.*?)\" type=\"(.*?)\" title=\"(.*?)\"|',$r,$matches);
594 $attributes = array("rel" => "enclosure",
595 "href" => $matches[1],
596 "type" => $matches[3]);
598 if(intval($matches[2]))
599 $attributes["length"] = intval($matches[2]);
601 if(trim($matches[4]) != "")
602 $attributes["title"] = trim($matches[4]);
604 xml_add_element($doc, $root, "link", "", $attributes);
611 * @brief Adds the header elements for the DFRN protocol
613 * @param object $doc XML document
614 * @param string $type "text" or "html"
615 * @param array $item Item element
616 * @param array $owner Owner record
617 * @param bool $comment Trigger the sending of the "comment" element
620 * @return object XML entry object
622 function dfrn_entry($doc, $type, $item, $owner, $comment = false, $cid = 0) {
625 $mentioned = array();
630 if($item['deleted']) {
631 $attributes = array("ref" => $item['uri'], "when" => datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME));
632 return xml_create_element($doc, "at:deleted-entry", "", $attributes);
635 $entry = $doc->createElement("entry");
637 if($item['allow_cid'] || $item['allow_gid'] || $item['deny_cid'] || $item['deny_gid'])
638 $body = fix_private_photos($item['body'],$owner['uid'],$item,$cid);
640 $body = $item['body'];
642 if ($type == 'html') {
645 if ($item['title'] != "")
646 $htmlbody = "[b]".$item['title']."[/b]\n\n".$htmlbody;
648 $htmlbody = bbcode($htmlbody, false, false, 7);
651 $author = dfrn_add_entry_author($doc, "author", $item["author-link"], $item);
652 $entry->appendChild($author);
654 $dfrnowner = dfrn_add_entry_author($doc, "dfrn:owner", $item["owner-link"], $item);
655 $entry->appendChild($dfrnowner);
657 if(($item['parent'] != $item['id']) || ($item['parent-uri'] !== $item['uri']) || (($item['thr-parent'] !== '') && ($item['thr-parent'] !== $item['uri']))) {
658 $parent = q("SELECT `guid` FROM `item` WHERE `id` = %d", intval($item["parent"]));
659 $parent_item = (($item['thr-parent']) ? $item['thr-parent'] : $item['parent-uri']);
660 $attributes = array("ref" => $parent_item, "type" => "text/html", "href" => $a->get_baseurl().'/display/'.$parent[0]['guid']);
661 xml_add_element($doc, $entry, "thr:in-reply-to", "", $attributes);
664 xml_add_element($doc, $entry, "id", $item["uri"]);
665 xml_add_element($doc, $entry, "title", $item["title"]);
667 xml_add_element($doc, $entry, "published", datetime_convert("UTC","UTC",$item["created"]."+00:00",ATOM_TIME));
668 xml_add_element($doc, $entry, "updated", datetime_convert("UTC","UTC",$item["edited"]."+00:00",ATOM_TIME));
670 xml_add_element($doc, $entry, "dfrn:env", base64url_encode($body, true));
671 xml_add_element($doc, $entry, "content", (($type === 'html') ? $htmlbody : $body), array("type" => $type));
673 xml_add_element($doc, $entry, "link", "", array("rel" => "alternate", "type" => "text/html",
674 "href" => $a->get_baseurl()."/display/".$item["guid"]));
677 xml_add_element($doc, $entry, "dfrn:comment-allow", intval($item['last-child']));
679 if($item['location'])
680 xml_add_element($doc, $entry, "dfrn:location", $item['location']);
683 xml_add_element($doc, $entry, "georss:point", $item['coord']);
685 if(($item['private']) || strlen($item['allow_cid']) || strlen($item['allow_gid']) || strlen($item['deny_cid']) || strlen($item['deny_gid']))
686 xml_add_element($doc, $entry, "dfrn:private", (($item['private']) ? $item['private'] : 1));
689 xml_add_element($doc, $entry, "dfrn:extid", $item['extid']);
691 if($item['bookmark'])
692 xml_add_element($doc, $entry, "dfrn:bookmark", "true");
695 xml_add_element($doc, $entry, "statusnet:notice_info", "", array("local_id" => $item['id'], "source" => $item['app']));
697 xml_add_element($doc, $entry, "dfrn:diaspora_guid", $item["guid"]);
699 if($item['signed_text']) {
700 $sign = base64_encode(json_encode(array('signed_text' => $item['signed_text'],'signature' => $item['signature'],'signer' => $item['signer'])));
701 xml_add_element($doc, $entry, "dfrn:diaspora_signature", $sign);
704 xml_add_element($doc, $entry, "activity:verb", construct_verb($item));
706 $actobj = dfrn_create_activity($doc, "activity:object", $item['object']);
708 $entry->appendChild($actobj);
710 $actarg = dfrn_create_activity($doc, "activity:target", $item['target']);
712 $entry->appendChild($actarg);
714 $tags = item_getfeedtags($item);
718 if (($type != 'html') OR ($t[0] != "@"))
719 xml_add_element($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2]));
725 $mentioned[$t[1]] = $t[1];
727 foreach ($mentioned AS $mention) {
728 $r = q("SELECT `forum`, `prv` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'",
729 intval($owner["uid"]),
730 dbesc(normalise_link($mention)));
731 if ($r[0]["forum"] OR $r[0]["prv"])
732 xml_add_element($doc, $entry, "link", "", array("rel" => "mentioned",
733 "ostatus:object-type" => ACTIVITY_OBJ_GROUP,
734 "href" => $mention));
736 xml_add_element($doc, $entry, "link", "", array("rel" => "mentioned",
737 "ostatus:object-type" => ACTIVITY_OBJ_PERSON,
738 "href" => $mention));
741 dfrn_get_attachment($doc, $entry, $item);