function settings_post(App $a)
{
- if (!local_user()) {
+ if (!$a->isLoggedIn()) {
+ notice(DI::l10n()->t('Permission denied.'));
return;
}
return;
}
- if (empty($a->getUserId()) || $a->getUserId() != local_user()) {
- notice(DI::l10n()->t('Permission denied.'));
- return;
- }
-
if ((DI::args()->getArgc() > 1) && (DI::args()->getArgv()[1] == 'addon')) {
BaseModule::checkFormSecurityTokenRedirectOnError('/settings/addon', 'settings_addon');
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');
$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);
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);
return;
}
- $user = User::getById($a->getUserId());
+ $user = User::getById($a->getLoggedInUserId());
$username = $user['username'];
$email = $user['email'];
- $nickname = $a->getNickname();
+ $nickname = $a->getLoggedInUserNickname();
$timezone = $user['timezone'];
$language = $user['language'];
$notify = $user['notify-flags'];
'$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->user),
+ '$aclselect' => ACL::getFullSelectorHTML(DI::page(), $a->getLoggedInUserId()),
'$expire' => [
'label' => DI::l10n()->t('Expiration settings'),
'$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'),