3 function notes_init(&$a) {
10 $which = $a->user['nickname'];
12 nav_set_selected('home');
14 // profile_load($a,$which,$profile);
19 function notes_content(&$a,$update = false) {
22 notice( t('Permission denied.') . EOL);
26 require_once("include/bbcode.php");
27 require_once('include/security.php');
28 require_once('include/conversation.php');
29 require_once('include/acl_selectors.php');
35 $remote_contact = false;
37 $contact_id = $_SESSION['cid'];
38 $contact = $a->contact;
43 $o .= profile_tabs($a,True);
46 $o .= '<h3>' . t('Personal Notes') . '</h3>';
52 'is_owner' => $is_owner,
53 'allow_location' => (($a->user['allow_location']) ? true : false),
54 'default_location' => $a->user['default-location'],
55 'nickname' => $a->user['nickname'],
56 'lockstate' => 'lock',
60 'profile_uid' => local_user(),
61 'button' => t('Save'),
65 $o .= status_editor($a,$x,$a->contact['id']);
69 // Construct permissions
71 // default permissions - anonymous user
73 $sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
75 $r = q("SELECT COUNT(*) AS `total`
76 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND %s
77 WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
78 AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
80 contact_condition(), item_condition(),
86 $a->set_pager_total($r[0]['total']);
87 $a->set_pager_itemspage(40);
90 $r = q("SELECT `item`.`id` AS `item_id` FROM `item`
91 LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND %s AND `contact`.`self`
92 WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
93 AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
95 ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
96 contact_condition(), item_condition(),
98 intval($a->pager['start']),
99 intval($a->pager['itemspage'])
103 $parents_arr = array();
108 $parents_arr[] = $rr['item_id'];
109 $parents_str = implode(', ', $parents_arr);
111 $r = q("SELECT %s FROM `item`
112 LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` AND %s
113 WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s)
115 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
116 item_fieldlist(), contact_fieldlist(),
117 contact_condition(), item_condition(),
118 intval(local_user()),
123 $items = conv_sort($r,"`commented`");
125 $o .= conversation($a,$items,'notes',$update);