4 function display_content(&$a) {
6 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
7 notice( t('Public access denied.') . EOL);
11 require_once("include/bbcode.php");
12 require_once('include/security.php');
13 require_once('include/conversation.php');
14 require_once('include/acl_selectors.php');
17 $o = '<div id="live-display"></div>' . "\r\n";
19 $a->page['htmlhead'] .= '<script>$(document).ready(function() { $(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl"); });</script>';
22 $nick = (($a->argc > 1) ? $a->argv[1] : '');
23 profile_load($a,$nick);
25 $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
29 notice( t('Item not found.') . EOL);
36 $remote_contact = false;
39 $contact_id = $_SESSION['visitor_id'];
40 $groups = init_groups_visitor($contact_id);
41 $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
43 intval($a->profile['uid'])
47 $remote_contact = true;
51 if(! $remote_contact) {
53 $contact_id = $_SESSION['cid'];
54 $contact = $a->contact;
58 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
59 intval($a->profile['uid'])
62 $a->page_contact = $r[0];
64 $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
66 if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
67 notice( t('Access to this profile has been restricted.') . EOL);
72 $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
76 'allow_location' => $a->user['allow_location'],
77 'default_location' => $a->user['default-location'],
78 'nickname' => $a->user['nickname'],
79 'lockstate' => ( (is_array($a->user)) && ((strlen($a->user['allow_cid'])) || (strlen($a->user['allow_gid'])) || (strlen($a->user['deny_cid'])) || (strlen($a->user['deny_gid']))) ? 'lock' : 'unlock'),
80 'acl' => populate_acl($a->user, $celeb),
83 'profile_uid' => local_user()
85 $o .= status_editor($a,$x,0,true);
88 $sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
90 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
91 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
92 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
93 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
94 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
95 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
96 and `item`.`moderated` = 0
97 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
98 AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ))
100 ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
101 intval($a->profile['uid']),
109 if((local_user()) && (local_user() == $a->profile['uid'])) {
110 q("UPDATE `item` SET `unseen` = 0
111 WHERE `parent` = %d AND `unseen` = 1",
112 intval($r[0]['parent'])
117 $o .= conversation($a,$r,'display', false);
121 $r = q("SELECT `id` FROM `item` WHERE `id` = '%s' OR `uri` = '%s' LIMIT 1",
126 if($r[0]['deleted']) {
127 notice( t('Item has been removed.') . EOL );
130 notice( t('Permission denied.') . EOL );
134 notice( t('Item not found.') . EOL );