]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
New function to keep the self contact updated
[friendica.git] / mod / settings.php
index 2d8d3a60514b25d3dd9c1eae037bc4eb18b1ac59..3edad6945c02d6497398b2975373d3881e5fc561 100644 (file)
@@ -13,10 +13,14 @@ use Friendica\Core\PConfig;
 use Friendica\Core\System;
 use Friendica\Core\Worker;
 use Friendica\Database\DBM;
+use Friendica\Model\Contact;
 use Friendica\Model\GContact;
 use Friendica\Model\Group;
 use Friendica\Model\User;
 use Friendica\Protocol\Email;
+use Friendica\Util\DateTimeFormat;
+use Friendica\Util\Network;
+use Friendica\Util\Temporal;
 
 function get_theme_config_file($theme)
 {
@@ -204,8 +208,7 @@ function settings_post(App $a)
                return;
        }
 
-       if (($a->argc > 1) && ($a->argv[1] == 'connectors'))
-       {
+       if (($a->argc > 1) && ($a->argv[1] == 'connectors')) {
                check_form_security_token_redirectOnErr('/settings/connectors', 'settings_connectors');
 
                if (x($_POST, 'general-submit')) {
@@ -482,10 +485,7 @@ function settings_post(App $a)
 
        $err = '';
 
-       $name_change = false;
-
        if ($username != $a->user['username']) {
-               $name_change = true;
                if (strlen($username) > 40) {
                        $err .= L10n::t(' Please use a shorter name.');
                }
@@ -535,9 +535,8 @@ function settings_post(App $a)
 
        // If openid has changed or if there's an openid but no openidserver, try and discover it.
        if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
-               if (validate_url($openid)) {
+               if (Network::isUrlValid($openid)) {
                        logger('updating openidserver');
-                       require_once 'library/openid.php';
                        $open_id_obj = new LightOpenID;
                        $open_id_obj->identity = $openid;
                        $openidserver = $open_id_obj->discover($open_id_obj->identity);
@@ -626,14 +625,7 @@ function settings_post(App $a)
                intval(local_user())
        );
 
-
-       if ($name_change) {
-               q("UPDATE `contact` SET `name` = '%s', `name-date` = '%s' WHERE `uid` = %d AND `self`",
-                       dbesc($username),
-                       dbesc(datetime_convert()),
-                       intval(local_user())
-               );
-       }
+       Contact::updateSelfFromUserID(local_user());
 
        if (($old_visibility != $net_publish) || ($page_flags != $old_page_flags)) {
                // Update global directory in background
@@ -804,7 +796,7 @@ function settings_content(App $a)
 
                if (is_site_admin()) {
                        $diasp_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('Diaspora'), ((Config::get('system', 'diaspora_enabled')) ? L10n::t('enabled') : L10n::t('disabled')));
-                       $ostat_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t('GNU Social (OStatus)'), ((Config::get('system', 'ostatus_disabled')) ? L10n::t('disabled') : L10n::t('enabled')));
+                       $ostat_enabled = L10n::t('Built-in support for %s connectivity is %s', L10n::t("GNU Social \x28OStatus\x29"), ((Config::get('system', 'ostatus_disabled')) ? L10n::t('disabled') : L10n::t('enabled')));
                } else {
                        $diasp_enabled = "";
                        $ostat_enabled = "";
@@ -847,9 +839,9 @@ function settings_content(App $a)
 
                        '$general_settings' => L10n::t('General Social Media Settings'),
                        '$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 (OStatus) 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.')],
+                       '$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 (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')],
+                       '$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_text' => L10n::t('Repair OStatus subscriptions'),
@@ -911,9 +903,9 @@ function settings_content(App $a)
                                if (!$is_experimental || ($is_experimental && (Config::get('experimentals', 'exp_themes')==1 || is_null(Config::get('experimentals', 'exp_themes'))))) {
                                        $theme_name = ucfirst($theme);
                                        if ($is_unsupported) {
-                                               $theme_name = L10n::t("%s - (Unsupported)", $theme_name);
+                                               $theme_name = L10n::t("%s - \x28Unsupported\x29", $theme_name);
                                        } elseif ($is_experimental) {
-                                               $theme_name = L10n::t("%s - (Experimental)", $theme_name);
+                                               $theme_name = L10n::t("%s - \x28Experimental\x29", $theme_name);
                                        }
                                        if ($is_mobile) {
                                                $mobile_themes[$theme] = $theme_name;
@@ -1104,40 +1096,40 @@ function settings_content(App $a)
                $profile_in_dir = '<input type="hidden" name="profile_in_directory" value="1" />';
        } else {
                $profile_in_dir = replace_macros($opt_tpl, [
-                       '$field' => ['profile_in_directory', L10n::t('Publish your default profile in your local site directory?'), $profile['publish'], L10n::t("Your profile may be visible in public."), [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 the global friendica directories (e.g. <a href="%s">%s</a>). Your profile will be visible in public.', Config::get('system', 'directory'), Config::get('system', 'directory')), [L10n::t('No'), L10n::t('Yes')]]
                ]);
        }
 
        if (strlen(Config::get('system', 'directory'))) {
                $profile_in_net_dir = replace_macros($opt_tpl, [
-                       '$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-publish'], '', [L10n::t('No'), L10n::t('Yes')]]
+                       '$field' => ['profile_in_netdirectory', L10n::t('Publish your default profile in the global social directory?'), $profile['net-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')]]
                ]);
        } else {
                $profile_in_net_dir = '';
        }
 
        $hide_friends = replace_macros($opt_tpl, [
-               '$field' => ['hide-friends', L10n::t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], '', [L10n::t('No'), L10n::t('Yes')]],
+               '$field' => ['hide-friends', L10n::t('Hide your contact/friend list from viewers of your default profile?'), $profile['hide-friends'], L10n::t('Your contact list won\'t be shown in your default profile page. You can decide to show your contact list separately for each additional profile you create'), [L10n::t('No'), L10n::t('Yes')]],
        ]);
 
        $hide_wall = replace_macros($opt_tpl, [
-               '$field' => ['hidewall', L10n::t('Hide your profile details from unknown viewers?'), $a->user['hidewall'], L10n::t("If enabled, posting public messages to Diaspora and other networks isn't possible."), [L10n::t('No'), L10n::t('Yes')]],
+               '$field' => ['hidewall', L10n::t('Hide your profile details from anonymous viewers?'), $a->user['hidewall'], L10n::t('Anonymous visitors will only see your profile picture, your display name and the nickname you are using on your profile page. Disables posting public messages to Diaspora and other networks.'), [L10n::t('No'), L10n::t('Yes')]],
        ]);
 
        $blockwall = replace_macros($opt_tpl, [
-               '$field' => ['blockwall', L10n::t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), '', [L10n::t('No'), L10n::t('Yes')]],
+               '$field' => ['blockwall', L10n::t('Allow friends to post to your profile page?'), (intval($a->user['blockwall']) ? '0' : '1'), L10n::t('Your contacts may write posts on your profile wall. These posts will be distributed to your contacts'), [L10n::t('No'), L10n::t('Yes')]],
        ]);
 
        $blocktags = replace_macros($opt_tpl, [
-               '$field' => ['blocktags', L10n::t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), '', [L10n::t('No'), L10n::t('Yes')]],
+               '$field' => ['blocktags', L10n::t('Allow friends to tag your posts?'), (intval($a->user['blocktags']) ? '0' : '1'), L10n::t('Your contacts can add additional tags to your posts.'), [L10n::t('No'), L10n::t('Yes')]],
        ]);
 
        $suggestme = replace_macros($opt_tpl, [
-               '$field' => ['suggestme', L10n::t('Allow us to suggest you as a potential friend to new members?'), $suggestme, '', [L10n::t('No'), L10n::t('Yes')]],
+               '$field' => ['suggestme', L10n::t('Allow us to suggest you as a potential friend to new members?'), $suggestme, L10n::t('If you like, Friendica may suggest new members to add you as a contact.'), [L10n::t('No'), L10n::t('Yes')]],
        ]);
 
        $unkmail = replace_macros($opt_tpl, [
-               '$field' => ['unkmail', L10n::t('Permit unknown people to send you private mail?'), $unkmail, '', [L10n::t('No'), L10n::t('Yes')]],
+               '$field' => ['unkmail', L10n::t('Permit unknown people to send you private mail?'), $unkmail, L10n::t('Friendica network users may send you private messages even if they are not in your contact list.'), [L10n::t('No'), L10n::t('Yes')]],
        ]);
 
        if (!$profile['publish'] && !$profile['net-publish']) {
@@ -1210,7 +1202,7 @@ function settings_content(App $a)
                '$h_basic'      => L10n::t('Basic Settings'),
                '$username' => ['username',  L10n::t('Full Name:'), $username, ''],
                '$email'        => ['email', L10n::t('Email Address:'), $email, '', '', '', 'email'],
-               '$timezone' => ['timezone_select' , L10n::t('Your Timezone:'), select_timezone($timezone), ''],
+               '$timezone' => ['timezone_select' , L10n::t('Your Timezone:'), Temporal::getTimezoneSelect($timezone), ''],
                '$language' => ['language', L10n::t('Your Language:'), $language, L10n::t('Set the language we use to show you friendica interface and to send you emails'), $lang_choices],
                '$defloc'       => ['defloc', L10n::t('Default Post Location:'), $defloc, ''],
                '$allowloc' => ['allow_location', L10n::t('Use Browser Location:'), ($a->user['allow_location'] == 1), ''],