1
0
Fork 0

Merge pull request #2746 from annando/1608-diaspora-handle-lowercase

The handle for Diaspora contacts must always be low…
This commit is contained in:
Tobias Diekershoff 2016-08-23 07:52:35 +02:00 committed by GitHub
commit dc6cce4080
2 changed files with 7 additions and 4 deletions

View file

@ -788,6 +788,9 @@ class Probe {
isset($data["pubkey"]) AND ($hcard != "")) { isset($data["pubkey"]) AND ($hcard != "")) {
$data["network"] = NETWORK_DIASPORA; $data["network"] = NETWORK_DIASPORA;
// The Diaspora handle must always be lowercase
$data["addr"] = strtolower($data["addr"]);
// We have to overwrite the detected value for "notify" since Hubzilla doesn't send it // We have to overwrite the detected value for "notify" since Hubzilla doesn't send it
$data["notify"] = $data["baseurl"]."/receive/users/".$data["guid"]; $data["notify"] = $data["baseurl"]."/receive/users/".$data["guid"];
$data["batch"] = $data["baseurl"]."/receive/public"; $data["batch"] = $data["baseurl"]."/receive/public";

View file

@ -623,7 +623,7 @@ class diaspora {
dbesc($arr["photo"]), dbesc($arr["photo"]),
dbesc($arr["request"]), dbesc($arr["request"]),
dbesc($arr["nick"]), dbesc($arr["nick"]),
dbesc($arr["addr"]), dbesc(strtolower($arr["addr"])),
dbesc($arr["guid"]), dbesc($arr["guid"]),
dbesc($arr["batch"]), dbesc($arr["batch"]),
dbesc($arr["notify"]), dbesc($arr["notify"]),
@ -677,7 +677,7 @@ class diaspora {
$r = q("SELECT `addr` FROM `gcontact` WHERE `id` = %d AND `addr` != ''", $r = q("SELECT `addr` FROM `gcontact` WHERE `id` = %d AND `addr` != ''",
intval($gcontact_id)); intval($gcontact_id));
if ($r) if ($r)
return $r[0]["addr"]; return strtolower($r[0]["addr"]);
} }
$r = q("SELECT `network`, `addr`, `self`, `url`, `nick` FROM `contact` WHERE `id` = %d", $r = q("SELECT `network`, `addr`, `self`, `url`, `nick` FROM `contact` WHERE `id` = %d",
@ -697,7 +697,7 @@ class diaspora {
} }
} }
return $handle; return strtolower($handle);
} }
/** /**
@ -1652,7 +1652,7 @@ class diaspora {
* @return bool Success * @return bool Success
*/ */
private function receive_profile($importer, $data) { private function receive_profile($importer, $data) {
$author = notags(unxmlify($data->author)); $author = strtolower(notags(unxmlify($data->author)));
$contact = self::contact_by_handle($importer["uid"], $author); $contact = self::contact_by_handle($importer["uid"], $author);
if (!$contact) if (!$contact)