X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Ffollow.php;h=830399ff5c51ae7903b239ed4fa80a07dcf9c840;hb=2abcf76ec17a9a7754c399cdde9a4449308a4b02;hp=2f3cb3c4d7074069714fe9420de6eea299161d5b;hpb=c052d688284fda76c612325b237d8352f2abb5d4;p=friendica.git diff --git a/mod/follow.php b/mod/follow.php index 2f3cb3c4d7..830399ff5c 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -12,16 +12,18 @@ function follow_post(&$a) { $url = $orig_url = notags(trim($_POST['url'])); + // remove ajax junk, e.g. Twitter + + $url = str_replace('/#!/','/',$url); + if(! allowed_url($url)) { notice( t('Disallowed profile URL.') . EOL); goaway($_SESSION['return_url']); // NOTREACHED } - $ret = probe_url($url); - if($ret['network'] === NETWORK_DFRN) { if(strlen($a->path)) $myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']); @@ -32,14 +34,33 @@ function follow_post(&$a) { // NOTREACHED } + else { + if(get_config('system','dfrn_only')) { + notice( t('This site is not configured to allow communications with other networks.') . EOL); + notice( t('No compatible communication protocols or feeds were discovered.') . EOL); + goaway($_SESSION['return_url']); + } + } // do we have enough information? if(! ((x($ret,'name')) && (x($ret,'poll')) && ((x($ret,'url')) || (x($ret,'addr'))))) { notice( t('The profile address specified does not provide adequate information.') . EOL); + if(! x($ret,'poll')) + notice( t('No compatible communication protocols or feeds were discovered.') . EOL); + if(! x($ret,'name')) + notice( t('An author or name was not found.') . EOL); + if(! x($ret,'url')) + notice( t('No browser URL could be matched to this address.') . EOL); + if(strpos($url,'@') !== false) + notice('Unable to match @-style Identity Address with a known protocol or email contact'); goaway($_SESSION['return_url']); } + if($ret['network'] === NETWORK_OSTATUS && get_config('system','ostatus_disabled')) { + notice( t('Communication options with this network have been restricted.') . EOL); + $ret['notify'] = ''; + } if(! $ret['notify']) { notice( t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . EOL); @@ -133,7 +154,7 @@ function follow_post(&$a) { // create a follow slap - $tpl = file_get_contents('view/follow_slap.tpl'); + $tpl = get_markup_template('follow_slap.tpl'); $slap = replace_macros($tpl, array( '$name' => $a->user['username'], '$profile_page' => $a->get_baseurl() . '/profile/' . $a->user['nickname'],