]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Merge pull request #8117 from annando/inbox
[friendica.git] / mod / settings.php
index ad83b682104f76093b516ac22bbc63428dbef178..4f44e9a00ed58530ad2dbac54bfbbe2ed2ae5e1e 100644 (file)
@@ -5,7 +5,6 @@
 
 use Friendica\App;
 use Friendica\BaseModule;
-use Friendica\BaseObject;
 use Friendica\Content\Feature;
 use Friendica\Content\Nav;
 use Friendica\Core\ACL;
@@ -16,18 +15,16 @@ use Friendica\Core\Logger;
 use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\Core\Session;
-use Friendica\Core\System;
 use Friendica\Core\Theme;
 use Friendica\Core\Worker;
 use Friendica\Database\DBA;
+use Friendica\DI;
 use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\Model\Group;
 use Friendica\Model\User;
 use Friendica\Module\Security\Login;
 use Friendica\Protocol\Email;
-use Friendica\Util\ACLFormatter;
-use Friendica\Util\Network;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 use Friendica\Worker\Delivery;
@@ -36,7 +33,7 @@ function get_theme_config_file($theme)
 {
        $theme = Strings::sanitizeFilePathItem($theme);
 
-       $a = \get_app();
+       $a = DI::app();
        $base_theme = $a->theme_info['extends'] ?? '';
 
        if (file_exists("view/theme/$theme/config.php")) {
@@ -58,7 +55,7 @@ function settings_init(App $a)
        // These lines provide the javascript needed by the acl selector
 
        $tpl = Renderer::getMarkupTemplate('settings/head.tpl');
-       $a->page['htmlhead'] .= Renderer::replaceMacros($tpl, [
+       DI::page()['htmlhead'] .= Renderer::replaceMacros($tpl, [
                '$ispublic' => L10n::t('everybody')
        ]);
 
@@ -145,7 +142,7 @@ function settings_init(App $a)
 
 
        $tabtpl = Renderer::getMarkupTemplate("generic_links_widget.tpl");
-       $a->page['aside'] = Renderer::replaceMacros($tabtpl, [
+       DI::page()['aside'] = Renderer::replaceMacros($tabtpl, [
                '$title' => L10n::t('Settings'),
                '$class' => 'settings-widget',
                '$items' => $tabs,
@@ -175,7 +172,7 @@ function settings_post(App $a)
 
                $key = $_POST['remove'];
                DBA::delete('tokens', ['id' => $key, 'uid' => local_user()]);
-               $a->internalRedirect('settings/oauth/', true);
+               DI::baseUrl()->redirect('settings/oauth/', true);
                return;
        }
 
@@ -221,7 +218,7 @@ function settings_post(App $a)
                                );
                        }
                }
-               $a->internalRedirect('settings/oauth/', true);
+               DI::baseUrl()->redirect('settings/oauth/', true);
                return;
        }
 
@@ -385,7 +382,7 @@ function settings_post(App $a)
                }
 
                Hook::callAll('display_settings_post', $_POST);
-               $a->internalRedirect('settings/display');
+               DI::baseUrl()->redirect('settings/display');
                return; // NOTREACHED
        }
 
@@ -421,7 +418,7 @@ function settings_post(App $a)
        if (!empty($_POST['resend_relocate'])) {
                Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::RELOCATION, local_user());
                info(L10n::t("Relocate message has been send to your contacts"));
-               $a->internalRedirect('settings');
+               DI::baseUrl()->redirect('settings');
        }
 
        Hook::callAll('settings_post', $_POST);
@@ -564,8 +561,7 @@ function settings_post(App $a)
                date_default_timezone_set($timezone);
        }
 
-       /** @var ACLFormatter $aclFormatter */
-       $aclFormatter = BaseObject::getClass(ACLFormatter::class);
+       $aclFormatter = DI::aclFormatter();
 
        $str_group_allow   = !empty($_POST['group_allow'])   ? $aclFormatter->toString($_POST['group_allow'])   : '';
        $str_contact_allow = !empty($_POST['contact_allow']) ? $aclFormatter->toString($_POST['contact_allow']) : '';
@@ -641,7 +637,7 @@ function settings_post(App $a)
        // Update the global contact for the user
        GContact::updateForUser(local_user());
 
-       $a->internalRedirect('settings');
+       DI::baseUrl()->redirect('settings');
        return; // NOTREACHED
 }
 
@@ -708,7 +704,7 @@ function settings_content(App $a)
                        BaseModule::checkFormSecurityTokenRedirectOnError('/settings/oauth', 'settings_oauth', 't');
 
                        DBA::delete('clients', ['client_id' => $a->argv[3], 'uid' => local_user()]);
-                       $a->internalRedirect('settings/oauth/', true);
+                       DI::baseUrl()->redirect('settings/oauth/', true);
                        return;
                }
 
@@ -724,7 +720,7 @@ function settings_content(App $a)
                $tpl = Renderer::getMarkupTemplate('settings/oauth.tpl');
                $o .= Renderer::replaceMacros($tpl, [
                        '$form_security_token' => BaseModule::getFormSecurityToken("settings_oauth"),
-                       '$baseurl'      => $a->getBaseURL(true),
+                       '$baseurl'      => DI::baseUrl()->get(true),
                        '$title'        => L10n::t('Connected Apps'),
                        '$add'          => L10n::t('Add application'),
                        '$edit'         => L10n::t('Edit'),
@@ -790,7 +786,7 @@ function settings_content(App $a)
 
                if (!empty($legacy_contact)) {
                        /// @todo Isn't it supposed to be a $a->internalRedirect() call?
-                       $a->page['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . System::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
+                       DI::page()['htmlhead'] = '<meta http-equiv="refresh" content="0; URL=' . DI::baseUrl().'/ostatus_subscribe?url=' . urlencode($legacy_contact) . '">';
                }
 
                $settings_connectors = '';
@@ -854,7 +850,7 @@ function settings_content(App $a)
                        '$default_group' => Group::displayGroupSelection(local_user(), $default_group, L10n::t("Default group for OStatus contacts")),
                        '$legacy_contact' => ['legacy_contact', L10n::t('Your legacy GNU Social account'), $legacy_contact, L10n::t("If you enter your old GNU Social/Statusnet account name here \x28in the format user@domain.tld\x29, your contacts will be added automatically. The field will be emptied when done.")],
 
-                       '$repair_ostatus_url' => System::baseUrl() . '/repair_ostatus',
+                       '$repair_ostatus_url' => DI::baseUrl() . '/repair_ostatus',
                        '$repair_ostatus_text' => L10n::t('Repair OStatus subscriptions'),
 
                        '$settings_connectors' => $settings_connectors,
@@ -952,7 +948,7 @@ function settings_content(App $a)
                        '$ptitle'       => L10n::t('Display Settings'),
                        '$form_security_token' => BaseModule::getFormSecurityToken("settings_display"),
                        '$submit'       => L10n::t('Save Settings'),
-                       '$baseurl' => System::baseUrl(true),
+                       '$baseurl' => DI::baseUrl()->get(true),
                        '$uid' => local_user(),
 
                        '$theme'        => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes, true],
@@ -1087,7 +1083,7 @@ function settings_content(App $a)
                $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
        } else {
                $profile_in_dir = Renderer::replaceMacros($opt_tpl, [
-                       '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', System::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
+                       '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t('Your profile will be published in this node\'s <a href="%s">local directory</a>. Your profile details may be publicly visible depending on the system settings.', DI::baseUrl().'/directory'), [L10n::t('No'), L10n::t('Yes')]]
                ]);
        }
 
@@ -1130,8 +1126,8 @@ function settings_content(App $a)
        $tpl_addr = Renderer::getMarkupTemplate('settings/nick_set.tpl');
 
        $prof_addr = Renderer::replaceMacros($tpl_addr,[
-               '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname),
-               '$basepath' => $a->getHostName()
+               '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . DI::baseUrl()->getHostname() . DI::baseUrl()->getUrlPath(), DI::baseUrl() . '/profile/' . $nickname),
+               '$basepath' => DI::baseUrl()->getHostname()
        ]);
 
        $stpl = Renderer::getMarkupTemplate('settings/settings.tpl');
@@ -1155,7 +1151,7 @@ function settings_content(App $a)
                $private_post = 0;
        }
 
-       $query_str = $a->query_string;
+       $query_str = DI::args()->getQueryString();
        if (strpos($query_str, 'public=1') !== false) {
                $query_str = str_replace(['?public=1', '&public=1'], ['', ''], $query_str);
        }
@@ -1177,7 +1173,7 @@ function settings_content(App $a)
                '$ptitle'       => L10n::t('Account Settings'),
 
                '$submit'       => L10n::t('Save Settings'),
-               '$baseurl' => System::baseUrl(true),
+               '$baseurl' => DI::baseUrl()->get(true),
                '$uid' => local_user(),
                '$form_security_token' => BaseModule::getFormSecurityToken("settings"),
                '$nickname_block' => $prof_addr,
@@ -1206,7 +1202,7 @@ function settings_content(App $a)
                '$permissions' => L10n::t('Default Post Permissions'),
                '$permdesc' => L10n::t("\x28click to open/close\x29"),
                '$visibility' => $profile['net-publish'],
-               '$aclselect' => ACL::getFullSelectorHTML($a->page, $a->user),
+               '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->user),
                '$suggestme' => $suggestme,
                '$blockwall'=> $blockwall, // array('blockwall', L10n::t('Allow friends to post to your profile page:'), !$blockwall, ''),
                '$blocktags'=> $blocktags, // array('blocktags', L10n::t('Allow friends to tag your posts:'), !$blocktags, ''),