3 function notes_init(&$a) {
10 $which = $a->user['nickname'];
12 // profile_load($a,$which,$profile);
17 function notes_content(&$a) {
20 notice( t('Permission denied.') . EOL);
24 require_once("include/bbcode.php");
25 require_once('include/security.php');
26 require_once('include/conversation.php');
27 require_once('include/acl_selectors.php');
33 $remote_contact = false;
35 $contact_id = $_SESSION['cid'];
36 $contact = $a->contact;
42 $tpl = get_markup_template('profile_tabs.tpl');
43 $o .= replace_macros($tpl,array(
44 '$url' => $a->get_baseurl() . '/profile/' . $a->user['nickname'],
45 '$phototab' => $a->get_baseurl() . '/photos/' . $a->user['nickname'],
46 '$status' => t('Status'),
47 '$profile' => t('Profile'),
48 '$photos' => t('Photos'),
49 '$events' => t('Events') ,
50 '$notes' => t('Personal Notes'),
51 '$activetab' => "notes",
55 $o .= '<h3>' . t('Personal Notes') . '</h3>';
65 'is_owner' => $is_owner,
66 'allow_location' => (($a->user['allow_location']) ? true : false),
67 'default_location' => $a->user['default-location'],
68 'nickname' => $a->user['nickname'],
69 'lockstate' => 'lock',
73 'profile_uid' => local_user(),
78 $o .= status_editor($a,$x,$a->contact['id']);
81 // Construct permissions
83 // default permissions - anonymous user
85 $sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
87 $r = q("SELECT COUNT(*) AS `total`
88 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
89 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
90 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
91 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
98 $a->set_pager_total($r[0]['total']);
99 $a->set_pager_itemspage(40);
102 $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
103 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
104 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
105 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
106 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
108 ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
109 intval(local_user()),
110 intval($a->pager['start']),
111 intval($a->pager['itemspage'])
115 $parents_arr = array();
120 $parents_arr[] = $rr['item_id'];
121 $parents_str = implode(', ', $parents_arr);
123 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
124 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`network`, `contact`.`rel`,
125 `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
126 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
127 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
128 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
129 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
130 AND `item`.`parent` IN ( %s )
132 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
133 intval(local_user()),
138 $o .= conversation($a,$r,'notes',$update);