]> git.mxchange.org Git - friendica.git/blob - mod/dfrn_request.php
prevent duplicate @ tags
[friendica.git] / mod / dfrn_request.php
1 <?php
2
3 /**
4  *
5  * Module: dfrn_request
6  *
7  * Purpose: Handles communication associated with the issuance of
8  * friend requests.
9  *
10  */
11
12 if(! function_exists('dfrn_request_init')) {
13 function dfrn_request_init(&$a) {
14
15         if($a->argc > 1)
16                 $which = $a->argv[1];
17
18         profile_load($a,$which);
19         return;
20 }}
21
22
23 /**
24  * Function: dfrn_request_post
25  *
26  * Purpose:
27  * Handles multiple scenarios.
28  *
29  * Scenario 1:
30  * Clicking 'submit' on a friend request page.
31  *
32  * Scenario 2:
33  * Following Scenario 1, we are brought back to our home site
34  * in order to link our friend request with our own server cell.
35  * After logging in, we click 'submit' to approve the linkage.
36  *
37  */
38
39 if(! function_exists('dfrn_request_post')) {
40 function dfrn_request_post(&$a) {
41
42         if(($a->argc != 2) || (! count($a->profile)))
43                 return;
44
45
46         if($_POST['cancel']) {
47                 goaway(z_root());
48         } 
49
50
51         /**
52          *
53          * Scenario 2: We've introduced ourself to another cell, then have been returned to our own cell
54          * to confirm the request, and then we've clicked submit (perhaps after logging in). 
55          * That brings us here:
56          *
57          */
58
59         if((x($_POST,'localconfirm')) && ($_POST['localconfirm'] == 1)) {
60
61                 /**
62                  * Ensure this is a valid request
63                  */
64
65                 if(local_user() && ($a->user['nickname'] == $a->argv[1]) && (x($_POST,'dfrn_url'))) {
66
67
68                         $dfrn_url    = notags(trim($_POST['dfrn_url']));
69                         $aes_allow   = (((x($_POST,'aes_allow')) && ($_POST['aes_allow'] == 1)) ? 1 : 0);
70                         $confirm_key = ((x($_POST,'confirm_key')) ? $_POST['confirm_key'] : "");
71
72                         $contact_record = null;
73         
74                         if(x($dfrn_url)) {
75
76                                 /**
77                                  * Lookup the contact based on their URL (which is the only unique thing we have at the moment)
78                                  */
79         
80                                 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1",
81                                         intval(local_user()),
82                                         dbesc($dfrn_url)
83                                 );
84         
85                                 if(count($r)) {
86                                         if(strlen($r[0]['dfrn-id'])) {
87
88                                                 /**
89                                                  * We don't need to be here. It has already happened.
90                                                  */
91
92                                                 notice( t("This introduction has already been accepted.") . EOL );
93                                                 return;
94                                         }
95                                         else
96                                                 $contact_record = $r[0];
97                                 }
98         
99                                 if(is_array($contact_record)) {
100                                         $r = q("UPDATE `contact` SET `ret-aes` = %d WHERE `id` = %d LIMIT 1",
101                                                 intval($aes_allow),
102                                                 intval($contact_record['id'])
103                                         );
104                                 }
105                                 else {
106         
107                                         /**
108                                          * Scrape the other site's profile page to pick up the dfrn links, key, fn, and photo
109                                          */
110
111                                         require_once('Scrape.php');
112         
113                                         $parms = scrape_dfrn($dfrn_url);
114         
115                                         if(! count($parms)) {
116                                                 notice( t('Profile location is not valid or does not contain profile information.') . EOL );
117                                                 return;
118                                         }
119                                         else {
120                                                 if(! x($parms,'fn'))
121                                                         notice( t('Warning: profile location has no identifiable owner name.') . EOL );
122                                                 if(! x($parms,'photo'))
123                                                         notice( t('Warning: profile location has no profile photo.') . EOL );
124                                                 $invalid = validate_dfrn($parms);               
125                                                 if($invalid) {
126                                                         notice( sprintf( tt("%d required parameter was not found at the given location",
127                                                                                                 "%d required parameters were not found at the given location",
128                                                                                                 $invalid), $invalid) . EOL );
129                                                         return;
130                                                 }
131                                         }
132
133                                         $dfrn_request = $parms['dfrn-request'];
134
135                     /********* Escape the entire array ********/
136
137                                         dbesc_array($parms);
138
139                                         /******************************************/
140
141                                         /**
142                                          * Create a contact record on our site for the other person
143                                          */
144
145                                         $r = q("INSERT INTO `contact` ( `uid`, `created`,`url`, `nurl`, `name`, `nick`, `photo`, `site-pubkey`,
146                                                 `request`, `confirm`, `notify`, `poll`, `poco`, `network`, `aes_allow`) 
147                                                 VALUES ( %d, '%s', '%s', '%s', '%s' , '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)",
148                                                 intval(local_user()),
149                                                 datetime_convert(),
150                                                 dbesc($dfrn_url),
151                                                 dbesc(normalise_link($dfrn_url)),
152                                                 $parms['fn'],
153                                                 $parms['nick'],
154                                                 $parms['photo'],
155                                                 $parms['key'],
156                                                 $parms['dfrn-request'],
157                                                 $parms['dfrn-confirm'],
158                                                 $parms['dfrn-notify'],
159                                                 $parms['dfrn-poll'],
160                                                 $parms['dfrn-poco'],
161                                                 dbesc(NETWORK_DFRN),
162                                                 intval($aes_allow)
163                                         );
164                                 }
165
166                                 if($r) {
167                                         info( t("Introduction complete.") . EOL);
168                                 }
169
170                                 /**
171                                  * Allow the blocked remote notification to complete
172                                  */
173
174                                 if(is_array($contact_record))
175                                         $dfrn_request = $contact_record['request'];
176
177                                 if(strlen($dfrn_request) && strlen($confirm_key))
178                                         $s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key);
179                                 
180                                 // (ignore reply, nothing we can do it failed)
181
182                                 goaway($dfrn_url);
183                                 return; // NOTREACHED
184
185                         }
186
187                 }
188
189                 // invalid/bogus request
190
191                 notice( t('Unrecoverable protocol error.') . EOL );
192                 goaway(z_root());
193                 return; // NOTREACHED
194         }
195
196         /**
197          * Otherwise:
198          * 
199          * Scenario 1:
200          * We are the requestee. A person from a remote cell has made an introduction 
201          * on our profile web page and clicked submit. We will use their DFRN-URL to 
202          * figure out how to contact their cell.  
203          *
204          * Scrape the originating DFRN-URL for everything we need. Create a contact record
205          * and an introduction to show our user next time he/she logs in.
206          * Finally redirect back to the requestor so that their site can record the request.
207          * If our user (the requestee) later confirms this request, a record of it will need 
208          * to exist on the requestor's cell in order for the confirmation process to complete.. 
209          *
210          * It's possible that neither the requestor or the requestee are logged in at the moment,
211          * and the requestor does not yet have any credentials to the requestee profile.
212          *
213          * Who is the requestee? We've already loaded their profile which means their nickname should be
214          * in $a->argv[1] and we should have their complete info in $a->profile.
215          *
216          */
217
218         if(! (is_array($a->profile) && count($a->profile))) {
219                 notice( t('Profile unavailable.') . EOL);
220                 return;
221         }
222
223         $nickname       = $a->profile['nickname'];
224         $notify_flags   = $a->profile['notify-flags'];
225         $uid            = $a->profile['uid'];
226         $maxreq         = intval($a->profile['maxreq']);
227         $contact_record = null;
228         $failed         = false;
229         $parms          = null;
230
231
232         if( x($_POST,'dfrn_url')) {
233
234                 /**
235                  * Block friend request spam
236                  */
237
238                 if($maxreq) {
239                         $r = q("SELECT * FROM `intro` WHERE `datetime` > '%s' AND `uid` = %d",
240                                 dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
241                                 intval($uid)
242                         );
243                         if(count($r) > $maxreq) {
244                                 notice( sprintf( t('%s has received too many connection requests today.'),  $a->profile['name']) . EOL);
245                                 notice( t('Spam protection measures have been invoked.') . EOL);
246                                 notice( t('Friends are advised to please try again in 24 hours.') . EOL);
247                                 return;
248                         } 
249                 }
250
251                 /**
252                  *
253                  * Cleanup old introductions that remain blocked. 
254                  * Also remove the contact record, but only if there is no existing relationship
255                  *
256                  */
257
258                 $r = q("SELECT `intro`.*, `intro`.`id` AS `iid`, `contact`.`id` AS `cid`, `contact`.`rel` 
259                         FROM `intro` LEFT JOIN `contact` on `intro`.`contact-id` = `contact`.`id`
260                         WHERE `intro`.`blocked` = 1 AND `contact`.`self` = 0 AND `intro`.`datetime` < UTC_TIMESTAMP() - INTERVAL 30 MINUTE ");
261                 if(count($r)) {
262                         foreach($r as $rr) {
263                                 if(! $rr['rel']) {
264                                         q("DELETE FROM `contact` WHERE `id` = %d LIMIT 1",
265                                                 intval($rr['cid'])
266                                         );
267                                 }
268                                 q("DELETE FROM `intro` WHERE `id` = %d LIMIT 1",
269                                         intval($rr['iid'])
270                                 );
271                         }
272                 }
273
274                 $url = trim($_POST['dfrn_url']);
275                 if(! strlen($url)) {
276                         notice( t("Invalid locator") . EOL );
277                         return;
278                 }
279
280                 // Canonicalise email-style profile locator
281
282                 $hcard = '';
283                 $url = webfinger_dfrn($url,$hcard);
284
285                 if(substr($url,0,5) === 'stat:') {
286                         $network = NETWORK_OSTATUS;
287                         $url = substr($url,5);
288                 }
289                 else {
290                         $network = NETWORK_DFRN;
291                 }
292
293                 logger('dfrn_request: url: ' . $url);
294
295                 if(! strlen($url)) {
296                         notice( t("Unable to resolve your name at the provided location.") . EOL);                      
297                         return;
298                 }
299
300
301                 if($network === NETWORK_DFRN) {
302                         $ret = q("SELECT * FROM `contact` WHERE `uid` = %d AND `url` = '%s' AND `self` = 0 LIMIT 1", 
303                                 intval($uid),
304                                 dbesc($url)
305                         );
306
307                         if(count($ret)) {
308                                 if(strlen($ret[0]['issued-id'])) {
309                                         notice( t('You have already introduced yourself here.') . EOL );
310                                         return;
311                                 }
312                                 elseif($ret[0]['rel'] == CONTACT_IS_FRIEND) {
313                                         notice( sprintf( t('Apparently you are already friends with %s.'), $a->profile['name']) . EOL);
314                                         return;
315                                 }
316                                 else {
317                                         $contact_record = $ret[0];
318                                         $parms = array('dfrn-request' => $ret[0]['request']);
319                                 }
320                         }
321
322                         $issued_id = random_string();
323
324                         if(is_array($contact_record)) {
325                                 // There is a contact record but no issued-id, so this
326                                 // is a reciprocal introduction from a known contact
327                                 $r = q("UPDATE `contact` SET `issued-id` = '%s' WHERE `id` = %d LIMIT 1",
328                                         dbesc($issued_id),
329                                         intval($contact_record['id'])
330                                 );
331                         }
332                         else {
333                                 if(! validate_url($url)) {
334                                         notice( t('Invalid profile URL.') . EOL);
335                                         goaway($a->get_baseurl() . '/' . $a->cmd);
336                                         return; // NOTREACHED
337                                 }
338
339                                 if(! allowed_url($url)) {
340                                         notice( t('Disallowed profile URL.') . EOL);
341                                         goaway($a->get_baseurl() . '/' . $a->cmd);
342                                         return; // NOTREACHED
343                                 }
344                         
345
346                                 require_once('Scrape.php');
347
348                                 $parms = scrape_dfrn(($hcard) ? $hcard : $url);
349
350                                 if(! count($parms)) {
351                                         notice( t('Profile location is not valid or does not contain profile information.') . EOL );
352                                         goaway($a->get_baseurl() . '/' . $a->cmd);
353                                 }
354                                 else {
355                                         if(! x($parms,'fn'))
356                                                 notice( t('Warning: profile location has no identifiable owner name.') . EOL );
357                                         if(! x($parms,'photo'))
358                                                 notice( t('Warning: profile location has no profile photo.') . EOL );
359                                         $invalid = validate_dfrn($parms);               
360                                         if($invalid) {
361                                                 notice( sprintf( tt("%d required parameter was not found at the given location",
362                                                                                         "%d required parameters were not found at the given location",
363                                                                                         $invalid), $invalid) . EOL );
364         
365                                                 return;
366                                         }
367                                 }
368
369
370                                 $parms['url'] = $url;
371                                 $parms['issued-id'] = $issued_id;
372
373
374                                 dbesc_array($parms);
375                                 $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`,`name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
376                                         `request`, `confirm`, `notify`, `poll`, `poco`, `network` )
377                                         VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s' )",
378                                         intval($uid),
379                                         dbesc(datetime_convert()),
380                                         $parms['url'],
381                                         dbesc(normalise_link($parms['url'])),
382                                         $parms['fn'],
383                                         $parms['nick'],
384                                         $parms['issued-id'],
385                                         $parms['photo'],
386                                         $parms['key'],
387                                         $parms['dfrn-request'],
388                                         $parms['dfrn-confirm'],
389                                         $parms['dfrn-notify'],
390                                         $parms['dfrn-poll'],
391                                         $parms['dfrn-poco'],
392                                         dbesc(NETWORK_DFRN)
393                                 );
394
395                                 // find the contact record we just created
396                                 if($r) {        
397                                         $r = q("SELECT `id` FROM `contact` 
398                                                 WHERE `uid` = %d AND `url` = '%s' AND `issued-id` = '%s' LIMIT 1",
399                                                 intval($uid),
400                                                 $parms['url'],
401                                                 $parms['issued-id']
402                                         );
403                                         if(count($r)) 
404                                                 $contact_record = $r[0];
405                                 }
406         
407                         }
408                         if($r === false) {
409                                 notice( t('Failed to update contact record.') . EOL );
410                                 return;
411                         }
412
413                         $hash = random_string() . (string) time();   // Generate a confirm_key
414         
415                         if(is_array($contact_record)) {
416                                 $ret = q("INSERT INTO `intro` ( `uid`, `contact-id`, `blocked`, `knowyou`, `note`, `hash`, `datetime`)
417                                         VALUES ( %d, %d, 1, %d, '%s', '%s', '%s' )",
418                                         intval($uid),
419                                         intval($contact_record['id']),
420                                         ((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
421                                         dbesc(notags(trim($_POST['dfrn-request-message']))),
422                                         dbesc($hash),
423                                         dbesc(datetime_convert())
424                                 );
425                         }
426         
427                         // This notice will only be seen by the requestor if the requestor and requestee are on the same server.
428
429                         if(! $failed) 
430                                 info( t('Your introduction has been sent.') . EOL );
431
432                         // "Homecoming" - send the requestor back to their site to record the introduction.
433
434                         $dfrn_url = bin2hex($a->get_baseurl() . '/profile/' . $nickname);
435                         $aes_allow = ((function_exists('openssl_encrypt')) ? 1 : 0);
436
437                         goaway($parms['dfrn-request'] . "?dfrn_url=$dfrn_url" 
438                                 . '&dfrn_version=' . DFRN_PROTOCOL_VERSION 
439                                 . '&confirm_key='  . $hash 
440                                 . (($aes_allow) ? "&aes_allow=1" : "")
441                         );
442                         // NOTREACHED
443                         // END $network === NETWORK_DFRN
444                 }
445                 elseif($network === NETWORK_OSTATUS) {
446                         
447                         /**
448                          *
449                          * OStatus network
450                          * Check contact existence
451                          * Try and scrape together enough information to create a contact record, 
452                          * with us as CONTACT_IS_FOLLOWER
453                          * Substitute our user's feed URL into $url template
454                          * Send the subscriber home to subscribe
455                          *
456                          */
457
458                         $url = str_replace('{uri}', $a->get_baseurl() . '/dfrn_poll/' . $nickname, $url);
459                         goaway($url);
460                         // NOTREACHED
461                         // END $network === NETWORK_OSTATUS
462                 }
463
464         }       return;
465 }}
466
467
468
469
470 if(! function_exists('dfrn_request_content')) {
471 function dfrn_request_content(&$a) {
472
473         if(($a->argc != 2) || (! count($a->profile)))
474                 return "";
475
476
477         // "Homecoming". Make sure we're logged in to this site as the correct user. Then offer a confirm button
478         // to send us to the post section to record the introduction.
479
480         if(x($_GET,'dfrn_url')) {
481
482                 if(! local_user()) {
483                         info( t("Please login to confirm introduction.") . EOL );
484
485                         /* setup the return URL to come back to this page if they use openid */
486
487                         $stripped = str_replace('q=','',$a->query_string);
488                         $_SESSION['return_url'] = trim($stripped,'/');
489
490                         return login();
491                 }
492
493                 // Edge case, but can easily happen in the wild. This person is authenticated, 
494                 // but not as the person who needs to deal with this request.
495
496                 if ($a->user['nickname'] != $a->argv[1]) {
497                         notice( t("Incorrect identity currently logged in. Please login to <strong>this</strong> profile.") . EOL);
498                         return login();
499                 }
500
501                 $dfrn_url = notags(trim(hex2bin($_GET['dfrn_url'])));
502                 $aes_allow = (((x($_GET,'aes_allow')) && ($_GET['aes_allow'] == 1)) ? 1 : 0);
503                 $confirm_key = (x($_GET,'confirm_key') ? $_GET['confirm_key'] : "");
504                 $tpl = get_markup_template("dfrn_req_confirm.tpl");
505                 $o  = replace_macros($tpl,array(
506                         '$dfrn_url' => $dfrn_url,
507                         '$aes_allow' => (($aes_allow) ? '<input type="hidden" name="aes_allow" value="1" />' : "" ),
508                         '$confirm_key' => $confirm_key,
509                         '$welcome' => sprintf( t('Welcome home %s.'), $a->user['username']),
510                         '$please' => sprintf( t('Please confirm your introduction/connection request to %s.'), $dfrn_url),
511                         '$submit' => t('Confirm'),
512                         '$uid' => $_SESSION['uid'],
513                         '$nickname' => $a->user['nickname'],
514                         'dfrn_rawurl' => $_GET['dfrn_url']
515                         ));
516                 return $o;
517
518         }
519         elseif((x($_GET,'confirm_key')) && strlen($_GET['confirm_key'])) { 
520
521                 // we are the requestee and it is now safe to send our user their introduction,
522                 // We could just unblock it, but first we have to jump through a few hoops to 
523                 // send an email, or even to find out if we need to send an email. 
524
525                 $intro = q("SELECT * FROM `intro` WHERE `hash` = '%s' LIMIT 1",
526                         dbesc($_GET['confirm_key'])
527                 );
528
529                 if(count($intro)) {
530
531                         $r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
532                                 WHERE `contact`.`id` = %d LIMIT 1",
533                                 intval($intro[0]['contact-id'])
534                         );
535
536                         $auto_confirm = false;
537
538                         if(count($r)) {
539                                 if($r[0]['page-flags'] != PAGE_NORMAL)
540                                         $auto_confirm = true;                           
541                                 if(($r[0]['notify-flags'] & NOTIFY_INTRO) && (! $auto_confirm)) {
542                                         $email_tpl = get_intltext_template('request_notify_eml.tpl');
543                                         $email = replace_macros($email_tpl, array(
544                                                 '$requestor' => ((strlen(stripslashes($r[0]['name']))) ? stripslashes($r[0]['name']) : t('[Name Withheld]')),
545                                                 '$url' => stripslashes($r[0]['url']),
546                                                 '$myname' => $r[0]['username'],
547                                                 '$siteurl' => $a->get_baseurl(),
548                                                 '$sitename' => $a->config['sitename']
549                                         ));
550                                         $res = mail($r[0]['email'], 
551                                             t("Introduction received at ") . $a->config['sitename'],
552                                                 $email,
553                                                 'From: ' . t('Administrator') . '@' . $_SERVER['SERVER_NAME'] . "\n"
554                                                 . 'Content-type: text/plain; charset=UTF-8' . "\n"
555                                                 . 'Content-transfer-encoding: 8bit' );
556
557                                         // This is a redundant notification - no point throwing errors if it fails.
558                                 }
559                                 if($auto_confirm) {
560                                         require_once('mod/dfrn_confirm.php');
561                                         $handsfree = array(
562                                                 'uid' => $r[0]['uid'],
563                                                 'node' => $r[0]['nickname'],
564                                                 'dfrn_id' => $r[0]['issued-id'],
565                                                 'intro_id' => $intro[0]['id'],
566                                                 'duplex' => (($r[0]['page-flags'] == PAGE_FREELOVE) ? 1 : 0)
567                                         );
568                                         dfrn_confirm_post($a,$handsfree);
569                                 }
570
571                         }
572
573                         if(! $auto_confirm) {
574
575                                 // If we are auto_confirming, this record will have already been nuked
576                                 // in dfrn_confirm_post()
577
578                                 $r = q("UPDATE `intro` SET `blocked` = 0 WHERE `hash` = '%s' LIMIT 1",
579                                         dbesc($_GET['confirm_key'])
580                                 );
581                         }
582                 }
583
584                 killme();
585                 return; // NOTREACHED
586         }
587         else {
588
589                 /**
590                  * Normal web request. Display our user's introduction form.
591                  */
592  
593                 if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
594                         notice( t('Public access denied.') . EOL);
595                         return;
596                 }
597
598
599                 /**
600                  * Try to auto-fill the profile address
601                  */
602
603                 if(local_user()) {
604                         if(strlen($a->path)) {
605                                 $myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
606                         }
607                         else {
608                                 $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
609                         }
610                 }
611                 elseif(x($_GET,'addr')) {
612                         $myaddr = hex2bin($_GET['addr']);
613                 }
614                 else {
615                         /* $_GET variables are already urldecoded */ 
616                         $myaddr = ((x($_GET,'address')) ? $_GET['address'] : '');
617                 }
618
619                 $target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
620
621
622                 /**
623                  *
624                  * The auto_request form only has the profile address
625                  * because nobody is going to read the comments and 
626                  * it doesn't matter if they know you or not.
627                  *
628                  */
629
630                 if($a->profile['page-flags'] == PAGE_NORMAL)
631                         $tpl = get_markup_template('dfrn_request.tpl');
632                 else
633                         $tpl = get_markup_template('auto_request.tpl');
634
635                 $page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'), 
636                         $target_addr) . EOL . EOL;
637
638                 $page_desc .= t("Please enter your 'Identity Address' from one of the following supported social networks:");
639
640                 $o .= replace_macros($tpl,array(
641                         '$header' => t('Friend/Connection Request'),
642                         '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
643                         '$pls_answer' => t('Please answer the following:'),
644                         '$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
645                         '$yes' => t('Yes'),
646                         '$no' => t('No'),
647                         '$add_note' => t('Add a personal note:'),
648                         '$page_desc' => $page_desc,
649                         '$friendika' => t('Friendica'),
650                         '$statusnet' => t('StatusNet/Federated Social Web'),
651                         '$diaspora' => t('Diaspora'),
652                         '$diasnote' => t('- please share from your own site as noted above'),
653                         '$your_address' => t('Your Identity Address:'),
654                         '$submit' => t('Submit Request'),
655                         '$cancel' => t('Cancel'),
656                         '$nickname' => $a->argv[1],
657                         '$name' => $a->profile['name'],
658                         '$myaddr' => $myaddr
659                 ));
660                 return $o;
661         }
662
663         return; // Somebody is fishing.
664 }}