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'] .= get_markup_template('display-head.tpl');
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;
40 if(is_array($_SESSION['remote'])) {
41 foreach($_SESSION['remote'] as $v) {
42 if($v['uid'] == $a->profile['uid']) {
43 $contact_id = $v['cid'];
50 $groups = init_groups_visitor($contact_id);
51 $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
53 intval($a->profile['uid'])
57 $remote_contact = true;
61 if(! $remote_contact) {
63 $contact_id = $_SESSION['cid'];
64 $contact = $a->contact;
68 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
69 intval($a->profile['uid'])
72 $a->page_contact = $r[0];
74 $is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);
76 if($a->profile['hidewall'] && (! $is_owner) && (! $remote_contact)) {
77 notice( t('Access to this profile has been restricted.') . EOL);
82 $celeb = ((($a->user['page-flags'] == PAGE_SOAPBOX) || ($a->user['page-flags'] == PAGE_COMMUNITY)) ? true : false);
86 'allow_location' => $a->user['allow_location'],
87 'default_location' => $a->user['default-location'],
88 'nickname' => $a->user['nickname'],
89 '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'),
90 'acl' => populate_acl($a->user, $celeb),
93 'profile_uid' => local_user()
95 $o .= status_editor($a,$x,0,true);
98 $sql_extra = item_permissions_sql($a->profile['uid'],$remote_contact,$groups);
100 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
101 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`rel`,
102 `contact`.`network`, `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
103 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
104 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
105 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
106 and `item`.`moderated` = 0
107 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
108 AND `item`.`parent` = ( SELECT `parent` FROM `item` WHERE ( `id` = '%s' OR `uri` = '%s' ))
110 ORDER BY `parent` DESC, `gravity` ASC, `id` ASC ",
111 intval($a->profile['uid']),
119 if((local_user()) && (local_user() == $a->profile['uid'])) {
120 q("UPDATE `item` SET `unseen` = 0
121 WHERE `parent` = %d AND `unseen` = 1",
122 intval($r[0]['parent'])
126 $items = conv_sort($r,"`commented`");
128 $o .= conversation($a,$items,'display', false);
132 $r = q("SELECT `id`,`deleted` FROM `item` WHERE `id` = '%s' OR `uri` = '%s' LIMIT 1",
137 if($r[0]['deleted']) {
138 notice( t('Item has been removed.') . EOL );
141 notice( t('Permission denied.') . EOL );
145 notice( t('Item not found.') . EOL );