From 1d3586623c24cc6033540c6a6f3f26d02a08181e Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Feb 2020 07:16:45 +0000 Subject: [PATCH] Replace "suggestme" with "net-publish" --- mod/poco.php | 14 ++++++-------- mod/settings.php | 9 --------- view/templates/settings/settings.tpl | 2 -- view/theme/frio/templates/settings/settings.tpl | 2 -- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/mod/poco.php b/mod/poco.php index 802824ee5f..96607552e0 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -43,8 +43,7 @@ function poco_init(App $a) { $nickname = Strings::escapeTags(trim($a->argv[1])); } if (empty($nickname)) { - $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1"); - if (!DBA::isResult($c)) { + if (!DBA::exists('profile', ['net-publish' => true])) { throw new \Friendica\Network\HTTPException\ForbiddenException(); } $system_mode = true; @@ -113,8 +112,7 @@ function poco_init(App $a) { DBA::escape(Protocol::OSTATUS) ); } elseif ($system_mode) { - $contacts = q("SELECT count(*) AS `total` FROM `contact` WHERE `self` = 1 - AND `uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) "); + $totalResults = DBA::count('profile', ['net-publish' => true]); } else { $contacts = q("SELECT count(*) AS `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 AND (`success_update` >= `failure_update` OR `last-item` >= `failure_update`) @@ -126,9 +124,9 @@ function poco_init(App $a) { DBA::escape(Protocol::STATUSNET) ); } - if (DBA::isResult($contacts)) { + if (empty($totalResults) && DBA::isResult($contacts)) { $totalResults = intval($contacts[0]['total']); - } else { + } elseif (empty($totalResults)) { $totalResults = 0; } if (!empty($_GET['startIndex'])) { @@ -156,8 +154,8 @@ function poco_init(App $a) { `profile`.`postal-code` AS `ppostalcode`, `profile`.`country-name` AS `pcountry`, `user`.`account-type` FROM `contact` INNER JOIN `profile` ON `profile`.`uid` = `contact`.`uid` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid` - WHERE `self` = 1 - AND `contact`.`uid` IN (SELECT `uid` FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1) LIMIT %d, %d", + WHERE `self` = 1 AND `profile`.`net-publish` + LIMIT %d, %d", intval($startIndex), intval($itemsPerPage) ); diff --git a/mod/settings.php b/mod/settings.php index 89434e5583..d06f5885f5 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -495,7 +495,6 @@ function settings_post(App $a) $blocktags = ((!empty($_POST['blocktags']) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! $unkmail = ((!empty($_POST['unkmail']) && (intval($_POST['unkmail']) == 1)) ? 1: 0); $cntunkmail = (!empty($_POST['cntunkmail']) ? intval($_POST['cntunkmail']) : 0); - $suggestme = (!empty($_POST['suggestme']) ? intval($_POST['suggestme']) : 0); $hide_friends = (($_POST['hide-friends'] == 1) ? 1: 0); $hidewall = (($_POST['hidewall'] == 1) ? 1: 0); @@ -593,8 +592,6 @@ function settings_post(App $a) DI::pConfig()->set(local_user(), 'expire', 'photos', $expire_photos); DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only); - DI::pConfig()->set(local_user(), 'system', 'suggestme', $suggestme); - DI::pConfig()->set(local_user(), 'system', 'email_textonly', $email_textonly); DI::pConfig()->set(local_user(), 'system', 'detailed_notif', $detailed_notif); @@ -1024,7 +1021,6 @@ function settings_content(App $a) $expire_starred = DI::pConfig()->get(local_user(), 'expire', 'starred', true); $expire_photos = DI::pConfig()->get(local_user(), 'expire', 'photos', false); $expire_network_only = DI::pConfig()->get(local_user(), 'expire', 'network_only', false); - $suggestme = DI::pConfig()->get(local_user(), 'system', 'suggestme', false); // nowarn_insecure @@ -1132,10 +1128,6 @@ function settings_content(App $a) '$field' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')], ]); - $suggestme = Renderer::replaceMacros($opt_tpl, [ - '$field' => ['suggestme', DI::l10n()->t('Allow us to suggest you as a potential friend to new members?'), $suggestme, DI::l10n()->t('If you like, Friendica may suggest new members to add you as a contact.')], - ]); - $unkmail = Renderer::replaceMacros($opt_tpl, [ '$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.')], ]); @@ -1219,7 +1211,6 @@ function settings_content(App $a) '$permdesc' => DI::l10n()->t("\x28click to open/close\x29"), '$visibility' => $profile['net-publish'], '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user), - '$suggestme' => $suggestme, '$blockwall'=> $blockwall, // array('blockwall', DI::l10n()->t('Allow friends to post to your profile page:'), !$blockwall, ''), '$blocktags'=> $blocktags, // array('blocktags', DI::l10n()->t('Allow friends to tag your posts:'), !$blocktags, ''), diff --git a/view/templates/settings/settings.tpl b/view/templates/settings/settings.tpl index 3a847651dc..e232ec1773 100644 --- a/view/templates/settings/settings.tpl +++ b/view/templates/settings/settings.tpl @@ -57,8 +57,6 @@ {{$blocktags nofilter}} -{{$suggestme nofilter}} - {{$unkmail nofilter}} {{include file="field_input.tpl" field=$cntunkmail}} diff --git a/view/theme/frio/templates/settings/settings.tpl b/view/theme/frio/templates/settings/settings.tpl index 87f76f9465..11506a70a4 100644 --- a/view/theme/frio/templates/settings/settings.tpl +++ b/view/theme/frio/templates/settings/settings.tpl @@ -93,8 +93,6 @@ {{$blocktags nofilter}} - {{$suggestme nofilter}} - {{$unkmail nofilter}} {{include file="field_input.tpl" field=$cntunkmail}}