From 585c893456e9f42900da5029658cb6db3feb1272 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 4 Jul 2016 22:34:35 +0200 Subject: [PATCH] You can now prove with an uid (important for mails) --- include/Probe.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/include/Probe.php b/include/Probe.php index 7619a127fb..23a89428b2 100644 --- a/include/Probe.php +++ b/include/Probe.php @@ -83,7 +83,7 @@ class Probe { return $xrd_data; } - public static function uri($uri, $network = "", $cache = true) { + public static function uri($uri, $network = "", $uid = 0, $cache = true) { if ($cache) { $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"])) $data["url"] = $uri; @@ -115,7 +118,7 @@ class Probe { $data = self::rearrange_data($data); // 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); /// @todo temporary fix - we need a real contact update function that updates only changing fields @@ -140,16 +143,16 @@ class Probe { return $data; } - private function detect($uri, $network) { + private function detect($uri, $network, $uid) { if (strstr($uri, '@')) { // If the URI starts with "mailto:" then jum directly to the mail detection if (strpos($url,'mailto:') !== false) { $uri = str_replace('mailto:', '', $url); - return self::mail($uri); + return self::mail($uri, $uid); } if ($network == NETWORK_MAIL) - return self::mail($uri); + return self::mail($uri, $uid); // Remove "acct:" from the URI $uri = str_replace('acct:', '', $uri); @@ -159,7 +162,7 @@ class Probe { $lrdd = self::xrd($host); if (!$lrdd) - return self::mail($uri); + return self::mail($uri, $uid); $addr = $uri; } else { @@ -735,14 +738,11 @@ class Probe { return $data; } - private function mail($uri) { + private function mail($uri, $uid) { if (!validate_email($uri)) return false; - $uid = local_user(); - $uid = 1; - $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)); -- 2.39.5