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 `id` FROM `intro`
18 AND `uid` = %d LIMIT 1",
24 $intro_id = $r[0]['id'];
27 notice( t('Invalid request identifier.') . EOL);
30 if($_POST['submit'] == t('Discard')) {
31 $r = q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
34 $r = q("DELETE FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
40 if($_POST['submit'] == t('Ignore')) {
41 $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
52 function notifications_content(&$a) {
55 notice( t('Permission denied.') . EOL);
56 goaway($a->get_baseurl());
60 $o .= '<script> $(document).ready(function() { $(\'#nav-notify-link\').addClass(\'nav-selected\'); });</script>';
62 if(($a->argc > 1) && ($a->argv[1] == 'all'))
65 $sql_extra = " AND `ignore` = 0 ";
68 $tpl = load_view_file('view/intros-top.tpl');
69 $o .= replace_macros($tpl,array(
70 '$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
71 '$hide_text' => ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests'))
74 $r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*
75 FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
76 WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
77 intval($_SESSION['uid']));
79 if(($r !== false) && (count($r))) {
82 $tpl = load_view_file("view/intros.tpl");
86 $friend_selected = (($rr['network'] === 'dfrn') ? ' checked="checked" ' : ' disabled ');
87 $fan_selected = (($rr['network'] === 'stat') ? ' checked="checked" disabled ' : '');
88 $dfrn_tpl = load_view_file('view/netfriend.tpl');
93 if($rr['network'] === 'dfrn') {
94 $knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
96 $dfrn_text = replace_macros($dfrn_tpl,array(
97 '$intro_id' => $rr['intro_id'],
98 '$friend_selected' => $friend_selected,
99 '$fan_selected' => $fan_selected,
105 $o .= replace_macros($tpl,array(
106 '$notify_type' => (($rr['network'] === 'dfrn') ? t('Friend/Connect Request') : t('New Follower')),
107 '$dfrn_text' => $dfrn_text,
108 '$dfrn_id' => $rr['issued-id'],
109 '$uid' => $_SESSION['uid'],
110 '$intro_id' => $rr['intro_id'],
111 '$contact_id' => $rr['contact-id'],
112 '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
113 '$fullname' => $rr['name'],
114 '$url' => $rr['url'],
115 '$knowyou' => $knowyou,
116 '$note' => $rr['note']
121 notice( t('No notifications.') . EOL);