<?php
/**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\DI;
-use Friendica\Model\Group;
+use Friendica\Model\Circle;
use Friendica\Model\Notification;
use Friendica\Model\Post\UserNotification;
use Friendica\Model\Profile;
use Friendica\Module\BaseSettings;
use Friendica\Network\HTTPException;
use Friendica\Protocol\Activity;
+use Friendica\Protocol\Delivery;
use Friendica\Util\Network;
use Friendica\Util\Temporal;
-use Friendica\Worker\Delivery;
class Account extends BaseSettings
{
$err .= DI::l10n()->t('Invalid email.');
}
// ensure new email is not the admin mail
- if (DI::config()->get('config', 'admin_email')) {
- $adminlist = explode(",", str_replace(" ", "", strtolower(DI::config()->get('config', 'admin_email'))));
- if (in_array(strtolower($email), $adminlist)) {
- $err .= DI::l10n()->t('Cannot change to that email.');
- $email = $user['email'];
- }
+ if (in_array(strtolower($email), User::getAdminEmailList())) {
+ $err .= DI::l10n()->t('Cannot change to that email.');
+ $email = $user['email'];
}
}
$blocktags = empty($request['blocktags']); // this setting is inverted!
$unkmail = !empty($request['unkmail']);
$cntunkmail = intval($request['cntunkmail'] ?? 0);
- $def_gid = intval($request['group-selection'] ?? 0);
+ $def_gid = intval($request['circle-selection'] ?? 0);
$aclFormatter = DI::aclFormatter();
- $str_group_allow = !empty($request['group_allow']) ? $aclFormatter->toString($request['group_allow']) : '';
$str_contact_allow = !empty($request['contact_allow']) ? $aclFormatter->toString($request['contact_allow']) : '';
- $str_group_deny = !empty($request['group_deny']) ? $aclFormatter->toString($request['group_deny']) : '';
- $str_contact_deny = !empty($request['contact_deny']) ? $aclFormatter->toString($request['contact_deny']) : '';
+ $str_circle_allow = !empty($request['circle_allow']) ? $aclFormatter->toString($request['circle_allow']) : '';
+ $str_contact_deny = !empty($request['contact_deny']) ? $aclFormatter->toString($request['contact_deny']) : '';
+ $str_circle_deny = !empty($request['circle_deny']) ? $aclFormatter->toString($request['circle_deny']) : '';
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'unlisted', !empty($request['unlisted']));
DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'accessible-photos', !empty($request['accessible-photos']));
+ DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'default-group-gid', intval($request['circle-selection-group'] ?? $def_gid));
$fields = [
'allow_cid' => $str_contact_allow,
- 'allow_gid' => $str_group_allow,
+ 'allow_gid' => $str_circle_allow,
'deny_cid' => $str_contact_deny,
- 'deny_gid' => $str_group_deny,
+ 'deny_gid' => $str_circle_deny,
'maxreq' => $maxreq,
'def_gid' => $def_gid,
'blockwall' => $blockwall,
$fields = [
'allow_cid' => '',
'allow_gid' => $page_flags == User::PAGE_FLAGS_PRVGROUP ?
- '<' . Group::FOLLOWERS . '>'
+ '<' . Circle::FOLLOWERS . '>'
: '',
'deny_cid' => '',
'deny_gid' => '',
// "http" or "@" to be present in the string.
// All other fields from the row will be ignored
if ((strpos($csvRow[0], '@') !== false) || Network::isValidHttpUrl($csvRow[0])) {
- Worker::add(Worker::PRIORITY_MEDIUM, 'AddContact', DI::userSession()->getLocalUserId(), $csvRow[0]);
+ Worker::add(Worker::PRIORITY_MEDIUM, 'AddContact', DI::userSession()->getLocalUserId(), trim($csvRow[0], '@'));
} else {
Logger::notice('Invalid account', ['url' => $csvRow[0]]);
}
$pagetype = Renderer::replaceMacros($pageset_tpl, [
'$account_types' => DI::l10n()->t("Account Types"),
'$user' => DI::l10n()->t("Personal Page Subtypes"),
- '$community' => DI::l10n()->t("Community Forum Subtypes"),
+ '$community' => DI::l10n()->t("Community Group Subtypes"),
'$account_type' => $user['account-type'],
'$type_person' => User::ACCOUNT_TYPE_PERSON,
'$type_organisation' => User::ACCOUNT_TYPE_ORGANISATION,
],
'$account_community' => [
'account-type',
- DI::l10n()->t('Community Forum'),
+ DI::l10n()->t('Community Group'),
User::ACCOUNT_TYPE_COMMUNITY,
DI::l10n()->t('Account for community discussions.'),
$user['account-type'] == User::ACCOUNT_TYPE_COMMUNITY
],
'$page_community' => [
'page-flags',
- DI::l10n()->t('Public Forum'),
+ DI::l10n()->t('Public Group'),
User::PAGE_FLAGS_COMMUNITY,
DI::l10n()->t('Automatically approves all contact requests.'),
$user['page-flags'] == User::PAGE_FLAGS_COMMUNITY
],
'$page_prvgroup' => [
'page-flags',
- DI::l10n()->t('Private Forum [Experimental]'),
+ DI::l10n()->t('Private Group [Experimental]'),
User::PAGE_FLAGS_PRVGROUP,
DI::l10n()->t('Requires manual approval of contact requests.'),
$user['page-flags'] == User::PAGE_FLAGS_PRVGROUP
$notify_type = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'notify_type');
- $passwordRules = DI::l10n()->t('Allowed characters are a-z, A-Z, 0-9 and special characters except white spaces, accentuated letters and colon (:).')
+ $passwordRules = DI::l10n()->t('Allowed characters are a-z, A-Z, 0-9 and special characters except white spaces and accentuated letters.')
. (PASSWORD_DEFAULT === PASSWORD_BCRYPT ? ' ' . DI::l10n()->t('Password length is limited to 72 characters.') : '');
$tpl = Renderer::getMarkupTemplate('settings/account.tpl');
$o = Renderer::replaceMacros($tpl, [
'$ptitle' => DI::l10n()->t('Account Settings'),
- '$desc' => DI::l10n()->t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . DI::baseUrl()->getHostname() . DI::baseUrl()->getUrlPath(), DI::baseUrl() . '/profile/' . $nickname),
+ '$desc' => DI::l10n()->t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . DI::baseUrl()->getHost() . DI::baseUrl()->getPath(), DI::baseUrl() . '/profile/' . $nickname),
'$submit' => DI::l10n()->t('Save Settings'),
- '$baseurl' => DI::baseUrl()->get(true),
'$uid' => DI::userSession()->getLocalUserId(),
'$form_security_token' => self::getFormSecurityToken('settings'),
'$open' => $this->parameters['open'] ?? 'password',
'$delete_openid' => ['delete_openid', DI::l10n()->t('Delete OpenID URL'), false, ''],
'$h_basic' => DI::l10n()->t('Basic Settings'),
- '$username' => ['username', DI::l10n()->t('Full Name:'), $username, '', false, 'autocomplete="off"'],
+ '$username' => ['username', DI::l10n()->t('Display name:'), $username, '', false, 'autocomplete="off"'],
'$email' => ['email', DI::l10n()->t('Email Address:'), $email, '', '', 'autocomplete="off"', 'email'],
'$timezone' => ['timezone_select', DI::l10n()->t('Your Timezone:'), Temporal::getTimezoneSelect($timezone), ''],
'$language' => ['language', DI::l10n()->t('Your Language:'), $language, DI::l10n()->t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices],
'$profile_in_dir' => $profile_in_dir,
'$profile_in_net_dir' => ['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' => ['hide-friends', DI::l10n()->t('Hide your contact/friend list from viewers of your profile?'), $profile['hide-friends'], DI::l10n()->t('A list of your contacts is displayed on your profile page. Activate this option to disable the display of your contact list.')],
- '$hide_wall' => ['hidewall', DI::l10n()->t('Hide your profile details from anonymous viewers?'), $user['hidewall'], DI::l10n()->t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Your public posts and replies will still be accessible by other means.')],
+ '$hide_wall' => ['hidewall', $this->t('Hide your public content from anonymous viewers'), $user['hidewall'], $this->t('Anonymous visitors will only see your basic profile details. Your public posts and replies will still be freely accessible on the remote servers of your followers and through relays.')],
'$unlisted' => ['unlisted', DI::l10n()->t('Make public posts unlisted'), DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'unlisted'), DI::l10n()->t('Your public posts will not appear on the community pages or in search results, nor be sent to relay servers. However they can still appear on public feeds on remote servers.')],
'$accessiblephotos' => ['accessible-photos', DI::l10n()->t('Make all posted pictures accessible'), DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'accessible-photos'), DI::l10n()->t("This option makes every posted picture accessible via the direct link. This is a workaround for the problem that most other networks can't handle permissions on pictures. Non public pictures still won't be visible for the public on your photo albums though.")],
'$blockwall' => ['blockwall', DI::l10n()->t('Allow friends to post to your profile page?'), (intval($user['blockwall']) ? '0' : '1'), DI::l10n()->t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts')],
'$blocktags' => ['blocktags', DI::l10n()->t('Allow friends to tag your posts?'), (intval($user['blocktags']) ? '0' : '1'), DI::l10n()->t('Your contacts can add additional tags to your posts.')],
'$unkmail' => ['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.')],
'$cntunkmail' => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail, DI::l10n()->t("(to prevent spam abuse)")],
- '$group_select' => Group::displayGroupSelection(DI::userSession()->getLocalUserId(), $user['def_gid']),
+ '$circle_select' => Circle::getSelectorHTML(DI::userSession()->getLocalUserId(), $user['def_gid'], 'circle-selection', DI::l10n()->t('Default privacy circle for new contacts')),
+ '$circle_select_group' => Circle::getSelectorHTML(DI::userSession()->getLocalUserId(), DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'default-group-gid', $user['def_gid']), 'circle-selection-group', DI::l10n()->t('Default privacy circle for new group contacts')),
'$permissions' => DI::l10n()->t('Default Post Permissions'),
'$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()),