+ if($followup) {
+ foreach($items as $item) { // there is only one item
+
+ $verb = construct_verb($item);
+ $actobj = construct_activity($item);
+
+ if($item['id'] == $item_id) {
+ $slap = replace_macros($cmnt_template, array(
+ '$name' => xmlify($owner['name']),
+ '$profile_page' => xmlify($owner['url']),
+ '$thumb' => xmlify($owner['thumb']),
+ '$owner_name' => xmlify($item['owner-name']),
+ '$owner_profile_page' => xmlify($item['owner-link']),
+ '$owner_thumb' => xmlify($item['owner-avatar']),
+ '$item_id' => xmlify($item['uri']),
+ '$title' => xmlify($item['title']),
+ '$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
+ '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
+ '$location' => xmlify($item['location']),
+ '$coord' => xmlify($item['coord']),
+ '$type' => 'text',
+ '$verb' => xmlify($verb),
+ '$actobj' => $actobj,
+ '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
+ '$content' => xmlify($item['body']),
+ '$parent_id' => xmlify($item['parent-uri']),
+ '$comment_allow' => 0
+ ));
+ }
+ }
+ $atom .= $slap;
+ }
+ else {
+ foreach($items as $item) {
+ if($item['deleted']) {
+ $atom .= replace_macros($tomb_template, array(
+ '$id' => xmlify($item['uri']),
+ '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME))
+ ));
+ }
+ else {
+ $contact = get_item_contact($item,$contacts);
+ if(! $contact)
+ continue;
+
+ $verb = construct_verb($item);
+ $actobj = construct_activity($item);
+
+ if($item['parent'] == $item['id']) {
+ $atom .= replace_macros($item_template, array(
+ '$name' => xmlify($contact['name']),
+ '$profile_page' => xmlify($contact['url']),
+ '$thumb' => xmlify($contact['thumb']),
+ '$owner_name' => xmlify($item['owner-name']),
+ '$owner_profile_page' => xmlify($item['owner-link']),
+ '$owner_thumb' => xmlify($item['owner-avatar']),
+ '$item_id' => xmlify($item['uri']),
+ '$title' => xmlify($item['title']),
+ '$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
+ '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
+ '$location' => xmlify($item['location']),
+ '$coord' => xmlify($item['coord']),
+ '$type' => 'text',
+ '$verb' => xmlify($verb),
+ '$actobj' => $actobj,
+ '$content' => xmlify($item['body']),
+ '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
+ '$comment_allow' => (($item['last-child']) ? 1 : 0)
+ ));
+ }
+ else {
+ $atom .= replace_macros($cmnt_template, array(
+ '$name' => xmlify($contact['name']),
+ '$profile_page' => xmlify($contact['url']),
+ '$thumb' => xmlify($contact['thumb']),
+ '$item_id' => xmlify($item['uri']),
+ '$title' => xmlify($item['title']),
+ '$published' => xmlify(datetime_convert('UTC', 'UTC', $item['created'] . '+00:00' , ATOM_TIME)),
+ '$updated' => xmlify(datetime_convert('UTC', 'UTC', $item['edited'] . '+00:00' , ATOM_TIME)),
+ '$content' => xmlify($item['body']),
+ '$alt' => xmlify($a->get_baseurl() . '/display/' . $owner['nickname'] . '/' . $item['id']),
+ '$location' => xmlify($item['location']),
+ '$coord' => xmlify($item['coord']),
+ '$type' => 'text',
+ '$verb' => xmlify($verb),
+ '$actobj' => $actobj,
+ '$parent_id' => xmlify($item['parent-uri']),
+ '$comment_allow' => (($item['last-child']) ? 1 : 0)
+ ));
+ }
+ }
+ }
+ }
+ }
+ $atom .= '</feed>' . "\r\n";
+
+ if($debugging)
+ echo $atom;