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