]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Merge pull request #5904 from annando/ap-announce
[friendica.git] / mod / settings.php
index aec0334d71eb1207c460a50a4c3f453aeea88497..5632193e3bddcf4255713060a28ac05e2d98bbd8 100644 (file)
@@ -22,6 +22,7 @@ use Friendica\Model\User;
 use Friendica\Protocol\Email;
 use Friendica\Util\Network;
 use Friendica\Util\Temporal;
+use Friendica\Module\Login;
 
 function get_theme_config_file($theme)
 {
@@ -481,14 +482,14 @@ function settings_post(App $a)
        }
 
        // Adjust the page flag if the account type doesn't fit to the page flag.
-       if (($account_type == ACCOUNT_TYPE_PERSON) && !in_array($page_flags, [PAGE_NORMAL, PAGE_SOAPBOX, PAGE_FREELOVE])) {
-               $page_flags = PAGE_NORMAL;
-       } elseif (($account_type == ACCOUNT_TYPE_ORGANISATION) && !in_array($page_flags, [PAGE_SOAPBOX])) {
-               $page_flags = PAGE_SOAPBOX;
-       } elseif (($account_type == ACCOUNT_TYPE_NEWS) && !in_array($page_flags, [PAGE_SOAPBOX])) {
-               $page_flags = PAGE_SOAPBOX;
-       } elseif (($account_type == ACCOUNT_TYPE_COMMUNITY) && !in_array($page_flags, [PAGE_COMMUNITY, PAGE_PRVGROUP])) {
-               $page_flags = PAGE_COMMUNITY;
+       if (($account_type == Contact::ACCOUNT_TYPE_PERSON) && !in_array($page_flags, [Contact::PAGE_NORMAL, Contact::PAGE_SOAPBOX, Contact::PAGE_FREELOVE])) {
+               $page_flags = Contact::PAGE_NORMAL;
+       } elseif (($account_type == Contact::ACCOUNT_TYPE_ORGANISATION) && !in_array($page_flags, [Contact::PAGE_SOAPBOX])) {
+               $page_flags = Contact::PAGE_SOAPBOX;
+       } elseif (($account_type == Contact::ACCOUNT_TYPE_NEWS) && !in_array($page_flags, [Contact::PAGE_SOAPBOX])) {
+               $page_flags = Contact::PAGE_SOAPBOX;
+       } elseif (($account_type == Contact::ACCOUNT_TYPE_COMMUNITY) && !in_array($page_flags, [Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP])) {
+               $page_flags = Contact::PAGE_COMMUNITY;
        }
 
        $email_changed = false;
@@ -546,7 +547,7 @@ function settings_post(App $a)
        if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
                if (Network::isUrlValid($openid)) {
                        logger('updating openidserver');
-                       $open_id_obj = new LightOpenID($a->get_hostname());
+                       $open_id_obj = new LightOpenID($a->getHostName());
                        $open_id_obj->identity = $openid;
                        $openidserver = $open_id_obj->discover($open_id_obj->identity);
                } else {
@@ -565,7 +566,7 @@ function settings_post(App $a)
        PConfig::set(local_user(), 'system', 'email_textonly', $email_textonly);
        PConfig::set(local_user(), 'system', 'detailed_notif', $detailed_notif);
 
-       if ($page_flags == PAGE_PRVGROUP) {
+       if ($page_flags == Contact::PAGE_PRVGROUP) {
                $hidewall = 1;
                if (!$str_contact_allow && !$str_group_allow && !$str_contact_deny && !$str_group_deny) {
                        if ($def_gid) {
@@ -658,7 +659,7 @@ function settings_content(App $a)
 
        if (!local_user()) {
                //notice(L10n::t('Permission denied.') . EOL);
-               return;
+               return Login::form();
        }
 
        if (x($_SESSION, 'submanage') && intval($_SESSION['submanage'])) {
@@ -982,11 +983,6 @@ function settings_content(App $a)
                        '$theme_config' => $theme_config,
                ]);
 
-               $tpl = get_markup_template('settings/display_end.tpl');
-               $a->page['end'] .= replace_macros($tpl, [
-                       '$theme'        => ['theme', L10n::t('Display Theme:'), $theme_selected, '', $themes]
-               ]);
-
                return $o;
        }
 
@@ -1029,9 +1025,9 @@ function settings_content(App $a)
 
        // Set the account type to "Community" when the page is a community page but the account type doesn't fit
        // This is only happening on the first visit after the update
-       if (in_array($a->user['page-flags'], [PAGE_COMMUNITY, PAGE_PRVGROUP]) &&
-               ($a->user['account-type'] != ACCOUNT_TYPE_COMMUNITY))
-               $a->user['account-type'] = ACCOUNT_TYPE_COMMUNITY;
+       if (in_array($a->user['page-flags'], [Contact::PAGE_COMMUNITY, Contact::PAGE_PRVGROUP]) &&
+               ($a->user['account-type'] != Contact::ACCOUNT_TYPE_COMMUNITY))
+               $a->user['account-type'] = Contact::ACCOUNT_TYPE_COMMUNITY;
 
        $pageset_tpl = get_markup_template('settings/pagetypes.tpl');
 
@@ -1040,46 +1036,46 @@ function settings_content(App $a)
                '$user'                 => L10n::t("Personal Page Subtypes"),
                '$community'            => L10n::t("Community Forum Subtypes"),
                '$account_type'         => $a->user['account-type'],
-               '$type_person'          => ACCOUNT_TYPE_PERSON,
-               '$type_organisation'    => ACCOUNT_TYPE_ORGANISATION,
-               '$type_news'            => ACCOUNT_TYPE_NEWS,
-               '$type_community'       => ACCOUNT_TYPE_COMMUNITY,
+               '$type_person'          => Contact::ACCOUNT_TYPE_PERSON,
+               '$type_organisation'    => Contact::ACCOUNT_TYPE_ORGANISATION,
+               '$type_news'            => Contact::ACCOUNT_TYPE_NEWS,
+               '$type_community'       => Contact::ACCOUNT_TYPE_COMMUNITY,
 
-               '$account_person'       => ['account-type', L10n::t('Personal Page'), ACCOUNT_TYPE_PERSON,
+               '$account_person'       => ['account-type', L10n::t('Personal Page'), Contact::ACCOUNT_TYPE_PERSON,
                                                                        L10n::t('Account for a personal profile.'),
-                                                                       ($a->user['account-type'] == ACCOUNT_TYPE_PERSON)],
+                                                                       ($a->user['account-type'] == Contact::ACCOUNT_TYPE_PERSON)],
 
-               '$account_organisation' => ['account-type', L10n::t('Organisation Page'), ACCOUNT_TYPE_ORGANISATION,
+               '$account_organisation' => ['account-type', L10n::t('Organisation Page'), Contact::ACCOUNT_TYPE_ORGANISATION,
                                                                        L10n::t('Account for an organisation that automatically approves contact requests as "Followers".'),
-                                                                       ($a->user['account-type'] == ACCOUNT_TYPE_ORGANISATION)],
+                                                                       ($a->user['account-type'] == Contact::ACCOUNT_TYPE_ORGANISATION)],
 
-               '$account_news'         => ['account-type', L10n::t('News Page'), ACCOUNT_TYPE_NEWS,
+               '$account_news'         => ['account-type', L10n::t('News Page'), Contact::ACCOUNT_TYPE_NEWS,
                                                                        L10n::t('Account for a news reflector that automatically approves contact requests as "Followers".'),
-                                                                       ($a->user['account-type'] == ACCOUNT_TYPE_NEWS)],
+                                                                       ($a->user['account-type'] == Contact::ACCOUNT_TYPE_NEWS)],
 
-               '$account_community'    => ['account-type', L10n::t('Community Forum'), ACCOUNT_TYPE_COMMUNITY,
+               '$account_community'    => ['account-type', L10n::t('Community Forum'), Contact::ACCOUNT_TYPE_COMMUNITY,
                                                                        L10n::t('Account for community discussions.'),
-                                                                       ($a->user['account-type'] == ACCOUNT_TYPE_COMMUNITY)],
+                                                                       ($a->user['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY)],
 
-               '$page_normal'          => ['page-flags', L10n::t('Normal Account Page'), PAGE_NORMAL,
+               '$page_normal'          => ['page-flags', L10n::t('Normal Account Page'), Contact::PAGE_NORMAL,
                                                                        L10n::t('Account for a regular personal profile that requires manual approval of "Friends" and "Followers".'),
-                                                                       ($a->user['page-flags'] == PAGE_NORMAL)],
+                                                                       ($a->user['page-flags'] == Contact::PAGE_NORMAL)],
 
-               '$page_soapbox'         => ['page-flags', L10n::t('Soapbox Page'), PAGE_SOAPBOX,
+               '$page_soapbox'         => ['page-flags', L10n::t('Soapbox Page'), Contact::PAGE_SOAPBOX,
                                                                        L10n::t('Account for a public profile that automatically approves contact requests as "Followers".'),
-                                                                       ($a->user['page-flags'] == PAGE_SOAPBOX)],
+                                                                       ($a->user['page-flags'] == Contact::PAGE_SOAPBOX)],
 
-               '$page_community'       => ['page-flags', L10n::t('Public Forum'), PAGE_COMMUNITY,
+               '$page_community'       => ['page-flags', L10n::t('Public Forum'), Contact::PAGE_COMMUNITY,
                                                                        L10n::t('Automatically approves all contact requests.'),
-                                                                       ($a->user['page-flags'] == PAGE_COMMUNITY)],
+                                                                       ($a->user['page-flags'] == Contact::PAGE_COMMUNITY)],
 
-               '$page_freelove'        => ['page-flags', L10n::t('Automatic Friend Page'), PAGE_FREELOVE,
+               '$page_freelove'        => ['page-flags', L10n::t('Automatic Friend Page'), Contact::PAGE_FREELOVE,
                                                                        L10n::t('Account for a popular profile that automatically approves contact requests as "Friends".'),
-                                                                       ($a->user['page-flags'] == PAGE_FREELOVE)],
+                                                                       ($a->user['page-flags'] == Contact::PAGE_FREELOVE)],
 
-               '$page_prvgroup'        => ['page-flags', L10n::t('Private Forum [Experimental]'), PAGE_PRVGROUP,
+               '$page_prvgroup'        => ['page-flags', L10n::t('Private Forum [Experimental]'), Contact::PAGE_PRVGROUP,
                                                                        L10n::t('Requires manual approval of contact requests.'),
-                                                                       ($a->user['page-flags'] == PAGE_PRVGROUP)],
+                                                                       ($a->user['page-flags'] == Contact::PAGE_PRVGROUP)],
 
 
        ]);
@@ -1140,8 +1136,8 @@ function settings_content(App $a)
        $tpl_addr = get_markup_template('settings/nick_set.tpl');
 
        $prof_addr = replace_macros($tpl_addr,[
-               '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->get_hostname() . $a->get_path(), System::baseUrl() . '/profile/' . $nickname),
-               '$basepath' => $a->get_hostname()
+               '$desc' => L10n::t("Your Identity Address is <strong>'%s'</strong> or '%s'.", $nickname . '@' . $a->getHostName() . $a->getURLPath(), System::baseUrl() . '/profile/' . $nickname),
+               '$basepath' => $a->getHostName()
        ]);
 
        $stpl = get_markup_template('settings/settings.tpl');