5 function notes_init(App $a) {
13 $which = $a->user['nickname'];
15 nav_set_selected('home');
17 // profile_load($a,$which,$profile);
22 function notes_content(App $a, $update = false) {
25 notice( t('Permission denied.') . EOL);
29 require_once("include/bbcode.php");
30 require_once('include/security.php');
31 require_once('include/conversation.php');
32 require_once('include/acl_selectors.php');
38 $remote_contact = false;
40 $contact_id = $_SESSION['cid'];
41 $contact = $a->contact;
46 $o .= profile_tabs($a,True);
49 $o .= '<h3>' . t('Personal Notes') . '</h3>';
55 'is_owner' => $is_owner,
56 'allow_location' => (($a->user['allow_location']) ? true : false),
57 'default_location' => $a->user['default-location'],
58 'nickname' => $a->user['nickname'],
59 'lockstate' => 'lock',
63 'profile_uid' => local_user(),
64 'button' => t('Save'),
68 $o .= status_editor($a,$x,$a->contact['id']);
72 // Construct permissions
74 // default permissions - anonymous user
76 $sql_extra = " AND `item`.`allow_cid` = '<" . $a->contact['id'] . ">' ";
78 $r = q("SELECT COUNT(*) AS `total`
80 WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
81 AND `contact`.`self` AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
83 item_joins(), item_condition(),
88 if (dbm::is_result($r)) {
89 $a->set_pager_total($r[0]['total']);
90 $a->set_pager_itemspage(40);
93 $r = q("SELECT `item`.`id` AS `item_id` FROM `item` %s
94 WHERE %s AND `item`.`uid` = %d AND `item`.`type` = 'note'
95 AND `item`.`id` = `item`.`parent` AND NOT `item`.`wall`
97 ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
98 item_joins(), item_condition(),
100 intval($a->pager['start']),
101 intval($a->pager['itemspage'])
105 $parents_arr = array();
108 if (dbm::is_result($r)) {
110 $parents_arr[] = $rr['item_id'];
111 $parents_str = implode(', ', $parents_arr);
113 $r = q("SELECT %s FROM `item` %s
114 WHERE %s AND `item`.`uid` = %d AND `item`.`parent` IN (%s)
116 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
117 item_fieldlists(), item_joins(), item_condition(),
118 intval(local_user()),
122 if (dbm::is_result($r)) {
123 $items = conv_sort($r,"`commented`");
125 $o .= conversation($a,$items,'notes',$update);