X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fsettings.php;h=7ae0f6479e1904ee4053f9eafdd3f8c6ec7646a5;hb=9435cc4b88de611407bf992f571e12e8f54b3c51;hp=dbe58b0875545d8f8d8860fe554309d547b1d007;hpb=ab8997f9db910ba70c592bf106a7f5fc41a55b2d;p=friendica.git diff --git a/mod/settings.php b/mod/settings.php index dbe58b0875..7ae0f6479e 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -8,7 +8,6 @@ use Friendica\BaseModule; use Friendica\Content\Feature; use Friendica\Content\Nav; use Friendica\Core\ACL; -use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; @@ -20,6 +19,7 @@ use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\GContact; use Friendica\Model\Group; +use Friendica\Model\Notify\Type; use Friendica\Model\User; use Friendica\Module\Security\Login; use Friendica\Protocol\Email; @@ -74,9 +74,9 @@ function settings_init(App $a) ]; $tabs[] = [ - 'label' => DI::l10n()->t('Profiles'), - 'url' => 'profiles', - 'selected' => (($a->argc == 1) && ($a->argv[0] === 'profiles')?'active':''), + 'label' => DI::l10n()->t('Profile'), + 'url' => 'settings/profile', + 'selected' => (($a->argc > 1) && ($a->argv[1] === 'profile')?'active':''), 'accesskey' => 'p', ]; @@ -250,9 +250,9 @@ function settings_post(App $a) $mail_pubmail = $_POST['mail_pubmail'] ?? ''; if ( - !Config::get('system', 'dfrn_only') + !DI::config()->get('system', 'dfrn_only') && function_exists('imap_open') - && !Config::get('system', 'imap_disabled') + && !DI::config()->get('system', 'imap_disabled') ) { $failed = false; $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1", @@ -541,8 +541,8 @@ function settings_post(App $a) $err .= DI::l10n()->t('Invalid email.'); } // ensure new email is not the admin mail - if (Config::get('config', 'admin_email')) { - $adminlist = explode(",", str_replace(" ", "", strtolower(Config::get('config', 'admin_email')))); + 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 = $a->user['email']; @@ -612,7 +612,7 @@ function settings_post(App $a) `name` = '%s', `net-publish` = %d, `hide-friends` = %d - WHERE `is-default` = 1 AND `uid` = %d", + WHERE `uid` = %d", intval($publish), DBA::escape($username), intval($net_publish), @@ -625,7 +625,7 @@ function settings_post(App $a) if (($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) { // Update global directory in background $url = $_SESSION['my_url']; - if ($url && strlen(Config::get('system', 'directory'))) { + if ($url && strlen(DI::config()->get('system', 'directory'))) { Worker::add(PRIORITY_LOW, "Directory", $url); } } @@ -791,15 +791,15 @@ function settings_content(App $a) Hook::callAll('connector_settings', $settings_connectors); if (is_site_admin()) { - $diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled'))); - $ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t("GNU Social \x28OStatus\x29"), ((Config::get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled'))); + $diasp_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t('Diaspora'), ((DI::config()->get('system', 'diaspora_enabled')) ? DI::l10n()->t('enabled') : DI::l10n()->t('disabled'))); + $ostat_enabled = DI::l10n()->t('Built-in support for %s connectivity is %s', DI::l10n()->t("GNU Social \x28OStatus\x29"), ((DI::config()->get('system', 'ostatus_disabled')) ? DI::l10n()->t('disabled') : DI::l10n()->t('enabled'))); } else { $diasp_enabled = ""; $ostat_enabled = ""; } - $mail_disabled = ((function_exists('imap_open') && (!Config::get('system', 'imap_disabled'))) ? 0 : 1); - if (Config::get('system', 'dfrn_only')) { + $mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1); + if (DI::config()->get('system', 'dfrn_only')) { $mail_disabled = 1; } if (!$mail_disabled) { @@ -827,7 +827,7 @@ function settings_content(App $a) $ssl_options = ['TLS' => 'TLS', 'SSL' => 'SSL']; - if (Config::get('system', 'insecure_imap')) { + if (DI::config()->get('system', 'insecure_imap')) { $ssl_options['notls'] = DI::l10n()->t('None'); } @@ -877,11 +877,11 @@ function settings_content(App $a) * DISPLAY SETTINGS */ if (($a->argc > 1) && ($a->argv[1] === 'display')) { - $default_theme = Config::get('system', 'theme'); + $default_theme = DI::config()->get('system', 'theme'); if (!$default_theme) { $default_theme = 'default'; } - $default_mobile_theme = Config::get('system', 'mobile-theme'); + $default_mobile_theme = DI::config()->get('system', 'mobile-theme'); if (!$default_mobile_theme) { $default_mobile_theme = 'none'; } @@ -894,7 +894,7 @@ function settings_content(App $a) $is_experimental = file_exists('view/theme/' . $theme . '/experimental'); $is_unsupported = file_exists('view/theme/' . $theme . '/unsupported'); $is_mobile = file_exists('view/theme/' . $theme . '/mobile'); - if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) { + if (!$is_experimental || ($is_experimental && (DI::config()->get('experimentals', 'exp_themes')==1 || is_null(DI::config()->get('experimentals', 'exp_themes'))))) { $theme_name = ucfirst($theme); if ($is_unsupported) { $theme_name = DI::l10n()->t('%s - (Unsupported)', $theme_name); @@ -979,7 +979,7 @@ function settings_content(App $a) * ACCOUNT SETTINGS */ - $profile = DBA::selectFirst('profile', [], ['is-default' => true, 'uid' => local_user()]); + $profile = DBA::selectFirst('profile', [], ['uid' => local_user()]); if (!DBA::isResult($profile)) { notice(DI::l10n()->t('Unable to find your profile. Please contact your admin.') . EOL); return; @@ -1068,7 +1068,7 @@ function settings_content(App $a) ]); - $noid = Config::get('system', 'no_openid'); + $noid = DI::config()->get('system', 'no_openid'); if ($noid) { $openid_field = false; @@ -1076,8 +1076,8 @@ function settings_content(App $a) $openid_field = ['openid_url', DI::l10n()->t('OpenID:'), $openid, DI::l10n()->t("\x28Optional\x29 Allow this OpenID to login to this account."), "", "readonly", "url"]; } - $opt_tpl = Renderer::getMarkupTemplate("field_yesno.tpl"); - if (Config::get('system', 'publish_all')) { + $opt_tpl = Renderer::getMarkupTemplate("field_checkbox.tpl"); + if (DI::config()->get('system', 'publish_all')) { $profile_in_dir = ''; } else { $profile_in_dir = Renderer::replaceMacros($opt_tpl, [ @@ -1085,9 +1085,9 @@ function settings_content(App $a) ]); } - if (strlen(Config::get('system', 'directory'))) { + if (strlen(DI::config()->get('system', 'directory'))) { $profile_in_net_dir = Renderer::replaceMacros($opt_tpl, [ - '$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. %s). Your profile will be visible in public.', Config::get('system', 'directory'), 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."), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]] + '$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. %s). 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."), [DI::l10n()->t('No'), DI::l10n()->t('Yes')]] ]); } else { $profile_in_net_dir = ''; @@ -1181,7 +1181,7 @@ function settings_content(App $a) '$password2'=> ['confirm', DI::l10n()->t('Confirm:'), '', DI::l10n()->t('Leave password fields blank unless changing')], '$password3'=> ['opassword', DI::l10n()->t('Current Password:'), '', DI::l10n()->t('Your current password to confirm the changes')], '$password4'=> ['mpassword', DI::l10n()->t('Password:'), '', DI::l10n()->t('Your current password to confirm the changes')], - '$oid_enable' => (!Config::get('system', 'no_openid')), + '$oid_enable' => (!DI::config()->get('system', 'no_openid')), '$openid' => $openid_field, '$delete_openid' => ['delete_openid', DI::l10n()->t('Delete OpenID URL'), false, ''], @@ -1230,11 +1230,11 @@ function settings_content(App $a) '$h_not' => DI::l10n()->t('Notification Settings'), '$lbl_not' => DI::l10n()->t('Send a notification email when:'), - '$notify1' => ['notify1', DI::l10n()->t('You receive an introduction'), ($notify & NOTIFY_INTRO), NOTIFY_INTRO, ''], - '$notify2' => ['notify2', DI::l10n()->t('Your introductions are confirmed'), ($notify & NOTIFY_CONFIRM), NOTIFY_CONFIRM, ''], - '$notify3' => ['notify3', DI::l10n()->t('Someone writes on your profile wall'), ($notify & NOTIFY_WALL), NOTIFY_WALL, ''], - '$notify4' => ['notify4', DI::l10n()->t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''], - '$notify5' => ['notify5', DI::l10n()->t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''], + '$notify1' => ['notify1', DI::l10n()->t('You receive an introduction'), ($notify & Type::INTRO), Type::INTRO, ''], + '$notify2' => ['notify2', DI::l10n()->t('Your introductions are confirmed'), ($notify & Type::CONFIRM), Type::CONFIRM, ''], + '$notify3' => ['notify3', DI::l10n()->t('Someone writes on your profile wall'), ($notify & Type::WALL), Type::WALL, ''], + '$notify4' => ['notify4', DI::l10n()->t('Someone writes a followup comment'), ($notify & Type::COMMENT), Type::COMMENT, ''], + '$notify5' => ['notify5', DI::l10n()->t('You receive a private message'), ($notify & Type::MAIL), Type::MAIL, ''], '$notify6' => ['notify6', DI::l10n()->t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''], '$notify7' => ['notify7', DI::l10n()->t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''], '$notify8' => ['notify8', DI::l10n()->t('You are poked/prodded/etc. in a post'), ($notify & NOTIFY_POKE), NOTIFY_POKE, ''], @@ -1256,7 +1256,7 @@ function settings_content(App $a) '$importcontact' => DI::l10n()->t('Import Contacts'), '$importcontact_text' => DI::l10n()->t('Upload a CSV file that contains the handle of your followed accounts in the first column you exported from the old account.'), '$importcontact_button' => DI::l10n()->t('Upload File'), - '$importcontact_maxsize' => Config::get('system', 'max_csv_file_size', 30720), + '$importcontact_maxsize' => DI::config()->get('system', 'max_csv_file_size', 30720), '$relocate' => DI::l10n()->t('Relocate'), '$relocate_text' => DI::l10n()->t("If you have moved this profile from another server, and some of your contacts don't receive your updates, try pushing this button."), '$relocate_button' => DI::l10n()->t("Resend relocate message to contacts"),