Single column delete view, test for mbstring extension
This commit is contained in:
parent
8f2534568d
commit
3b8d54460c
@ -77,6 +77,16 @@ fieldset.emoji-group {
|
||||
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="number"],
|
||||
input[type="password"],
|
||||
|
@ -50,12 +50,15 @@
|
||||
|
||||
public function handleAdd(string $emoji, ?string $description=null): void {
|
||||
// Validate 1 visible character in the emoji
|
||||
$charCount = mb_strlen($emoji, 'UTF-8');
|
||||
if ($charCount !== 1) {
|
||||
// TODO - handle error
|
||||
return;
|
||||
if (extension_loaded('mbstring')) {
|
||||
// TODO - log a warning if mbstring isn't loaded
|
||||
$charCount = mb_strlen($emoji, 'UTF-8');
|
||||
if ($charCount !== 1) {
|
||||
// TODO - handle error
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Validate the emoji is actually an emoji
|
||||
$emojiPattern = '/^[\x{1F000}-\x{1F9FF}\x{2600}-\x{26FF}\x{2700}-\x{27BF}\x{1F600}-\x{1F64F}\x{1F300}-\x{1F5FF}\x{1F680}-\x{1F6FF}\x{1F1E0}-\x{1F1FF}\x{1F900}-\x{1F9FF}\x{1FA70}-\x{1FAFF}]$/u';
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
<?php if (!empty($emojiList)): ?>
|
||||
<form action="<?= $config->basePath ?>admin/emoji" method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<fieldset>
|
||||
<fieldset class="delete-emoji-fieldset">
|
||||
<legend>Delete Emoji</legend>
|
||||
<div class="fieldset-items">
|
||||
<?php foreach ($emojiList as $emojiItem): ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user