- $url = notags(trim($_POST['url']));
-
- if($url) {
- $links = lrdd($url);
- if(count($links)) {
- foreach($links as $link) {
- if($link['@attributes']['rel'] === NAMESPACE_DFRN)
- $dfrn = $link['@attributes']['href'];
- if($link['@attributes']['rel'] === 'salmon')
- $notify = $link['@attributes']['href'];
- if($link['@attributes']['rel'] === NAMESPACE_FEED)
- $poll = $link['@attributes']['href'];
- if($link['@attributes']['rel'] === 'http://microformats.org/profile/hcard')
- $hcard = $link['@attributes']['href'];
- if($link['@attributes']['rel'] === 'http://webfinger.net/rel/profile-page')
- $profile = $link['@attributes']['href'];
-
- }
- }
- }
-
- // If we find a DFRN site, send our subscriber to the other person's
- // dfrn_request page and all the other details will get sorted.
-
- if(strlen($dfrn)) {
- $ret = scrape_dfrn($dfrn);
- if(is_array($ret) && x($ret,'dfrn-request')) {
- if(strlen($a->path))
- $myaddr = urlencode($a->get_baseurl() . '/profile/' . $a->user['nickname']);
- else
- $myaddr = urlencode($a->user['nickname'] . '@' . $a->get_hostname());
+ $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']);
+ else
+ $myaddr = bin2hex($a->user['nickname'] . '@' . $a->get_hostname());