]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Merge pull request #8117 from annando/inbox
[friendica.git] / mod / settings.php
index be121f6a78e51b197b6b939cb909e73535e769ae..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\Login;
+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')
        ]);
 
@@ -131,8 +128,8 @@ function settings_init(App $a)
 
        $tabs[] =       [
                'label' => L10n::t('Export personal data'),
-               'url' => 'uexport',
-               'selected' => (($a->argc == 1) && ($a->argv[0] === 'uexport')?'active':''),
+               'url' => 'settings/userexport',
+               'selected' => (($a->argc > 1) && ($a->argv[1] === 'userexport')?'active':''),
                'accesskey' => 'e',
        ];
 
@@ -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;
        }
 
@@ -239,6 +236,7 @@ function settings_post(App $a)
                        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', 'attach_link_title', intval($_POST['attach_link_title']));
                        PConfig::set(local_user(), 'system', 'ostatus_autofriend', intval($_POST['snautofollow']));
                        PConfig::set(local_user(), 'ostatus', 'default_group', $_POST['group-selection']);
                        PConfig::set(local_user(), 'ostatus', 'legacy_contact', $_POST['legacy_contact']);
@@ -326,17 +324,17 @@ function settings_post(App $a)
        if (($a->argc > 1) && ($a->argv[1] === 'display')) {
                BaseModule::checkFormSecurityTokenRedirectOnError('/settings/display', 'settings_display');
 
-               $theme             = !empty($_POST['theme'])             ? Strings::escapeTags(trim($_POST['theme']))        : $a->user['theme'];
-               $mobile_theme      = !empty($_POST['mobile_theme'])      ? Strings::escapeTags(trim($_POST['mobile_theme'])) : '';
-               $nosmile           = !empty($_POST['nosmile'])           ? intval($_POST['nosmile'])            : 0;
-               $first_day_of_week = !empty($_POST['first_day_of_week']) ? intval($_POST['first_day_of_week'])  : 0;
-               $noinfo            = !empty($_POST['noinfo'])            ? intval($_POST['noinfo'])             : 0;
-               $infinite_scroll   = !empty($_POST['infinite_scroll'])   ? intval($_POST['infinite_scroll'])    : 0;
-               $no_auto_update    = !empty($_POST['no_auto_update'])    ? intval($_POST['no_auto_update'])     : 0;
-               $bandwidth_saver   = !empty($_POST['bandwidth_saver'])   ? intval($_POST['bandwidth_saver'])    : 0;
-               $smart_threading   = !empty($_POST['smart_threading'])   ? intval($_POST['smart_threading'])    : 0;
-               $nowarn_insecure   = !empty($_POST['nowarn_insecure'])   ? intval($_POST['nowarn_insecure'])    : 0;
-               $browser_update    = !empty($_POST['browser_update'])    ? intval($_POST['browser_update'])     : 0;
+               $theme              = !empty($_POST['theme'])              ? Strings::escapeTags(trim($_POST['theme']))        : $a->user['theme'];
+               $mobile_theme       = !empty($_POST['mobile_theme'])       ? Strings::escapeTags(trim($_POST['mobile_theme'])) : '';
+               $nosmile            = !empty($_POST['nosmile'])            ? intval($_POST['nosmile'])            : 0;
+               $first_day_of_week  = !empty($_POST['first_day_of_week'])  ? intval($_POST['first_day_of_week'])  : 0;
+               $noinfo             = !empty($_POST['noinfo'])             ? intval($_POST['noinfo'])             : 0;
+               $infinite_scroll    = !empty($_POST['infinite_scroll'])    ? intval($_POST['infinite_scroll'])    : 0;
+               $no_auto_update     = !empty($_POST['no_auto_update'])     ? intval($_POST['no_auto_update'])     : 0;
+               $bandwidth_saver    = !empty($_POST['bandwidth_saver'])    ? intval($_POST['bandwidth_saver'])    : 0;
+               $no_smart_threading = !empty($_POST['no_smart_threading']) ? intval($_POST['no_smart_threading']) : 0;
+               $nowarn_insecure    = !empty($_POST['nowarn_insecure'])    ? intval($_POST['nowarn_insecure'])    : 0;
+               $browser_update     = !empty($_POST['browser_update'])     ? intval($_POST['browser_update'])     : 0;
                if ($browser_update != -1) {
                        $browser_update = $browser_update * 1000;
                        if ($browser_update < 10000) {
@@ -367,7 +365,7 @@ function settings_post(App $a)
                PConfig::set(local_user(), 'system', 'infinite_scroll'         , $infinite_scroll);
                PConfig::set(local_user(), 'system', 'no_auto_update'          , $no_auto_update);
                PConfig::set(local_user(), 'system', 'bandwidth_saver'         , $bandwidth_saver);
-               PConfig::set(local_user(), 'system', 'smart_threading'         , $smart_threading);
+               PConfig::set(local_user(), 'system', 'no_smart_threading'      , $no_smart_threading);
 
                if (in_array($theme, Theme::getAllowedList())) {
                        if ($theme == $a->user['theme']) {
@@ -384,16 +382,43 @@ function settings_post(App $a)
                }
 
                Hook::callAll('display_settings_post', $_POST);
-               $a->internalRedirect('settings/display');
+               DI::baseUrl()->redirect('settings/display');
                return; // NOTREACHED
        }
 
        BaseModule::checkFormSecurityTokenRedirectOnError('/settings', 'settings');
 
+       // Import Contacts from CSV file
+       if (!empty($_POST['importcontact-submit'])) {
+               if (isset($_FILES['importcontact-filename'])) {
+                       // was there an error
+                       if ($_FILES['importcontact-filename']['error'] > 0) {
+                               Logger::notice('Contact CSV file upload error');
+                               info(L10n::t('Contact CSV file upload error'));
+                       } else {
+                               $csvArray = array_map('str_getcsv', file($_FILES['importcontact-filename']['tmp_name']));
+                               // import contacts
+                               foreach ($csvArray as $csvRow) {
+                                       // The 1st row may, or may not contain the headers of the table
+                                       // We expect the 1st field of the row to contain either the URL
+                                       // or the handle of the account, therefore we check for either
+                                       // "http" or "@" to be present in the string.
+                                       // All other fields from the row will be ignored
+                                       if ((strpos($csvRow[0],'@') !== false) || (strpos($csvRow[0],'http') !== false)) {
+                                               $arr = Contact::createFromProbe($_SESSION['uid'], $csvRow[0], '', false);
+                                       }
+                               }
+                               info(L10n::t('Importing Contacts done'));
+                               // delete temp file
+                               unlink($filename);
+                       }
+               }
+       }
+
        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);
@@ -536,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']) : '';
@@ -569,14 +593,15 @@ function settings_post(App $a)
 
        $fields = ['username' => $username, 'email' => $email, 'timezone' => $timezone,
                'allow_cid' => $str_contact_allow, 'allow_gid' => $str_group_allow, 'deny_cid' => $str_contact_deny, 'deny_gid' => $str_group_deny,
-               'notify-flags' => $notify, 'page-flags' => $notify, 'account-type' => $account_type, 'default-location' => $defloc,
+               'notify-flags' => $notify, 'page-flags' => $page_flags, 'account-type' => $account_type, 'default-location' => $defloc,
                'allow_location' => $allow_location, 'maxreq' => $maxreq, 'expire' => $expire, 'def_gid' => $def_gid, 'blockwall' => $blockwall,
-               'hidewall' => $hide_wall, 'blocktags' => $blocktags, 'unkmail' => $unkmail, 'cntunkmail' => $cntunkmail, 'language' => $language];
+               'hidewall' => $hidewall, 'blocktags' => $blocktags, 'unkmail' => $unkmail, 'cntunkmail' => $cntunkmail, 'language' => $language];
 
        if ($delete_openid) {
                $fields['openid'] = '';
                $fields['openidserver'] = '';
        }
+
        if (DBA::update('user', $fields, ['uid' => local_user()])) {
                info(L10n::t('Settings updated.') . EOL);
        }
@@ -612,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
 }
 
@@ -679,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;
                }
 
@@ -695,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'),
@@ -754,13 +779,14 @@ function settings_content(App $a)
                $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'));
+               $attach_link_title         = intval(PConfig::get(local_user(), 'system', 'attach_link_title'));
                $ostatus_autofriend        = intval(PConfig::get(local_user(), 'system', 'ostatus_autofriend'));
                $default_group             = PConfig::get(local_user(), 'ostatus', 'default_group');
                $legacy_contact            = PConfig::get(local_user(), 'ostatus', 'legacy_contact');
 
                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 = '';
@@ -799,7 +825,13 @@ function settings_content(App $a)
 
                $tpl = Renderer::getMarkupTemplate('settings/connectors.tpl');
 
-               $mail_disabled_message = (($mail_disabled) ? L10n::t('Email access is disabled on this site.') : '');
+               $mail_disabled_message = ($mail_disabled ? L10n::t('Email access is disabled on this site.') : '');
+
+               $ssl_options = ['TLS' => 'TLS', 'SSL' => 'SSL'];
+
+               if (Config::get('system', 'insecure_imap')) {
+                       $ssl_options['notls'] = L10n::t('None');
+               }
 
                $o .= Renderer::replaceMacros($tpl, [
                        '$form_security_token' => BaseModule::getFormSecurityToken("settings_connectors"),
@@ -813,11 +845,12 @@ function settings_content(App $a)
                        '$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.')],
+                       '$attach_link_title' => ['attach_link_title', L10n::t('Attach the link title'), $attach_link_title, L10n::t('When activated, the title of the attached link will be added as a title on posts to Diaspora. This is mostly helpful with "remote-self" contacts that share feed content.')],
                        '$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.')],
                        '$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,
@@ -826,15 +859,15 @@ function settings_content(App $a)
                        '$imap_desc' => L10n::t("If you wish to communicate with email contacts using this service \x28optional\x29, please specify how to connect to your mailbox."),
                        '$imap_lastcheck' => ['imap_lastcheck', L10n::t('Last successful email check:'), $mail_chk, ''],
                        '$mail_disabled' => $mail_disabled_message,
-                       '$mail_server'  => ['mail_server',  L10n::t('IMAP server name:'), $mail_server, ''],
-                       '$mail_port'    => ['mail_port',         L10n::t('IMAP port:'), $mail_port, ''],
-                       '$mail_ssl'             => ['mail_ssl',          L10n::t('Security:'), strtoupper($mail_ssl), '', ['notls'=>L10n::t('None'), 'TLS'=>'TLS', 'SSL'=>'SSL']],
-                       '$mail_user'    => ['mail_user',    L10n::t('Email login name:'), $mail_user, ''],
-                       '$mail_pass'    => ['mail_pass',         L10n::t('Email password:'), '', ''],
-                       '$mail_replyto' => ['mail_replyto', L10n::t('Reply-to address:'), $mail_replyto, 'Optional'],
-                       '$mail_pubmail' => ['mail_pubmail', L10n::t('Send public posts to all email contacts:'), $mail_pubmail, ''],
-                       '$mail_action'  => ['mail_action',       L10n::t('Action after import:'), $mail_action, '', [0=>L10n::t('None'), /*1=>L10n::t('Delete'),*/ 2=>L10n::t('Mark as seen'), 3=>L10n::t('Move to folder')]],
-                       '$mail_movetofolder'    => ['mail_movetofolder',         L10n::t('Move to folder:'), $mail_movetofolder, ''],
+                       '$mail_server'  => ['mail_server',      L10n::t('IMAP server name:'), $mail_server, ''],
+                       '$mail_port'    => ['mail_port',        L10n::t('IMAP port:'), $mail_port, ''],
+                       '$mail_ssl'     => ['mail_ssl',         L10n::t('Security:'), strtoupper($mail_ssl), '', $ssl_options],
+                       '$mail_user'    => ['mail_user',        L10n::t('Email login name:'), $mail_user, ''],
+                       '$mail_pass'    => ['mail_pass',        L10n::t('Email password:'), '', ''],
+                       '$mail_replyto' => ['mail_replyto',     L10n::t('Reply-to address:'), $mail_replyto, 'Optional'],
+                       '$mail_pubmail' => ['mail_pubmail',     L10n::t('Send public posts to all email contacts:'), $mail_pubmail, ''],
+                       '$mail_action'  => ['mail_action',      L10n::t('Action after import:'), $mail_action, '', [0 => L10n::t('None'), 1 => L10n::t('Delete'), 2 => L10n::t('Mark as seen'), 3 => L10n::t('Move to folder')]],
+                       '$mail_movetofolder' => ['mail_movetofolder', L10n::t('Move to folder:'), $mail_movetofolder, ''],
                        '$submit' => L10n::t('Save Settings'),
                ]);
 
@@ -902,7 +935,7 @@ function settings_content(App $a)
                $infinite_scroll = PConfig::get(local_user(), 'system', 'infinite_scroll', 0);
                $no_auto_update = PConfig::get(local_user(), 'system', 'no_auto_update', 0);
                $bandwidth_saver = PConfig::get(local_user(), 'system', 'bandwidth_saver', 0);
-               $smart_threading = PConfig::get(local_user(), 'system', 'smart_threading', 0);
+               $no_smart_threading = PConfig::get(local_user(), 'system', 'no_smart_threading', 0);
 
                $theme_config = "";
                if (($themeconfigfile = get_theme_config_file($theme_selected)) !== null) {
@@ -915,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],
@@ -931,7 +964,7 @@ function settings_content(App $a)
                        '$infinite_scroll'      => ['infinite_scroll', L10n::t("Infinite scroll"), $infinite_scroll, ''],
                        '$no_auto_update'       => ['no_auto_update', L10n::t("Automatic updates only at the top of the network page"), $no_auto_update, L10n::t('When disabled, the network page is updated all the time, which could be confusing while reading.')],
                        '$bandwidth_saver' => ['bandwidth_saver', L10n::t('Bandwidth Saver Mode'), $bandwidth_saver, L10n::t('When enabled, embedded content is not displayed on automatic updates, they only show on page reload.')],
-                       '$smart_threading' => ['smart_threading', L10n::t('Smart Threading'), $smart_threading, L10n::t('When enabled, suppress extraneous thread indentation while keeping it where it matters. Only works if threading is available and enabled.')],
+                       '$no_smart_threading' => ['no_smart_threading', L10n::t('Disable Smart Threading'), $no_smart_threading, L10n::t('Disable the automatic suppression of extraneous thread indentation.')],
 
                        '$d_tset' => L10n::t('General Theme Settings'),
                        '$d_ctset' => L10n::t('Custom Theme Settings'),
@@ -1050,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')]]
                ]);
        }
 
@@ -1093,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');
@@ -1118,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);
        }
@@ -1140,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,
@@ -1169,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->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, ''),
@@ -1222,6 +1255,10 @@ function settings_content(App $a)
                '$h_descadvn' => L10n::t('Change the behaviour of this account for special situations'),
                '$pagetype' => $pagetype,
 
+               '$importcontact' => L10n::t('Import Contacts'),
+               '$importcontact_text' => 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' => L10n::t('Upload File'),
+               '$importcontact_maxsize' => Config::get('system', 'max_csv_file_size', 30720), 
                '$relocate' => L10n::t('Relocate'),
                '$relocate_text' => 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' => L10n::t("Resend relocate message to contacts"),