This commit is contained in:
@@ -159,6 +159,8 @@ final class AccountPages
|
||||
$communityAccess = $pdo ? new CommunityAccess($pdo, $communityConfig) : null;
|
||||
$communityMigration = $pdo ? new CommunityMigration($pdo) : null;
|
||||
$profileSettings = $pdo ? new ProfileSettings($pdo) : null;
|
||||
$section = (string)($_GET['section'] ?? 'profile');
|
||||
$allowedSections = ['profile', 'children', 'events', 'community', 'settings'];
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$action = $_POST['action'] ?? '';
|
||||
@@ -188,6 +190,15 @@ final class AccountPages
|
||||
'id' => $userId,
|
||||
]);
|
||||
$info = 'Profil gespeichert.';
|
||||
} elseif ($action === 'settings_location') {
|
||||
$locationPreference = (string)($_POST['location_tracking_preference'] ?? 'prompt');
|
||||
if ($profileSettings) {
|
||||
$profileSettings->updateLocationTrackingPreference(
|
||||
$userId,
|
||||
in_array($locationPreference, ['disabled', 'prompt', 'enabled'], true) ? $locationPreference : 'prompt'
|
||||
);
|
||||
}
|
||||
$info = 'Einstellungen gespeichert.';
|
||||
} elseif ($action === 'child_add') {
|
||||
$firstNameEnc = $crypto ? $crypto->encrypt(trim((string)$_POST['first_name'])) : trim((string)$_POST['first_name']);
|
||||
$noteEnc = $crypto ? $crypto->encrypt(trim((string)$_POST['note'])) : trim((string)$_POST['note']);
|
||||
@@ -396,6 +407,12 @@ final class AccountPages
|
||||
];
|
||||
$communityIsSiteAdmin = $communityAccess ? $communityAccess->canManageApplications($userId) : false;
|
||||
$communityMigrationStatus = ($communityMigration && $communityIsSiteAdmin) ? $communityMigration->status() : null;
|
||||
if (in_array('forum_admin', $communityRoles, true) || $communityIsSiteAdmin) {
|
||||
$allowedSections[] = 'admin';
|
||||
}
|
||||
if (!in_array($section, $allowedSections, true)) {
|
||||
$section = 'profile';
|
||||
}
|
||||
|
||||
return compact(
|
||||
'flash',
|
||||
@@ -413,7 +430,9 @@ final class AccountPages
|
||||
'communityCanApply',
|
||||
'communityRestrictions',
|
||||
'communityIsSiteAdmin',
|
||||
'communityMigrationStatus'
|
||||
'communityMigrationStatus',
|
||||
'section',
|
||||
'allowedSections'
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user