4 * @file mod/dfrn_request.php
5 * @brief Module: dfrn_request
7 * Purpose: Handles communication associated with the issuance of
10 * @see PDF with dfrn specs: https://github.com/friendica/friendica/blob/master/spec/dfrn2.pdf
11 * You also find a graphic which describes the confirmation process at
12 * https://github.com/friendica/friendica/blob/master/spec/dfrn2_contact_request.png
16 use Friendica\Core\Config;
17 use Friendica\Core\PConfig;
18 use Friendica\Core\System;
19 use Friendica\Network\Probe;
21 require_once 'include/enotify.php';
22 require_once 'include/group.php';
24 function dfrn_request_init(App $a) {
29 profile_load($a,$which);
35 * Function: dfrn_request_post
38 * Handles multiple scenarios.
41 * Clicking 'submit' on a friend request page.
44 * Following Scenario 1, we are brought back to our home site
45 * in order to link our friend request with our own server cell.
46 * After logging in, we click 'submit' to approve the linkage.
49 function dfrn_request_post(App $a) {
51 if(($a->argc != 2) || (! count($a->profile))) {
52 logger('Wrong count of argc or profiles: argc=' . $a->argc . ',profile()=' . count($a->profile));
57 if(x($_POST, 'cancel')) {
58 goaway(System::baseUrl());
64 * Scenario 2: We've introduced ourself to another cell, then have been returned to our own cell
65 * to confirm the request, and then we've clicked submit (perhaps after logging in).
66 * That brings us here:
70 if((x($_POST,'localconfirm')) && ($_POST['localconfirm'] == 1)) {
73 * Ensure this is a valid request
76 if(local_user() && ($a->user['nickname'] == $a->argv[1]) && (x($_POST,'dfrn_url'))) {
79 $dfrn_url = notags(trim($_POST['dfrn_url']));
80 $aes_allow = (((x($_POST,'aes_allow')) && ($_POST['aes_allow'] == 1)) ? 1 : 0);
81 $confirm_key = ((x($_POST,'confirm_key')) ? $_POST['confirm_key'] : "");
82 $hidden = ((x($_POST,'hidden-contact')) ? intval($_POST['hidden-contact']) : 0);
83 $contact_record = null;
90 * Lookup the contact based on their URL (which is the only unique thing we have at the moment)
93 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' AND NOT `self` LIMIT 1",
95 dbesc(normalise_link($dfrn_url))
98 if (dbm::is_result($r)) {
99 if(strlen($r[0]['dfrn-id'])) {
102 * We don't need to be here. It has already happened.
105 notice( t("This introduction has already been accepted.") . EOL );
109 $contact_record = $r[0];
112 if(is_array($contact_record)) {
113 $r = q("UPDATE `contact` SET `ret-aes` = %d, hidden = %d WHERE `id` = %d",
116 intval($contact_record['id'])
122 * Scrape the other site's profile page to pick up the dfrn links, key, fn, and photo
125 $parms = Probe::profile($dfrn_url);
127 if (! count($parms)) {
128 notice( t('Profile location is not valid or does not contain profile information.') . EOL );
132 if (! x($parms,'fn')) {
133 notice( t('Warning: profile location has no identifiable owner name.') . EOL );
135 if (! x($parms,'photo')) {
136 notice( t('Warning: profile location has no profile photo.') . EOL );
138 $invalid = Probe::validDfrn($parms);
140 notice( sprintf( tt("%d required parameter was not found at the given location",
141 "%d required parameters were not found at the given location",
142 $invalid), $invalid) . EOL );
147 $dfrn_request = $parms['dfrn-request'];
149 $photo = $parms["photo"];
151 // Escape the entire array
152 dbm::esc_array($parms);
155 * Create a contact record on our site for the other person
158 $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `addr`, `name`, `nick`, `photo`, `site-pubkey`,
159 `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`, `hidden`, `blocked`, `pending`)
160 VALUES ( %d, '%s', '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, %d)",
161 intval(local_user()),
164 dbesc(normalise_link($dfrn_url)),
170 $parms['dfrn-request'],
171 $parms['dfrn-confirm'],
172 $parms['dfrn-notify'],
184 info( t("Introduction complete.") . EOL);
187 $r = q("SELECT `id`, `network` FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `site-pubkey` = '%s' LIMIT 1",
188 intval(local_user()),
190 $parms['key'] // this was already escaped
192 if (dbm::is_result($r)) {
193 $def_gid = get_default_group(local_user(), $r[0]["network"]);
195 group_add_member(local_user(), '', $r[0]['id'], $def_gid);
198 update_contact_avatar($photo, local_user(), $r[0]["id"], true);
200 $forwardurl = System::baseUrl()."/contacts/".$r[0]['id'];
202 $forwardurl = System::baseUrl()."/contacts";
206 * Allow the blocked remote notification to complete
209 if (is_array($contact_record)) {
210 $dfrn_request = $contact_record['request'];
213 if (strlen($dfrn_request) && strlen($confirm_key)) {
214 $s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key);
217 // (ignore reply, nothing we can do it failed)
219 // Old: goaway(zrl($dfrn_url));
221 return; // NOTREACHED
227 // invalid/bogus request
229 notice( t('Unrecoverable protocol error.') . EOL );
230 goaway(System::baseUrl());
231 return; // NOTREACHED
238 * We are the requestee. A person from a remote cell has made an introduction
239 * on our profile web page and clicked submit. We will use their DFRN-URL to
240 * figure out how to contact their cell.
242 * Scrape the originating DFRN-URL for everything we need. Create a contact record
243 * and an introduction to show our user next time he/she logs in.
244 * Finally redirect back to the requestor so that their site can record the request.
245 * If our user (the requestee) later confirms this request, a record of it will need
246 * to exist on the requestor's cell in order for the confirmation process to complete..
248 * It's possible that neither the requestor or the requestee are logged in at the moment,
249 * and the requestor does not yet have any credentials to the requestee profile.
251 * Who is the requestee? We've already loaded their profile which means their nickname should be
252 * in $a->argv[1] and we should have their complete info in $a->profile.
256 if(! (is_array($a->profile) && count($a->profile))) {
257 notice( t('Profile unavailable.') . EOL);
261 $nickname = $a->profile['nickname'];
262 $notify_flags = $a->profile['notify-flags'];
263 $uid = $a->profile['uid'];
264 $maxreq = intval($a->profile['maxreq']);
265 $contact_record = null;
272 if( x($_POST,'dfrn_url')) {
275 * Block friend request spam
279 $r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d",
280 dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
283 if (dbm::is_result($r) && count($r) > $maxreq) {
284 notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL);
285 notice( t('Spam protection measures have been invoked.') . EOL);
286 notice( t('Friends are advised to please try again in 24 hours.') . EOL);
293 * Cleanup old introductions that remain blocked.
294 * Also remove the contact record, but only if there is no existing relationship
295 * Do not remove email contacts as these may be awaiting email verification
298 $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
299 FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
300 WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
301 AND `contact`.`network` != '%s'
302 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ",
305 if (dbm::is_result($r)) {
306 foreach ($r as $rr) {
308 q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
312 q("DELETE FROM `intro` WHERE `id` = %d",
320 * Cleanup any old email intros - which will have a greater lifetime
323 $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel`
324 FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
325 WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0
326 AND `contact`.`network` = '%s'
327 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 3 DAY ",
330 if (dbm::is_result($r)) {
331 foreach ($r as $rr) {
333 q("DELETE FROM `contact` WHERE `id` = %d AND NOT `self`",
337 q("DELETE FROM `intro` WHERE `id` = %d",
343 $email_follow = (x($_POST,'email_follow') ? intval($_POST['email_follow']) : 0);
344 $real_name = (x($_POST,'realname') ? notags(trim($_POST['realname'])) : '');
346 $url = trim($_POST['dfrn_url']);
348 notice( t("Invalid locator") . EOL );
356 if(! validate_email($url)) {
357 notice( t('Invalid email address.') . EOL);
362 $name = ($realname) ? $realname : $addr;
363 $nick = substr($addr,0,strpos($addr,'@'));
364 $url = 'http://' . substr($addr,strpos($addr,'@') + 1);
365 $nurl = normalise_url($host);
366 $poll = 'email ' . random_string();
367 $notify = 'smtp ' . random_string();
368 $network = NETWORK_MAIL2;
369 $rel = CONTACT_IS_FOLLOWER;
371 $mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
372 if(Config::get('system','dfrn_only'))
375 if(! $mail_disabled) {
377 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
381 if (! dbm::is_result($r)) {
382 notice( t('This account has not been configured for email. Request failed.') . EOL);
387 $r = q("insert into contact ( uid, created, addr, name, nick, url, nurl, poll, notify, blocked, pending, network, rel )
388 values( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d ) ",
390 dbesc(datetime_convert()),
404 $r = q("SELECT `id`, `network` FROM `contact` WHERE `poll` = '%s' AND `uid` = %d LIMIT 1",
408 if (dbm::is_result($r)) {
409 $contact_id = $r[0]['id'];
411 $def_gid = get_default_group($uid, $r[0]["network"]);
412 if (intval($def_gid))
413 group_add_member($uid, '', $contact_id, $def_gid);
415 $photo = avatar_img($addr);
417 $r = q("UPDATE `contact` SET
423 `avatar-date` = '%s',
430 dbesc(datetime_convert()),
431 dbesc(datetime_convert()),
432 dbesc(datetime_convert()),
437 // contact is created. Now create an introduction
439 $hash = random_string();
441 $r = q("INSERT INTO `intro` ( `uid`, `contact-id`, knowyou, note, hash, datetime, blocked )
442 VALUES( %d , %d, %d, '%s', '%s', '%s', %d ) ",
445 ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
446 dbesc(notags(trim($_POST['dfrn-request-message']))),
448 dbesc(datetime_convert()),
452 // Next send an email verify form to the requestor.
455 // Detect the network
456 $data = Probe::uri($url);
457 $network = $data["network"];
459 // Canonicalise email-style profile locator
460 $url = Probe::webfingerDfrn($url,$hcard);
462 if (substr($url,0,5) === 'stat:') {
464 // Every time we detect the remote subscription we define this as OStatus.
465 // We do this even if it is not OStatus.
466 // we only need to pass this through another section of the code.
467 if ($network != NETWORK_DIASPORA)
468 $network = NETWORK_OSTATUS;
470 $url = substr($url,5);
472 $network = NETWORK_DFRN;
475 logger('dfrn_request: url: ' . $url . ',network=' . $network, LOGGER_DEBUG);
477 if($network === NETWORK_DFRN) {
478 $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
483 if (dbm::is_result($ret)) {
484 if(strlen($ret[0]['issued-id'])) {
485 notice( t('You have already introduced yourself here.') . EOL );
488 elseif($ret[0]['rel'] == CONTACT_IS_FRIEND) {
489 notice( sprintf( t('Apparently you are already friends with %s.'), $a->profile['name']) . EOL);
493 $contact_record = $ret[0];
494 $parms = array('dfrn-request' => $ret[0]['request']);
498 $issued_id = random_string();
500 if(is_array($contact_record)) {
501 // There is a contact record but no issued-id, so this
502 // is a reciprocal introduction from a known contact
503 $r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d",
505 intval($contact_record['id'])
509 if (! validate_url($url)) {
510 notice( t('Invalid profile URL.') . EOL);
511 goaway(System::baseUrl() . '/' . $a->cmd);
512 return; // NOTREACHED
515 if (! allowed_url($url)) {
516 notice( t('Disallowed profile URL.') . EOL);
517 goaway(System::baseUrl() . '/' . $a->cmd);
518 return; // NOTREACHED
521 if (blocked_url($url)) {
522 notice( t('Blocked domain') . EOL);
523 goaway(System::baseUrl() . '/' . $a->cmd);
524 return; // NOTREACHED
527 $parms = Probe::profile(($hcard) ? $hcard : $url);
529 if (! count($parms)) {
530 notice( t('Profile location is not valid or does not contain profile information.') . EOL );
531 goaway(System::baseUrl() . '/' . $a->cmd);
534 if (! x($parms,'fn')) {
535 notice( t('Warning: profile location has no identifiable owner name.') . EOL );
537 if (! x($parms,'photo')) {
538 notice( t('Warning: profile location has no profile photo.') . EOL );
540 $invalid = Probe::validDfrn($parms);
542 notice( sprintf( tt("%d required parameter was not found at the given location",
543 "%d required parameters were not found at the given location",
544 $invalid), $invalid) . EOL );
551 $parms['url'] = $url;
552 $parms['issued-id'] = $issued_id;
553 $photo = $parms["photo"];
555 dbm::esc_array($parms);
556 $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
557 `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `blocked`, `pending` )
558 VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d )",
560 dbesc(datetime_convert()),
562 dbesc(normalise_link($url)),
569 $parms['dfrn-request'],
570 $parms['dfrn-confirm'],
571 $parms['dfrn-notify'],
579 // find the contact record we just created
581 $r = q("SELECT `id` FROM `contact`
582 WHERE `uid` = %d AND `url` = '%s' AND `issued-id` = '%s' LIMIT 1",
587 if (dbm::is_result($r)) {
588 $contact_record = $r[0];
589 update_contact_avatar($photo, $uid, $contact_record["id"], true);
595 notice( t('Failed to update contact record.') . EOL );
599 $hash = random_string() . (string) time(); // Generate a confirm_key
601 if (is_array($contact_record)) {
602 $ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
603 VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
605 intval($contact_record['id']),
606 ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
607 dbesc(notags(trim($_POST['dfrn-request-message']))),
609 dbesc(datetime_convert())
613 // This notice will only be seen by the requestor if the requestor and requestee are on the same server.
616 info( t('Your introduction has been sent.') . EOL );
619 // "Homecoming" - send the requestor back to their site to record the introduction.
621 $dfrn_url = bin2hex(System::baseUrl() . '/profile/' . $nickname);
622 $aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0);
624 goaway($parms['dfrn-request'] . "?dfrn_url=$dfrn_url"
625 . '&dfrn_version=' . DFRN_PROTOCOL_VERSION
626 . '&confirm_key=' . $hash
627 . (($aes_allow) ? "&aes_allow=1" : "")
630 // END $network === NETWORK_DFRN
631 } elseif (($network != NETWORK_PHANTOM) && ($url != "")) {
635 * Substitute our user's feed URL into $url template
636 * Send the subscriber home to subscribe
640 // Diaspora needs the uri in the format user@domain.tld
641 // Diaspora will support the remote subscription in a future version
642 if ($network == NETWORK_DIASPORA) {
643 $uri = $nickname.'@'.$a->get_hostname();
646 $uri .= '/'.$a->get_path();
648 $uri = urlencode($uri);
650 $uri = System::baseUrl().'/profile/'.$nickname;
653 $url = str_replace('{uri}', $uri, $url);
656 // END $network != NETWORK_PHANTOM
658 notice(t("Remote subscription can't be done for your network. Please subscribe directly on your system.").EOL);
666 function dfrn_request_content(App $a) {
668 if (($a->argc != 2) || (! count($a->profile))) {
673 // "Homecoming". Make sure we're logged in to this site as the correct user. Then offer a confirm button
674 // to send us to the post section to record the introduction.
676 if (x($_GET,'dfrn_url')) {
678 if (! local_user()) {
679 info( t("Please login to confirm introduction.") . EOL );
680 /* setup the return URL to come back to this page if they use openid */
681 $_SESSION['return_url'] = $a->query_string;
685 // Edge case, but can easily happen in the wild. This person is authenticated,
686 // but not as the person who needs to deal with this request.
688 if ($a->user['nickname'] != $a->argv[1]) {
689 notice( t("Incorrect identity currently logged in. Please login to <strong>this</strong> profile.") . EOL);
693 $dfrn_url = notags(trim(hex2bin($_GET['dfrn_url'])));
694 $aes_allow = (((x($_GET,'aes_allow')) && ($_GET['aes_allow'] == 1)) ? 1 : 0);
695 $confirm_key = (x($_GET,'confirm_key') ? $_GET['confirm_key'] : "");
697 // Checking fastlane for validity
698 if (x($_SESSION, "fastlane") && (normalise_link($_SESSION["fastlane"]) == normalise_link($dfrn_url))) {
699 $_POST["dfrn_url"] = $dfrn_url;
700 $_POST["confirm_key"] = $confirm_key;
701 $_POST["localconfirm"] = 1;
702 $_POST["hidden-contact"] = 0;
703 $_POST["submit"] = t('Confirm');
705 dfrn_request_post($a);
708 return; // NOTREACHED
711 $tpl = get_markup_template("dfrn_req_confirm.tpl");
712 $o = replace_macros($tpl,array(
713 '$dfrn_url' => $dfrn_url,
714 '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
715 '$hidethem' => t('Hide this contact'),
716 '$hidechecked' => '',
717 '$confirm_key' => $confirm_key,
718 '$welcome' => sprintf( t('Welcome home %s.'), $a->user['username']),
719 '$please' => sprintf( t('Please confirm your introduction/connection request to %s.'), $dfrn_url),
720 '$submit' => t('Confirm'),
721 '$uid' => $_SESSION['uid'],
722 '$nickname' => $a->user['nickname'],
723 'dfrn_rawurl' => $_GET['dfrn_url']
728 elseif((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) {
730 // we are the requestee and it is now safe to send our user their introduction,
731 // We could just unblock it, but first we have to jump through a few hoops to
732 // send an email, or even to find out if we need to send an email.
734 $intro = q("SELECT * FROM `intro` WHERE `hash` = '%s' LIMIT 1",
735 dbesc($_GET['confirm_key'])
738 if (dbm::is_result($intro)) {
740 $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
741 WHERE `contact`.`id` = %d LIMIT 1",
742 intval($intro[0]['contact-id'])
745 $auto_confirm = false;
747 if (dbm::is_result($r)) {
748 if(($r[0]['page-flags'] != PAGE_NORMAL) && ($r[0]['page-flags'] != PAGE_PRVGROUP))
749 $auto_confirm = true;
751 if(! $auto_confirm) {
754 'type' => NOTIFY_INTRO,
755 'notify_flags' => $r[0]['notify-flags'],
756 'language' => $r[0]['language'],
757 'to_name' => $r[0]['username'],
758 'to_email' => $r[0]['email'],
759 'uid' => $r[0]['uid'],
760 'link' => System::baseUrl() . '/notifications/intros',
761 'source_name' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
762 'source_link' => $r[0]['url'],
763 'source_photo' => $r[0]['photo'],
764 'verb' => ACTIVITY_REQ_FRIEND,
770 require_once 'mod/dfrn_confirm.php';
772 'uid' => $r[0]['uid'],
773 'node' => $r[0]['nickname'],
774 'dfrn_id' => $r[0]['issued-id'],
775 'intro_id' => $intro[0]['id'],
776 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0),
777 'activity' => intval(PConfig::get($r[0]['uid'],'system','post_newfriend'))
779 dfrn_confirm_post($a,$handsfree);
784 if(! $auto_confirm) {
786 // If we are auto_confirming, this record will have already been nuked
787 // in dfrn_confirm_post()
789 $r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s'",
790 dbesc($_GET['confirm_key'])
796 return; // NOTREACHED
801 * Normal web request. Display our user's introduction form.
804 if((Config::get('system','block_public')) && (! local_user()) && (! remote_user())) {
805 if(! Config::get('system','local_block')) {
806 notice( t('Public access denied.') . EOL);
813 * Try to auto-fill the profile address
816 // At first look if an address was provided
817 // Otherwise take the local address
818 if (x($_GET,'addr') && ($_GET['addr'] != "")) {
819 $myaddr = hex2bin($_GET['addr']);
820 } elseif (x($_GET,'address') && ($_GET['address'] != "")) {
821 $myaddr = $_GET['address'];
822 } elseif (local_user()) {
823 if (strlen($a->path)) {
824 $myaddr = System::baseUrl() . '/profile/' . $a->user['nickname'];
826 $myaddr = $a->user['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3 );
830 $myaddr = get_my_url();
833 $target_addr = $a->profile['nickname'] . '@' . substr(System::baseUrl(), strpos(System::baseUrl(),'://') + 3 );
838 * The auto_request form only has the profile address
839 * because nobody is going to read the comments and
840 * it doesn't matter if they know you or not.
844 if ($a->profile['page-flags'] == PAGE_NORMAL) {
845 $tpl = get_markup_template('dfrn_request.tpl');
847 $tpl = get_markup_template('auto_request.tpl');
850 $page_desc = t("Please enter your 'Identity Address' from one of the following supported communications networks:");
852 // see if we are allowed to have NETWORK_MAIL2 contacts
854 $mail_disabled = ((function_exists('imap_open') && (! Config::get('system','imap_disabled'))) ? 0 : 1);
856 if (Config::get('system','dfrn_only')) {
860 if (! $mail_disabled) {
861 $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
862 intval($a->profile['uid'])
864 if (! dbm::is_result($r)) {
869 // "coming soon" is disabled for now
870 //$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
873 $invite_desc = sprintf(
874 t('If you are not yet a member of the free social web, <a href="%s/siteinfo">follow this link to find a public Friendica site and join us today</a>.'),
878 $o = replace_macros($tpl,array(
879 '$header' => t('Friend/Connection Request'),
880 '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
881 '$pls_answer' => t('Please answer the following:'),
882 '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$a->profile['name']), false, '', array(t('No'), t('Yes'))),
883 /*'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
886 '$add_note' => t('Add a personal note:'),
887 '$page_desc' => $page_desc,
888 '$friendica' => t('Friendica'),
889 '$statusnet' => t('StatusNet/Federated Social Web'),
890 '$diaspora' => t('Diaspora'),
891 '$diasnote' => sprintf (t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.'),$target_addr),
892 '$your_address' => t('Your Identity Address:'),
893 '$invite_desc' => $invite_desc,
894 '$emailnet' => $emailnet,
895 '$submit' => t('Submit Request'),
896 '$cancel' => t('Cancel'),
897 '$nickname' => $a->argv[1],
898 '$name' => $a->profile['name'],
904 return; // Somebody is fishing.