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'] .= <<<EOT
21 $(document).ready(function() {
22 $(".comment-edit-wrapper textarea").contact_autocomplete(baseurl+"/acl");
23 // make auto-complete work in more places
24 $(".wall-item-comment-wrapper textarea").contact_autocomplete(baseurl+"/acl");
30 $nick = (($a->argc > 1) ? $a->argv[1] : '');
31 profile_load($a,$nick);
33 $item_id = (($a->argc > 2) ? intval($a->argv[2]) : 0);
37 notice( t('Item not found.') . EOL);
44 $remote_contact = false;
47 $contact_id = $_SESSION['visitor_id'];
48 $groups = init_groups_visitor($contact_id);
49 $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
51 intval($a->profile['uid'])
55 $remote_contact = true;
59 if(! $remote_contact) {
61 $contact_id = $_SESSION['cid'];
62 $contact = $a->contact;
66 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
67 intval($a->profile['uid'])
70 $a->page_contact = $r[0];
72 $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
74 if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
75 notice( t('Access to this profile has been restricted.') . EOL);
80 $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
84 'allow_location' => $a->user['allow_location'],
85 'default_location' => $a->user['default-location'],
86 'nickname' => $a->user['nickname'],
87 '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'),
88 'acl' => populate_acl($a->user, $celeb),
91 'profile_uid' => local_user()
93 $o .= status_editor($a,$x,0,true);
96 $sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
98 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
99 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
100 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
101 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
102 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
103 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
104 and `item`.`moderated` = 0
105 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
106 AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ))
108 ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
109 intval($a->profile['uid']),
117 if((local_user()) && (local_user() == $a->profile['uid'])) {
118 q("UPDATE `item` SET `unseen` = 0
119 WHERE `parent` = %d AND `unseen` = 1",
120 intval($r[0]['parent'])
125 $o .= conversation($a,$r,'display', false);
129 $r = q("SELECT `id` FROM `item` WHERE `id` = '%s' OR `uri` = '%s' LIMIT 1",
134 if($r[0]['deleted']) {
135 notice( t('Item has been removed.') . EOL );
138 notice( t('Permission denied.') . EOL );
142 notice( t('Item not found.') . EOL );