Massively updated avatar handling
This commit is contained in:
parent
8762fb671f
commit
e512a83ecc
13 changed files with 169 additions and 108 deletions
|
|
@ -451,8 +451,18 @@ function get_contact($url, $uid = 0) {
|
|||
$data = probe_url($url);
|
||||
|
||||
// Does this address belongs to a valid network?
|
||||
if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA)))
|
||||
return 0;
|
||||
if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
|
||||
if ($uid != 0)
|
||||
return 0;
|
||||
|
||||
// Get data from the gcontact table
|
||||
$r = q("SELECT `name`, `nick`, `url`, `photo`, `addr`, `alias`, `network` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
dbesc(normalise_link($url)));
|
||||
if (!$r)
|
||||
return 0;
|
||||
|
||||
$data = $r[0];
|
||||
}
|
||||
|
||||
$url = $data["url"];
|
||||
|
||||
|
|
@ -490,6 +500,16 @@ function get_contact($url, $uid = 0) {
|
|||
return 0;
|
||||
|
||||
$contactid = $contact[0]["id"];
|
||||
|
||||
// Update the newly created contact from data in the gcontact table
|
||||
$r = q("SELECT `location`, `about`, `keywords`, `gender` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||
dbesc(normalise_link($data["url"])));
|
||||
if ($r) {
|
||||
logger("Update contact ".$data["url"]);
|
||||
q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d",
|
||||
dbesc($r["location"]), dbesc($r["about"]), dbesc($r["keywords"]),
|
||||
dbesc($r["gender"]), intval($contactid));
|
||||
}
|
||||
}
|
||||
|
||||
if ((count($contact) > 1) AND ($uid == 0) AND ($contactid != 0) AND ($url != ""))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue