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`
77 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0
78 AND `item`.`deleted` = 0 AND `item`.`type` = 'note'
79 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
80 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
87 $a->set_pager_total($r[0]['total']);
88 $a->set_pager_itemspage(40);
91 $r = q("SELECT `item`.`id` AS `item_id`, `contact`.`uid` AS `contact-uid`
92 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
93 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0
94 and `item`.`moderated` = 0 AND `item`.`type` = 'note'
95 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 AND `contact`.`self` = 1
96 AND `item`.`id` = `item`.`parent` AND `item`.`wall` = 0
98 ORDER BY `item`.`created` DESC LIMIT %d ,%d ",
100 intval($a->pager['start']),
101 intval($a->pager['itemspage'])
105 $parents_arr = array();
110 $parents_arr[] = $rr['item_id'];
111 $parents_str = implode(', ', $parents_arr);
113 $r = q("SELECT `item`.*, `item`.`id` AS `item_id`,
114 `contact`.`name`, `contact`.`photo`, `contact`.`url`, `contact`.`alias`, `contact`.`network`, `contact`.`rel`,
115 `contact`.`thumb`, `contact`.`self`, `contact`.`writable`,
116 `contact`.`id` AS `cid`, `contact`.`uid` AS `contact-uid`
117 FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
118 WHERE `item`.`uid` = %d AND `item`.`visible` = 1 and `item`.`moderated` = 0 AND `item`.`deleted` = 0
119 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
120 AND `item`.`parent` IN ( %s )
122 ORDER BY `parent` DESC, `gravity` ASC, `item`.`id` ASC ",
123 intval(local_user()),
128 $items = conv_sort($r,"`commented`");
130 $o .= conversation($a,$items,'notes',$update);