Clarify the effect of "net-publish"

This commit is contained in:
Michael 2020-02-16 15:39:44 +00:00
parent 9182879a00
commit ee6cceba30
11 changed files with 21 additions and 34 deletions

View File

@ -1098,18 +1098,20 @@ function settings_content(App $a)
$profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />'; $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
} else { } else {
$profile_in_dir = Renderer::replaceMacros($opt_tpl, [ $profile_in_dir = Renderer::replaceMacros($opt_tpl, [
'$field' => ['profile_in_directory', DI::l10n()->t('Publish your default profile in your local site directory?'), $profile['publish'], DI::l10n()->t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory')] '$field' => ['profile_in_directory', DI::l10n()->t('Publish your profile in your local site directory?'), $profile['publish'], DI::l10n()->t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory')]
]); ]);
} }
if (strlen(DI::config()->get('system', 'directory'))) { if (strlen(DI::config()->get('system', 'directory'))) {
$profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [ $net_pub_desc = ' ' . DI::l10n()->t('Your profile will also be published in the global friendica directories (e.g. <a href="%s">%s</a>).', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory'));
'$field' => ['profile_in_netdirectory', DI::l10n()->t('Publish your default profile in the global social directory?'), $profile['net-publish'], DI::l10n()->t('Your profile will be published in the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', DI::config()->get('system', 'directory'), DI::config()->get('system', 'directory')) . " " . DI::l10n()->t("This setting also determines whether Friendica will inform search engines that your profile should be indexed or not. Third-party search engines may or may not respect this setting.")]
]);
} else { } else {
$profile_in_net_dir = ''; $net_pub_desc = '';
} }
$profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [
'$field' => ['profile_in_netdirectory', DI::l10n()->t('Allow your profile to be searchable globally?'), $profile['net-publish'], DI::l10n()->t("Activate this setting if you want others to easily find and follow you. Your profile will be searchable on remote systems. This setting also determines whether Friendica will inform search engines that your profile should be indexed or not.") . $net_pub_desc]
]);
$hide_friends = Renderer::replaceMacros($opt_tpl, [ $hide_friends = Renderer::replaceMacros($opt_tpl, [
'$field' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], DI::l10n()->t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create')], '$field' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], DI::l10n()->t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create')],
]); ]);
@ -1134,10 +1136,6 @@ function settings_content(App $a)
'$field' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')], '$field' => ['unkmail', DI::l10n()->t('Permit unknown people to send you private mail?'), $unkmail, DI::l10n()->t('Friendica network users may send you private messages even if they are not in your contact list.')],
]); ]);
if (!$profile['publish'] && !$profile['net-publish']) {
info(DI::l10n()->t('Profile is <strong>not published</strong>.') . EOL);
}
$tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl'); $tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl');
$prof_addr = Renderer::replaceMacros($tpl_addr,[ $prof_addr = Renderer::replaceMacros($tpl_addr,[

View File

@ -785,7 +785,7 @@ class Contact
$fields['avatar'] = DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix; $fields['avatar'] = DI::baseUrl() . '/photo/profile/' .$uid . '.' . $file_suffix;
$fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY; $fields['forum'] = $user['page-flags'] == User::PAGE_FLAGS_COMMUNITY;
$fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP; $fields['prv'] = $user['page-flags'] == User::PAGE_FLAGS_PRVGROUP;
$fields['unsearchable'] = $user['hidewall'] || !$profile['net-publish']; $fields['unsearchable'] = !$profile['net-publish'];
// it seems as if ported accounts can have wrong values, so we make sure that now everything is fine. // it seems as if ported accounts can have wrong values, so we make sure that now everything is fine.
$fields['url'] = DI::baseUrl() . '/profile/' . $user['nickname']; $fields['url'] = DI::baseUrl() . '/profile/' . $user['nickname'];

View File

@ -1136,7 +1136,7 @@ class GContact
'keywords' => $userdata['pub_keywords'], 'keywords' => $userdata['pub_keywords'],
'birthday' => $userdata['dob'], 'photo' => $userdata['photo'], 'birthday' => $userdata['dob'], 'photo' => $userdata['photo'],
"notify" => $userdata['notify'], 'url' => $userdata['url'], "notify" => $userdata['notify'], 'url' => $userdata['url'],
"hide" => ($userdata['hidewall'] || !$userdata['net-publish']), "hide" => !$userdata['net-publish'],
'nick' => $userdata['nickname'], 'addr' => $userdata['addr'], 'nick' => $userdata['nickname'], 'addr' => $userdata['addr'],
"connect" => $userdata['addr'], "server_url" => DI::baseUrl(), "connect" => $userdata['addr'], "server_url" => DI::baseUrl(),
"generation" => 1, 'network' => Protocol::DFRN]; "generation" => 1, 'network' => Protocol::DFRN];

View File

@ -392,7 +392,7 @@ class Profile
$diaspora = [ $diaspora = [
'guid' => $profile['guid'], 'guid' => $profile['guid'],
'podloc' => DI::baseUrl(), 'podloc' => DI::baseUrl(),
'searchable' => (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'), 'searchable' => ($profile['net-publish'] ? 'true' : 'false'),
'nickname' => $profile['nickname'], 'nickname' => $profile['nickname'],
'fullname' => $profile['name'], 'fullname' => $profile['name'],
'firstname' => $firstname, 'firstname' => $firstname,

View File

@ -616,8 +616,7 @@ class User
$verified = !empty($data['verified']); $verified = !empty($data['verified']);
$language = !empty($data['language']) ? Strings::escapeTags(trim($data['language'])) : 'en'; $language = !empty($data['language']) ? Strings::escapeTags(trim($data['language'])) : 'en';
$publish = !empty($data['profile_publish_reg']); $netpublish = $publish = !empty($data['profile_publish_reg']);
$netpublish = $publish && DI::config()->get('system', 'directory');
if ($password1 != $confirm) { if ($password1 != $confirm) {
throw new Exception(DI::l10n()->t('Passwords do not match. Password unchanged.')); throw new Exception(DI::l10n()->t('Passwords do not match. Password unchanged.'));

View File

@ -75,7 +75,7 @@ class HoverCard extends BaseModule
$uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : '')); $uri = urlencode('acct:' . $a->profile['nickname'] . '@' . $baseUrl->getHostname() . ($baseUrl->getUrlPath() ? '/' . $baseUrl->getUrlPath() : ''));
$page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . (($a->profile['net-publish']) ? 'true' : 'false') . '" />' . "\r\n"; $page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($a->profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl->get() . '/dfrn_poll/' . $nickname . '" />' . "\r\n"; $page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl->get() . '/dfrn_poll/' . $nickname . '" />' . "\r\n";
$page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $baseUrl->get() . '/xrd/?uri=' . $uri . '" />' . "\r\n"; $page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $baseUrl->get() . '/xrd/?uri=' . $uri . '" />' . "\r\n";
header('Link: <' . $baseUrl->get() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false); header('Link: <' . $baseUrl->get() . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);

View File

@ -69,7 +69,7 @@ class NoScrape extends BaseModule
$json_info["dfrn-{$dfrn}"] = DI::baseUrl() . "/dfrn_{$dfrn}/{$which}"; $json_info["dfrn-{$dfrn}"] = DI::baseUrl() . "/dfrn_{$dfrn}/{$which}";
} }
if (!$a->profile['net-publish'] || $a->profile['hidewall']) { if (!$a->profile['net-publish']) {
$json_info['hide'] = true; $json_info['hide'] = true;
System::jsonExit($json_info); System::jsonExit($json_info);
} }

View File

@ -293,7 +293,7 @@ class Profile extends BaseProfile
$htmlhead .= '<meta name="dfrn-global-visibility" content="' . ($profile['net-publish'] ? 'true' : 'false') . '" />' . "\n"; $htmlhead .= '<meta name="dfrn-global-visibility" content="' . ($profile['net-publish'] ? 'true' : 'false') . '" />' . "\n";
if (!$profile['net-publish'] || $profile['hidewall']) { if (!$profile['net-publish']) {
$htmlhead .= '<meta content="noindex, noarchive" name="robots" />' . "\n"; $htmlhead .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
} }

View File

@ -48,7 +48,7 @@ class Status extends BaseProfile
ProfileModel::load($a, $parameters['nickname']); ProfileModel::load($a, $parameters['nickname']);
if (!$a->profile['net-publish'] || $a->profile['hidewall']) { if (!$a->profile['net-publish']) {
DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n"; DI::page()['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
} }

View File

@ -639,27 +639,17 @@ class DFRN
*/ */
private static function addAuthor(DOMDocument $doc, array $owner, $authorelement, $public) private static function addAuthor(DOMDocument $doc, array $owner, $authorelement, $public)
{ {
// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element // Should the profile be "unsearchable" in the net? Then add the "hide" element
$r = q( $hide = DBA::exists('profile', ['uid' => $owner['uid'], 'net-publish' = false]);
"SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE (`hidewall` OR NOT `net-publish`) AND `user`.`uid` = %d",
intval($owner['uid'])
);
if (DBA::isResult($r)) {
$hidewall = true;
} else {
$hidewall = false;
}
$author = $doc->createElement($authorelement); $author = $doc->createElement($authorelement);
$namdate = DateTimeFormat::utc($owner['name-date'].'+00:00', DateTimeFormat::ATOM); $namdate = DateTimeFormat::utc($owner['name-date'].'+00:00', DateTimeFormat::ATOM);
$uridate = DateTimeFormat::utc($owner['uri-date'].'+00:00', DateTimeFormat::ATOM);
$picdate = DateTimeFormat::utc($owner['avatar-date'].'+00:00', DateTimeFormat::ATOM); $picdate = DateTimeFormat::utc($owner['avatar-date'].'+00:00', DateTimeFormat::ATOM);
$attributes = []; $attributes = [];
if (!$public || !$hidewall) { if (!$public || !$hide) {
$attributes = ["dfrn:updated" => $namdate]; $attributes = ["dfrn:updated" => $namdate];
} }
@ -670,7 +660,7 @@ class DFRN
$attributes = ["rel" => "photo", "type" => "image/jpeg", $attributes = ["rel" => "photo", "type" => "image/jpeg",
"media:width" => 300, "media:height" => 300, "href" => $owner['photo']]; "media:width" => 300, "media:height" => 300, "href" => $owner['photo']];
if (!$public || !$hidewall) { if (!$public || !$hide) {
$attributes["dfrn:updated"] = $picdate; $attributes["dfrn:updated"] = $picdate;
} }
@ -679,7 +669,7 @@ class DFRN
$attributes["rel"] = "avatar"; $attributes["rel"] = "avatar";
XML::addElement($doc, $author, "link", "", $attributes); XML::addElement($doc, $author, "link", "", $attributes);
if ($hidewall) { if ($hide) {
XML::addElement($doc, $author, "dfrn:hide", "true"); XML::addElement($doc, $author, "dfrn:hide", "true");
} }

View File

@ -4118,7 +4118,7 @@ class Diaspora
$large = DI::baseUrl().'/photo/custom/300/'.$profile['uid'].'.jpg'; $large = DI::baseUrl().'/photo/custom/300/'.$profile['uid'].'.jpg';
$medium = DI::baseUrl().'/photo/custom/100/'.$profile['uid'].'.jpg'; $medium = DI::baseUrl().'/photo/custom/100/'.$profile['uid'].'.jpg';
$small = DI::baseUrl().'/photo/custom/50/' .$profile['uid'].'.jpg'; $small = DI::baseUrl().'/photo/custom/50/' .$profile['uid'].'.jpg';
$searchable = (($profile['publish'] && $profile['net-publish']) ? 'true' : 'false'); $searchable = ($profile['net-publish'] ? 'true' : 'false');
$dob = null; $dob = null;
$about = null; $about = null;