Single column delete view, test for mbstring extension

This commit is contained in:
Greg Sarjeant 2025-06-14 00:23:59 -04:00
parent 8f2534568d
commit 3b8d54460c
3 changed files with 19 additions and 6 deletions

View File

@ -77,6 +77,16 @@ fieldset.emoji-group {
gap: 0.3em; gap: 0.3em;
} }
.delete-emoji-fieldset .fieldset-items {
display: block;
grid-template-columns: none;
}
.delete-emoji-fieldset button {
margin-top: 16px;
width: auto;
}
input[type="text"], input[type="text"],
input[type="number"], input[type="number"],
input[type="password"], input[type="password"],

View File

@ -50,10 +50,13 @@
public function handleAdd(string $emoji, ?string $description=null): void { public function handleAdd(string $emoji, ?string $description=null): void {
// Validate 1 visible character in the emoji // Validate 1 visible character in the emoji
$charCount = mb_strlen($emoji, 'UTF-8'); if (extension_loaded('mbstring')) {
if ($charCount !== 1) { // TODO - log a warning if mbstring isn't loaded
// TODO - handle error $charCount = mb_strlen($emoji, 'UTF-8');
return; if ($charCount !== 1) {
// TODO - handle error
return;
}
} }
// Validate the emoji is actually an emoji // Validate the emoji is actually an emoji

View File

@ -24,7 +24,7 @@
<?php if (!empty($emojiList)): ?> <?php if (!empty($emojiList)): ?>
<form action="<?= $config->basePath ?>admin/emoji" method="post" enctype="multipart/form-data"> <form action="<?= $config->basePath ?>admin/emoji" method="post" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>"> <input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
<fieldset> <fieldset class="delete-emoji-fieldset">
<legend>Delete Emoji</legend> <legend>Delete Emoji</legend>
<div class="fieldset-items"> <div class="fieldset-items">
<?php foreach ($emojiList as $emojiItem): ?> <?php foreach ($emojiList as $emojiItem): ?>