// Fetch contact data from the contact table for the given user
$r = q("SELECT `id`, `id` AS `cid`, 0 AS `gid`, 0 AS `zid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
- `keywords`, `gender`, `photo`, `thumb`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, `self`
+ `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, `self`
FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d",
dbesc(normalise_link($url)), intval($uid));
// Fetch the data from the contact table with "uid=0" (which is filled automatically)
if (!$r)
$r = q("SELECT `id`, 0 AS `cid`, `id` AS `zid`, 0 AS `gid`, `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
- `keywords`, `gender`, `photo`, `thumb`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, 0 AS `self`
+ `keywords`, `gender`, `photo`, `thumb`, `micro`, `forum`, `prv`, (`forum` | `prv`) AS `community`, `bd` AS `birthday`, 0 AS `self`
FROM `contact` WHERE `nurl` = '%s' AND `uid` = 0",
dbesc(normalise_link($url)));
// Fetch the data from the gcontact table
if (!$r)
$r = q("SELECT 0 AS `id`, 0 AS `cid`, `id` AS `gid`, 0 AS `zid`, 0 AS `uid`, `url`, `nurl`, `alias`, `network`, `name`, `nick`, `addr`, `location`, `about`,
- `keywords`, `gender`, `photo`, `photo` AS `thumb`, `community` AS `forum`, 0 AS `prv`, `community`, `birthday`, 0 AS `self`
+ `keywords`, `gender`, `photo`, `photo` AS `thumb`, `photo` AS `micro`, `community` AS `forum`, 0 AS `prv`, `community`, `birthday`, 0 AS `self`
FROM `gcontact` WHERE `nurl` = '%s'",
dbesc(normalise_link($url)));
if (($profile["network"] == "") AND isset($default["network"]))
$profile["network"] = $default["network"];
- if (!isset($profile["thumb"]) AND isset($profile["photo"]))
+ if (($profile["thumb"] == "") AND isset($profile["photo"]))
$profile["thumb"] = $profile["photo"];
+ if (($profile["micro"] == "") AND isset($profile["thumb"]))
+ $profile["micro"] = $profile["thumb"];
+
if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND ($profile["gid"] != 0) AND
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
proc_run('php',"include/update_gcontact.php", $profile["gid"]);
if (isset($data["name"]))
$author = $data["name"];
- if (isset($data["thumb"]))
- $avatar = $data["thumb"];
+ if (isset($data["micro"]))
+ $avatar = $data["micro"];
$preshare = trim($share[1]);
if(intval($def_gid))
group_add_member($importer["uid"], "", $contact_record["id"], $def_gid);
+ update_contact_avatar($ret["photo"], $importer['uid'], $contact_record["id"], true);
+
if($importer["page-flags"] == PAGE_NORMAL) {
$hash = random_string().(string)time(); // Generate a confirm_key
dbesc($url)
);
if(count($r)) {
- $contact_record = $r[0];
-
- $photos = import_profile_photo($photo,$importer["uid"],$contact_record["id"]);
-
- q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
- dbesc($photos[0]),
- dbesc($photos[1]),
- dbesc($photos[2]),
- intval($contact_record["id"])
- );
+ $contact_record = $r[0];
+ update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
}
// We have not only to look at the parent, since it could be a Friendica thread.
if (($thr_parent AND ($thr_parent[0]['network'] == NETWORK_OSTATUS)) OR ($parent['network'] == NETWORK_OSTATUS)) {
- logger('Some parent is OStatus for '.$target_item["guid"], LOGGER_DEBUG);
+ logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent[0]['author-link']." - Owner: ".$thr_parent[0]['owner-link'], LOGGER_DEBUG);
// Send a salmon to the parent author
- $probed_contact = probe_url($thr_parent[0]['author-link']);
+ $r = q("SELECT `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
+ dbesc(normalise_link($thr_parent[0]['author-link'])),
+ intval($uid));
+ if ($r)
+ $probed_contact = $r[0];
+ else
+ $probed_contact = probe_url($thr_parent[0]['author-link']);
+
if ($probed_contact["notify"] != "") {
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
// Send a salmon to the parent owner
- $probed_contact = probe_url($thr_parent[0]['owner-link']);
+ $r = q("SELECT `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
+ dbesc(normalise_link($thr_parent[0]['owner-link'])),
+ intval($uid));
+ if ($r)
+ $probed_contact = $r[0];
+ else
+ $probed_contact = probe_url($thr_parent[0]['owner-link']);
if ($probed_contact["notify"] != "") {
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
$dfrn_request = $parms['dfrn-request'];
+ $photo = $parms["photo"];
+
/********* Escape the entire array ********/
dbesc_array($parms);
if(intval($def_gid))
group_add_member(local_user(), '', $r[0]['id'], $def_gid);
+ if (isset($photo))
+ update_contact_avatar($photo, local_user(), $r[0]["id"], true);
+
$forwardurl = $a->get_baseurl()."/contacts/".$r[0]['id'];
} else
$forwardurl = $a->get_baseurl()."/contacts";
$parms['url'] = $url;
$parms['issued-id'] = $issued_id;
-
+ $photo = $parms["photo"];
dbesc_array($parms);
$r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `nurl`, `addr`, `name`, `nick`, `issued-id`, `photo`, `site-pubkey`,
intval($uid),
dbesc(datetime_convert()),
$parms['url'],
- dbesc(normalise_link($parms['url'])),
+ dbesc(normalise_link($url)),
$parms['addr'],
$parms['fn'],
$parms['nick'],
$parms['url'],
$parms['issued-id']
);
- if(count($r))
+ if(count($r)) {
$contact_record = $r[0];
+ update_contact_avatar($photo, $uid, $contact_record["id"], true);
+ }
}
}
$a->set_pager_itemspage(20);
}
+ /// @todo Fetch contact details by "get_contact_details_by_url" instead of queries to contact, fcontact and gcontact
+
$r = q("SELECT `intro`.`id` AS `intro_id`, `intro`.*, `contact`.*, `fcontact`.`name` AS `fname`,`fcontact`.`url` AS `furl`,`fcontact`.`photo` AS `fphoto`,`fcontact`.`request` AS `frequest`,
`gcontact`.`location` AS `glocation`, `gcontact`.`about` AS `gabout`,
`gcontact`.`keywords` AS `gkeywords`, `gcontact`.`gender` AS `ggender`,
function xmlize($n){
$contact = get_contact_details_by_url($n['url']);
- if (isset($contact["thumb"]))
- $n['photo'] = proxy_url($contact["thumb"], false, PROXY_SIZE_MICRO);
+ if (isset($contact["micro"]))
+ $n['photo'] = proxy_url($contact["micro"], false, PROXY_SIZE_MICRO);
else
$n['photo'] = proxy_url($n['photo'], false, PROXY_SIZE_MICRO);