4 function network_init(&$a) {
9 function network_content(&$a) {
14 require_once("include/bbcode.php");
17 $contact_id = $a->cid;
20 $tpl = file_get_contents('view/jot-header.tpl');
22 $a->page['htmlhead'] .= replace_macros($tpl, array('$baseurl' => $a->get_baseurl()));
23 require_once('view/acl_selectors.php');
25 $tpl = file_get_contents("view/jot.tpl");
27 $o .= replace_macros($tpl,array(
28 '$baseurl' => $a->get_baseurl(),
29 '$visitor' => 'block',
30 '$lockstate' => 'unlock',
31 '$acl' => populate_acl(),
32 '$profile_uid' => $_SESSION['uid']
37 // Alter registration and settings
38 // and profile to update contact table when names and photos change.
39 // work on item_display and can_write_wall
47 $r = q("SELECT COUNT(*) AS `total`
48 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
49 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
50 AND `contact`.`blocked` = 0
52 intval($_SESSION['uid'])
57 $a->set_pager_total($r[0]['total']);
60 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
61 `contact`.`name`, `contact`.`photo`, `contact`.`url`,
62 `contact`.`thumb`, `contact`.`dfrn-id`, `contact`.`self`,
63 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
64 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
65 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
66 AND `contact`.`blocked` = 0
68 ORDER BY `parent` DESC, `id` ASC LIMIT %d ,%d ",
69 intval($_SESSION['uid']),
70 intval($a->pager['start']),
71 intval($a->pager['itemspage'])
76 $cmnt_tpl = file_get_contents('view/comment_item.tpl');
79 $tpl = file_get_contents('view/wall_item.tpl');
80 $wallwall = file_get_contents('view/wallwall_item.tpl');
86 if($rr['last-child']) {
87 $comment = replace_macros($cmnt_tpl,array(
88 '$id' => $rr['item_id'],
89 '$parent' => $rr['parent'],
90 '$profile_uid' => $_SESSION['uid']
97 $profile_url = $item['url'];
99 if(($item['contact-uid'] == $_SESSION['uid']) && (strlen($item['dfrn-id'])) && (! $item['self'] ))
100 $profile_url = $a->get_baseurl() . '/redir/' . $item['cid'] ;
102 $photo = $item['photo'];
103 $thumb = $item['thumb'];
105 $profile_name = ((strlen($item['remote-name'])) ? $item['remote-name'] : $item['name']);
106 $profile_link = ((strlen($item['remote-link'])) ? $item['remote-link'] : $profile_url);
107 $profile_avatar = ((strlen($item['remote-avatar'])) ? $item['remote-avatar'] : $thumb);
109 if(($item['parent'] == $item['item_id']) && (! $item['self'])) {
110 $template = $wallwall; // FIXME also if remote owner
111 $owner_url = $a->contact['url'];
112 $owner_photo = $a->contact['thumb'];
113 $owner_name = $a->contact['name'];
116 $o .= replace_macros($template,array(
117 '$id' => $item['item_id'],
118 '$profile_url' => $profile_link,
119 '$name' => $profile_name,
120 '$thumb' => $profile_avatar,
121 '$body' => bbcode($item['body']),
122 '$ago' => relative_date($item['created']),
123 '$indent' => (($item['parent'] != $item['item_id']) ? 'comment-' : ''),
124 '$owner_url' => $owner_url,
125 '$owner_photo' => $owner_photo,
126 '$owner_name' => $owner_name,
127 '$comment' => $comment