You can now prove with an uid (important for mails)
This commit is contained in:
parent
4e5d335492
commit
585c893456
1 changed files with 11 additions and 11 deletions
|
@ -83,7 +83,7 @@ class Probe {
|
||||||
return $xrd_data;
|
return $xrd_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function uri($uri, $network = "", $cache = true) {
|
public static function uri($uri, $network = "", $uid = 0, $cache = true) {
|
||||||
|
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$result = Cache::get("probe_url:".$network.":".$uri);
|
$result = Cache::get("probe_url:".$network.":".$uri);
|
||||||
|
@ -93,7 +93,10 @@ class Probe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = self::detect($uri, $network);
|
if ($uid == 0)
|
||||||
|
$uid = local_user();
|
||||||
|
|
||||||
|
$data = self::detect($uri, $network, $uid);
|
||||||
|
|
||||||
if (!isset($data["url"]))
|
if (!isset($data["url"]))
|
||||||
$data["url"] = $uri;
|
$data["url"] = $uri;
|
||||||
|
@ -115,7 +118,7 @@ class Probe {
|
||||||
$data = self::rearrange_data($data);
|
$data = self::rearrange_data($data);
|
||||||
|
|
||||||
// Only store into the cache if the value seems to be valid
|
// Only store into the cache if the value seems to be valid
|
||||||
if ($data['network'] != NETWORK_PHANTOM) {
|
if (!in_array($data['network'], array(NETWORK_PHANTOM, NETWORK_MAIL))) {
|
||||||
Cache::set("probe_url:".$network.":".$uri,serialize($data), CACHE_DAY);
|
Cache::set("probe_url:".$network.":".$uri,serialize($data), CACHE_DAY);
|
||||||
|
|
||||||
/// @todo temporary fix - we need a real contact update function that updates only changing fields
|
/// @todo temporary fix - we need a real contact update function that updates only changing fields
|
||||||
|
@ -140,16 +143,16 @@ class Probe {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function detect($uri, $network) {
|
private function detect($uri, $network, $uid) {
|
||||||
if (strstr($uri, '@')) {
|
if (strstr($uri, '@')) {
|
||||||
// If the URI starts with "mailto:" then jum directly to the mail detection
|
// If the URI starts with "mailto:" then jum 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);
|
||||||
return self::mail($uri);
|
return self::mail($uri, $uid);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($network == NETWORK_MAIL)
|
if ($network == NETWORK_MAIL)
|
||||||
return self::mail($uri);
|
return self::mail($uri, $uid);
|
||||||
|
|
||||||
// Remove "acct:" from the URI
|
// Remove "acct:" from the URI
|
||||||
$uri = str_replace('acct:', '', $uri);
|
$uri = str_replace('acct:', '', $uri);
|
||||||
|
@ -159,7 +162,7 @@ class Probe {
|
||||||
|
|
||||||
$lrdd = self::xrd($host);
|
$lrdd = self::xrd($host);
|
||||||
if (!$lrdd)
|
if (!$lrdd)
|
||||||
return self::mail($uri);
|
return self::mail($uri, $uid);
|
||||||
|
|
||||||
$addr = $uri;
|
$addr = $uri;
|
||||||
} else {
|
} else {
|
||||||
|
@ -735,14 +738,11 @@ class Probe {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function mail($uri) {
|
private function mail($uri, $uid) {
|
||||||
|
|
||||||
if (!validate_email($uri))
|
if (!validate_email($uri))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$uid = local_user();
|
|
||||||
$uid = 1;
|
|
||||||
|
|
||||||
$x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
|
$x = q("SELECT `prvkey` FROM `user` WHERE `uid` = %d LIMIT 1", intval($uid));
|
||||||
|
|
||||||
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
|
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d AND `server` != '' LIMIT 1", intval($uid));
|
||||||
|
|
Loading…
Reference in a new issue