The global contact for server users is now stored directly
This commit is contained in:
parent
90155da59a
commit
3df235e5bd
4 changed files with 22 additions and 8 deletions
|
@ -492,12 +492,12 @@ class dfrn {
|
||||||
|
|
||||||
// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
|
// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
|
||||||
$r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
$r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||||
WHERE `hidewall` OR NOT `net-publish` AND `user`.`uid` = %d",
|
WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
|
||||||
intval($owner['uid']));
|
intval($owner['uid']));
|
||||||
if ($r)
|
if ($r)
|
||||||
xml::add_element($doc, $author, "dfrn:hide", "true");
|
xml::add_element($doc, $author, "dfrn:hide", "true");
|
||||||
|
|
||||||
// The following fields will only be generated if this isn't for a public feed
|
// The following fields will only be generated if the data isn't meant for a public feed
|
||||||
if ($public)
|
if ($public)
|
||||||
return $author;
|
return $author;
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,11 @@ function noscrape_init(&$a) {
|
||||||
|
|
||||||
profile_load($a,$which,$profile);
|
profile_load($a,$which,$profile);
|
||||||
|
|
||||||
if(!$a->profile['net-publish']) {
|
if (!$a->profile['net-publish'] OR $a->profile['hidewall']) {
|
||||||
header('Content-type: application/json; charset=utf-8');
|
header('Content-type: application/json; charset=utf-8');
|
||||||
$json_info = array("hide" => true);
|
$json_info = array("hide" => true);
|
||||||
echo json_encode($json_info);
|
echo json_encode($json_info);
|
||||||
killme();
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
|
$keywords = ((x($a->profile,'pub_keywords')) ? $a->profile['pub_keywords'] : '');
|
||||||
|
|
|
@ -484,7 +484,7 @@ function profiles_post(&$a) {
|
||||||
if($is_default) {
|
if($is_default) {
|
||||||
$location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
|
$location = formatted_location(array("locality" => $locality, "region" => $region, "country-name" => $country_name));
|
||||||
|
|
||||||
$r = q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` = 1 AND `uid` = %d",
|
q("UPDATE `contact` SET `about` = '%s', `location` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `self` AND `uid` = %d",
|
||||||
dbesc($about),
|
dbesc($about),
|
||||||
dbesc($location),
|
dbesc($location),
|
||||||
dbesc($pub_keywords),
|
dbesc($pub_keywords),
|
||||||
|
@ -492,6 +492,17 @@ function profiles_post(&$a) {
|
||||||
intval(local_user())
|
intval(local_user())
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$r = q("SELECT `avatar`, `notify`, `url` FROM `contact` WHERE `self` AND `uid` = %d",
|
||||||
|
intval(local_user()));
|
||||||
|
|
||||||
|
$gcontact = array("name" => $name, "location" => $location, "about" => $about,
|
||||||
|
"gender" => $gender, "keywords" => $pub_keywords, "birthday" => $dob,
|
||||||
|
"photo" => $r[0]["avatar"], "notify" => $r[0]["notify"],
|
||||||
|
"generation" => 1, "network" => NETWORK_DFRN,
|
||||||
|
"url" => $r[0]["url"], "updated" => datetime_convert());
|
||||||
|
|
||||||
|
update_gcontact($gcontact);
|
||||||
|
|
||||||
// Update global directory in background
|
// Update global directory in background
|
||||||
$url = $_SESSION['my_url'];
|
$url = $_SESSION['my_url'];
|
||||||
if($url && strlen(get_config('system','directory')))
|
if($url && strlen(get_config('system','directory')))
|
||||||
|
|
|
@ -620,9 +620,12 @@ function settings_post(&$a) {
|
||||||
|
|
||||||
$r = q("SELECT `url` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
|
$r = q("SELECT `url` FROM `contact` WHERE `self` AND `uid` = %d", intval(local_user()));
|
||||||
if ($r) {
|
if ($r) {
|
||||||
|
$nickname = $a->user['nickname'];
|
||||||
|
$addr = $nickname.'@'.str_replace(array("http://", "https://"), "", App::get_baseurl());
|
||||||
$gcontact = array("name" => $username, "generation" => 1, "hide" => ($hidewall OR !$net_publish),
|
$gcontact = array("name" => $username, "generation" => 1, "hide" => ($hidewall OR !$net_publish),
|
||||||
|
"nick" => $nickname, "addr" => $addr,
|
||||||
|
"connect" => $addr, "server_url" => App::get_baseurl(),
|
||||||
"network" => NETWORK_DFRN, "url" => $r[0]["url"], "updated" => datetime_convert());
|
"network" => NETWORK_DFRN, "url" => $r[0]["url"], "updated" => datetime_convert());
|
||||||
|
|
||||||
update_gcontact($gcontact);
|
update_gcontact($gcontact);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue