mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 09:44:55 +02:00
Fixes in create new character nick
+ fixed config.character_name_min/max_length being ignored in change_name.php
This commit is contained in:
@@ -26,21 +26,13 @@ class CreateCharacter
|
||||
if(empty($name))
|
||||
$errors['name'] = 'Please enter a name for your character!';
|
||||
else if(strlen($name) > $maxLength)
|
||||
$errors['name'] = 'Name is too long. Max. lenght <b>'.$maxLength.'</b> letters.';
|
||||
$errors['name'] = 'Name is too long. Max. length <b>'.$maxLength.'</b> letters.';
|
||||
else if(strlen($name) < $minLength)
|
||||
$errors['name'] = 'Name is too short. Min. lenght <b>'.$minLength.'</b> letters.';
|
||||
elseif(preg_match('/ {2,}/', $name))
|
||||
$errors['name'] = 'Invalid character name format. Use only A-Z and numbers 0-9 and no double spaces.';
|
||||
$errors['name'] = 'Name is too short. Min. length <b>'.$minLength.'</b> letters.';
|
||||
else {
|
||||
if(!admin() && !Validator::newCharacterName($name)) {
|
||||
$errors['name'] = Validator::getLastError();
|
||||
}
|
||||
|
||||
$exist = new OTS_Player();
|
||||
$exist->find($name);
|
||||
if($exist->isLoaded()) {
|
||||
$errors['name'] = 'Character with this name already exist.';
|
||||
}
|
||||
}
|
||||
|
||||
if(empty($sex) && $sex != "0")
|
||||
@@ -122,7 +114,7 @@ class CreateCharacter
|
||||
return false;
|
||||
}
|
||||
|
||||
global $db, $twig;
|
||||
global $db;
|
||||
|
||||
if($sex == "0")
|
||||
$char_to_copy->setLookType(136);
|
||||
@@ -188,7 +180,7 @@ class CreateCharacter
|
||||
}
|
||||
|
||||
$player->save();
|
||||
$player->setCustomField("created", time());
|
||||
$player->setCustomField('created', time());
|
||||
|
||||
$player = new OTS_Player();
|
||||
$player->find($name);
|
||||
@@ -211,6 +203,7 @@ class CreateCharacter
|
||||
foreach($loaded_items_to_copy as $save_item)
|
||||
$db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');");
|
||||
|
||||
global $twig;
|
||||
$twig->display('success.html.twig', array(
|
||||
'title' => 'Character Created',
|
||||
'description' => 'The character <b>' . $name . '</b> has been created.<br/>
|
||||
|
Reference in New Issue
Block a user