- /*
- heluecht 2018-06-19: from my point of view this whole code part is useless.
- It just renders the body message of technical posts (Like, dislike, ...).
- But: The body isn't visible at all. So we do this stuff just because we can.
- Even if these messages were visible, this would only mean that something went wrong.
- During the further steps of the database restructuring I would like to address this issue.
- */
-
- $xmlhead = "<" . "?xml version='1.0' encoding='UTF-8' ?" . ">";
- if (activity_match($item['verb'], ACTIVITY_LIKE)
- || activity_match($item['verb'], ACTIVITY_DISLIKE)
- || activity_match($item['verb'], ACTIVITY_ATTEND)
- || activity_match($item['verb'], ACTIVITY_ATTENDNO)
- || activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
-
- $fields = ['author-link', 'author-name', 'verb', 'object-type', 'resource-id', 'body', 'plink'];
- $obj = Item::selectFirst($fields, ['uri' => $item['parent-uri']]);
- if (!DBA::isResult($obj)) {
- return;
- }
-
- $author = '[url=' . $item['author-link'] . ']' . $item['author-name'] . '[/url]';
- $objauthor = '[url=' . $obj['author-link'] . ']' . $obj['author-name'] . '[/url]';
-
- switch ($obj['verb']) {
- case ACTIVITY_POST:
- switch ($obj['object-type']) {
- case ACTIVITY_OBJ_EVENT:
- $post_type = L10n::t('event');
- break;
- default:
- $post_type = L10n::t('status');
- }
- break;
- default:
- if ($obj['resource-id']) {
- $post_type = L10n::t('photo');
- $m = [];
- preg_match("/\[url=([^]]*)\]/", $obj['body'], $m);
- $rr['plink'] = $m[1];
- } else {
- $post_type = L10n::t('status');
- }
- }
-
- $plink = '[url=' . $obj['plink'] . ']' . $post_type . '[/url]';
-
- $bodyverb = '';
- if (activity_match($item['verb'], ACTIVITY_LIKE)) {
- $bodyverb = L10n::t('%1$s likes %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_DISLIKE)) {
- $bodyverb = L10n::t('%1$s doesn\'t like %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_ATTEND)) {
- $bodyverb = L10n::t('%1$s attends %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_ATTENDNO)) {
- $bodyverb = L10n::t('%1$s doesn\'t attend %2$s\'s %3$s');
- } elseif (activity_match($item['verb'], ACTIVITY_ATTENDMAYBE)) {
- $bodyverb = L10n::t('%1$s attends maybe %2$s\'s %3$s');
- }
-
- $item['body'] = sprintf($bodyverb, $author, $objauthor, $plink);
- }
-
- if (activity_match($item['verb'], ACTIVITY_FRIEND)) {
-
- if ($item['object-type']=="" || $item['object-type']!== ACTIVITY_OBJ_PERSON) return;
-
- $Aname = $item['author-name'];
- $Alink = $item['author-link'];
-
- $xmlhead="<"."?xml version='1.0' encoding='UTF-8' ?".">";