dfrn relocate: addr field added, gcontact update added
This commit is contained in:
parent
5ec7626b12
commit
3c9a80a31c
1 changed files with 34 additions and 2 deletions
|
@ -368,6 +368,7 @@ class dfrn {
|
||||||
|
|
||||||
xml::add_element($doc, $relocate, "dfrn:url", $owner['url']);
|
xml::add_element($doc, $relocate, "dfrn:url", $owner['url']);
|
||||||
xml::add_element($doc, $relocate, "dfrn:name", $owner['name']);
|
xml::add_element($doc, $relocate, "dfrn:name", $owner['name']);
|
||||||
|
xml::add_element($doc, $relocate, "dfrn:addr", $owner['addr']);
|
||||||
xml::add_element($doc, $relocate, "dfrn:photo", $photos[4]);
|
xml::add_element($doc, $relocate, "dfrn:photo", $photos[4]);
|
||||||
xml::add_element($doc, $relocate, "dfrn:thumb", $photos[5]);
|
xml::add_element($doc, $relocate, "dfrn:thumb", $photos[5]);
|
||||||
xml::add_element($doc, $relocate, "dfrn:micro", $photos[6]);
|
xml::add_element($doc, $relocate, "dfrn:micro", $photos[6]);
|
||||||
|
@ -1545,6 +1546,7 @@ class dfrn {
|
||||||
$relocate["uid"] = $importer["importer_uid"];
|
$relocate["uid"] = $importer["importer_uid"];
|
||||||
$relocate["cid"] = $importer["id"];
|
$relocate["cid"] = $importer["id"];
|
||||||
$relocate["url"] = $xpath->query("dfrn:url/text()", $relocation)->item(0)->nodeValue;
|
$relocate["url"] = $xpath->query("dfrn:url/text()", $relocation)->item(0)->nodeValue;
|
||||||
|
$relocate["addr"] = $xpath->query("dfrn:addr/text()", $relocation)->item(0)->nodeValue;
|
||||||
$relocate["name"] = $xpath->query("dfrn:name/text()", $relocation)->item(0)->nodeValue;
|
$relocate["name"] = $xpath->query("dfrn:name/text()", $relocation)->item(0)->nodeValue;
|
||||||
$relocate["photo"] = $xpath->query("dfrn:photo/text()", $relocation)->item(0)->nodeValue;
|
$relocate["photo"] = $xpath->query("dfrn:photo/text()", $relocation)->item(0)->nodeValue;
|
||||||
$relocate["thumb"] = $xpath->query("dfrn:thumb/text()", $relocation)->item(0)->nodeValue;
|
$relocate["thumb"] = $xpath->query("dfrn:thumb/text()", $relocation)->item(0)->nodeValue;
|
||||||
|
@ -1555,6 +1557,9 @@ class dfrn {
|
||||||
$relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
|
$relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
|
||||||
$relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
|
$relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
if ($relocate["addr"] == "")
|
||||||
|
$relocate["addr"] = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$3@$2", $relocate["url"]);
|
||||||
|
|
||||||
// update contact
|
// update contact
|
||||||
$r = q("SELECT `photo`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d;",
|
$r = q("SELECT `photo`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d;",
|
||||||
intval($importer["id"]),
|
intval($importer["id"]),
|
||||||
|
@ -1564,6 +1569,30 @@ class dfrn {
|
||||||
|
|
||||||
$old = $r[0];
|
$old = $r[0];
|
||||||
|
|
||||||
|
// Update the gcontact entry
|
||||||
|
$relocate["server_url"] = preg_replace("=(https?://)(.*)/profile/(.*)=ism", "$1$2", $relocate["url"]);
|
||||||
|
|
||||||
|
$x = q("UPDATE `gcontact` SET
|
||||||
|
`name` = '%s',
|
||||||
|
`photo` = '%s',
|
||||||
|
`url` = '%s',
|
||||||
|
`nurl` = '%s',
|
||||||
|
`addr` = '%s',
|
||||||
|
`connect` = '%s',
|
||||||
|
`notify` = '%s',
|
||||||
|
`server_url` = '%s'
|
||||||
|
WHERE `nurl` = '%s';",
|
||||||
|
dbesc($relocate["name"]),
|
||||||
|
dbesc($relocate["photo"]),
|
||||||
|
dbesc($relocate["url"]),
|
||||||
|
dbesc(normalise_link($relocate["url"])),
|
||||||
|
dbesc($relocate["addr"]),
|
||||||
|
dbesc($relocate["addr"]),
|
||||||
|
dbesc($relocate["notify"]),
|
||||||
|
dbesc($relocate["server_url"]),
|
||||||
|
dbesc(normalise_link($old["url"])));
|
||||||
|
|
||||||
|
// Update the contact table. We try to find every entry.
|
||||||
$x = q("UPDATE `contact` SET
|
$x = q("UPDATE `contact` SET
|
||||||
`name` = '%s',
|
`name` = '%s',
|
||||||
`photo` = '%s',
|
`photo` = '%s',
|
||||||
|
@ -1571,25 +1600,28 @@ class dfrn {
|
||||||
`micro` = '%s',
|
`micro` = '%s',
|
||||||
`url` = '%s',
|
`url` = '%s',
|
||||||
`nurl` = '%s',
|
`nurl` = '%s',
|
||||||
|
`addr` = '%s',
|
||||||
`request` = '%s',
|
`request` = '%s',
|
||||||
`confirm` = '%s',
|
`confirm` = '%s',
|
||||||
`notify` = '%s',
|
`notify` = '%s',
|
||||||
`poll` = '%s',
|
`poll` = '%s',
|
||||||
`site-pubkey` = '%s'
|
`site-pubkey` = '%s'
|
||||||
WHERE `id` = %d AND `uid` = %d;",
|
WHERE (`id` = %d AND `uid` = %d) OR (`nurl` = '%s');",
|
||||||
dbesc($relocate["name"]),
|
dbesc($relocate["name"]),
|
||||||
dbesc($relocate["photo"]),
|
dbesc($relocate["photo"]),
|
||||||
dbesc($relocate["thumb"]),
|
dbesc($relocate["thumb"]),
|
||||||
dbesc($relocate["micro"]),
|
dbesc($relocate["micro"]),
|
||||||
dbesc($relocate["url"]),
|
dbesc($relocate["url"]),
|
||||||
dbesc(normalise_link($relocate["url"])),
|
dbesc(normalise_link($relocate["url"])),
|
||||||
|
dbesc($relocate["addr"]),
|
||||||
dbesc($relocate["request"]),
|
dbesc($relocate["request"]),
|
||||||
dbesc($relocate["confirm"]),
|
dbesc($relocate["confirm"]),
|
||||||
dbesc($relocate["notify"]),
|
dbesc($relocate["notify"]),
|
||||||
dbesc($relocate["poll"]),
|
dbesc($relocate["poll"]),
|
||||||
dbesc($relocate["sitepubkey"]),
|
dbesc($relocate["sitepubkey"]),
|
||||||
intval($importer["id"]),
|
intval($importer["id"]),
|
||||||
intval($importer["importer_uid"]));
|
intval($importer["importer_uid"]),
|
||||||
|
dbesc(normalise_link($old["url"])));
|
||||||
|
|
||||||
if ($x === false)
|
if ($x === false)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue