3 function notifications_post(&$a) {
5 if((! x($_SESSION,'authenticated')) || (! (x($_SESSION,'uid')))) {
6 goaway($a->get_baseurl());
9 $request_id = (($a->argc > 1) ? $a->argv[0] : 0);
11 if($request_id == "all")
16 $r = q("SELECT `id` FROM `intro`
17 WHERE `request-id` = %d
18 AND `uid` = %d LIMIT 1",
20 intval($_SESSION['uid'])
24 $intro_id = $r[0]['id'];
27 $_SESSION['sysmsg'] .= "Invalid request identifier." . EOL;
30 if($_POST['submit'] == 'Discard') {
31 $r = q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1", intval($intro_id));
32 $r = q("DELETE `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
34 intval($_SESSION['uid']));
37 if($_POST['submit'] == 'Ignore') {
38 $r = q("UPDATE `intro` SET `ignore` = 1 WHERE `id` = %d LIMIT 1",
49 function notifications_content(&$a) {
53 if((! x($_SESSION,'authenticated')) || (! (x($_SESSION,'uid')))) {
54 goaway($a->get_baseurl());
57 if(($a->argc > 1) && ($a->argv[1] == 'all'))
60 $sql_extra = " AND `ignore` = 0 ";
63 $tpl = file_get_contents('view/intros-top.tpl');
64 $o .= replace_macros($tpl,array(
65 '$hide_url' => ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ),
66 '$hide_text' => ((strlen($sql_extra)) ? 'Show Ignored Requests' : 'Hide Ignored Requests')
69 $r = q("SELECT `intro`.`id` AS `intro-id`, `intro`.*, `contact`.*
70 FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
71 WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
72 intval($_SESSION['uid']));
74 if(($r !== false) && (count($r))) {
77 $tpl = file_get_contents("view/intros.tpl");
81 $o .= replace_macros($tpl,array(
82 '$intro_id' => $rr['intro-id'],
83 '$dfrn-id' => $rr['issued-id'],
84 '$uid' => $_SESSION['uid'],
85 '$contact-id' => $rr['contact-id'],
86 '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
87 '$fullname' => $rr['name'],
88 '$knowyou' => (($rr['knowyou']) ? 'yes' : 'no'),
90 '$note' => $rr['note']
95 $_SESSION['sysmsg'] .= "No notifications." . EOL;