Merge pull request #2866 from annando/1610-probe-hidden-profile
Bugfix: probing failed when a profile was hidden
This commit is contained in:
commit
2d0c56fd37
|
@ -661,8 +661,12 @@ class Probe {
|
||||||
*/
|
*/
|
||||||
private function poll_hcard($hcard, $data, $dfrn = false) {
|
private function poll_hcard($hcard, $data, $dfrn = false) {
|
||||||
|
|
||||||
|
$content = fetch_url($hcard);
|
||||||
|
if (!$content)
|
||||||
|
return false;
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
if (!@$doc->loadHTMLFile($hcard))
|
if (!@$doc->loadHTML($content))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$xpath = new DomXPath($doc);
|
$xpath = new DomXPath($doc);
|
||||||
|
@ -671,40 +675,39 @@ class Probe {
|
||||||
if (!is_object($vcards))
|
if (!is_object($vcards))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if ($vcards->length == 0)
|
if ($vcards->length > 0) {
|
||||||
return false;
|
$vcard = $vcards->item(0);
|
||||||
|
|
||||||
$vcard = $vcards->item(0);
|
// We have to discard the guid from the hcard in favour of the guid from lrdd
|
||||||
|
// Reason: Hubzilla doesn't use the value "uid" in the hcard like Diaspora does.
|
||||||
|
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' uid ')]", $vcard); // */
|
||||||
|
if (($search->length > 0) AND ($data["guid"] == ""))
|
||||||
|
$data["guid"] = $search->item(0)->nodeValue;
|
||||||
|
|
||||||
// We have to discard the guid from the hcard in favour of the guid from lrdd
|
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' nickname ')]", $vcard); // */
|
||||||
// Reason: Hubzilla doesn't use the value "uid" in the hcard like Diaspora does.
|
if ($search->length > 0)
|
||||||
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' uid ')]", $vcard); // */
|
$data["nick"] = $search->item(0)->nodeValue;
|
||||||
if (($search->length > 0) AND ($data["guid"] == ""))
|
|
||||||
$data["guid"] = $search->item(0)->nodeValue;
|
|
||||||
|
|
||||||
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' nickname ')]", $vcard); // */
|
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' fn ')]", $vcard); // */
|
||||||
if ($search->length > 0)
|
if ($search->length > 0)
|
||||||
$data["nick"] = $search->item(0)->nodeValue;
|
$data["name"] = $search->item(0)->nodeValue;
|
||||||
|
|
||||||
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' fn ')]", $vcard); // */
|
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' searchable ')]", $vcard); // */
|
||||||
if ($search->length > 0)
|
if ($search->length > 0)
|
||||||
$data["name"] = $search->item(0)->nodeValue;
|
$data["searchable"] = $search->item(0)->nodeValue;
|
||||||
|
|
||||||
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' searchable ')]", $vcard); // */
|
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' key ')]", $vcard); // */
|
||||||
if ($search->length > 0)
|
if ($search->length > 0) {
|
||||||
$data["searchable"] = $search->item(0)->nodeValue;
|
$data["pubkey"] = $search->item(0)->nodeValue;
|
||||||
|
if (strstr($data["pubkey"], 'RSA '))
|
||||||
|
$data["pubkey"] = rsatopem($data["pubkey"]);
|
||||||
|
}
|
||||||
|
|
||||||
$search = $xpath->query("//*[contains(concat(' ', @class, ' '), ' key ')]", $vcard); // */
|
$search = $xpath->query("//*[@id='pod_location']", $vcard); // */
|
||||||
if ($search->length > 0) {
|
if ($search->length > 0)
|
||||||
$data["pubkey"] = $search->item(0)->nodeValue;
|
$data["baseurl"] = trim($search->item(0)->nodeValue, "/");
|
||||||
if (strstr($data["pubkey"], 'RSA '))
|
|
||||||
$data["pubkey"] = rsatopem($data["pubkey"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$search = $xpath->query("//*[@id='pod_location']", $vcard); // */
|
|
||||||
if ($search->length > 0)
|
|
||||||
$data["baseurl"] = trim($search->item(0)->nodeValue, "/");
|
|
||||||
|
|
||||||
$avatar = array();
|
$avatar = array();
|
||||||
$photos = $xpath->query("//*[contains(concat(' ', @class, ' '), ' photo ') or contains(concat(' ', @class, ' '), ' avatar ')]", $vcard); // */
|
$photos = $xpath->query("//*[contains(concat(' ', @class, ' '), ' photo ') or contains(concat(' ', @class, ' '), ' avatar ')]", $vcard); // */
|
||||||
foreach ($photos AS $photo) {
|
foreach ($photos AS $photo) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user