Reduced options when adding a friendica contact and an address was provided via URL parameter.

This commit is contained in:
Michael Vogel 2014-08-21 00:56:21 +02:00
parent 716e0b073f
commit d23d26f44d
3 changed files with 37 additions and 28 deletions

View file

@ -111,9 +111,9 @@ function dfrn_request_post(&$a) {
*/ */
require_once('include/Scrape.php'); require_once('include/Scrape.php');
$parms = scrape_dfrn($dfrn_url); $parms = scrape_dfrn($dfrn_url);
if(! count($parms)) { if(! count($parms)) {
notice( t('Profile location is not valid or does not contain profile information.') . EOL ); notice( t('Profile location is not valid or does not contain profile information.') . EOL );
return; return;
@ -123,7 +123,7 @@ function dfrn_request_post(&$a) {
notice( t('Warning: profile location has no identifiable owner name.') . EOL ); notice( t('Warning: profile location has no identifiable owner name.') . EOL );
if(! x($parms,'photo')) if(! x($parms,'photo'))
notice( t('Warning: profile location has no profile photo.') . EOL ); notice( t('Warning: profile location has no profile photo.') . EOL );
$invalid = validate_dfrn($parms); $invalid = validate_dfrn($parms);
if($invalid) { if($invalid) {
notice( sprintf( tt("%d required parameter was not found at the given location", notice( sprintf( tt("%d required parameter was not found at the given location",
"%d required parameters were not found at the given location", "%d required parameters were not found at the given location",
@ -194,7 +194,7 @@ function dfrn_request_post(&$a) {
if(strlen($dfrn_request) && strlen($confirm_key)) if(strlen($dfrn_request) && strlen($confirm_key))
$s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key); $s = fetch_url($dfrn_request . '?confirm_key=' . $confirm_key);
// (ignore reply, nothing we can do it failed) // (ignore reply, nothing we can do it failed)
goaway(zrl($dfrn_url)); goaway(zrl($dfrn_url));
@ -432,7 +432,7 @@ function dfrn_request_post(&$a) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
1 1
); );
// Next send an email verify form to the requestor. // Next send an email verify form to the requestor.
} }
@ -585,7 +585,7 @@ function dfrn_request_post(&$a) {
dbesc(datetime_convert()) dbesc(datetime_convert())
); );
} }
// This notice will only be seen by the requestor if the requestor and requestee are on the same server. // This notice will only be seen by the requestor if the requestor and requestee are on the same server.
if(! $failed) if(! $failed)
@ -768,27 +768,22 @@ function dfrn_request_content(&$a) {
* Try to auto-fill the profile address * Try to auto-fill the profile address
*/ */
if(local_user()) { // 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)) { if(strlen($a->path)) {
$myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname']; $myaddr = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
} }
else { else {
$myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); $myaddr = $a->user['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
} }
} } else // last, try a zrl
elseif(x($_GET,'addr')) {
$myaddr = hex2bin($_GET['addr']);
}
else {
/* $_GET variables are already urldecoded */
$myaddr = ((x($_GET,'address')) ? $_GET['address'] : '');
}
// last, try a zrl
if(! strlen($myaddr))
$myaddr = get_my_url(); $myaddr = get_my_url();
$target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 ); $target_addr = $a->profile['nickname'] . '@' . substr(z_root(), strpos(z_root(),'://') + 3 );
@ -805,9 +800,6 @@ function dfrn_request_content(&$a) {
else else
$tpl = get_markup_template('auto_request.tpl'); $tpl = get_markup_template('auto_request.tpl');
# $page_desc = sprintf( t('Diaspora members: Please do not use this form. Instead, enter "%s" into your Diaspora search bar.'),
# $target_addr) . EOL . EOL;
$page_desc .= t("Please enter your 'Identity Address' from one of the following supported communications networks:"); $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 // see if we are allowed to have NETWORK_MAIL2 contacts
@ -824,7 +816,9 @@ function dfrn_request_content(&$a) {
$mail_disabled = 1; $mail_disabled = 1;
} }
$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29")); // "coming soon" is disabled for now
//$emailnet = (($mail_disabled) ? '' : t("<strike>Connect as an email follower</strike> \x28Coming soon\x29"));
$emailnet = "";
$invite_desc = t('If you are not yet a member of the free social web, <a href="http://dir.friendica.com/siteinfo">follow this link to find a public Friendica site and join us today</a>.'); $invite_desc = t('If you are not yet a member of the free social web, <a href="http://dir.friendica.com/siteinfo">follow this link to find a public Friendica site and join us today</a>.');
@ -832,9 +826,10 @@ function dfrn_request_content(&$a) {
'$header' => t('Friend/Connection Request'), '$header' => t('Friend/Connection Request'),
'$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'), '$desc' => t('Examples: jojo@demo.friendica.com, http://demo.friendica.com/profile/jojo, testuser@identi.ca'),
'$pls_answer' => t('Please answer the following:'), '$pls_answer' => t('Please answer the following:'),
'$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']), '$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'), '$yes' => t('Yes'),
'$no' => t('No'), '$no' => t('No'), */
'$add_note' => t('Add a personal note:'), '$add_note' => t('Add a personal note:'),
'$page_desc' => $page_desc, '$page_desc' => $page_desc,
'$friendica' => t('Friendica'), '$friendica' => t('Friendica'),

View file

@ -6,6 +6,7 @@
<h1>{{$header}}</h1> <h1>{{$header}}</h1>
{{if $myaddr == ""}}
<p id="dfrn-request-intro"> <p id="dfrn-request-intro">
{{$page_desc}}<br /> {{$page_desc}}<br />
<ul id="dfrn-request-networks"> <ul id="dfrn-request-networks">
@ -21,12 +22,17 @@
<p> <p>
{{$desc}} {{$desc}}
</p> </p>
{{/if}}
<form action="dfrn_request/{{$nickname}}" method="post" /> <form action="dfrn_request/{{$nickname}}" method="post" />
<div id="dfrn-request-url-wrapper" > <div id="dfrn-request-url-wrapper" >
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label> <label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" /> {{if $myaddr}}
{{$myaddr}}
{{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" />
{{/if}}
<div id="dfrn-request-url-end"></div> <div id="dfrn-request-url-end"></div>
</div> </div>

View file

@ -6,6 +6,8 @@
<h1>{{$header}}</h1> <h1>{{$header}}</h1>
{{if $myaddr}}
{{else}}
<p id="dfrn-request-intro"> <p id="dfrn-request-intro">
{{$page_desc}}<br /> {{$page_desc}}<br />
<ul id="dfrn-request-networks"> <ul id="dfrn-request-networks">
@ -19,12 +21,17 @@
<p> <p>
{{$desc}} {{$desc}}
</p> </p>
{{/if}}
<form action="dfrn_request/{{$nickname}}" method="post" /> <form action="dfrn_request/{{$nickname}}" method="post" />
<div id="dfrn-request-url-wrapper" > <div id="dfrn-request-url-wrapper" >
<label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label> <label id="dfrn-url-label" for="dfrn-url" >{{$your_address}}</label>
{{if $myaddr}}
{{$myaddr}}
{{else}}
<input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" /> <input type="text" name="dfrn_url" id="dfrn-url" size="32" value="{{$myaddr}}" />
{{/if}}
<div id="dfrn-request-url-end"></div> <div id="dfrn-request-url-end"></div>
</div> </div>
@ -34,7 +41,8 @@
<div id="dfrn-request-info-wrapper" > <div id="dfrn-request-info-wrapper" >
{{include file="field_yesno.tpl" field=$does_know_you}}
<!--
<p id="doiknowyou"> <p id="doiknowyou">
{{$does_know}} {{$does_know}}
</p> </p>
@ -51,7 +59,7 @@
<div id="dfrn-request-knowyou-end"></div> <div id="dfrn-request-knowyou-end"></div>
</div> </div>
-->
<p id="dfrn-request-message-desc"> <p id="dfrn-request-message-desc">
{{$add_note}} {{$add_note}}