Skip to content

Commit

Permalink
(admin) do not set null for broadcast message receiver, use fixed "Ru…
Browse files Browse the repository at this point in the history
…ndmail"
  • Loading branch information
bratkartoffel committed Jan 30, 2023
1 parent 918dd59 commit e280799
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `install/update.php` can now be invoked by cli (without secret)
- don't just invalidate, delete old http-session on login
- (mobile) scroll to content when navigating to the pages
- (admin) do not set null for broadcast message receiver, use fixed "Rundmail"

### Fixed

Expand Down
3 changes: 2 additions & 1 deletion actions/nachrichten.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
'senderId' => $_SESSION['blm_user'],
'senderName' => Database::getInstance()->getPlayerNameById($_SESSION['blm_user']),
'subject' => $subject,
'message' => $message
'message' => $message,
'receiverName' => 'Rundmail'
)) !== 1) {
Database::getInstance()->rollBack();
redirectTo($base_link, 141, __LINE__);
Expand Down
2 changes: 1 addition & 1 deletion include/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ function verifyOffset(int $offset, int $entriesCount, int $entriesPerPage): int

function createProfileLink(?int $blm_user, string $name): string
{
if ($blm_user == 0) return $name;
if ($blm_user === null || $blm_user === 0) return $name;
return sprintf('<a href="/?p=profil&amp;id=%d">%s</a>', $blm_user, escapeForOutput($name));
}

Expand Down
10 changes: 10 additions & 0 deletions install/sql/21-1.11.1-log_nachrichten-rundmail.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- MIT Licence
-- Copyright (c) 2023 Simon Frankenberger
-- Please see LICENCE.md for complete licence text.

update log_nachrichten
set receiverName = 'Rundmail'
where receiverId is null;

alter table log_nachrichten
change receiverName receiverName varchar(20) not null;
8 changes: 1 addition & 7 deletions pages/admin_log_nachrichten.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,7 @@
?>
<tr>
<td><?= createProfileLink($row['senderId'], $row['senderName']); ?></td>
<td><?php
if ($row['receiverId'] === null) {
echo '<i>Rundmail</i>';
} else {
echo createProfileLink($row['receiverId'], $row['receiverName']);
}
?></td>
<td><?= createProfileLink($row['receiverId'], $row['receiverName']); ?></td>
<td><?= formatDateTime(strtotime($row['created'])); ?></td>
<td><?= escapeForOutput($row['subject']); ?></td>
<td><?= escapeForOutput($row['message']); ?></td>
Expand Down

0 comments on commit e280799

Please sign in to comment.