]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Admin/Site.php
Merge pull request #13244 from annando/kbin
[friendica.git] / src / Module / Admin / Site.php
index fbebfcb3fe6da80830ce3aa89aa7a522a68dc18e..09624dcfc74de4114c7a6687bc81d112fa30e8a2 100644 (file)
@@ -1,6 +1,6 @@
 <?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
  *
@@ -22,7 +22,6 @@
 namespace Friendica\Module\Admin;
 
 use Friendica\App;
-use Friendica\Core\Relocate;
 use Friendica\Core\Renderer;
 use Friendica\Core\Search;
 use Friendica\Core\System;
@@ -33,14 +32,13 @@ use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\User;
 use Friendica\Module\BaseAdmin;
+use Friendica\Module\Conversation\Community;
 use Friendica\Module\Register;
+use Friendica\Navigation\SystemMessages;
 use Friendica\Protocol\Relay;
 use Friendica\Util\BasePath;
 use Friendica\Util\EMailer\MailBuilder;
 use Friendica\Util\Strings;
-use Friendica\Worker\Delivery;
-
-require_once __DIR__ . '/../../../boot.php';
 
 class Site extends BaseAdmin
 {
@@ -50,10 +48,8 @@ class Site extends BaseAdmin
 
                self::checkFormSecurityTokenRedirectOnError('/admin/site', 'admin_site');
 
-               $a = DI::app();
-
                if (!empty($_POST['republish_directory'])) {
-                       Worker::add(PRIORITY_LOW, 'Directory');
+                       Worker::add(Worker::PRIORITY_LOW, 'Directory');
                        return;
                }
 
@@ -71,11 +67,12 @@ class Site extends BaseAdmin
                $language         = (!empty($_POST['language'])         ? trim($_POST['language'])      : '');
                $theme            = (!empty($_POST['theme'])            ? trim($_POST['theme'])         : '');
                $theme_mobile     = (!empty($_POST['theme_mobile'])     ? trim($_POST['theme_mobile'])  : '');
-               $maximagesize     = (!empty($_POST['maximagesize'])     ? intval(trim($_POST['maximagesize']))               : 0);
+               $maximagesize     = (!empty($_POST['maximagesize'])     ? trim($_POST['maximagesize'])              : 0);
                $maximagelength   = (!empty($_POST['maximagelength'])   ? intval(trim($_POST['maximagelength']))             : -1);
                $jpegimagequality = (!empty($_POST['jpegimagequality']) ? intval(trim($_POST['jpegimagequality']))           : 100);
 
                $register_policy        = (!empty($_POST['register_policy'])         ? intval(trim($_POST['register_policy']))             : 0);
+               $max_registered_users   = (!empty($_POST['max_registered_users'])     ? intval(trim($_POST['max_registered_users']))         : 0);
                $daily_registrations    = (!empty($_POST['max_daily_registrations']) ? intval(trim($_POST['max_daily_registrations']))     : 0);
                $abandon_days           = (!empty($_POST['abandon_days'])            ? intval(trim($_POST['abandon_days']))                : 0);
 
@@ -102,6 +99,7 @@ class Site extends BaseAdmin
                $enable_multi_reg       = !empty($_POST['enable_multi_reg']);
                $enable_openid          = !empty($_POST['enable_openid']);
                $enable_regfullname     = !empty($_POST['enable_regfullname']);
+               $register_notification  = !empty($_POST['register_notification']);
                $community_page_style   = (!empty($_POST['community_page_style']) ? intval(trim($_POST['community_page_style'])) : 0);
                $max_author_posts_community_page = (!empty($_POST['max_author_posts_community_page']) ? intval(trim($_POST['max_author_posts_community_page'])) : 0);
 
@@ -121,7 +119,6 @@ class Site extends BaseAdmin
                $mail_enabled           = !empty($_POST['mail_enabled']);
                $ostatus_enabled        = !empty($_POST['ostatus_enabled']);
                $diaspora_enabled       = !empty($_POST['diaspora_enabled']);
-               $ssl_policy             = (!empty($_POST['ssl_policy'])             ? intval($_POST['ssl_policy'])                    : 0);
                $force_ssl              = !empty($_POST['force_ssl']);
                $show_help              = !empty($_POST['show_help']);
                $dbclean                = !empty($_POST['dbclean']);
@@ -134,7 +131,7 @@ class Site extends BaseAdmin
                $temppath               = (!empty($_POST['temppath'])               ? trim($_POST['temppath'])   : '');
                $singleuser             = (!empty($_POST['singleuser'])             ? trim($_POST['singleuser']) : '');
                $only_tag_search        = !empty($_POST['only_tag_search']);
-               $compute_group_counts   = !empty($_POST['compute_group_counts']);
+               $compute_circle_counts  = !empty($_POST['compute_circle_counts']);
                $check_new_version_url  = (!empty($_POST['check_new_version_url'])  ? trim($_POST['check_new_version_url']) : 'none');
 
                $worker_queues    = (!empty($_POST['worker_queues'])                ? intval($_POST['worker_queues'])                 : 10);
@@ -147,174 +144,152 @@ class Site extends BaseAdmin
                $relay_user_tags   = !empty($_POST['relay_user_tags']);
                $active_panel      = (!empty($_POST['active_panel'])      ? "#" . trim($_POST['active_panel']) : '');
 
+               $transactionConfig = DI::config()->beginTransaction();
+
                // Has the directory url changed? If yes, then resubmit the existing profiles there
                if ($global_directory != DI::config()->get('system', 'directory') && ($global_directory != '')) {
-                       DI::config()->set('system', 'directory', $global_directory);
-                       Worker::add(PRIORITY_LOW, 'Directory');
+                       $transactionConfig->set('system', 'directory', $global_directory);
+                       Worker::add(Worker::PRIORITY_LOW, 'Directory');
                }
 
-               if (DI::baseUrl()->getUrlPath() != "") {
+               if (DI::baseUrl()->getPath() != "") {
                        $diaspora_enabled = false;
                }
-               if ($ssl_policy != intval(DI::config()->get('system', 'ssl_policy'))) {
-                       if ($ssl_policy == App\BaseURL::SSL_POLICY_FULL) {
-                               DBA::e("UPDATE `contact` SET
-                               `url`     = REPLACE(`url`    , 'http:' , 'https:'),
-                               `photo`   = REPLACE(`photo`  , 'http:' , 'https:'),
-                               `thumb`   = REPLACE(`thumb`  , 'http:' , 'https:'),
-                               `micro`   = REPLACE(`micro`  , 'http:' , 'https:'),
-                               `request` = REPLACE(`request`, 'http:' , 'https:'),
-                               `notify`  = REPLACE(`notify` , 'http:' , 'https:'),
-                               `poll`    = REPLACE(`poll`   , 'http:' , 'https:'),
-                               `confirm` = REPLACE(`confirm`, 'http:' , 'https:'),
-                               `poco`    = REPLACE(`poco`   , 'http:' , 'https:')
-                               WHERE `self` = 1"
-                               );
-                               DBA::e("UPDATE `profile` SET
-                               `photo`   = REPLACE(`photo`  , 'http:' , 'https:'),
-                               `thumb`   = REPLACE(`thumb`  , 'http:' , 'https:')
-                               WHERE 1 "
-                               );
-                       } elseif ($ssl_policy == App\BaseURL::SSL_POLICY_SELFSIGN) {
-                               DBA::e("UPDATE `contact` SET
-                               `url`     = REPLACE(`url`    , 'https:' , 'http:'),
-                               `photo`   = REPLACE(`photo`  , 'https:' , 'http:'),
-                               `thumb`   = REPLACE(`thumb`  , 'https:' , 'http:'),
-                               `micro`   = REPLACE(`micro`  , 'https:' , 'http:'),
-                               `request` = REPLACE(`request`, 'https:' , 'http:'),
-                               `notify`  = REPLACE(`notify` , 'https:' , 'http:'),
-                               `poll`    = REPLACE(`poll`   , 'https:' , 'http:'),
-                               `confirm` = REPLACE(`confirm`, 'https:' , 'http:'),
-                               `poco`    = REPLACE(`poco`   , 'https:' , 'http:')
-                               WHERE `self` = 1"
-                               );
-                               DBA::e("UPDATE `profile` SET
-                               `photo`   = REPLACE(`photo`  , 'https:' , 'http:'),
-                               `thumb`   = REPLACE(`thumb`  , 'https:' , 'http:')
-                               WHERE 1 "
-                               );
-                       }
+
+               $transactionConfig->set('system', 'maxloadavg'            , $maxloadavg);
+               $transactionConfig->set('system', 'min_memory'            , $min_memory);
+               $transactionConfig->set('system', 'optimize_tables'       , $optimize_tables);
+               $transactionConfig->set('system', 'contact_discovery'     , $contact_discovery);
+               $transactionConfig->set('system', 'synchronize_directory' , $synchronize_directory);
+               $transactionConfig->set('system', 'poco_requery_days'     , $poco_requery_days);
+               $transactionConfig->set('system', 'poco_discovery'        , $poco_discovery);
+               $transactionConfig->set('system', 'poco_local_search'     , $poco_local_search);
+               $transactionConfig->set('system', 'nodeinfo'              , $nodeinfo);
+               if (DI::config()->isWritable('config', 'sitename')) {
+                       $transactionConfig->set('config', 'sitename', $sitename);
                }
-               DI::config()->set('system', 'ssl_policy'            , $ssl_policy);
-               DI::config()->set('system', 'maxloadavg'            , $maxloadavg);
-               DI::config()->set('system', 'min_memory'            , $min_memory);
-               DI::config()->set('system', 'optimize_tables'       , $optimize_tables);
-               DI::config()->set('system', 'contact_discovery'     , $contact_discovery);
-               DI::config()->set('system', 'synchronize_directory' , $synchronize_directory);
-               DI::config()->set('system', 'poco_requery_days'     , $poco_requery_days);
-               DI::config()->set('system', 'poco_discovery'        , $poco_discovery);
-               DI::config()->set('system', 'poco_local_search'     , $poco_local_search);
-               DI::config()->set('system', 'nodeinfo'              , $nodeinfo);
-               DI::config()->set('config', 'sitename'              , $sitename);
-               DI::config()->set('config', 'sender_email'          , $sender_email);
-               DI::config()->set('system', 'suppress_tags'         , $suppress_tags);
-               DI::config()->set('system', 'shortcut_icon'         , $shortcut_icon);
-               DI::config()->set('system', 'touch_icon'            , $touch_icon);
+               $transactionConfig->set('config', 'sender_email'          , $sender_email);
+               $transactionConfig->set('system', 'suppress_tags'         , $suppress_tags);
+               $transactionConfig->set('system', 'shortcut_icon'         , $shortcut_icon);
+               $transactionConfig->set('system', 'touch_icon'            , $touch_icon);
 
                if ($banner == "") {
-                       DI::config()->delete('system', 'banner');
+                       $transactionConfig->delete('system', 'banner');
                } else {
-                       DI::config()->set('system', 'banner', $banner);
+                       $transactionConfig->set('system', 'banner', $banner);
                }
 
                if (empty($email_banner)) {
-                       DI::config()->delete('system', 'email_banner');
+                       $transactionConfig->delete('system', 'email_banner');
                } else {
-                       DI::config()->set('system', 'email_banner', $email_banner);
+                       $transactionConfig->set('system', 'email_banner', $email_banner);
                }
 
                if (empty($additional_info)) {
-                       DI::config()->delete('config', 'info');
+                       $transactionConfig->delete('config', 'info');
                } else {
-                       DI::config()->set('config', 'info', $additional_info);
+                       $transactionConfig->set('config', 'info', $additional_info);
+               }
+               if (DI::config()->isWritable('system', 'language')) {
+                       $transactionConfig->set('system', 'language', $language);
                }
-               DI::config()->set('system', 'language', $language);
-               DI::config()->set('system', 'theme', $theme);
+               $transactionConfig->set('system', 'theme', $theme);
                Theme::install($theme);
 
                if ($theme_mobile == '---') {
-                       DI::config()->delete('system', 'mobile-theme');
+                       $transactionConfig->delete('system', 'mobile-theme');
                } else {
-                       DI::config()->set('system', 'mobile-theme', $theme_mobile);
+                       $transactionConfig->set('system', 'mobile-theme', $theme_mobile);
                }
                if ($singleuser == '---') {
-                       DI::config()->delete('system', 'singleuser');
+                       $transactionConfig->delete('system', 'singleuser');
                } else {
-                       DI::config()->set('system', 'singleuser', $singleuser);
+                       $transactionConfig->set('system', 'singleuser', $singleuser);
                }
-               DI::config()->set('system', 'maximagesize'           , $maximagesize);
-               DI::config()->set('system', 'max_image_length'       , $maximagelength);
-               DI::config()->set('system', 'jpeg_quality'           , $jpegimagequality);
-
-               DI::config()->set('config', 'register_policy'        , $register_policy);
-               DI::config()->set('system', 'max_daily_registrations', $daily_registrations);
-               DI::config()->set('system', 'account_abandon_days'   , $abandon_days);
-               DI::config()->set('config', 'register_text'          , $register_text);
-               DI::config()->set('system', 'allowed_sites'          , $allowed_sites);
-               DI::config()->set('system', 'allowed_email'          , $allowed_email);
-               DI::config()->set('system', 'forbidden_nicknames'    , $forbidden_nicknames);
-               DI::config()->set('system', 'system_actor_name'      , $system_actor_name);
-               DI::config()->set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
-               DI::config()->set('system', 'allowed_oembed'         , $allowed_oembed);
-               DI::config()->set('system', 'block_public'           , $block_public);
-               DI::config()->set('system', 'publish_all'            , $force_publish);
-               DI::config()->set('system', 'newuser_private'        , $newuser_private);
-               DI::config()->set('system', 'enotify_no_content'     , $enotify_no_content);
-               DI::config()->set('system', 'disable_embedded'       , $disable_embedded);
-               DI::config()->set('system', 'allow_users_remote_self', $allow_users_remote_self);
-               DI::config()->set('system', 'explicit_content'       , $explicit_content);
-               DI::config()->set('system', 'proxify_content'        , $proxify_content);
-               DI::config()->set('system', 'cache_contact_avatar'   , $cache_contact_avatar);
-               DI::config()->set('system', 'check_new_version_url'  , $check_new_version_url);
-
-               DI::config()->set('system', 'block_extended_register', !$enable_multi_reg);
-               DI::config()->set('system', 'no_openid'              , !$enable_openid);
-               DI::config()->set('system', 'no_regfullname'         , !$enable_regfullname);
-               DI::config()->set('system', 'community_page_style'   , $community_page_style);
-               DI::config()->set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
-               DI::config()->set('system', 'verifyssl'              , $verifyssl);
-               DI::config()->set('system', 'proxyuser'              , $proxyuser);
-               DI::config()->set('system', 'proxy'                  , $proxy);
-               DI::config()->set('system', 'curl_timeout'           , $timeout);
-               DI::config()->set('system', 'imap_disabled'          , !$mail_enabled && function_exists('imap_open'));
-               DI::config()->set('system', 'ostatus_disabled'       , !$ostatus_enabled);
-               DI::config()->set('system', 'diaspora_enabled'       , $diaspora_enabled);
-
-               DI::config()->set('config', 'private_addons'         , $private_addons);
-
-               DI::config()->set('system', 'force_ssl'              , $force_ssl);
-               DI::config()->set('system', 'hide_help'              , !$show_help);
-
-               DI::config()->set('system', 'dbclean'                , $dbclean);
-               DI::config()->set('system', 'dbclean-expire-days'    , $dbclean_expire_days);
-               DI::config()->set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
+               if (preg_match('/\d+(?:\s*[kmg])?/i', $maximagesize)) {
+                       $transactionConfig->set('system', 'maximagesize', $maximagesize);
+               } else {
+                       DI::sysmsg()->addNotice(DI::l10n()->t('%s is no valid input for maximum image size', $maximagesize));
+               }
+               $transactionConfig->set('system', 'max_image_length'       , $maximagelength);
+               $transactionConfig->set('system', 'jpeg_quality'           , $jpegimagequality);
+
+               $transactionConfig->set('config', 'register_policy'        , $register_policy);
+               $transactionConfig->set('config', 'max_registered_users'   , $max_registered_users);
+               $transactionConfig->set('system', 'max_daily_registrations', $daily_registrations);
+
+               User::setRegisterMethodByUserCount();
+
+               $transactionConfig->set('system', 'account_abandon_days'   , $abandon_days);
+               $transactionConfig->set('config', 'register_text'          , $register_text);
+               $transactionConfig->set('system', 'allowed_sites'          , $allowed_sites);
+               $transactionConfig->set('system', 'allowed_email'          , $allowed_email);
+               $transactionConfig->set('system', 'forbidden_nicknames'    , $forbidden_nicknames);
+               $transactionConfig->set('system', 'system_actor_name'      , $system_actor_name);
+               $transactionConfig->set('system', 'no_oembed_rich_content' , $no_oembed_rich_content);
+               $transactionConfig->set('system', 'allowed_oembed'         , $allowed_oembed);
+               $transactionConfig->set('system', 'block_public'           , $block_public);
+               $transactionConfig->set('system', 'publish_all'            , $force_publish);
+               $transactionConfig->set('system', 'newuser_private'        , $newuser_private);
+               $transactionConfig->set('system', 'enotify_no_content'     , $enotify_no_content);
+               $transactionConfig->set('system', 'disable_embedded'       , $disable_embedded);
+               $transactionConfig->set('system', 'allow_users_remote_self', $allow_users_remote_self);
+               $transactionConfig->set('system', 'explicit_content'       , $explicit_content);
+               $transactionConfig->set('system', 'proxify_content'        , $proxify_content);
+               $transactionConfig->set('system', 'cache_contact_avatar'   , $cache_contact_avatar);
+               $transactionConfig->set('system', 'check_new_version_url'  , $check_new_version_url);
+
+               $transactionConfig->set('system', 'block_extended_register', !$enable_multi_reg);
+               $transactionConfig->set('system', 'no_openid'              , !$enable_openid);
+               $transactionConfig->set('system', 'no_regfullname'         , !$enable_regfullname);
+               $transactionConfig->set('system', 'register_notification'  , $register_notification);
+               $transactionConfig->set('system', 'community_page_style'   , $community_page_style);
+               $transactionConfig->set('system', 'max_author_posts_community_page', $max_author_posts_community_page);
+               $transactionConfig->set('system', 'verifyssl'              , $verifyssl);
+               $transactionConfig->set('system', 'proxyuser'              , $proxyuser);
+               $transactionConfig->set('system', 'proxy'                  , $proxy);
+               $transactionConfig->set('system', 'curl_timeout'           , $timeout);
+               $transactionConfig->set('system', 'imap_disabled'          , !$mail_enabled && function_exists('imap_open'));
+               $transactionConfig->set('system', 'ostatus_disabled'       , !$ostatus_enabled);
+               $transactionConfig->set('system', 'diaspora_enabled'       , $diaspora_enabled);
+
+               $transactionConfig->set('config', 'private_addons'         , $private_addons);
+
+               $transactionConfig->set('system', 'force_ssl'              , $force_ssl);
+               $transactionConfig->set('system', 'hide_help'              , !$show_help);
+
+               $transactionConfig->set('system', 'dbclean'                , $dbclean);
+               $transactionConfig->set('system', 'dbclean-expire-days'    , $dbclean_expire_days);
+               $transactionConfig->set('system', 'dbclean_expire_conversation', $dbclean_expire_conv);
 
                if ($dbclean_unclaimed == 0) {
                        $dbclean_unclaimed = $dbclean_expire_days;
                }
 
-               DI::config()->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
+               $transactionConfig->set('system', 'dbclean-expire-unclaimed', $dbclean_unclaimed);
 
-               DI::config()->set('system', 'max_comments', $max_comments);
-               DI::config()->set('system', 'max_display_comments', $max_display_comments);
+               $transactionConfig->set('system', 'max_comments', $max_comments);
+               $transactionConfig->set('system', 'max_display_comments', $max_display_comments);
 
                if ($temppath != '') {
                        $temppath = BasePath::getRealPath($temppath);
                }
 
-               DI::config()->set('system', 'temppath', $temppath);
+               $transactionConfig->set('system', 'temppath', $temppath);
+
+               $transactionConfig->set('system', 'only_tag_search'  , $only_tag_search);
+               $transactionConfig->set('system', 'compute_circle_counts', $compute_circle_counts);
 
-               DI::config()->set('system', 'only_tag_search'  , $only_tag_search);
-               DI::config()->set('system', 'compute_group_counts', $compute_group_counts);
+               $transactionConfig->set('system', 'worker_queues'    , $worker_queues);
+               $transactionConfig->set('system', 'worker_fastlane'  , $worker_fastlane);
 
-               DI::config()->set('system', 'worker_queues'    , $worker_queues);
-               DI::config()->set('system', 'worker_fastlane'  , $worker_fastlane);
+               $transactionConfig->set('system', 'relay_directly'   , $relay_directly);
+               $transactionConfig->set('system', 'relay_scope'      , $relay_scope);
+               $transactionConfig->set('system', 'relay_server_tags', $relay_server_tags);
+               $transactionConfig->set('system', 'relay_deny_tags'  , $relay_deny_tags);
+               $transactionConfig->set('system', 'relay_user_tags'  , $relay_user_tags);
 
-               DI::config()->set('system', 'relay_directly'   , $relay_directly);
-               DI::config()->set('system', 'relay_scope'      , $relay_scope);
-               DI::config()->set('system', 'relay_server_tags', $relay_server_tags);
-               DI::config()->set('system', 'relay_deny_tags'  , $relay_deny_tags);
-               DI::config()->set('system', 'relay_user_tags'  , $relay_user_tags);
+               $transactionConfig->commit();
 
                DI::baseUrl()->redirect('admin/site' . $active_panel);
        }
@@ -326,8 +301,8 @@ class Site extends BaseAdmin
                /* Installed langs */
                $lang_choices = DI::l10n()->getAvailableLanguages();
 
-               if (strlen(DI::config()->get('system', 'directory_submit_url')) &&
-                       !strlen(DI::config()->get('system', 'directory'))) {
+               if (DI::config()->get('system', 'directory_submit_url') &&
+                       !DI::config()->get('system', 'directory')) {
                        DI::config()->set('system', 'directory', dirname(DI::config()->get('system', 'directory_submit_url')));
                        DI::config()->delete('system', 'directory_submit_url');
                }
@@ -364,11 +339,11 @@ class Site extends BaseAdmin
 
                /* Community page style */
                $community_page_style_choices = [
-                       CP_NO_INTERNAL_COMMUNITY => DI::l10n()->t('No community page for local users'),
-                       CP_NO_COMMUNITY_PAGE => DI::l10n()->t('No community page'),
-                       CP_USERS_ON_SERVER => DI::l10n()->t('Public postings from users of this site'),
-                       CP_GLOBAL_COMMUNITY => DI::l10n()->t('Public postings from the federated network'),
-                       CP_USERS_AND_GLOBAL => DI::l10n()->t('Public postings from local users and the federated network')
+                       Community::DISABLED         => DI::l10n()->t('No community page'),
+                       Community::DISABLED_VISITOR => DI::l10n()->t('No community page for visitors'),
+                       Community::LOCAL            => DI::l10n()->t('Public postings from users of this site'),
+                       Community::GLOBAL           => DI::l10n()->t('Public postings from the federated network'),
+                       Community::LOCAL_AND_GLOBAL => DI::l10n()->t('Public postings from local users and the federated network')
                ];
 
                /* get user names to make the install a personal install of X */
@@ -384,10 +359,6 @@ class Site extends BaseAdmin
                /* Banner */
                $banner = DI::config()->get('system', 'banner');
 
-               if ($banner == false) {
-                       $banner = '<a href="https://friendi.ca"><img id="logo-img" width="32" height="32" src="images/friendica.svg" alt="logo" /></a><span id="logo-text"><a href="https://friendi.ca">Friendica</a></span>';
-               }
-
                $email_banner = DI::config()->get('system', 'email_banner');
 
                if ($email_banner == false) {
@@ -406,12 +377,6 @@ class Site extends BaseAdmin
                        Register::OPEN => DI::l10n()->t('Open')
                ];
 
-               $ssl_choices = [
-                       App\BaseURL::SSL_POLICY_NONE => DI::l10n()->t('No SSL policy, links will track page SSL state'),
-                       App\BaseURL::SSL_POLICY_FULL => DI::l10n()->t('Force all links to use SSL'),
-                       App\BaseURL::SSL_POLICY_SELFSIGN => DI::l10n()->t('Self-signed certificate, use SSL for local links only (discouraged)')
-               ];
-
                $check_git_version_choices = [
                        'none' => DI::l10n()->t('Don\'t check'),
                        'stable' => DI::l10n()->t('check the stable version'),
@@ -426,7 +391,7 @@ class Site extends BaseAdmin
                        // ContactRelation::DISCOVERY_ALL => DI::l10n()->t('All'),
                ];
 
-               $diaspora_able = (DI::baseUrl()->getUrlPath() == '');
+               $diaspora_able = (DI::baseUrl()->getPath() == '');
 
                $t = Renderer::getMarkupTemplate('admin/site.tpl');
                return Renderer::replaceMacros($t, [
@@ -450,10 +415,9 @@ class Site extends BaseAdmin
                        '$relocate'          => DI::l10n()->t('Relocate Node'),
                        '$relocate_msg'      => DI::l10n()->t('Relocating your node enables you to change the DNS domain of this node and keep all the existing users and posts. This process takes a while and can only be started from the relocate console command like this:'),
                        '$relocate_cmd'      => DI::l10n()->t('(Friendica directory)# bin/console relocate https://newdomain.com'),
-                       '$baseurl'           => DI::baseUrl()->get(true),
 
                        // name, label, value, help string, extra data...
-                       '$sitename'         => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), ''],
+                       '$sitename'         => ['sitename', DI::l10n()->t('Site name'), DI::config()->get('config', 'sitename'), !DI::config()->isWritable('config', 'sitename') ? DI::l10n()->t('<strong>Read-only</strong> because it is set by an environment variable') : '', '', !DI::config()->isWritable('config', 'sitename') ? 'disabled' : ''],
                        '$sender_email'     => ['sender_email', DI::l10n()->t('Sender Email'), DI::config()->get('config', 'sender_email'), DI::l10n()->t('The email address your server shall use to send notification emails from.'), '', '', 'email'],
                        '$system_actor_name' => ['system_actor_name', DI::l10n()->t('Name of the system actor'), User::getActorName(), DI::l10n()->t("Name of the internal system account that is used to perform ActivityPub requests. This must be an unused username. If set, this can't be changed again.")],
                        '$banner'           => ['banner', DI::l10n()->t('Banner/Logo'), $banner, ''],
@@ -461,19 +425,22 @@ class Site extends BaseAdmin
                        '$shortcut_icon'    => ['shortcut_icon', DI::l10n()->t('Shortcut icon'), DI::config()->get('system', 'shortcut_icon'), DI::l10n()->t('Link to an icon that will be used for browsers.')],
                        '$touch_icon'       => ['touch_icon', DI::l10n()->t('Touch icon'), DI::config()->get('system', 'touch_icon'), DI::l10n()->t('Link to an icon that will be used for tablets and mobiles.')],
                        '$additional_info'  => ['additional_info', DI::l10n()->t('Additional Info'), $additional_info, DI::l10n()->t('For public servers: you can add additional information here that will be listed at %s/servers.', Search::getGlobalDirectory())],
-                       '$language'         => ['language', DI::l10n()->t('System language'), DI::config()->get('system', 'language'), '', $lang_choices],
-                       '$theme'            => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::l10n()->t('Default system theme - may be over-ridden by user profiles - <a href="%s" id="cnftheme">Change default theme settings</a>', DI::baseUrl()->get(true) . '/admin/themes'), $theme_choices],
+                       '$language'         => ['language', DI::l10n()->t('System language'), DI::config()->get('system', 'language'), !DI::config()->isWritable('system', 'language') ? DI::l10n()->t("<strong>Read-only</strong> because it is set by an environment variable") : '', $lang_choices, !DI::config()->isWritable('system', 'language') ? 'disabled' : ''],
+                       '$theme'            => ['theme', DI::l10n()->t('System theme'), DI::config()->get('system', 'theme'), DI::l10n()->t('Default system theme - may be over-ridden by user profiles - <a href="%s" id="cnftheme">Change default theme settings</a>', DI::baseUrl() . '/admin/themes'), $theme_choices],
                        '$theme_mobile'     => ['theme_mobile', DI::l10n()->t('Mobile system theme'), DI::config()->get('system', 'mobile-theme', '---'), DI::l10n()->t('Theme for mobile devices'), $theme_choices_mobile],
-                       '$ssl_policy'       => ['ssl_policy', DI::l10n()->t('SSL link policy'), DI::config()->get('system', 'ssl_policy'), DI::l10n()->t('Determines whether generated links should be forced to use SSL'), $ssl_choices],
                        '$force_ssl'        => ['force_ssl', DI::l10n()->t('Force SSL'), DI::config()->get('system', 'force_ssl'), DI::l10n()->t('Force all Non-SSL requests to SSL - Attention: on some systems it could lead to endless loops.')],
                        '$show_help'        => ['show_help', DI::l10n()->t('Show help entry from navigation menu'), !DI::config()->get('system', 'hide_help'), DI::l10n()->t('Displays the menu entry for the Help pages from the navigation menu. It is always accessible by calling /help directly.')],
                        '$singleuser'       => ['singleuser', DI::l10n()->t('Single user instance'), DI::config()->get('system', 'singleuser', '---'), DI::l10n()->t('Make this instance multi-user or single-user for the named user'), $user_names],
 
-                       '$maximagesize'     => ['maximagesize', DI::l10n()->t('Maximum image size'), DI::config()->get('system', 'maximagesize'), DI::l10n()->t('Maximum size in bytes of uploaded images. Default is 0, which means no limits.')],
+                       '$maximagesize'     => ['maximagesize', DI::l10n()->t('Maximum image size'), DI::config()->get('system', 'maximagesize'), DI::l10n()->t('Maximum size in bytes of uploaded images. Default is 0, which means no limits. You can put k, m, or g behind the desired value for KiB, MiB, GiB, respectively.
+                                                                                                       The value of <code>upload_max_filesize</code> in your <code>PHP.ini</code> needs be set to at least the desired limit.
+                                                                                                       Currently <code>upload_max_filesize</code> is set to %s (%s byte)', Strings::formatBytes(Strings::getBytesFromShorthand(ini_get('upload_max_filesize'))), Strings::getBytesFromShorthand(ini_get('upload_max_filesize'))),
+                                                                                                       '', 'pattern="\d+(?:\s*[kmg])?"'],
                        '$maximagelength'   => ['maximagelength', DI::l10n()->t('Maximum image length'), DI::config()->get('system', 'max_image_length'), DI::l10n()->t('Maximum length in pixels of the longest side of uploaded images. Default is -1, which means no limits.')],
                        '$jpegimagequality' => ['jpegimagequality', DI::l10n()->t('JPEG image quality'), DI::config()->get('system', 'jpeg_quality'), DI::l10n()->t('Uploaded JPEGS will be saved at this quality setting [0-100]. Default is 100, which is full quality.')],
 
                        '$register_policy'        => ['register_policy', DI::l10n()->t('Register policy'), DI::config()->get('config', 'register_policy'), '', $register_choices],
+                       '$max_registered_users'   => ['max_registered_users', DI::l10n()->t('Maximum Users'), DI::config()->get('config', 'max_registered_users'), DI::l10n()->t('If defined, the register policy is automatically closed when the given number of users is reached and reopens the registry when the number drops below the limit. It only works when the policy is set to open or close, but not when the policy is set to approval.')],
                        '$daily_registrations'    => ['max_daily_registrations', DI::l10n()->t('Maximum Daily Registrations'), DI::config()->get('system', 'max_daily_registrations'), DI::l10n()->t('If registration is permitted above, this sets the maximum number of new user registrations to accept per day.  If register is set to closed, this setting has no effect.')],
                        '$register_text'          => ['register_text', DI::l10n()->t('Register text'), DI::config()->get('config', 'register_text'), DI::l10n()->t('Will be displayed prominently on the registration page. You can use BBCode here.')],
                        '$forbidden_nicknames'    => ['forbidden_nicknames', DI::l10n()->t('Forbidden Nicknames'), DI::config()->get('system', 'forbidden_nicknames'), DI::l10n()->t('Comma separated list of nicknames that are forbidden from registration. Preset is a list of role names according RFC 2142.')],
@@ -485,7 +452,7 @@ class Site extends BaseAdmin
                        '$block_public'           => ['block_public', DI::l10n()->t('Block public'), DI::config()->get('system', 'block_public'), DI::l10n()->t('Check to block public access to all otherwise public personal pages on this site unless you are currently logged in.')],
                        '$force_publish'          => ['publish_all', DI::l10n()->t('Force publish'), DI::config()->get('system', 'publish_all'), DI::l10n()->t('Check to force all profiles on this site to be listed in the site directory.') . '<strong>' . DI::l10n()->t('Enabling this may violate privacy laws like the GDPR') . '</strong>'],
                        '$global_directory'       => ['directory', DI::l10n()->t('Global directory URL'), DI::config()->get('system', 'directory'), DI::l10n()->t('URL to the global directory. If this is not set, the global directory is completely unavailable to the application.')],
-                       '$newuser_private'        => ['newuser_private', DI::l10n()->t('Private posts by default for new users'), DI::config()->get('system', 'newuser_private'), DI::l10n()->t('Set default post permissions for all new members to the default privacy group rather than public.')],
+                       '$newuser_private'        => ['newuser_private', DI::l10n()->t('Private posts by default for new users'), DI::config()->get('system', 'newuser_private'), DI::l10n()->t('Set default post permissions for all new members to the default privacy circle rather than public.')],
                        '$enotify_no_content'     => ['enotify_no_content', DI::l10n()->t('Don\'t include post content in email notifications'), DI::config()->get('system', 'enotify_no_content'), DI::l10n()->t('Don\'t include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.')],
                        '$private_addons'         => ['private_addons', DI::l10n()->t('Disallow public access to addons listed in the apps menu.'), DI::config()->get('config', 'private_addons'), DI::l10n()->t('Checking this box will restrict addons listed in the apps menu to members only.')],
                        '$disable_embedded'       => ['disable_embedded', DI::l10n()->t('Don\'t embed private images in posts'), DI::config()->get('system', 'disable_embedded'), DI::l10n()->t('Don\'t replace locally-hosted private photos in posts with an embedded copy of the image. This means that contacts who receive posts containing private photos will have to authenticate and load each image, which may take a while.')],
@@ -496,6 +463,7 @@ class Site extends BaseAdmin
                        '$enable_multi_reg'       => ['enable_multi_reg', DI::l10n()->t('Enable multiple registrations'), !DI::config()->get('system', 'block_extended_register'), DI::l10n()->t('Enable users to register additional accounts for use as pages.')],
                        '$enable_openid'          => ['enable_openid', DI::l10n()->t('Enable OpenID'), !DI::config()->get('system', 'no_openid'), DI::l10n()->t('Enable OpenID support for registration and logins.')],
                        '$enable_regfullname'     => ['enable_regfullname', DI::l10n()->t('Enable Fullname check'), !DI::config()->get('system', 'no_regfullname'), DI::l10n()->t('Enable check to only allow users to register with a space between the first name and the last name in their full name.')],
+                       '$register_notification'  => ['register_notification', DI::l10n()->t('Email administrators on new registration'), DI::config()->get('system', 'register_notification'), DI::l10n()->t('If enabled and the system is set to an open registration, an email for each new registration is sent to the administrators.')],
                        '$community_page_style'   => ['community_page_style', DI::l10n()->t('Community pages for visitors'), DI::config()->get('system', 'community_page_style'), DI::l10n()->t('Which community pages should be available for visitors. Local users always see both pages.'), $community_page_style_choices],
                        '$max_author_posts_community_page' => ['max_author_posts_community_page', DI::l10n()->t('Posts per user on community page'), DI::config()->get('system', 'max_author_posts_community_page'), DI::l10n()->t('The maximum number of posts per user on the community page. (Not valid for "Global Community")')],
                        '$mail_able'              => function_exists('imap_open'),
@@ -536,7 +504,7 @@ class Site extends BaseAdmin
                        '$max_display_comments'   => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')],
                        '$temppath'               => ['temppath', DI::l10n()->t('Temp path'), DI::config()->get('system', 'temppath'), DI::l10n()->t('If you have a restricted system where the webserver can\'t access the system temp path, enter another path here.')],
                        '$only_tag_search'        => ['only_tag_search', DI::l10n()->t('Only search in tags'), DI::config()->get('system', 'only_tag_search'), DI::l10n()->t('On large systems the text search can slow down the system extremely.')],
-                       '$compute_group_counts'   => ['compute_group_counts', DI::l10n()->t('Generate counts per contact group when calculating network count'), DI::config()->get('system', 'compute_group_counts'), DI::l10n()->t('On systems with users that heavily use contact groups the query can be very expensive.')],
+                       '$compute_circle_counts'   => ['compute_circle_counts', DI::l10n()->t('Generate counts per contact circle when calculating network count'), DI::config()->get('system', 'compute_group_counts') ?? DI::config()->get('system', 'compute_circle_counts'), DI::l10n()->t('On systems with users that heavily use contact circles the query can be very expensive.')],
 
                        '$worker_queues'          => ['worker_queues', DI::l10n()->t('Maximum number of parallel workers'), DI::config()->get('system', 'worker_queues'), DI::l10n()->t('On shared hosters set this to %d. On larger systems, values of %d are great. Default value is %d.', 5, 20, 10)],
                        '$worker_fastlane'        => ['worker_fastlane', DI::l10n()->t('Enable fastlane'), DI::config()->get('system', 'worker_fastlane'), DI::l10n()->t('When enabed, the fastlane mechanism starts an additional worker if processes with higher priority are blocked by processes of lower priority.')],