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 ";
68 $o .= '<h1>' . t('Pending Friend/Connect Notifications') . '</h1>' . "\r\n";
70 $o .= '<div id="notification-show-hide-wrapper" >';
71 $o .= '<a href="' . ((strlen($sql_extra)) ? 'notifications/all' : 'notifications' ) . '" id="notifications-show-hide-link" >'
72 . ((strlen($sql_extra)) ? t('Show Ignored Requests') : t('Hide Ignored Requests')) . '</a></div>' . "\r\n";
75 $r = q("SELECT COUNT(*) AS `total` FROM `intro`
76 WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
77 intval($_SESSION['uid'])
80 $a->set_pager_total($r[0]['total']);
81 $a->set_pager_itemspage(20);
84 $r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*
85 FROM `intro` LEFT JOIN `contact` ON `intro`.`contact-id` = `contact`.`id`
86 WHERE `intro`.`uid` = %d $sql_extra AND `intro`.`blocked` = 0 ",
87 intval($_SESSION['uid']));
89 if(($r !== false) && (count($r))) {
92 $tpl = get_markup_template("intros.tpl");
96 $friend_selected = (($rr['network'] !== 'stat') ? ' checked="checked" ' : ' disabled ');
97 $fan_selected = (($rr['network'] === 'stat') ? ' checked="checked" disabled ' : '');
98 $dfrn_tpl = get_markup_template('netfriend.tpl');
103 if($rr['network'] !== 'stat') {
104 $knowyou = t('Claims to be known to you: ') . (($rr['knowyou']) ? t('yes') : t('no'));
106 $dfrn_text = replace_macros($dfrn_tpl,array(
107 '$intro_id' => $rr['intro_id'],
108 '$friend_selected' => $friend_selected,
109 '$fan_selected' => $fan_selected,
110 '$approve_as' => t('Approve as: '),
111 '$as_friend' => t('Friend'),
112 '$as_fan' => t('Fan/Admirer')
118 $o .= replace_macros($tpl,array(
119 '$str_notifytype' => t('Notification type: '),
120 '$notify_type' => (($rr['network'] !== 'stat') ? t('Friend/Connect Request') : t('New Follower')),
121 '$dfrn_text' => $dfrn_text,
122 '$dfrn_id' => $rr['issued-id'],
123 '$uid' => $_SESSION['uid'],
124 '$intro_id' => $rr['intro_id'],
125 '$contact_id' => $rr['contact-id'],
126 '$photo' => ((x($rr,'photo')) ? $rr['photo'] : "images/default-profile.jpg"),
127 '$fullname' => $rr['name'],
128 '$url' => $rr['url'],
129 '$knowyou' => $knowyou,
130 '$approve' => t('Approve'),
131 '$note' => $rr['note'],
132 '$ignore' => t('Ignore'),
133 '$discard' => t('Discard')
139 notice( t('No notifications.') . EOL);
141 if ($a->config['register_policy'] == REGISTER_APPROVE &&
142 $a->config['admin_email'] === $a->user['email']){
143 $o .= '<h1>' . t('User registrations waiting for confirm') . '</h1>' . "\r\n";
145 $r = q("SELECT `register`.*, `contact`.`name`, `user`.`email`
147 LEFT JOIN `contact` ON `register`.`uid` = `contact`.`uid`
148 LEFT JOIN `user` ON `register`.`uid` = `user`.`uid`;");
149 if(($r !== false) && (count($r))) {
152 $o .= '<li>' . sprintf('%s (%s) : ', $rr['name'],$rr['email'])
153 . '<a href="regmod/allow/' . $rr['hash'] .'">' . t('Approve')
154 . '</a> - <a href="regmod/deny/' . $rr['hash'] . '">' . t('Deny') . '</a></li>' . "\r\n";
159 notice( t('No registrations.') . EOL);