+ if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
+ if(! get_config('system','local_block')) {
+ notice( t('Public access denied.') . EOL);
+ return;
+ }
+ }
+
+
+ /**
+ * Try to auto-fill the profile address
+ */
+
+ // At first look if an address was provided
+ // Otherwise take the local address
+ if (x($_GET,'addr') AND ($_GET['addr'] != ""))
+ $myaddr = hex2bin($_GET['addr']);
+ elseif (x($_GET,'address') AND ($_GET['address'] != ""))
+ $myaddr = $_GET['address'];
+ elseif(local_user()) {
+ if(strlen($a->path)) {
+ $myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
+ }
+ else {
+ $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
+ }
+ } else // last, try a zrl
+ $myaddr = get_my_url();
+
+ $target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
+
+
+ /**
+ *
+ * The auto_request form only has the profile address
+ * because nobody is going to read the comments and
+ * it doesn't matter if they know you or not.
+ *
+ */
+
+ if($a->profile['page-flags'] == PAGE_NORMAL)
+ $tpl = get_markup_template('dfrn_request.tpl');
+ else
+ $tpl = get_markup_template('auto_request.tpl');
+
+ $page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:");
+
+ // see if we are allowed to have NETWORK_MAIL2 contacts
+
+ $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1);
+ if(get_config('system','dfrn_only'))
+ $mail_disabled = 1;
+
+ if(! $mail_disabled) {
+ $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
+ intval($a->profile['uid'])
+ );
+ if(! count($r))
+ $mail_disabled = 1;
+ }
+
+ // "coming soon" is disabled for now
+ //$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
+ $emailnet = "";
+
+ $invite_desc = sprintf(
+ 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>.'),
+ get_server()
+ );
+
+ $o .= replace_macros($tpl,array(
+ '$header' => t('Friend/Connection Request'),
+ '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
+ '$pls_answer' => t('Please answer the following:'),
+ '$does_know_you' => array('knowyou', sprintf(t('Does %s know you?'),$a->profile['name']), false, '', array(t('No'),t('Yes'))),
+ /*'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
+ '$yes' => t('Yes'),
+ '$no' => t('No'), */
+ '$add_note' => t('Add a personal note:'),
+ '$page_desc' => $page_desc,
+ '$friendica' => t('Friendica'),
+ '$statusnet' => t('StatusNet/Federated Social Web'),
+ '$diaspora' => t('Diaspora'),
+ '$diasnote' => sprintf (t(' - please do not use this form. Instead, enter %s into your Diaspora search bar.'),$target_addr),
+ '$your_address' => t('Your Identity Address:'),
+ '$invite_desc' => $invite_desc,
+ '$emailnet' => $emailnet,
+ '$submit' => t('Submit Request'),
+ '$cancel' => t('Cancel'),
+ '$nickname' => $a->argv[1],
+ '$name' => $a->profile['name'],
+ '$myaddr' => $myaddr
+ ));