+ elseif((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) {
+
+ // we are the requestee and it is now safe to send our user their introduction,
+ // We could just unblock it, but first we have to jump through a few hoops to
+ // send an email, or even to find out if we need to send an email.
+
+ $intro = q("SELECT * FROM `intro` WHERE `hash` = '%s' LIMIT 1",
+ dbesc($_GET['confirm_key'])
+ );
+
+ if(count($intro)) {
+
+ $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
+ WHERE `contact`.`id` = %d LIMIT 1",
+ intval($intro[0]['contact-id'])
+ );
+ if(count($r)) {
+
+ if($r[0]['notify-flags'] & NOTIFY_INTRO) {
+ $email_tpl = file_get_contents('view/request_notify_eml.tpl');
+ $email = replace_macros($email_tpl, array(
+ '$requestor' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : '[Name Withheld]'),
+ '$url' => stripslashes($r[0]['url']),
+ '$myname' => $r[0]['username'],
+ '$siteurl' => $a->get_baseurl(),
+ '$sitename' => $a->config['sitename']
+ ));
+ $res = mail($r[0]['email'],"Introduction received at {$a->config['sitename']}",$email,"From: Administrator@{$_SERVER[SERVER_NAME]}");
+ // This is a redundant notification - no point throwing errors if it fails.
+ }
+ }
+