Fix(creature names): restrict multiword creature names (#474)

* Fix(creature names): restrict multiword creature names
This commit is contained in:
TechnicalIllusion 2021-06-25 12:16:15 -05:00 committed by GitHub
parent bdb4a862b5
commit a0c7831f58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -32,13 +32,17 @@ if (empty($_POST) === false) {
} }
// name restriction // name restriction
$resname = explode(" ", $_POST['name']); $resname = explode(" ", $_POST['name']);
$username = $_POST['name'];
foreach($resname as $res) { foreach($resname as $res) {
if(in_array(strtolower($res), $config['invalidNameTags'])) { if(in_array(strtolower($res), $config['invalidNameTags'])) {
$errors[] = 'Your username contains a restricted word.'; $errors[] = 'Your username contains a restricted word.';
} }
else if(strlen($res) == 1) { if(strlen($res) == 1) {
$errors[] = 'Too short words in your name.'; $errors[] = 'Too short words in your name.';
} }
}
if(in_array(strtolower($username), $config['creatureNameTags'])) {
$errors[] = 'Your username contains a creature name.';
} }
// Validate vocation id // Validate vocation id
if (!in_array((int)$_POST['selected_vocation'], $config['available_vocations'])) { if (!in_array((int)$_POST['selected_vocation'], $config['available_vocations'])) {