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`
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 item_joins(), 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` %s
91 WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
92 AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
94 ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
95 item_joins(), item_condition(),
97 intval($a->pager['start']),
98 intval($a->pager['itemspage'])
102 $parents_arr = array();
107 $parents_arr[] = $rr['item_id'];
108 $parents_str = implode(', ', $parents_arr);
110 $r = q("SELECT %s FROM `item` %s
111 WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s)
113 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
114 item_fieldlists(), item_joins(), item_condition(),
115 intval(local_user()),
120 $items = conv_sort($r,"`commented`");
122 $o .= conversation($a,$items,'notes',$update);