- if (dbm::is_result($r)) {
- if ($r[0]["id"] != $r[0]["parent"]) {
- $r = qu("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
- WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
- AND `id` = %d", $r[0]["parent"]);
- }
- if (($itemuid != local_user()) AND local_user()) {
- // Do we know this contact but we haven't got this item?
- // Copy the wohle thread to our local storage so that we can interact.
- // We really should change this need for the future since it scales very bad.
- $contactid = get_contact($r[0]['owner-link'], local_user());
- if ($contactid) {
- $items = qu("SELECT * FROM `item` WHERE `parent` = %d ORDER BY `id`", intval($r[0]["id"]));
- foreach ($items AS $item) {
- $itemcontactid = get_contact($item['owner-link'], local_user());
- if (!$itemcontactid) {
- $itemcontactid = $contactid;
- }
- unset($item['id']);
- $item['uid'] = local_user();
- $item['origin'] = 0;
- $item['contact-id'] = $itemcontactid;
- $local_copy = item_store($item, false, false, true);
- logger("Stored local copy for post ".$item['guid']." under id ".$local_copy, LOGGER_DEBUG);
- }
- }
- }
+ } elseif (($a->argc == 3) && ($nick == '_feed_')) {
+ $r = dba::fetch_first("SELECT `id`, `parent`, `author-name`, `author-link`,
+ `author-avatar`, `network`, `body`, `uid`, `owner-link`
+ FROM `item` WHERE `visible` AND NOT `deleted` AND NOT `moderated`
+ AND `allow_cid` = '' AND `allow_gid` = ''
+ AND `deny_cid` = '' AND `deny_gid` = ''
+ AND NOT `private` AND `uid` = 0
+ AND `id` = ? LIMIT 1", $a->argv[2]);
+ }
+
+ if (DBM::is_result($r)) {
+ if (strstr($_SERVER['HTTP_ACCEPT'], 'application/atom+xml')) {
+ logger('Directly serving XML for id '.$r["id"], LOGGER_DEBUG);
+ displayShowFeed($r["id"], false);
+ }
+
+ if ($r["id"] != $r["parent"]) {
+ $r = dba::fetch_first("SELECT `id`, `author-name`, `author-link`, `author-avatar`, `network`, `body`, `uid`, `owner-link` FROM `item`
+ WHERE `item`.`visible` AND NOT `item`.`deleted` AND NOT `item`.`moderated`
+ AND `id` = ?", $r["parent"]);
+ }
+
+ $profiledata = display_fetchauthor($a, $r);