mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-27 09:49:22 +02:00
update validator name check
-added character_name_npc_check to config.php -added npc name check to validator
This commit is contained in:
parent
31f0050f4e
commit
9d8f398d9f
@ -171,6 +171,7 @@ $config = array(
|
|||||||
// This is the minimum and the maximum length that a player can create a character. It is highly recommend the maximum length to be 21.
|
// This is the minimum and the maximum length that a player can create a character. It is highly recommend the maximum length to be 21.
|
||||||
'character_name_min_length' => 4,
|
'character_name_min_length' => 4,
|
||||||
'character_name_max_length' => 21,
|
'character_name_max_length' => 21,
|
||||||
|
'character_name_npc_check' => true,
|
||||||
|
|
||||||
// list of towns
|
// list of towns
|
||||||
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns)
|
// if you use TFS 1.3 with support for 'towns' table in database, then you can ignore this - it will be configured automatically (from MySQL database - Table - towns)
|
||||||
|
@ -221,6 +221,16 @@ class Validator
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$npcCheck = config('character_name_npc_check');
|
||||||
|
if ($npcCheck) {
|
||||||
|
require LIBS . 'npc.php';
|
||||||
|
NPCS::load();
|
||||||
|
if(NPCS::$npcs && in_array(strtolower($name), NPCS::$npcs)) {
|
||||||
|
self::$lastError = "Invalid name format. Do not use NPC Names";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,6 +344,16 @@ class Validator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$npcCheck = config('character_name_npc_check');
|
||||||
|
if ($npcCheck) {
|
||||||
|
require LIBS . 'npc.php';
|
||||||
|
NPCS::load();
|
||||||
|
if(NPCS::$npcs && in_array($name_lower, NPCS::$npcs)) {
|
||||||
|
self::$lastError = "Invalid name format. Do not use NPC Names";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
|
if(strspn($name, "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM- '") != $name_length) {
|
||||||
self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
self::$lastError = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.';
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user