]> git.mxchange.org Git - friendica.git/blobdiff - mod/settings.php
Merge pull request #10644 from annando/issue-10640
[friendica.git] / mod / settings.php
index 5ad884e883c4a980302ee27026964206c5b375c3..8f48f66862732fca1753abeb9d2c3c0e6a82eb12 100644 (file)
@@ -69,7 +69,7 @@ function settings_post(App $a)
                return;
        }
 
-       $user = User::getById($a->getUserId());
+       $user = User::getById($a->getLoggedInUserId());
 
        if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'connectors')) {
                BaseModule::checkFormSecurityTokenRedirectOnError('/settings/connectors', 'settings_connectors');
@@ -92,11 +92,7 @@ function settings_post(App $a)
                        $mail_replyto      =                 $_POST['mail_replyto']      ?? '';
                        $mail_pubmail      =                 $_POST['mail_pubmail']      ?? '';
 
-                       if (
-                               !DI::config()->get('system', 'dfrn_only')
-                               && function_exists('imap_open')
-                               && !DI::config()->get('system', 'imap_disabled')
-                       ) {
+                       if (function_exists('imap_open') && !DI::config()->get('system', 'imap_disabled')) {
                                $failed = false;
                                $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                        intval(local_user())
@@ -262,6 +258,9 @@ function settings_post(App $a)
        $unlisted         = (($_POST['unlisted'] == 1) ? 1: 0);
        $accessiblephotos = (($_POST['accessible-photos'] == 1) ? 1: 0);
 
+       $notify_like      = (($_POST['notify_like'] == 1) ? 1 : 0);
+       $notify_announce  = (($_POST['notify_announce'] == 1) ? 1 : 0);
+
        $email_textonly   = (($_POST['email_textonly'] == 1) ? 1 : 0);
        $detailed_notif   = (($_POST['detailed_notif'] == 1) ? 1 : 0);
 
@@ -358,6 +357,9 @@ function settings_post(App $a)
        DI::pConfig()->set(local_user(), 'expire', 'photos', $expire_photos);
        DI::pConfig()->set(local_user(), 'expire', 'network_only', $expire_network_only);
 
+       DI::pConfig()->set(local_user(), 'system', 'notify_like', $notify_like);
+       DI::pConfig()->set(local_user(), 'system', 'notify_announce', $notify_announce);
+
        DI::pConfig()->set(local_user(), 'system', 'email_textonly', $email_textonly);
        DI::pConfig()->set(local_user(), 'system', 'detailed_notif', $detailed_notif);
        DI::pConfig()->set(local_user(), 'system', 'notify_ignored', $notify_ignored);
@@ -507,9 +509,6 @@ function settings_content(App $a)
                }
 
                $mail_disabled = ((function_exists('imap_open') && (!DI::config()->get('system', 'imap_disabled'))) ? 0 : 1);
-               if (DI::config()->get('system', 'dfrn_only')) {
-                       $mail_disabled = 1;
-               }
                if (!$mail_disabled) {
                        $r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
                                local_user()
@@ -590,11 +589,11 @@ function settings_content(App $a)
                return;
        }
 
-       $user = User::getById($a->getUserId());
+       $user = User::getById($a->getLoggedInUserId());
 
        $username   = $user['username'];
        $email      = $user['email'];
-       $nickname   = $a->getUserNickname();
+       $nickname   = $a->getLoggedInUserNickname();
        $timezone   = $user['timezone'];
        $language   = $user['language'];
        $notify     = $user['notify-flags'];
@@ -748,7 +747,7 @@ function settings_content(App $a)
                '$cntunkmail'         => ['cntunkmail', DI::l10n()->t('Maximum private messages per day from unknown people:'), $cntunkmail , DI::l10n()->t("\x28to prevent spam abuse\x29")],
                '$group_select'       => Group::displayGroupSelection(local_user(), $user['def_gid']),
                '$permissions'        => DI::l10n()->t('Default Post Permissions'),
-               '$aclselect'          => ACL::getFullSelectorHTML(DI::page(), $a->getUserId()),
+               '$aclselect'          => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()),
 
                '$expire' => [
                        'label'        => DI::l10n()->t('Expiration settings'),
@@ -771,6 +770,10 @@ function settings_content(App $a)
                '$notify7'  => ['notify7', DI::l10n()->t('You are tagged in a post'), ($notify & Notification\Type::TAG_SELF), Notification\Type::TAG_SELF, ''],
                '$notify8'  => ['notify8', DI::l10n()->t('You are poked/prodded/etc. in a post'), ($notify & Notification\Type::POKE), Notification\Type::POKE, ''],
 
+               '$lbl_notify'      => DI::l10n()->t('Create a desktop notification when:'),
+               '$notify_like'     => ['notify_like', DI::l10n()->t('Someone liked your content'), DI::pConfig()->get(local_user(), 'system', 'notify_like'), ''],
+               '$notify_announce' => ['notify_announce', DI::l10n()->t('Someone shared your content'), DI::pConfig()->get(local_user(), 'system', 'notify_announce'), ''],
+
                '$desktop_notifications' => ['desktop_notifications', DI::l10n()->t('Activate desktop notifications') , false, DI::l10n()->t('Show desktop popup on new notifications')],
 
                '$email_textonly' => ['email_textonly', DI::l10n()->t('Text-only notification emails'),