Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Leone25 committed Sep 24, 2024
1 parent 0bee4bb commit 3f24fe8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
version: '3.4'
services:
app:
image: weeehire-ng/app
Expand Down
9 changes: 6 additions & 3 deletions src/PagePosition.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ public function handle(ServerRequestInterface $request): ResponseInterface
// Delete position
$db->deletePosition($_GET['id']);
return new RedirectResponse('settings.php', 303);
} elseif (isset($POST['id'])) {
}
if (isset($POST['id'])) {
// Update the id of the position
// Make sure the id is url safe (aka keep only lowercase letters and dashes) and replace spaces with dashes
$newId = preg_replace('/[^a-z-]/', '', preg_replace('/ /', '-', strtolower($POST['id'])));
Expand All @@ -66,11 +67,13 @@ public function handle(ServerRequestInterface $request): ResponseInterface
return new RedirectResponse('position.php?id=' . $newId, 303);
}
}
} elseif (isset($POST['index'])) {
}
if (isset($POST['index'])) {
// Update the index of the position
$db->updatePositionIndex($_GET['id'], $POST['index']);
$changed = true;
} elseif (isset($POST['translation'])) {
}
if (isset($POST['translation'])) {
// Figure out which translation has been changed and update it
foreach (Template::SUPPORTED_LOCALES as $locale) {
if (isset($POST['name-' . $locale]) && $POST['name-' . $locale] !== $nameTranslations[$locale]) {
Expand Down
4 changes: 2 additions & 2 deletions src/PageSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ public function handle(ServerRequestInterface $request): ResponseInterface
$id = preg_replace('/[^a-z-]/', '', preg_replace('/ /', '-', strtolower($POST['newPositionName'])));
$db->addPosition($id);
foreach (Template::SUPPORTED_LOCALES as $locale) {
$db->updateTranslation('position.' . $id . '.name', $POST['newPositionName'], $locale);
$db->updateTranslation('position.' . $id . '.description', '', $locale);
$db->updateTranslation('position.' . $id . '.name', $locale, $POST['newPositionName']);
$db->updateTranslation('position.' . $id . '.description', $locale, '');
} // setting translations to a default string, we'll edit it right after
return new RedirectResponse('position.php?id=' . $id, 303);
} elseif (isset($POST['notifyEmail'])) {
Expand Down

0 comments on commit 3f24fe8

Please sign in to comment.