]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Issue 7285: Perform duplicate check for item URI also with AP
[friendica.git] / mod / settings.php
index efb601f4d24f1c6e66123cb377387be75169121e..af4f7e2cab5544702d2cb6700e247bb1660e8426 100644 (file)
@@ -28,6 +28,7 @@ use Friendica\Protocol\Email;
 use Friendica\Util\Network;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
+use Friendica\Worker\Delivery;
 
 function get_theme_config_file($theme)
 {
@@ -233,6 +234,7 @@ function settings_post(App $a)
                BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors');
 
                if (!empty($_POST['general-submit'])) {
+                       PConfig::set(local_user(), 'system', 'accept_only_sharer', intval($_POST['accept_only_sharer']));
                        PConfig::set(local_user(), 'system', 'disable_cw', intval($_POST['disable_cw']));
                        PConfig::set(local_user(), 'system', 'no_intelligent_shortening', intval($_POST['no_intelligent_shortening']));
                        PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
@@ -368,19 +370,19 @@ function settings_post(App $a)
                PConfig::set(local_user(), 'system', 'bandwidth_saver'         , $bandwidth_saver);
                PConfig::set(local_user(), 'system', 'smart_threading'         , $smart_threading);
 
-               if ($theme == $a->user['theme']) {
-                       // call theme_post only if theme has not been changed
-                       if (($themeconfigfile = get_theme_config_file($theme)) !== null) {
-                               require_once $themeconfigfile;
-                               theme_post($a);
+               if (in_array($theme, Theme::getAllowedList())) {
+                       if ($theme == $a->user['theme']) {
+                               // call theme_post only if theme has not been changed
+                               if (($themeconfigfile = get_theme_config_file($theme)) !== null) {
+                                       require_once $themeconfigfile;
+                                       theme_post($a);
+                               }
+                       } else {
+                               DBA::update('user', ['theme' => $theme], ['uid' => local_user()]);
                        }
+               } else {
+                       notice(L10n::t('The theme you chose isn\'t available.'));
                }
-               Theme::install($theme);
-
-               q("UPDATE `user` SET `theme` = '%s' WHERE `uid` = %d",
-                               DBA::escape($theme),
-                               intval(local_user())
-               );
 
                Hook::callAll('display_settings_post', $_POST);
                $a->internalRedirect('settings/display');
@@ -390,7 +392,7 @@ function settings_post(App $a)
        BaseModule::checkFormSecurityTokenRedirectOnError('/settings', 'settings');
 
        if (!empty($_POST['resend_relocate'])) {
-               Worker::add(PRIORITY_HIGH, 'Notifier', 'relocate', local_user());
+               Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
                info(L10n::t("Relocate message has been send to your contacts"));
                $a->internalRedirect('settings');
        }
@@ -785,6 +787,7 @@ function settings_content(App $a)
        }
 
        if (($a->argc > 1) && ($a->argv[1] === 'connectors')) {
+               $accept_only_sharer        = intval(PConfig::get(local_user(), 'system', 'accept_only_sharer'));
                $disable_cw                = intval(PConfig::get(local_user(), 'system', 'disable_cw'));
                $no_intelligent_shortening = intval(PConfig::get(local_user(), 'system', 'no_intelligent_shortening'));
                $ostatus_autofriend        = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend'));
@@ -843,6 +846,7 @@ function settings_content(App $a)
                        '$ostat_enabled' => $ostat_enabled,
 
                        '$general_settings' => L10n::t('General Social Media Settings'),
+                       '$accept_only_sharer' => ['accept_only_sharer', L10n::t('Accept only top level posts by contacts you follow'), $accept_only_sharer, L10n::t('The system does an auto completion of threads when a comment arrives. This has got the side effect that you can receive posts that had been started by a non-follower but had been commented by someone you follow. This setting deactivates this behaviour. When activated, you strictly only will receive posts from people you really do follow.')],
                        '$disable_cw' => ['disable_cw', L10n::t('Disable Content Warning'), $disable_cw, L10n::t('Users on networks like Mastodon or Pleroma are able to set a content warning field which collapse their post by default. This disables the automatic collapsing and sets the content warning as the post title. Doesn\'t affect any other content filtering you eventually set up.')],
                        '$no_intelligent_shortening' => ['no_intelligent_shortening', L10n::t('Disable intelligent shortening'), $no_intelligent_shortening, L10n::t('Normally the system tries to find the best link to add to shortened posts. If this option is enabled then every shortened post will always point to the original friendica post.')],
                        '$ostatus_autofriend' => ['snautofollow', L10n::t("Automatically follow any GNU Social \x28OStatus\x29 followers/mentioners"), $ostatus_autofriend, L10n::t('If you receive a message from an unknown OStatus user, this option decides what to do. If it is checked, a new contact will be created for every unknown user.')],
@@ -911,7 +915,7 @@ function settings_content(App $a)
                        }
                }
 
-               $theme_selected        = Session::get('theme', $default_theme);
+               $theme_selected        = $a->user['theme'] ?: $default_theme;
                $mobile_theme_selected = Session::get('mobile-theme', $default_mobile_theme);
 
                $nowarn_insecure = intval(PConfig::get(local_user(), 'system', 'nowarn_insecure'));