]> git.mxchange.org Git - friendica.git/blob - mod/network.php
Merge remote-tracking branch 'friendika-master/master'
[friendica.git] / mod / network.php
1 <?php
2
3
4 function network_init(&$a) {
5         if(! local_user()) {
6                 notice( t('Permission denied.') . EOL);
7                 return;
8         }
9   
10   
11         require_once('include/group.php');
12         if(! x($a->page,'aside'))
13                 $a->page['aside'] = '';
14
15         $a->page['aside'] .= '<div id="network-new-link">';
16
17         if(($a->argc > 1 && $a->argv[1] === 'new') || ($a->argc > 2 && $a->argv[2] === 'new'))
18                 $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . str_replace('/new', '', $a->cmd) . '">' . t('Normal View') . '</a>';
19         else 
20                 $a->page['aside'] .= '<a href="' . $a->get_baseurl() . '/' . $a->cmd . '/new' . '">' . t('New Item View') . '</a>';
21
22         $a->page['aside'] .= '</div>';
23
24         $a->page['aside'] .= group_side('network','network');
25 }
26
27
28 function network_content(&$a, $update = 0) {
29
30         if(! local_user())
31         return login(false);
32
33         $o = '';
34
35         require_once("include/bbcode.php");
36
37         $contact_id = $a->cid;
38
39         $group = 0;
40
41         $nouveau = false;
42         require_once('include/acl_selectors.php');
43
44         if(($a->argc > 2) && $a->argv[2] === 'new')
45                 $nouveau = true;
46
47         if($a->argc > 1) {
48                 if($a->argv[1] === 'new')
49                         $nouveau = true;
50                 else {
51                         $group = intval($a->argv[1]);
52                         $group_acl = array('allow_gid' => '<' . $group . '>');
53                 }
54         }
55
56         if(! $update) {
57                 $o .= '<script> $(document).ready(function() { $(\'#nav-network-link\').addClass(\'nav-selected\'); });</script>';
58
59                 $_SESSION['return_url'] = $a->cmd;
60
61                 $geotag = (($a->user['allow_location']) ? load_view_file('view/jot_geotag.tpl') : '');
62
63                 $tpl = load_view_file('view/jot-header.tpl');
64         
65                 $a->page['htmlhead'] .= replace_macros($tpl, array(
66                         '$baseurl' => $a->get_baseurl(),
67                         '$geotag' => $geotag,
68                         '$nickname' => $a->user['nickname'],
69                         '$linkurl' => t('Please enter a link URL:'),
70                         '$utubeurl' => t('Please enter a YouTube link:'),
71                         '$vidurl' => t("Please enter a video\x28.ogg\x29 link/URL:"),
72                         '$audurl' => t("Please enter an audio\x28.ogg\x29 link/URL:"),
73                         '$whereareu' => t('Where are you right now?'),
74                         '$title' => t('Enter a title for this item') 
75                 ));
76
77
78                 $tpl = load_view_file("view/jot.tpl");
79                 
80                 if(($group) || (is_array($a->user) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid'])))))
81                                 $lockstate = 'lock';
82                         else
83                                 $lockstate = 'unlock';
84
85                 $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
86
87                 $jotplugins = '';
88                 $jotnets = '';
89                 call_hooks('jot_tool', $jotplugins);
90                 call_hooks('jot_networks', $jotnets);
91
92                 $tpl = replace_macros($tpl,array('$jotplugins' => $jotplugins));        
93
94                 $o .= replace_macros($tpl,array(
95                         '$return_path' => $a->cmd,
96                         '$action' => 'item',
97                         '$share' => t('Share'),
98                         '$upload' => t('Upload photo'),
99                         '$weblink' => t('Insert web link'),
100                         '$youtube' => t('Insert YouTube video'),
101                         '$video' => t('Insert Vorbis [.ogg] video'),
102                         '$audio' => t('Insert Vorbis [.ogg] audio'),
103                         '$setloc' => t('Set your location'),
104                         '$noloc' => t('Clear browser location'),
105                         '$title' => t('Set title'),
106                         '$wait' => t('Please wait'),
107                         '$permset' => t('Permission settings'),
108                         '$content' => '',
109                         '$post_id' => '',
110                         '$baseurl' => $a->get_baseurl(),
111                         '$defloc' => $a->user['default-location'],
112                         '$visitor' => 'block',
113                         '$emailcc' => t('CC: email addresses'),
114                         '$jotnets' => $jotnets,
115                         '$emtitle' => t('Example: bob@example.com, mary@example.com'),
116                         '$lockstate' => $lockstate,
117                         '$acl' => populate_acl((($group) ? $group_acl : $a->user), $celeb),
118                         '$bang' => (($group) ? '!' : ''),
119                         '$profile_uid' => local_user()
120                 ));
121
122
123                 // The special div is needed for liveUpdate to kick in for this page.
124                 // We only launch liveUpdate if you are on the front page, you aren't
125                 // filtering by group and also you aren't writing a comment (the last
126                 // criteria is discovered in javascript).
127
128                         $o .= '<div id="live-network"></div>' . "\r\n";
129                         $o .= "<script> var profile_uid = " . $_SESSION['uid'] 
130                                 . "; var netargs = '" . substr($a->cmd,8) 
131                                 . "'; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
132
133         }
134
135         // We aren't going to try and figure out at the item, group, and page level 
136         // which items you've seen and which you haven't. You're looking at some
137         // subset of items, so just mark everything seen. 
138         
139         $r = q("UPDATE `item` SET `unseen` = 0 
140                 WHERE `unseen` = 1 AND `uid` = %d",
141                 intval($_SESSION['uid'])
142         );
143
144         // We don't have to deal with ACL's on this page. You're looking at everything
145         // that belongs to you, hence you can see all of it. We will filter by group if
146         // desired. 
147
148         $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` ) ";
149
150         if($group) {
151                 $r = q("SELECT `name`, `id` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1",
152                         intval($group),
153                         intval($_SESSION['uid'])
154                 );
155                 if(! count($r)) {
156                         if($update)
157                                 killme();
158                         notice( t('No such group') . EOL );
159                         goaway($a->get_baseurl() . '/network');
160                         return; // NOTREACHED
161                 }
162
163                 $contacts = expand_groups(array($group));
164                 if((is_array($contacts)) && count($contacts)) {
165                         $contact_str = implode(',',$contacts);
166                 }
167                 else {
168                                 $contact_str = ' 0 ';
169                                 notice( t('Group is empty'));
170                 }
171
172                 $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE `id` = `parent` AND `contact-id` IN ( $contact_str )) ";
173                 $o = '<h2>' . t('Group: ') . $r[0]['name'] . '</h2>' . $o;
174         }
175
176         if((! $group) && (! $update))
177                 $o .= get_birthdays();
178
179
180         $r = q("SELECT COUNT(*) AS `total`
181                 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
182                 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
183                 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
184                 $sql_extra ",
185                 intval($_SESSION['uid'])
186         );
187
188         if(count($r)) {
189                 $a->set_pager_total($r[0]['total']);
190                 $a->set_pager_itemspage(40);
191         }
192
193
194         if($nouveau) {
195
196                 // "New Item View" - show all items unthreaded in reverse created date order
197
198                 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, 
199                         `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
200                         `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
201                         `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
202                         FROM `item`, `contact`
203                         WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
204                         AND `contact`.`id` = `item`.`contact-id`
205                         AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
206                         $sql_extra
207                         ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
208                         intval($_SESSION['uid']),
209                         intval($a->pager['start']),
210                         intval($a->pager['itemspage'])
211                 );
212         }
213         else {
214
215                 // Normal conversation view
216                 // First fetch a known number of parent items
217
218                 $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact_uid`
219                         FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
220                         WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
221                         AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
222                         AND `item`.`parent` = `item`.`id`
223                         $sql_extra
224                         ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
225                         intval(local_user()),
226                         intval($a->pager['start']),
227                         intval($a->pager['itemspage'])
228                 );
229
230
231                 // Then fetch all the children of the parents that are on this page
232
233                 $parents_arr = array();
234                 $parents_str = '';
235
236                 if(count($r)) {
237                         foreach($r as $rr)
238                                 $parents_arr[] = $rr['item_id'];
239                         $parents_str = implode(', ', $parents_arr);
240
241                         $r = q("SELECT `item`.*, `item`.`id` AS `item_id`, 
242                                 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
243                                 `contact`.`network`, `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
244                                 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
245                                 FROM `item`, (SELECT `p`.`id`,`p`.`created` FROM `item` AS `p` WHERE `p`.`parent`=`p`.`id`) as `parentitem`, `contact`
246                                 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
247                                 AND `contact`.`id` = `item`.`contact-id`
248                                 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
249                                 AND `item`.`parent` = `parentitem`.`id` AND `item`.`parent` IN ( %s )
250                                 $sql_extra
251                                 ORDER BY `parentitem`.`created`  DESC, `item`.`gravity` ASC, `item`.`created` ASC ",
252                                 intval(local_user()),
253                                 dbesc($parents_str)
254                         );
255                 }
256         }
257
258         // find all the authors involved in remote conversations
259         // We will use a local profile photo if they are one of our contacts
260         // otherwise we have to get the photo from the item owner's site
261
262         $author_contacts = extract_item_authors($r,local_user());
263
264         $cmnt_tpl = load_view_file('view/comment_item.tpl');
265         $like_tpl = load_view_file('view/like.tpl');
266         $noshare_tpl = load_view_file('view/like_noshare.tpl');
267         $tpl = load_view_file('view/wall_item.tpl');
268         $wallwall = load_view_file('view/wallwall_item.tpl');
269
270         $alike = array();
271         $dlike = array();
272         
273         if(count($r)) {
274
275                 if($nouveau) {
276
277                         // "New Item View" - just loop through the items and format them minimally for display
278
279                         $tpl = load_view_file('view/search_item.tpl');
280                         $droptpl = load_view_file('view/wall_fake_drop.tpl');
281
282                         foreach($r as $item) {
283
284                                 $comment     = '';
285                                 $owner_url   = '';
286                                 $owner_photo = '';
287                                 $owner_name  = '';
288                                 $sparkle     = '';
289                         
290                                 $profile_name   = ((strlen($item['author-name']))   ? $item['author-name']   : $item['name']);
291                                 $profile_avatar = ((strlen($item['author-avatar'])) ? $item['author-avatar'] : $item['thumb']);
292                                 $profile_link   = ((strlen($item['author-link']))   ? $item['author-link']   : $item['url']);
293
294                                 $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
295
296                                 if(strlen($item['author-link'])) {
297                                         if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
298                                                 $profile_link = $redirect_url;
299                                                 $sparkle = ' sparkle';
300                                         }
301                                         elseif(isset($author_contacts[$item['author-link']])) {
302                                                 $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
303                                                 $sparkle = ' sparkle';
304                                         }
305                                 }
306
307                                 $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
308                                 $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
309                                 if($coord) {
310                                         if($location)
311                                                 $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
312                                         else
313                                                 $location = '<span class="smalltext">' . $coord . '</span>';
314                                 }
315
316                                 $drop = replace_macros($droptpl,array('$id' => $item['id']));
317                                 $lock = '<div class="wall-item-lock"></div>';
318
319                                 $o .= replace_macros($tpl,array(
320                                         '$id' => $item['item_id'],
321                                         '$linktitle' => t('View $name\'s profile'),
322                                         '$profile_url' => $profile_link,
323                                         '$name' => $profile_name,
324                                         '$sparkle' => $sparkle,
325                                         '$lock' => $lock,
326                                         '$thumb' => $profile_avatar,
327                                         '$title' => $item['title'],
328                                         '$body' => smilies(bbcode($item['body'])),
329                                         '$ago' => relative_date($item['created']),
330                                         '$location' => $location,
331                                         '$indent' => '',
332                                         '$owner_url' => $owner_url,
333                                         '$owner_photo' => $owner_photo,
334                                         '$owner_name' => $owner_name,
335                                         '$drop' => $drop,
336                                         '$conv' => '<a href="' . $a->get_baseurl() . '/display/' . $a->user['nickname'] . '/' . $item['id'] . '">' . t('View in context') . '</a>'
337                                 ));
338
339                         }
340                         $o .= paginate($a);
341
342                         return $o;
343
344                 }
345
346                 // Normal View
347
348
349                 // Figure out how many comments each parent has
350                 // (Comments all have gravity of 6)
351                 // Store the result in the $comments array
352
353                 $comments = array();
354                 foreach($r as $rr) {
355                         if(intval($rr['gravity']) == 6) {
356                                 if(! x($comments,$rr['parent']))
357                                         $comments[$rr['parent']] = 1;
358                                 else
359                                         $comments[$rr['parent']] += 1;
360                         }
361                 }
362
363                 // map all the like/dislike activities for each parent item 
364                 // Store these in the $alike and $dlike arrays
365
366                 foreach($r as $item) {
367                         like_puller($a,$item,$alike,'like');
368                         like_puller($a,$item,$dlike,'dislike');
369                 }
370
371                 $comments_collapsed = false;
372                 $blowhard = 0;
373                 $blowhard_count = 0;
374
375                 foreach($r as $item) {
376
377                         $comment = '';
378                         $template = $tpl;
379                         $commentww = '';
380                         $sparkle = '';
381                         $owner_url = $owner_photo = $owner_name = '';
382
383
384                         // We've already parsed out like/dislike for special treatment. We can ignore them now
385
386                         if(((activity_match($item['verb'],ACTIVITY_LIKE)) 
387                                 || (activity_match($item['verb'],ACTIVITY_DISLIKE))) 
388                                 && ($item['id'] != $item['parent']))
389                                 continue;
390
391                         // Take care of author collapsing and comment collapsing
392                         // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
393                         // If there are more than two comments, squash all but the last 2.
394
395                         if($item['id'] == $item['parent']) {
396                                 if($blowhard == $item['cid'] && (! $item['self'])) {
397                                         $blowhard_count ++;
398                                         if($blowhard_count == 3) {
399                                                 $o .= '<div class="icollapse-wrapper fakelink" id="icollapse-wrapper-' . $item['parent'] . '" onclick="openClose(' . '\'icollapse-' . $item['parent'] . '\');" >' . t('See more posts like this') . '</div>' . '<div class="icollapse" id="icollapse-' . $item['parent'] . '" style="display: none;" >';
400                                         }
401                                 }
402                                 else {
403                                         $blowhard = $item['cid'];                                       
404                                         if($blowhard_count >= 3)
405                                                 $o .= '</div>';
406                                         $blowhard_count = 0;
407                                 }
408
409                                 $comments_seen = 0;
410                                 $comments_collapsed = false;
411                         }
412                         else
413                                 $comments_seen ++;
414
415
416                         if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
417                                 if(! $comments_collapsed) {
418                                         $o .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent'] . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\');" >' . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>';
419                                         $o .= '<div class="ccollapse" id="ccollapse-' . $item['parent'] . '" style="display: none;" >';
420                                         $comments_collapsed = true;
421                                 }
422                         }
423                         if(($comments[$item['parent']] > 2) && ($comments_seen == ($comments[$item['parent']] - 1))) {
424                                 $o .= '</div>';
425                         }
426
427
428
429                         $redirect_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
430
431                         $lock = ((($item['private']) || (($item['uid'] == local_user()) && (strlen($item['allow_cid']) || strlen($item['allow_gid']) 
432                                 || strlen($item['deny_cid']) || strlen($item['deny_gid']))))
433                                 ? '<div class="wall-item-lock"><img src="images/lock_icon.gif" class="lockview" alt="' . t('Private Message') . '" onclick="lockview(event,' . $item['id'] . ');" /></div>'
434                                 : '<div class="wall-item-lock"></div>');
435
436
437                         // Top-level wall post not written by the wall owner (wall-to-wall)
438                         // First figure out who owns it. 
439
440                         $osparkle = '';
441
442                         if(($item['parent'] == $item['item_id']) && (! $item['self'])) {
443
444                                 if($item['type'] === 'wall') {
445                                         // I do. Put me on the left of the wall-to-wall notice.
446                                         $owner_url = $a->contact['url'];
447                                         $owner_photo = $a->contact['thumb'];
448                                         $owner_name = $a->contact['name'];
449                                         $template = $wallwall;
450                                         $commentww = 'ww';      
451                                 }
452                                 if(($item['type'] === 'remote') && (strlen($item['owner-link'])) && ($item['owner-link'] != $item['author-link'])) {
453                                         // Could be anybody. 
454                                         $owner_url = $item['owner-link'];
455                                         $owner_photo = $item['owner-avatar'];
456                                         $owner_name = $item['owner-name'];
457                                         $template = $wallwall;
458                                         $commentww = 'ww';
459                                         // If it is our contact, use a friendly redirect link
460                                         if((link_compare($item['owner-link'],$item['url'])) 
461                                                 && ($item['network'] === 'dfrn')) {
462                                                 $owner_url = $redirect_url;
463                                                 $osparkle = ' sparkle';
464                                         }
465                                 }
466                         }
467
468                         if($update)
469                                 $return_url = $_SESSION['return_url'];
470                         else
471                                 $return_url = $_SESSION['return_url'] = $a->cmd;
472
473                         $likebuttons = '';
474                         if($item['id'] == $item['parent']) {
475                                 $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array(
476                                         '$id' => $item['id'],
477                                         '$likethis' => t("I like this \x28toggle\x29"),
478                                         '$nolike' => t("I don't like this \x28toggle\x29"),
479                                         '$share' => t('Share'),
480                                         '$wait' => t('Please wait') 
481                                 ));
482                         }
483
484                         if($item['last-child']) {
485                                 $comment = replace_macros($cmnt_tpl,array(
486                                         '$return_path' => '', 
487                                         '$jsreload' => '', // $_SESSION['return_url'],
488                                         '$type' => 'net-comment',
489                                         '$id' => $item['item_id'],
490                                         '$parent' => $item['parent'],
491                                         '$profile_uid' =>  $_SESSION['uid'],
492                                         '$mylink' => $a->contact['url'],
493                                         '$mytitle' => t('This is you'),
494                                         '$myphoto' => $a->contact['thumb'],
495                                         '$ww' => $commentww
496                                 ));
497                         }
498
499                         $edpost = '';
500                         if(($item['id'] == $item['parent']) && (intval($item['wall']) == 1)) 
501                                 $edpost = '<a class="editpost" href="' . $a->get_baseurl() . '/editpost/' . $item['id'] . '" title="' . t('Edit') . '"><img src="images/pencil.gif" /></a>';
502                         $drop = replace_macros(load_view_file('view/wall_item_drop.tpl'), array('$id' => $item['id'], '$delete' => t('Delete')));
503
504                         $photo = $item['photo'];
505                         $thumb = $item['thumb'];
506
507                         // Post was remotely authored.
508
509                         $diff_author = ((link_compare($item['url'],$item['author-link'])) ? false : true);
510
511                         $profile_name   = (((strlen($item['author-name']))   && $diff_author) ? $item['author-name']   : $item['name']);
512                         $profile_avatar = (((strlen($item['author-avatar'])) && $diff_author) ? $item['author-avatar'] : $thumb);
513
514                         if(strlen($item['author-link'])) {
515                                 $profile_link = $item['author-link'];
516                                 if(link_compare($item['author-link'],$item['url']) && ($item['network'] === 'dfrn') && (! $item['self'])) {
517                                         $profile_link = $redirect_url;
518                                         $sparkle = ' sparkle';
519                                 }
520                                 elseif(isset($author_contacts[$item['author-link']])) {
521                                         $profile_link = $a->get_baseurl() . '/redir/' . $author_contacts[$item['author-link']];
522                                         $sparkle = ' sparkle';
523                                 }
524                         }
525                         else 
526                                 $profile_link = $item['url'];
527
528                         $like    = ((x($alike,$item['id'])) ? format_like($alike[$item['id']],$alike[$item['id'] . '-l'],'like',$item['id']) : '');
529                         $dislike = ((x($dlike,$item['id'])) ? format_like($dlike[$item['id']],$dlike[$item['id'] . '-l'],'dislike',$item['id']) : '');
530
531                         $location = (($item['location']) ? '<a target="map" title="' . $item['location'] . '" href="http://maps.google.com/?q=' . urlencode($item['location']) . '">' . $item['location'] . '</a>' : '');
532                         $coord = (($item['coord']) ? '<a target="map" title="' . $item['coord'] . '" href="http://maps.google.com/?q=' . urlencode($item['coord']) . '">' . $item['coord'] . '</a>' : '');
533                         if($coord) {
534                                 if($location)
535                                         $location .= '<br /><span class="smalltext">(' . $coord . ')</span>';
536                                 else
537                                         $location = '<span class="smalltext">' . $coord . '</span>';
538                         }
539
540                         $indent = (($item['parent'] != $item['item_id']) ? ' comment' : '');
541
542                         if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
543                                 $indent .= ' shiny'; 
544
545
546                         // Build the HTML
547
548                         $tmp_item = replace_macros($template,array(
549                                 '$id' => $item['item_id'],
550                                 '$linktitle' => t('View $name\'s profile'),
551                                 '$olinktitle' => t('View $owner_name\'s profile'),
552                                 '$to' => t('to'),
553                                 '$wall' => t('Wall-to-Wall'),
554                                 '$vwall' => t('via Wall-To-Wall:'),
555                                 '$profile_url' => $profile_link,
556                                 '$name' => $profile_name,
557                                 '$thumb' => $profile_avatar,
558                                 '$osparkle' => $osparkle,
559                                 '$sparkle' => $sparkle,
560                                 '$title' => $item['title'],
561                                 '$body' => smilies(bbcode($item['body'])),
562                                 '$ago' => relative_date($item['created']),
563                                 '$lock' => $lock,
564                                 '$location' => $location,
565                                 '$indent' => $indent,
566                                 '$owner_url' => $owner_url,
567                                 '$owner_photo' => $owner_photo,
568                                 '$owner_name' => $owner_name,
569                                 '$plink' => get_plink($item),
570                                 '$edpost' => $edpost,
571                                 '$drop' => $drop,
572                                 '$vote' => $likebuttons,
573                                 '$like' => $like,
574                                 '$dislike' => $dislike,
575                                 '$comment' => $comment
576                         ));
577
578                         $arr = array('item' => $item, 'output' => $tmp_item);
579                         call_hooks('display_item', $arr);
580
581                         $o .= $arr['output'];
582
583                 }
584         }
585
586         if(! $update) {
587
588                 // if author collapsing is in force but didn't get closed, close it off now.
589
590                 if($blowhard_count >= 3)
591                         $o .= '</div>';
592
593
594                 $o .= paginate($a);
595                 $o .= '<div class="cc-license">' . t('Shared content is covered by the <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a> license.') . '</div>';
596         }
597
598         return $o;
599 }