3 function notes_init(App &$a) {
11 $which = $a->user['nickname'];
13 nav_set_selected('home');
15 // profile_load($a,$which,$profile);
20 function notes_content(&$a,$update = false) {
23 notice( t('Permission denied.') . EOL);
27 require_once("include/bbcode.php");
28 require_once('include/security.php');
29 require_once('include/conversation.php');
30 require_once('include/acl_selectors.php');
36 $remote_contact = false;
38 $contact_id = $_SESSION['cid'];
39 $contact = $a->contact;
44 $o .= profile_tabs($a,True);
47 $o .= '<h3>' . t('Personal Notes') . '</h3>';
53 'is_owner' => $is_owner,
54 'allow_location' => (($a->user['allow_location']) ? true : false),
55 'default_location' => $a->user['default-location'],
56 'nickname' => $a->user['nickname'],
57 'lockstate' => 'lock',
61 'profile_uid' => local_user(),
62 'button' => t('Save'),
66 $o .= status_editor($a,$x,$a->contact['id']);
70 // Construct permissions
72 // default permissions - anonymous user
74 $sql_extra = " AND `allow_cid` = '<" . $a->contact['id'] . ">' ";
76 $r = q("SELECT COUNT(*) AS `total`
78 WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
79 AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
81 item_joins(), item_condition(),
86 if (dbm::is_result($r)) {
87 $a->set_pager_total($r[0]['total']);
88 $a->set_pager_itemspage(40);
91 $r = q("SELECT `item`.`id` AS `item_id` FROM `item` %s
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 item_joins(), item_condition(),
98 intval($a->pager['start']),
99 intval($a->pager['itemspage'])
103 $parents_arr = array();
106 if (dbm::is_result($r)) {
108 $parents_arr[] = $rr['item_id'];
109 $parents_str = implode(', ', $parents_arr);
111 $r = q("SELECT %s FROM `item` %s
112 WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s)
114 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
115 item_fieldlists(), item_joins(), item_condition(),
116 intval(local_user()),
120 if (dbm::is_result($r)) {
121 $items = conv_sort($r,"`commented`");
123 $o .= conversation($a,$items,'notes',$update);