improve readability
This commit is contained in:
parent
450a4920fd
commit
51372bc314
|
@ -109,11 +109,13 @@ class Probe {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($attributes["rel"] == "lrdd") AND
|
if (($attributes["rel"] == "lrdd")
|
||||||
($attributes["type"] == "application/xrd+xml")) {
|
AND ($attributes["type"] == "application/xrd+xml")
|
||||||
|
) {
|
||||||
$xrd_data["lrdd-xml"] = $attributes["template"];
|
$xrd_data["lrdd-xml"] = $attributes["template"];
|
||||||
} elseif (($attributes["rel"] == "lrdd") AND
|
} elseif (($attributes["rel"] == "lrdd")
|
||||||
($attributes["type"] == "application/json")) {
|
AND ($attributes["type"] == "application/json")
|
||||||
|
) {
|
||||||
$xrd_data["lrdd-json"] = $attributes["template"];
|
$xrd_data["lrdd-json"] = $attributes["template"];
|
||||||
} elseif ($attributes["rel"] == "lrdd") {
|
} elseif ($attributes["rel"] == "lrdd") {
|
||||||
$xrd_data["lrdd"] = $attributes["template"];
|
$xrd_data["lrdd"] = $attributes["template"];
|
||||||
|
@ -330,8 +332,14 @@ class Probe {
|
||||||
/// @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
|
||||||
/// The biggest problem is the avatar picture that could have a reduced image size.
|
/// The biggest problem is the avatar picture that could have a reduced image size.
|
||||||
/// It should only be updated if the existing picture isn't existing anymore.
|
/// It should only be updated if the existing picture isn't existing anymore.
|
||||||
if (($data['network'] != NETWORK_FEED) AND ($mode == PROBE_NORMAL) AND
|
if (($data['network'] != NETWORK_FEED)
|
||||||
$data["name"] AND $data["nick"] AND $data["url"] AND $data["addr"] AND $data["poll"]) {
|
AND ($mode == PROBE_NORMAL)
|
||||||
|
AND $data["name"]
|
||||||
|
AND $data["nick"]
|
||||||
|
AND $data["url"]
|
||||||
|
AND $data["addr"]
|
||||||
|
AND $data["poll"]
|
||||||
|
) {
|
||||||
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `addr` = '%s',
|
q("UPDATE `contact` SET `name` = '%s', `nick` = '%s', `url` = '%s', `addr` = '%s',
|
||||||
`notify` = '%s', `poll` = '%s', `alias` = '%s', `success_update` = '%s'
|
`notify` = '%s', `poll` = '%s', `alias` = '%s', `success_update` = '%s'
|
||||||
WHERE `nurl` = '%s' AND NOT `self` AND `uid` = 0",
|
WHERE `nurl` = '%s' AND NOT `self` AND `uid` = 0",
|
||||||
|
@ -694,10 +702,14 @@ class Probe {
|
||||||
$noscrape = str_replace(array("/hcard/", "/profile/"), "/noscrape/", $profile);
|
$noscrape = str_replace(array("/hcard/", "/profile/"), "/noscrape/", $profile);
|
||||||
$data = self::pollNoscrape($noscrape, $data);
|
$data = self::pollNoscrape($noscrape, $data);
|
||||||
|
|
||||||
if (!isset($data["notify"]) OR !isset($data["confirm"]) OR
|
if (!isset($data["notify"])
|
||||||
!isset($data["request"]) OR !isset($data["poll"]) OR
|
OR !isset($data["confirm"])
|
||||||
!isset($data["poco"]) OR !isset($data["name"]) OR
|
OR !isset($data["request"])
|
||||||
!isset($data["photo"])) {
|
OR !isset($data["poll"])
|
||||||
|
OR !isset($data["poco"])
|
||||||
|
OR !isset($data["name"])
|
||||||
|
OR !isset($data["photo"])
|
||||||
|
) {
|
||||||
$data = self::pollHcard($profile, $data, true);
|
$data = self::pollHcard($profile, $data, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,8 +776,13 @@ class Probe {
|
||||||
$noscrape = str_replace("/hcard/", "/noscrape/", $hcard);
|
$noscrape = str_replace("/hcard/", "/noscrape/", $hcard);
|
||||||
$data = self::pollNoscrape($noscrape, $data);
|
$data = self::pollNoscrape($noscrape, $data);
|
||||||
|
|
||||||
if (isset($data["notify"]) AND isset($data["confirm"]) AND isset($data["request"]) AND
|
if (isset($data["notify"])
|
||||||
isset($data["poll"]) AND isset($data["name"]) AND isset($data["photo"])) {
|
AND isset($data["confirm"])
|
||||||
|
AND isset($data["request"])
|
||||||
|
AND isset($data["poll"])
|
||||||
|
AND isset($data["name"])
|
||||||
|
AND isset($data["photo"])
|
||||||
|
) {
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,8 +965,12 @@ class Probe {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data["url"]) AND isset($data["guid"]) AND isset($data["baseurl"]) AND
|
if (isset($data["url"])
|
||||||
isset($data["pubkey"]) AND ($hcard != "")) {
|
AND isset($data["guid"])
|
||||||
|
AND isset($data["baseurl"])
|
||||||
|
AND isset($data["pubkey"])
|
||||||
|
AND ($hcard != "")
|
||||||
|
) {
|
||||||
$data["network"] = NETWORK_DIASPORA;
|
$data["network"] = NETWORK_DIASPORA;
|
||||||
|
|
||||||
// The Diaspora handle must always be lowercase
|
// The Diaspora handle must always be lowercase
|
||||||
|
@ -987,8 +1008,10 @@ class Probe {
|
||||||
}
|
}
|
||||||
$pubkey = "";
|
$pubkey = "";
|
||||||
foreach ($webfinger["links"] as $link) {
|
foreach ($webfinger["links"] as $link) {
|
||||||
if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
|
if (($link["rel"] == "http://webfinger.net/rel/profile-page")
|
||||||
($link["type"] == "text/html") AND ($link["href"] != "")) {
|
AND ($link["type"] == "text/html")
|
||||||
|
AND ($link["href"] != "")
|
||||||
|
) {
|
||||||
$data["url"] = $link["href"];
|
$data["url"] = $link["href"];
|
||||||
} elseif (($link["rel"] == "salmon") AND ($link["href"] != "")) {
|
} elseif (($link["rel"] == "salmon") AND ($link["href"] != "")) {
|
||||||
$data["notify"] = $link["href"];
|
$data["notify"] = $link["href"];
|
||||||
|
@ -1021,8 +1044,10 @@ class Probe {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data["notify"]) AND isset($data["pubkey"]) AND
|
if (isset($data["notify"]) AND isset($data["pubkey"])
|
||||||
isset($data["poll"]) AND isset($data["url"])) {
|
AND isset($data["poll"])
|
||||||
|
AND isset($data["url"])
|
||||||
|
) {
|
||||||
$data["network"] = NETWORK_OSTATUS;
|
$data["network"] = NETWORK_OSTATUS;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1115,8 +1140,10 @@ class Probe {
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
foreach ($webfinger["links"] as $link) {
|
foreach ($webfinger["links"] as $link) {
|
||||||
if (($link["rel"] == "http://webfinger.net/rel/profile-page") AND
|
if (($link["rel"] == "http://webfinger.net/rel/profile-page")
|
||||||
($link["type"] == "text/html") AND ($link["href"] != "")) {
|
AND ($link["type"] == "text/html")
|
||||||
|
AND ($link["href"] != "")
|
||||||
|
) {
|
||||||
$data["url"] = $link["href"];
|
$data["url"] = $link["href"];
|
||||||
} elseif (($link["rel"] == "activity-inbox") AND ($link["href"] != "")) {
|
} elseif (($link["rel"] == "activity-inbox") AND ($link["href"] != "")) {
|
||||||
$data["notify"] = $link["href"];
|
$data["notify"] = $link["href"];
|
||||||
|
@ -1126,8 +1153,10 @@ class Probe {
|
||||||
$data["dialback"] = $link["href"];
|
$data["dialback"] = $link["href"];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($data["poll"]) AND isset($data["notify"]) AND
|
if (isset($data["poll"]) AND isset($data["notify"])
|
||||||
isset($data["dialback"]) AND isset($data["url"])) {
|
AND isset($data["dialback"])
|
||||||
|
AND isset($data["url"])
|
||||||
|
) {
|
||||||
// by now we use these fields only for the network type detection
|
// by now we use these fields only for the network type detection
|
||||||
// So we unset all data that isn't used at the moment
|
// So we unset all data that isn't used at the moment
|
||||||
unset($data["dialback"]);
|
unset($data["dialback"]);
|
||||||
|
@ -1308,8 +1337,8 @@ class Probe {
|
||||||
foreach ($adr as $feadr) {
|
foreach ($adr as $feadr) {
|
||||||
if ((strcasecmp($feadr->mailbox, $data["name"]) == 0)
|
if ((strcasecmp($feadr->mailbox, $data["name"]) == 0)
|
||||||
&&(strcasecmp($feadr->host, $phost) == 0)
|
&&(strcasecmp($feadr->host, $phost) == 0)
|
||||||
&& (strlen($feadr->personal))) {
|
&& (strlen($feadr->personal))
|
||||||
|
) {
|
||||||
$personal = imap_mime_header_decode($feadr->personal);
|
$personal = imap_mime_header_decode($feadr->personal);
|
||||||
$data["name"] = "";
|
$data["name"] = "";
|
||||||
foreach ($personal as $perspart) {
|
foreach ($personal as $perspart) {
|
||||||
|
|
Loading…
Reference in a new issue