3 function notifications_post(&$a) {
6 goaway($a->get_baseurl());
9 $request_id = (($a->argc > 1) ? $a->argv[1] : 0);
11 if($request_id === "all")
16 $r = q("SELECT * FROM `intro`
18 AND `uid` = %d LIMIT 1",
24 $intro_id = $r[0]['id'];
25 $contact_id = $r[0]['contact-id'];
28 notice( t('Invalid request identifier.') . EOL);
31 if($_POST['submit'] == t('Discard')) {
32 $r = q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
35 $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d AND `self` = 0 LIMIT 1",
41 if($_POST['submit'] == t('Ignore')) {
42 $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
53 function notifications_content(&$a) {
56 notice( t('Permission denied.') . EOL);
57 goaway($a->get_baseurl());
61 $o .= '<script> $(document).ready(function() { $(\'#nav-notify-link\').addClass(\'nav-selected\'); });</script>';
63 if(($a->argc > 1) && ($a->argv[1] == 'all'))
66 $sql_extra = " AND `ignore` = 0 ";
69 $tpl = load_view_file('view/intros-top.tpl');
70 $o .= replace_macros($tpl,array(
71 '$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
72 '$hide_text' => ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
76 $r = q("SELECT COUNT(*) AS `total` FROM `intro`
77 WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
78 intval($_SESSION['uid'])
81 $a->set_pager_total($r[0]['total']);
82 $a->set_pager_itemspage(20);
85 $r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*
86 FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
87 WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
88 intval($_SESSION['uid']));
90 if(($r !== false) && (count($r))) {
93 $tpl = load_view_file("view/intros.tpl");
97 $friend_selected = (($rr['network'] !== 'stat') ? ' checked="checked" ' : ' disabled ');
98 $fan_selected = (($rr['network'] === 'stat') ? ' checked="checked" disabled ' : '');
99 $dfrn_tpl = load_view_file('view/netfriend.tpl');
104 if($rr['network'] !== 'stat') {
105 $knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
107 $dfrn_text = replace_macros($dfrn_tpl,array(
108 '$intro_id' => $rr['intro_id'],
109 '$friend_selected' => $friend_selected,
110 '$fan_selected' => $fan_selected,
111 '$approve_as' => t('Approve as: '),
112 '$as_friend' => t('Friend'),
113 '$as_fan' => t('Fan/Admirer')
119 $o .= replace_macros($tpl,array(
120 '$str_notifytype' => t('Notification type: '),
121 '$notify_type' => (($rr['network'] !== 'stat') ? t('Friend/Connect Request') : t('New Follower')),
122 '$dfrn_text' => $dfrn_text,
123 '$dfrn_id' => $rr['issued-id'],
124 '$uid' => $_SESSION['uid'],
125 '$intro_id' => $rr['intro_id'],
126 '$contact_id' => $rr['contact-id'],
127 '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
128 '$fullname' => $rr['name'],
129 '$url' => $rr['url'],
130 '$knowyou' => $knowyou,
131 '$approve' => t('Approve'),
132 '$note' => $rr['note'],
133 '$ignore' => t('Ignore'),
134 '$discard' => t('Discard')
140 notice( t('No notifications.') . EOL);
142 if ($a->config['register_policy'] == REGISTER_APPROVE &&
143 $a->config['admin_email'] === $a->user['email']){
144 $o .= load_view_file('view/registrations-top.tpl');
146 $r = q("SELECT `register`.*, `contact`.`name`, `user`.`email`
148 LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`
149 LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
150 if(($r !== false) && (count($r))) {
151 $tpl = load_view_file("view/registrations.tpl");
154 $o .= replace_macros($tpl, array(
155 '$fullname' => $rr['name'],
156 '$email' => $rr['email'],
157 '$approvelink' => "regmod/allow/".$rr['hash'],
158 '$denylink' => "regmod/deny/".$rr['hash'],
164 notice( t('No registrations.') . EOL);