- if($r === false)
- notice( t("Unable to set contact photo info.") . EOL);
-
- // Otherwise everything seems to have worked and we are almost done. Yay!
- // Send an email notification
-
- $r = q("SELECT * FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
- WHERE `contact`.`id` = %d LIMIT 1",
- intval($dfrn_record)
- );
- if((count($r)) && ($r[0]['notify-flags'] & NOTIFY_CONFIRM)) {
-
- $tpl = (($new_relation == $REL_BUD)
- ? load_view_file('view/friend_complete_eml.tpl');
- : load_view_file('view/intro_complete_eml.tpl'));
-
- $email_tpl = replace_macros($tpl, array(
- '$sitename' => $a->config['sitename'],
- '$siteurl' => $a->get_baseurl(),
- '$username' => $r[0]['username'],
- '$email' => $r[0]['email'],
- '$fn' => $r[0]['name'],
- '$dfrn_url' => $r[0]['url'],
- '$uid' => $newuid )
- );
-
- $res = mail($r[0]['email'], t("Connection accepted at ") . $a->config['sitename'],
- $email_tpl, 'From: ' . t('Administrator') . '@' . $_SERVER[SERVER_NAME] );
- if(!$res) {
- notice( t("Email notification failed.") . EOL );
- }
- }
- xml_status(0); // Success
- return; // NOTREACHED
- }
- else {
- xml_status(2); // Hopefully temporary problem that can be retried.