]> git.mxchange.org Git - friendica.git/blob - src/Protocol/ActivityPub.php
07989621f183854341cb45cdb96c9b2097ad5fd8
[friendica.git] / src / Protocol / ActivityPub.php
1 <?php
2 /**
3  * @file src/Protocol/ActivityPub.php
4  */
5 namespace Friendica\Protocol;
6
7 use Friendica\Database\DBA;
8 use Friendica\Core\System;
9 use Friendica\BaseObject;
10 use Friendica\Util\Network;
11 use Friendica\Util\HTTPSignature;
12 use Friendica\Core\Protocol;
13 use Friendica\Model\Item;
14 use Friendica\Model\User;
15 use Friendica\Util\DateTimeFormat;
16 use Friendica\Util\Crypto;
17 use Friendica\Content\Text\BBCode;
18
19 /**
20  * @brief ActivityPub Protocol class
21  * The ActivityPub Protocol is a message exchange protocol defined by the W3C.
22  * https://www.w3.org/TR/activitypub/
23  * https://www.w3.org/TR/activitystreams-core/
24  * https://www.w3.org/TR/activitystreams-vocabulary/
25  *
26  * https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/
27  * https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/
28  *
29  * Digest: https://tools.ietf.org/html/rfc5843
30  * https://tools.ietf.org/html/draft-cavage-http-signatures-10#ref-15
31  */
32 class ActivityPub
33 {
34         const PUBLIC = 'https://www.w3.org/ns/activitystreams#Public';
35
36         public static function transmit($content, $target, $uid)
37         {
38                 $owner = User::getOwnerDataById($uid);
39
40                 if (!$owner) {
41                         return;
42                 }
43
44                 $host = parse_url($target, PHP_URL_HOST);
45                 $path = parse_url($target, PHP_URL_PATH);
46                 $date = date('r');
47
48                 $headers = ['Host: ' . $host, 'Date: ' . $date];
49
50                 $signed_data = "(request-target): post " . $path . "\nhost: " . $host . "\ndate: " . $date;
51
52                 $signature = base64_encode(Crypto::rsaSign($signed_data, $owner['uprvkey'], 'sha256'));
53
54                 $headers[] = 'Signature: keyId="' . $owner['url'] . '#main-key' . '",headers="(request-target) host date",signature="' . $signature . '"';
55                 $headers[] = 'Content-Type: application/activity+json';
56 //print_r($headers);
57 //die($signed_data);
58 //$headers = [];
59 //              $headers = HTTPSignature::createSig('', $headers, $owner['uprvkey'], $owner['url'] . '#main-key', false, false, 'sha256');
60
61                 Network::post($target, $content, $headers);
62                 $return_code = BaseObject::getApp()->get_curl_code();
63 echo $return_code."\n";
64                 print_r(BaseObject::getApp()->get_curl_headers());
65                 print_r($headers);
66         }
67
68         /**
69          * Return the ActivityPub profile of the given user
70          *
71          * @param integer $uid User ID
72          * @return array
73          */
74         public static function profile($uid)
75         {
76                 $accounttype = ['Person', 'Organization', 'Service', 'Group', 'Application'];
77
78                 $condition = ['uid' => $uid, 'blocked' => false, 'account_expired' => false,
79                         'account_removed' => false, 'verified' => true];
80                 $fields = ['guid', 'nickname', 'pubkey', 'account-type'];
81                 $user = DBA::selectFirst('user', $fields, $condition);
82                 if (!DBA::isResult($user)) {
83                         return [];
84                 }
85
86                 $fields = ['locality', 'region', 'country-name'];
87                 $profile = DBA::selectFirst('profile', $fields, ['uid' => $uid, 'is-default' => true]);
88                 if (!DBA::isResult($profile)) {
89                         return [];
90                 }
91
92                 $fields = ['name', 'url', 'location', 'about', 'avatar'];
93                 $contact = DBA::selectFirst('contact', $fields, ['uid' => $uid, 'self' => true]);
94                 if (!DBA::isResult($contact)) {
95                         return [];
96                 }
97
98                 $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
99                         ['uuid' => 'http://schema.org/identifier', 'sensitive' => 'as:sensitive',
100                         'vcard' => 'http://www.w3.org/2006/vcard/ns#']]];
101
102                 $data['id'] = $contact['url'];
103                 $data['uuid'] = $user['guid'];
104                 $data['type'] = $accounttype[$user['account-type']];
105                 $data['following'] = System::baseUrl() . '/following/' . $user['nickname'];
106                 $data['followers'] = System::baseUrl() . '/followers/' . $user['nickname'];
107                 $data['inbox'] = System::baseUrl() . '/inbox/' . $user['nickname'];
108                 $data['outbox'] = System::baseUrl() . '/outbox/' . $user['nickname'];
109                 $data['preferredUsername'] = $user['nickname'];
110                 $data['name'] = $contact['name'];
111                 $data['vcard:hasAddress'] = ['@type' => 'Home', 'vcard:country-name' => $profile['country-name'],
112                         'vcard:region' => $profile['region'], 'vcard:locality' => $profile['locality']];
113                 $data['summary'] = $contact['about'];
114                 $data['url'] = $contact['url'];
115                 $data['manuallyApprovesFollowers'] = false;
116                 $data['publicKey'] = ['id' => $contact['url'] . '#main-key',
117                         'owner' => $contact['url'],
118                         'publicKeyPem' => $user['pubkey']];
119                 $data['endpoints'] = ['sharedInbox' => System::baseUrl() . '/inbox'];
120                 $data['icon'] = ['type' => 'Image',
121                         'url' => $contact['avatar']];
122
123                 // tags: https://kitty.town/@inmysocks/100656097926961126.json
124                 return $data;
125         }
126
127         public static function createActivityFromItem($item_id)
128         {
129                 $item = Item::selectFirst([], ['id' => $item_id]);
130
131                 $data = ['@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1',
132                         ['Emoji' => 'toot:Emoji', 'Hashtag' => 'as:Hashtag', 'atomUri' => 'ostatus:atomUri',
133                         'conversation' => 'ostatus:conversation', 'inReplyToAtomUri' => 'ostatus:inReplyToAtomUri',
134                         'ostatus' => 'http://ostatus.org#', 'sensitive' => 'as:sensitive',
135                         'toot' => 'http://joinmastodon.org/ns#']]];
136
137                 $data['type'] = 'Create';
138                 $data['id'] = $item['plink'];
139                 $data['actor'] = $item['author-link'];
140                 $data['to'] = 'https://www.w3.org/ns/activitystreams#Public';
141                 $data['object'] = self::createNote($item);
142 //              print_r($data);
143 //              print_r($item);
144                 return $data;
145         }
146
147         public static function createNote($item)
148         {
149                 $data = [];
150                 $data['type'] = 'Note';
151                 $data['id'] = $item['plink'];
152                 //$data['context'] = $data['conversation'] = $item['parent-uri'];
153                 $data['actor'] = $item['author-link'];
154 //              if (!$item['private']) {
155 //                      $data['to'] = [];
156 //                      $data['to'][] = '"https://pleroma.soykaf.com/users/heluecht"';
157                         $data['to'] = 'https://www.w3.org/ns/activitystreams#Public';
158 //                      $data['cc'] = 'https://pleroma.soykaf.com/users/heluecht';
159 //              }
160                 $data['published'] = DateTimeFormat::utc($item["created"]."+00:00", DateTimeFormat::ATOM);
161                 $data['updated'] = DateTimeFormat::utc($item["edited"]."+00:00", DateTimeFormat::ATOM);
162                 $data['attributedTo'] = $item['author-link'];
163                 $data['name'] = BBCode::convert($item['title'], false, 7);
164                 $data['content'] = BBCode::convert($item['body'], false, 7);
165                 //$data['summary'] = '';
166                 //$data['sensitive'] = false;
167                 //$data['emoji'] = [];
168                 //$data['tag'] = [];
169                 //$data['attachment'] = [];
170                 return $data;
171         }
172
173         /**
174          * Fetches ActivityPub content from the given url
175          *
176          * @param string $url content url
177          * @return array
178          */
179         public static function fetchContent($url)
180         {
181                 $ret = Network::curl($url, false, $redirects, ['accept_content' => 'application/activity+json']);
182
183                 if (!$ret['success'] || empty($ret['body'])) {
184                         return;
185                 }
186
187                 return json_decode($ret['body'], true);
188         }
189
190         /**
191          * Resolves the profile url from the address by using webfinger
192          *
193          * @param string $addr profile address (user@domain.tld)
194          * @return string url
195          */
196         private static function addrToUrl($addr)
197         {
198                 $addr_parts = explode('@', $addr);
199                 if (count($addr_parts) != 2) {
200                         return false;
201                 }
202
203                 $webfinger = 'https://' . $addr_parts[1] . '/.well-known/webfinger?resource=acct:' . urlencode($addr);
204
205                 $ret = Network::curl($webfinger, false, $redirects, ['accept_content' => 'application/jrd+json,application/json']);
206                 if (!$ret['success'] || empty($ret['body'])) {
207                         return false;
208                 }
209
210                 $data = json_decode($ret['body'], true);
211
212                 if (empty($data['links'])) {
213                         return false;
214                 }
215
216                 foreach ($data['links'] as $link) {
217                         if (empty($link['href']) || empty($link['rel']) || empty($link['type'])) {
218                                 continue;
219                         }
220
221                         if (($link['rel'] == 'self') && ($link['type'] == 'application/activity+json')) {
222                                 return $link['href'];
223                         }
224                 }
225
226                 return false;
227         }
228
229         /**
230          * Fetches a profile from the given url
231          *
232          * @param string $url profile url
233          * @return array
234          */
235         public static function fetchProfile($url)
236         {
237                 if (empty(parse_url($url, PHP_URL_SCHEME))) {
238                         $url = self::addrToUrl($url);
239                         if (empty($url)) {
240                                 return false;
241                         }
242                 }
243
244                 $data = self::fetchContent($url);
245
246                 if (empty($data) || empty($data['id']) || empty($data['inbox'])) {
247                         return false;
248                 }
249
250                 $profile = ['network' => Protocol::ACTIVITYPUB];
251                 $profile['nick'] = $data['preferredUsername'];
252                 $profile['name'] = defaults($data, 'name', $profile['nick']);
253                 $profile['guid'] = defaults($data, 'uuid', null);
254                 $profile['url'] = $data['id'];
255                 $profile['alias'] = self::processElement($data, 'url', 'href');
256
257                 $parts = parse_url($profile['url']);
258                 unset($parts['scheme']);
259                 unset($parts['path']);
260                 $profile['addr'] = $profile['nick'] . '@' . str_replace('//', '', Network::unparseURL($parts));
261
262                 $profile['photo'] = self::processElement($data, 'icon', 'url');
263                 $profile['about'] = defaults($data, 'summary', '');
264                 $profile['batch'] = self::processElement($data, 'endpoints', 'sharedInbox');
265                 $profile['pubkey'] = self::processElement($data, 'publicKey', 'publicKeyPem');
266                 $profile['notify'] = $data['inbox'];
267                 $profile['poll'] = $data['outbox'];
268
269                 // Check if the address is resolvable
270                 if (self::addrToUrl($profile['addr']) == $profile['url']) {
271                         $parts = parse_url($profile['url']);
272                         unset($parts['path']);
273                         $profile['baseurl'] = Network::unparseURL($parts);
274                 } else {
275                         unset($profile['addr']);
276                 }
277
278                 if ($profile['url'] == $profile['alias']) {
279                         unset($profile['alias']);
280                 }
281
282                 // Remove all "null" fields
283                 foreach ($profile as $field => $content) {
284                         if (is_null($content)) {
285                                 unset($profile[$field]);
286                         }
287                 }
288
289                 // Handled
290                 unset($data['id']);
291                 unset($data['inbox']);
292                 unset($data['outbox']);
293                 unset($data['preferredUsername']);
294                 unset($data['name']);
295                 unset($data['summary']);
296                 unset($data['url']);
297                 unset($data['publicKey']);
298                 unset($data['endpoints']);
299                 unset($data['icon']);
300                 unset($data['uuid']);
301
302                 // To-Do
303                 unset($data['type']);
304                 unset($data['manuallyApprovesFollowers']);
305
306                 // Unhandled
307                 unset($data['@context']);
308                 unset($data['tag']);
309                 unset($data['attachment']);
310                 unset($data['image']);
311                 unset($data['nomadicLocations']);
312                 unset($data['signature']);
313                 unset($data['following']);
314                 unset($data['followers']);
315                 unset($data['featured']);
316                 unset($data['movedTo']);
317                 unset($data['liked']);
318                 unset($data['sharedInbox']); // Misskey
319                 unset($data['isCat']); // Misskey
320                 unset($data['kroeg:blocks']); // Kroeg
321                 unset($data['updated']); // Kroeg
322
323 /*              if (!empty($data)) {
324                         print_r($data);
325                         die();
326                 }
327 */
328                 return $profile;
329         }
330
331         public static function fetchOutbox($url)
332         {
333                 $data = self::fetchContent($url);
334                 if (empty($data)) {
335                         return;
336                 }
337
338                 if (!empty($data['orderedItems'])) {
339                         $items = $data['orderedItems'];
340                 } elseif (!empty($data['first']['orderedItems'])) {
341                         $items = $data['first']['orderedItems'];
342                 } elseif (!empty($data['first'])) {
343                         self::fetchOutbox($data['first']);
344                         return;
345                 } else {
346                         $items = [];
347                 }
348
349                 foreach ($items as $activity) {
350                         self::processActivity($activity, $url);
351                 }
352         }
353
354         function processActivity($activity, $url)
355         {
356                 if (empty($activity['type'])) {
357                         return;
358                 }
359
360                 if (empty($activity['object'])) {
361                         return;
362                 }
363
364                 if (empty($activity['actor'])) {
365                         return;
366                 }
367
368                 $actor = self::processElement($activity, 'actor', 'id');
369                 if (empty($actor)) {
370                         return;
371                 }
372
373                 if (is_string($activity['object'])) {
374                         $object_url = $activity['object'];
375                 } elseif (!empty($activity['object']['id'])) {
376                         $object_url = $activity['object']['id'];
377                 } else {
378                         return;
379                 }
380
381                 $receivers = self::getReceivers($activity);
382                 if (empty($receivers)) {
383                         return;
384                 }
385
386                 // ----------------------------------
387                 // unhandled
388                 unset($activity['@context']);
389                 unset($activity['id']);
390
391                 // Non standard
392                 unset($activity['title']);
393                 unset($activity['atomUri']);
394                 unset($activity['context_id']);
395                 unset($activity['statusnetConversationId']);
396
397                 $structure = $activity;
398
399                 // To-Do?
400                 unset($activity['context']);
401                 unset($activity['location']);
402
403                 // handled
404                 unset($activity['to']);
405                 unset($activity['cc']);
406                 unset($activity['bto']);
407                 unset($activity['bcc']);
408                 unset($activity['type']);
409                 unset($activity['actor']);
410                 unset($activity['object']);
411                 unset($activity['published']);
412                 unset($activity['updated']);
413                 unset($activity['instrument']);
414                 unset($activity['inReplyTo']);
415
416                 if (!empty($activity)) {
417                         echo "Activity\n";
418                         print_r($activity);
419                         die($url."\n");
420                 }
421
422                 $activity = $structure;
423                 // ----------------------------------
424
425                 $item = self::fetchObject($object_url, $url);
426                 if (empty($item)) {
427                         return;
428                 }
429
430                 $item = self::addActivityFields($item, $activity);
431
432                 $item['owner'] = $actor;
433
434                 $item['receiver'] = array_merge($item['receiver'], $receivers);
435
436                 switch ($activity['type']) {
437                         case 'Create':
438                         case 'Update':
439                                 self::createItem($item);
440                                 break;
441
442                         case 'Announce':
443                                 self::announceItem($item);
444                                 break;
445
446                         case 'Like':
447                         case 'Dislike':
448                                 self::activityItem($item);
449                                 break;
450
451                         case 'Follow':
452                                 break;
453
454                         default:
455                                 echo "Unknown activity: ".$activity['type']."\n";
456                                 print_r($item);
457                                 die();
458                                 break;
459                 }
460         }
461
462         private static function getReceivers($activity)
463         {
464                 $receivers = [];
465
466                 $elements = ['to', 'cc', 'bto', 'bcc'];
467                 foreach ($elements as $element) {
468                         if (empty($activity[$element])) {
469                                 continue;
470                         }
471
472                         // The receiver can be an arror or a string
473                         if (is_string($activity[$element])) {
474                                 $activity[$element] = [$activity[$element]];
475                         }
476
477                         foreach ($activity[$element] as $receiver) {
478                                 if ($receiver == self::PUBLIC) {
479                                         $receivers[$receiver] = 0;
480                                 }
481
482                                 $condition = ['self' => true, 'nurl' => normalise_link($receiver)];
483                                 $contact = DBA::selectFirst('contact', ['id'], $condition);
484                                 if (!DBA::isResult($contact)) {
485                                         continue;
486                                 }
487                                 $receivers[$receiver] = $contact['id'];
488                         }
489                 }
490                 return $receivers;
491         }
492
493         private static function addActivityFields($item, $activity)
494         {
495                 if (!empty($activity['published']) && empty($item['published'])) {
496                         $item['published'] = $activity['published'];
497                 }
498
499                 if (!empty($activity['updated']) && empty($item['updated'])) {
500                         $item['updated'] = $activity['updated'];
501                 }
502
503                 if (!empty($activity['inReplyTo']) && empty($item['parent-uri'])) {
504                         $item['parent-uri'] = self::processElement($activity, 'inReplyTo', 'id');
505                 }
506
507                 if (!empty($activity['instrument'])) {
508                         $item['service'] = self::processElement($activity, 'instrument', 'name', 'Service');
509                 }
510
511                 // Remove all "null" fields
512                 foreach ($item as $field => $content) {
513                         if (is_null($content)) {
514                                 unset($item[$field]);
515                         }
516                 }
517
518                 return $item;
519         }
520
521         private static function fetchObject($object_url, $url)
522         {
523                 $data = self::fetchContent($object_url);
524                 if (empty($data)) {
525                         return false;
526                 }
527
528                 if (empty($data['type'])) {
529                         return false;
530                 } else {
531                         $type = $data['type'];
532                 }
533
534                 if (in_array($type, ['Note', 'Article', 'Video'])) {
535                         $common = self::processCommonData($data, $url);
536                 }
537
538                 switch ($type) {
539                         case 'Note':
540                                 return array_merge($common, self::processNote($data, $url));
541                         case 'Article':
542                                 return array_merge($common, self::processArticle($data, $url));
543                         case 'Video':
544                                 return array_merge($common, self::processVideo($data, $url));
545
546                         case 'Announce':
547                                 if (empty($data['object'])) {
548                                         return false;
549                                 }
550                                 return self::fetchObject($data['object'], $url);
551
552                         case 'Person':
553                         case 'Tombstone':
554                                 break;
555
556                         default:
557                                 echo "Unknown object type: ".$data['type']."\n";
558                                 print_r($data);
559                                 die($url."\n");
560                                 break;
561                 }
562         }
563
564         private static function processCommonData(&$object, $url)
565         {
566                 if (empty($object['id']) || empty($object['attributedTo'])) {
567                         return false;
568                 }
569
570                 $item = [];
571                 $item['uri'] = $object['id'];
572
573                 if (!empty($object['inReplyTo'])) {
574                         $item['reply-to-uri'] = self::processElement($object, 'inReplyTo', 'id');
575                 } else {
576                         $item['reply-to-uri'] = $item['uri'];
577                 }
578
579                 $item['published'] = defaults($object, 'published', null);
580                 $item['updated'] = defaults($object, 'updated', $item['published']);
581
582                 if (empty($item['published']) && !empty($item['updated'])) {
583                         $item['published'] = $item['updated'];
584                 }
585
586                 $item['uuid'] = defaults($object, 'uuid', null);
587                 $item['owner'] = $item['author'] = self::processElement($object, 'attributedTo', 'id');
588                 $item['context'] = defaults($object, 'context', null);
589                 $item['conversation'] = defaults($object, 'conversation', null);
590                 $item['sensitive'] = defaults($object, 'sensitive', null);
591                 $item['name'] = defaults($object, 'title', null);
592                 $item['name'] = defaults($object, 'name', $item['name']);
593                 $item['summary'] = defaults($object, 'summary', null);
594                 $item['content'] = defaults($object, 'content', null);
595                 $item['location'] = self::processElement($object, 'location', 'name', 'Place');
596                 $item['attachments'] = defaults($object, 'attachment', null);
597                 $item['tags'] = defaults($object, 'tag', null);
598                 $item['service'] = self::processElement($object, 'instrument', 'name', 'Service');
599                 $item['alternate-url'] = self::processElement($object, 'url', 'href');
600                 $item['receiver'] = self::getReceivers($object);
601
602                 // handled
603                 unset($object['id']);
604                 unset($object['inReplyTo']);
605                 unset($object['published']);
606                 unset($object['updated']);
607                 unset($object['uuid']);
608                 unset($object['attributedTo']);
609                 unset($object['context']);
610                 unset($object['conversation']);
611                 unset($object['sensitive']);
612                 unset($object['name']);
613                 unset($object['title']);
614                 unset($object['content']);
615                 unset($object['summary']);
616                 unset($object['location']);
617                 unset($object['attachment']);
618                 unset($object['tag']);
619                 unset($object['instrument']);
620                 unset($object['url']);
621                 unset($object['to']);
622                 unset($object['cc']);
623                 unset($object['bto']);
624                 unset($object['bcc']);
625
626                 // To-Do
627                 unset($object['source']);
628
629                 // Unhandled
630                 unset($object['@context']);
631                 unset($object['type']);
632                 unset($object['actor']);
633                 unset($object['signature']);
634                 unset($object['mediaType']);
635                 unset($object['duration']);
636                 unset($object['replies']);
637                 unset($object['icon']);
638
639                 /*
640                 audience, preview, endTime, startTime, generator, image
641                 */
642
643                 return $item;
644         }
645
646         private static function processNote($object, $url)
647         {
648                 $item = [];
649
650                 // To-Do?
651                 unset($object['emoji']);
652                 unset($object['atomUri']);
653                 unset($object['inReplyToAtomUri']);
654
655                 // Unhandled
656                 unset($object['contentMap']);
657                 unset($object['announcement_count']);
658                 unset($object['announcements']);
659                 unset($object['context_id']);
660                 unset($object['likes']);
661                 unset($object['like_count']);
662                 unset($object['inReplyToStatusId']);
663                 unset($object['shares']);
664                 unset($object['quoteUrl']);
665                 unset($object['statusnetConversationId']);
666
667                 if (empty($object))
668                         return $item;
669
670                 echo "Unknown Note\n";
671                 print_r($object);
672                 print_r($item);
673                 die($url."\n");
674
675                 return [];
676         }
677
678         private static function processArticle($object, $url)
679         {
680                 $item = [];
681
682                 if (empty($object))
683                         return $item;
684
685                 echo "Unknown Article\n";
686                 print_r($object);
687                 print_r($item);
688                 die($url."\n");
689
690                 return [];
691         }
692
693         private static function processVideo($object, $url)
694         {
695                 $item = [];
696
697                 // To-Do?
698                 unset($object['category']);
699                 unset($object['licence']);
700                 unset($object['language']);
701                 unset($object['commentsEnabled']);
702
703                 // Unhandled
704                 unset($object['views']);
705                 unset($object['waitTranscoding']);
706                 unset($object['state']);
707                 unset($object['support']);
708                 unset($object['subtitleLanguage']);
709                 unset($object['likes']);
710                 unset($object['dislikes']);
711                 unset($object['shares']);
712                 unset($object['comments']);
713
714                 if (empty($object))
715                         return $item;
716
717                 echo "Unknown Video\n";
718                 print_r($object);
719                 print_r($item);
720                 die($url."\n");
721
722                 return [];
723         }
724
725         private static function processElement($array, $element, $key, $type = null)
726         {
727                 if (empty($array)) {
728                         return false;
729                 }
730
731                 if (empty($array[$element])) {
732                         return false;
733                 }
734
735                 if (is_string($array[$element])) {
736                         return $array[$element];
737                 }
738
739                 if (is_null($type)) {
740                         if (!empty($array[$element][$key])) {
741                                 return $array[$element][$key];
742                         }
743
744                         if (!empty($array[$element][0][$key])) {
745                                 return $array[$element][0][$key];
746                         }
747
748                         return false;
749                 }
750
751                 if (!empty($array[$element][$key]) && !empty($array[$element]['type']) && ($array[$element]['type'] == $type)) {
752                         return $array[$element][$key];
753                 }
754
755                 /// @todo Add array search
756
757                 return false;
758         }
759
760         private static function createItem($item)
761         {
762 //              print_r($item);
763         }
764
765         private static function announceItem($item)
766         {
767 //              print_r($item);
768         }
769
770         private static function activityItem($item)
771         {
772         //      print_r($item);
773         }
774
775 }