Merge remote-tracking branch 'refs/remotes/friendica/develop' into develop
This commit is contained in:
commit
3cb08c7458
|
@ -177,6 +177,8 @@ class Probe {
|
||||||
|
|
||||||
$path_parts = explode("/", trim($parts["path"], "/"));
|
$path_parts = explode("/", trim($parts["path"], "/"));
|
||||||
|
|
||||||
|
$nick = array_pop($path_parts);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
$lrdd = self::xrd($host);
|
$lrdd = self::xrd($host);
|
||||||
$host .= "/".array_shift($path_parts);
|
$host .= "/".array_shift($path_parts);
|
||||||
|
@ -200,6 +202,19 @@ class Probe {
|
||||||
$path = str_replace('{uri}', urlencode("acct:".$uri), $link);
|
$path = str_replace('{uri}', urlencode("acct:".$uri), $link);
|
||||||
$webfinger = self::webfinger($path);
|
$webfinger = self::webfinger($path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Special treatment for Mastodon
|
||||||
|
// Problem is that Mastodon uses an URL format like http://domain.tld/@nick
|
||||||
|
// But the webfinger for this format fails.
|
||||||
|
if (!$webfinger AND isset($nick)) {
|
||||||
|
// Mastodon uses a "@" as prefix for usernames in their url format
|
||||||
|
$nick = ltrim($nick, '@');
|
||||||
|
|
||||||
|
$addr = $nick."@".$host;
|
||||||
|
|
||||||
|
$path = str_replace('{uri}', urlencode("acct:".$addr), $link);
|
||||||
|
$webfinger = self::webfinger($path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($webfinger["links"]))
|
if (!is_array($webfinger["links"]))
|
||||||
|
@ -315,7 +330,34 @@ class Probe {
|
||||||
* @return array uri data
|
* @return array uri data
|
||||||
*/
|
*/
|
||||||
private function detect($uri, $network, $uid) {
|
private function detect($uri, $network, $uid) {
|
||||||
if (strstr($uri, '@')) {
|
$parts = parse_url($uri);
|
||||||
|
|
||||||
|
if (isset($parts["scheme"]) AND isset($parts["host"]) AND isset($parts["path"])) {
|
||||||
|
|
||||||
|
/// @todo: Ports?
|
||||||
|
$host = $parts["host"];
|
||||||
|
|
||||||
|
if ($host == 'twitter.com') {
|
||||||
|
return array("network" => NETWORK_TWITTER);
|
||||||
|
}
|
||||||
|
$lrdd = self::xrd($host);
|
||||||
|
|
||||||
|
$path_parts = explode("/", trim($parts["path"], "/"));
|
||||||
|
|
||||||
|
while (!$lrdd AND (sizeof($path_parts) > 1)) {
|
||||||
|
$host .= "/".array_shift($path_parts);
|
||||||
|
$lrdd = self::xrd($host);
|
||||||
|
}
|
||||||
|
if (!$lrdd) {
|
||||||
|
return self::feed($uri);
|
||||||
|
}
|
||||||
|
$nick = array_pop($path_parts);
|
||||||
|
|
||||||
|
// Mastodon uses a "@" as prefix for usernames in their url format
|
||||||
|
$nick = ltrim($nick, '@');
|
||||||
|
|
||||||
|
$addr = $nick."@".$host;
|
||||||
|
} elseif (strstr($uri, '@')) {
|
||||||
// If the URI starts with "mailto:" then jump directly to the mail detection
|
// If the URI starts with "mailto:" then jump directly to the mail detection
|
||||||
if (strpos($url,'mailto:') !== false) {
|
if (strpos($url,'mailto:') !== false) {
|
||||||
$uri = str_replace('mailto:', '', $url);
|
$uri = str_replace('mailto:', '', $url);
|
||||||
|
@ -331,42 +373,19 @@ class Probe {
|
||||||
$host = substr($uri,strpos($uri, '@') + 1);
|
$host = substr($uri,strpos($uri, '@') + 1);
|
||||||
$nick = substr($uri,0, strpos($uri, '@'));
|
$nick = substr($uri,0, strpos($uri, '@'));
|
||||||
|
|
||||||
if (strpos($uri, '@twitter.com'))
|
if (strpos($uri, '@twitter.com')) {
|
||||||
return array("network" => NETWORK_TWITTER);
|
return array("network" => NETWORK_TWITTER);
|
||||||
|
}
|
||||||
$lrdd = self::xrd($host);
|
$lrdd = self::xrd($host);
|
||||||
|
|
||||||
if (!$lrdd)
|
if (!$lrdd) {
|
||||||
return self::mail($uri, $uid);
|
return self::mail($uri, $uid);
|
||||||
|
}
|
||||||
$addr = $uri;
|
$addr = $uri;
|
||||||
} else {
|
} else {
|
||||||
$parts = parse_url($uri);
|
|
||||||
if (!isset($parts["scheme"]) OR
|
|
||||||
!isset($parts["host"]) OR
|
|
||||||
!isset($parts["path"]))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/// @todo: Ports?
|
|
||||||
$host = $parts["host"];
|
|
||||||
|
|
||||||
if ($host == 'twitter.com')
|
|
||||||
return array("network" => NETWORK_TWITTER);
|
|
||||||
|
|
||||||
$lrdd = self::xrd($host);
|
|
||||||
|
|
||||||
$path_parts = explode("/", trim($parts["path"], "/"));
|
|
||||||
|
|
||||||
while (!$lrdd AND (sizeof($path_parts) > 1)) {
|
|
||||||
$host .= "/".array_shift($path_parts);
|
|
||||||
$lrdd = self::xrd($host);
|
|
||||||
}
|
}
|
||||||
if (!$lrdd)
|
|
||||||
return self::feed($uri);
|
|
||||||
|
|
||||||
$nick = array_pop($path_parts);
|
|
||||||
$addr = $nick."@".$host;
|
|
||||||
}
|
|
||||||
$webfinger = false;
|
$webfinger = false;
|
||||||
|
|
||||||
/// @todo Do we need the prefix "acct:" or "acct://"?
|
/// @todo Do we need the prefix "acct:" or "acct://"?
|
||||||
|
|
12436
view/lang/es/messages.po
12436
view/lang/es/messages.po
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user