3 function notes_init(&$a) {
10 $which = $a->user['nickname'];
12 // profile_load($a,$which,$profile);
17 function notes_content(&$a,$update = false) {
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;
41 $o .= profile_tabs($a,True);
44 $o .= '<h3>' . t('Personal Notes') . '</h3>';
54 'is_owner' => $is_owner,
55 'allow_location' => (($a->user['allow_location']) ? true : false),
56 'default_location' => $a->user['default-location'],
57 'nickname' => $a->user['nickname'],
58 'lockstate' => 'lock',
62 'profile_uid' => local_user(),
67 $o .= status_editor($a,$x,$a->contact['id']);
69 $o .= '<div id="live-notes"></div>' . "\r\n";
70 $o .= "<script> var profile_uid = " . local_user()
71 . "; var netargs = '/?f='; var profile_page = " . $a->pager['page'] . "; </script>\r\n";
75 // Construct permissions
77 // default permissions - anonymous user
79 $sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
81 $r = q("SELECT COUNT(*) AS `total`
82 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
83 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0
84 AND `item`.`deleted` = 0 AND `item`.`type` = 'note'
85 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
86 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
93 $a->set_pager_total($r[0]['total']);
94 $a->set_pager_itemspage(40);
97 $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
98 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
99 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
100 and `item`.`moderated` = 0 AND `item`.`type` = 'note'
101 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
102 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
104 ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
105 intval(local_user()),
106 intval($a->pager['start']),
107 intval($a->pager['itemspage'])
111 $parents_arr = array();
116 $parents_arr[] = $rr['item_id'];
117 $parents_str = implode(', ', $parents_arr);
119 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
120 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`,
121 `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
122 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
123 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
124 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
125 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
126 AND `item`.`parent` IN ( %s )
128 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
129 intval(local_user()),
134 $items = conv_sort($r,"`commented`");
136 $o .= conversation($a,$items,'notes',$update);