mirror of
https://github.com/slawkens/myaac.git
synced 2025-10-14 01:34:55 +02:00
* new account.login view for tibiacom template
* added new indicator icons for create account, create character and change character name * attempt to fix incorrect views counter behavior (its resetting to 0 in some cases) * moved check_* functions to class Validator * from now all validators ajax requests will fire onblur instead of onkeyup * ajax requests returns now json instead of xml * added 404 response when file is not found * fixed gallery
This commit is contained in:
@@ -141,17 +141,12 @@ $errors = array();
|
||||
if($new_password != $new_password2) {
|
||||
$errors[] = "The new passwords do not match!";
|
||||
}
|
||||
else if($password_strlen < 8) {
|
||||
$errors[] = "New password minimal length is 8 characters.";
|
||||
}
|
||||
else if($password_strlen > 32) {
|
||||
$errors[] = "New password maximal length is 32 characters.";
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
if(!check_password($new_password)) {
|
||||
$errors[] = "New password contains illegal chars (a-z, A-Z and 0-9 only!). Minimum password length is 7 characters and maximum 32.";
|
||||
if(!Validator::password($new_password)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
$old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password);
|
||||
if($old_password != $account_logged->getPassword()) {
|
||||
$errors[] = "Current password is incorrect!";
|
||||
@@ -215,14 +210,8 @@ if($action == "changeemail") {
|
||||
$email_new = $_POST['new_email'];
|
||||
$post_password = $_POST['password'];
|
||||
|
||||
if(empty($email_new)) {
|
||||
$errors[] = 'Please enter your new email address.';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!check_mail($email_new)) {
|
||||
$errors[] = 'Email address is not correct.';
|
||||
}
|
||||
if(!Validator::email($email_new)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($post_password)) {
|
||||
@@ -536,7 +525,7 @@ if($action == "changeemail") {
|
||||
$new_hideacc = isset($_POST['accountvisible']) ? (int)$_POST['accountvisible'] : NULL;
|
||||
|
||||
if($player_name != null) {
|
||||
if (check_name($player_name)) {
|
||||
if (Validator::characterName($player_name)) {
|
||||
$player = new OTS_Player();
|
||||
$player->find($player_name);
|
||||
if ($player->isLoaded()) {
|
||||
@@ -609,9 +598,8 @@ if($action == "changeemail") {
|
||||
|
||||
if(empty($errors))
|
||||
{
|
||||
$error = '';
|
||||
if(!admin() && !check_name_new_char($name, $error))
|
||||
$errors[] = $error;
|
||||
if(!admin() && !Validator::newCharacterName($name))
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -654,6 +642,7 @@ if($action == "changeemail") {
|
||||
|
||||
echo $twig->render('account.change_name.html.twig', array(
|
||||
'points' => $points,
|
||||
'errors' => $errors
|
||||
//'account_players' => $account_logged->getPlayersList()
|
||||
));
|
||||
}
|
||||
@@ -743,7 +732,7 @@ if($action == "changeemail") {
|
||||
$password_verify = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $password_verify);
|
||||
if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) {
|
||||
if(!empty($player_name) && !empty($password_verify)) {
|
||||
if(check_name($player_name)) {
|
||||
if(Validator::characterName($player_name)) {
|
||||
$player = new OTS_Player();
|
||||
$player->find($player_name);
|
||||
if($player->isLoaded()) {
|
||||
@@ -805,18 +794,23 @@ if($action == "changeemail") {
|
||||
$newchar_town = isset($_POST['town']) ? $_POST['town'] : NULL;
|
||||
|
||||
$newchar_created = false;
|
||||
if(isset($_POST['savecharacter']) && $_POST['savecharacter'] == 1) {
|
||||
$save = isset($_POST['save']) && $_POST['save'] == 1;
|
||||
if($save) {
|
||||
if(empty($newchar_name))
|
||||
$errors[] = 'Please enter a name for your character!';
|
||||
$errors['name'] = 'Please enter a name for your character!';
|
||||
else if(strlen($newchar_name) > 25)
|
||||
$errors[] = 'Name is too long. Max. lenght <b>25</b> letters.';
|
||||
$errors['name'] = 'Name is too long. Max. lenght <b>25</b> letters.';
|
||||
else if(strlen($newchar_name) < 3)
|
||||
$errors[] = 'Name is too short. Min. lenght <b>3</b> letters.';
|
||||
$errors['name'] = 'Name is too short. Min. lenght <b>3</b> letters.';
|
||||
else {
|
||||
if(!admin() && !Validator::newCharacterName($newchar_name)) {
|
||||
$errors['name'] = Validator::getLastError();
|
||||
}
|
||||
|
||||
$exist = new OTS_Player();
|
||||
$exist->find($newchar_name);
|
||||
if($exist->isLoaded()) {
|
||||
$errors[] = 'Character with this name already exist.';
|
||||
$errors['name'] = 'Character with this name already exist.';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -840,10 +834,6 @@ if($action == "changeemail") {
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
$error = '';
|
||||
if(!admin() && !check_name_new_char($newchar_name, $error)) {
|
||||
$errors[] = $error;
|
||||
}
|
||||
if(!isset($config['genders'][$newchar_sex]))
|
||||
$errors[] = 'Sex is invalid.';
|
||||
if(!in_array($newchar_town, $config['character_towns']))
|
||||
@@ -865,7 +855,7 @@ if($action == "changeemail") {
|
||||
{
|
||||
$number_of_players_on_account = $account_logged->getPlayersList()->count();
|
||||
if($number_of_players_on_account >= $config['characters_per_account'])
|
||||
$errors[] .= 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.$config['characters_per_account'].')</b>!';
|
||||
$errors[] = 'You have too many characters on your account <b>('.$number_of_players_on_account.'/'.$config['characters_per_account'].')</b>!';
|
||||
}
|
||||
|
||||
if(empty($errors))
|
||||
@@ -874,7 +864,7 @@ if($action == "changeemail") {
|
||||
$char_to_copy = new OTS_Player();
|
||||
$char_to_copy->find($char_to_copy_name);
|
||||
if(!$char_to_copy->isLoaded())
|
||||
$errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy: <b>'.$char_to_copy_name.'</b> doesn\'t exist.';
|
||||
$errors[] = 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy: <b>'.$char_to_copy_name.'</b> doesn\'t exist.';
|
||||
}
|
||||
|
||||
if(empty($errors))
|
||||
@@ -986,7 +976,9 @@ if($action == "changeemail") {
|
||||
'name' => $newchar_name,
|
||||
'sex' => $newchar_sex,
|
||||
'vocation' => $newchar_vocation,
|
||||
'town' => $newchar_town
|
||||
'town' => $newchar_town,
|
||||
'save' => $save,
|
||||
'errors' => $errors
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ function echo_error($message) {
|
||||
}
|
||||
|
||||
function verify_number($number, $name, $max_length) {
|
||||
if(!check_number($number))
|
||||
if(!Validator::number($number))
|
||||
echo_error($name . ' can contain only numbers.');
|
||||
|
||||
$number_length = strlen($number);
|
||||
@@ -50,11 +50,11 @@ $id = 0;
|
||||
if(isset($_REQUEST['id']))
|
||||
$id = (int)$_REQUEST['id'];
|
||||
else if(isset($_REQUEST['search_name'])) {
|
||||
if(strlen($_REQUEST['search_name']) < 3 && !check_number($_REQUEST['search_name'])) {
|
||||
if(strlen($_REQUEST['search_name']) < 3 && !Validator::number($_REQUEST['search_name'])) {
|
||||
echo 'Player name is too short.';
|
||||
}
|
||||
else {
|
||||
if(check_number($_REQUEST['search_name']))
|
||||
if(Validator::number($_REQUEST['search_name']))
|
||||
$id = $_REQUEST['search_name'];
|
||||
else {
|
||||
$query = $db->query('SELECT `id` FROM `players` WHERE `name` = ' . $db->quote($_REQUEST['search_name']));
|
||||
@@ -90,11 +90,11 @@ if($id > 0) {
|
||||
|
||||
$name = $_POST['name'];
|
||||
$_error = '';
|
||||
if(!check_name($name, $_error))
|
||||
echo_error($_error);
|
||||
if(!Validator::characterName($name))
|
||||
echo_error(Validator::getLastError());
|
||||
|
||||
//if(!check_name_new_char($name, $_error))
|
||||
// echo_error($_error);
|
||||
//if(!Validator::newCharacterName($name)
|
||||
// echo_error(Validator::getLastError());
|
||||
|
||||
$player_db = $ots->createObject('Player');
|
||||
$player_db->find($name);
|
||||
|
@@ -12,7 +12,8 @@
|
||||
defined('MYAAC') or die('Direct access not allowed!');
|
||||
$title = 'Characters';
|
||||
|
||||
require(SYSTEM . 'item.php');
|
||||
require_once(SYSTEM . 'item.php');
|
||||
|
||||
$groups = new OTS_Groups_List();
|
||||
function generate_search_form($autofocus = false)
|
||||
{
|
||||
@@ -213,7 +214,7 @@ if($player->isLoaded() && !$player->isDeleted())
|
||||
|
||||
for($i = 1; $i < 11; $i++)
|
||||
{
|
||||
if(check_number($equipment[$i]))
|
||||
if(Validator::number($equipment[$i]))
|
||||
$equipment[$i] = getItemImage($equipment[$i]);
|
||||
else
|
||||
$equipment[$i] = '<img src="images/items/' . $equipment[$i] . '.gif" width="32" height="32" border="0" alt=" ' . $equipment[$i] . '" />';
|
||||
|
@@ -22,8 +22,8 @@ if($logged)
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
$step = isset($_POST['step']) ? $_POST['step'] : '';
|
||||
if($step == 'save')
|
||||
$save = isset($_POST['save']) && $_POST['save'] == 1;
|
||||
if($save)
|
||||
{
|
||||
if(USE_ACCOUNT_NAME) {
|
||||
$account_name = $_POST['account'];
|
||||
@@ -38,23 +38,15 @@ if($step == 'save')
|
||||
|
||||
// account
|
||||
if(isset($account_id)) {
|
||||
if(empty($account_id))
|
||||
$errors['account'] = 'Please enter your account number!';
|
||||
else if(!check_number($account_id))
|
||||
$errors['account'] = 'Invalid account number format. Please use only numbers 0-9.';
|
||||
}
|
||||
else {
|
||||
if(empty($account_name))
|
||||
$errors['account'] = 'Please enter your account name!';
|
||||
else if(!check_account_name($account_name_up))
|
||||
$errors['account'] = 'Invalid account name format. Please use only A-Z and numbers 0-9.';
|
||||
if(!Validator::accountId($account_id))
|
||||
$errors['account'] = Validator::getLastError();
|
||||
}
|
||||
else if(!Validator::accountName($account_name_up))
|
||||
$errors['account'] = Validator::getLastError();
|
||||
|
||||
// email
|
||||
if(empty($email))
|
||||
$errors['email'] = 'Please enter your email address!';
|
||||
else if(!check_mail($email))
|
||||
$errors['email'] = 'Email address is not correct.';
|
||||
if(!Validator::email($email))
|
||||
$errors['email'] = Validator::getLastError();
|
||||
|
||||
// country
|
||||
$country = '';
|
||||
@@ -81,14 +73,14 @@ if($step == 'save')
|
||||
}
|
||||
|
||||
// password
|
||||
if(empty($password))
|
||||
if(!isset($password[0])) {
|
||||
$errors['password'] = 'Please enter the password for your new account.';
|
||||
elseif($password != $password2)
|
||||
}
|
||||
elseif($password != $password2) {
|
||||
$errors['password'] = 'Passwords are not the same.';
|
||||
else
|
||||
{
|
||||
if(!check_password($password))
|
||||
$errors['password'] = 'Password contains illegal chars (a-z, A-Z and 0-9 only!). Minimum password length is 7 characters and maximum 32.';
|
||||
}
|
||||
else if(!Validator::password($password)) {
|
||||
$errors['password'] = Validator::getLastError();
|
||||
}
|
||||
|
||||
// check if account name is not equal to password
|
||||
@@ -246,6 +238,7 @@ if($step == 'save')
|
||||
'accept_rules' => isset($_POST['accept_rules']) ? $_POST['accept_rules'] : false,
|
||||
'country_recognized' => $country_recognized,
|
||||
'country' => isset($country) ? $country : null,
|
||||
'errors' => $errors
|
||||
'errors' => $errors,
|
||||
'save' => $save
|
||||
));
|
||||
?>
|
@@ -76,17 +76,17 @@ if(isset($_GET['image']))
|
||||
$image = $image->fetch();
|
||||
else
|
||||
{
|
||||
echo 'Image with this name does not exists.';
|
||||
echo 'Image with this id does not exists.';
|
||||
return;
|
||||
}
|
||||
|
||||
$previous_image = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($image['id'] - 1) . ' ORDER by `ordering`;');
|
||||
$previous_image = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($image['id'] - 1) . ' ORDER by `ordering`;');
|
||||
if($previous_image->rowCount() == 1)
|
||||
$previous_image = $previous_image->fetch();
|
||||
else
|
||||
$previous_image = NULL;
|
||||
|
||||
$next_image = $db->query('SELECT * FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($image['id'] + 1) . ' ORDER by `ordering`;');
|
||||
$next_image = $db->query('SELECT `id` FROM `' . TABLE_PREFIX . 'gallery` WHERE `id` = ' . $db->quote($image['id'] + 1) . ' ORDER by `ordering`;');
|
||||
if($next_image->rowCount() == 1)
|
||||
$next_image = $next_image->fetch();
|
||||
else
|
||||
|
@@ -159,8 +159,8 @@ if($action == '')
|
||||
if($action == 'show')
|
||||
{
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name))
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name))
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
if(empty($guild_errors))
|
||||
{
|
||||
$guild = $ots->createObject('Guild');
|
||||
@@ -424,8 +424,8 @@ if($action == 'show')
|
||||
if($action == 'changerank')
|
||||
{
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name))
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name))
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
if(!$logged)
|
||||
$guild_errors[] = 'You are not logged in. You can\'t change rank.';
|
||||
if(empty($guild_errors))
|
||||
@@ -513,7 +513,7 @@ echo '
|
||||
{
|
||||
$player_name = stripslashes($_REQUEST['name']);
|
||||
$new_rank = (int) $_REQUEST['rankid'];
|
||||
if(!check_name($player_name))
|
||||
if(!Validator::characterName($player_name))
|
||||
$change_errors[] = 'Invalid player name format.';
|
||||
$rank = $ots->createObject('GuildRank');
|
||||
$rank->load($new_rank);
|
||||
@@ -625,9 +625,9 @@ if($action == 'deleteinvite')
|
||||
$name = stripslashes($_REQUEST['name']);
|
||||
if(!$logged)
|
||||
$guild_errors[] = 'You are not logged in. You can\'t delete invitations.';
|
||||
if(!check_guild_name($guild_name))
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!check_name($name))
|
||||
if(!Validator::guildName($guild_name))
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
if(!Validator($name))
|
||||
$guild_errors[] = 'Invalid name format.';
|
||||
if(empty($guild_errors))
|
||||
{
|
||||
@@ -726,8 +726,8 @@ if($action == 'invite')
|
||||
$guild_errors[] = 'You are not logged in. You can\'t invite players.';
|
||||
}
|
||||
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($guild_errors)) {
|
||||
@@ -770,7 +770,7 @@ if($action == 'invite')
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
if(!check_name($name)) {
|
||||
if(!Validator::characterName($name)) {
|
||||
$guild_errors[] = 'Invalid name format.';
|
||||
}
|
||||
|
||||
@@ -831,8 +831,8 @@ if($action == 'acceptinvite') {
|
||||
if(!$logged) {
|
||||
$errors[] = 'You are not logged in. You can\'t accept invitations.';
|
||||
}
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
if(empty($errors)) {
|
||||
$guild = $ots->createObject('Guild');
|
||||
@@ -843,7 +843,7 @@ if($action == 'acceptinvite') {
|
||||
}
|
||||
|
||||
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
if(!check_name($name)) {
|
||||
if(!Validator::characterName($name)) {
|
||||
$errors[] = 'Invalid name format.';
|
||||
}
|
||||
|
||||
@@ -947,11 +947,11 @@ if($action == 'kickplayer') {
|
||||
$errors[] = 'You are not logged in. You can\'t kick characters.';
|
||||
}
|
||||
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(!check_name($name)) {
|
||||
if(!Validator::characterName($name)) {
|
||||
$errors[] = 'Invalid name format.';
|
||||
}
|
||||
|
||||
@@ -1052,8 +1052,8 @@ if($action == 'leaveguild') {
|
||||
$errors[] = 'You are not logged in. You can\'t leave guild.';
|
||||
}
|
||||
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -1068,7 +1068,7 @@ if($action == 'leaveguild') {
|
||||
if(empty($errors)) {
|
||||
$guild_owner_name = $guild->getOwner()->getName();
|
||||
if(isset($_REQUEST['todo']) && $_REQUEST['todo'] == 'save') {
|
||||
if(!check_name($name)) {
|
||||
if(!Validator::characterName($name)) {
|
||||
$errors[] = 'Invalid name format.';
|
||||
}
|
||||
|
||||
@@ -1198,12 +1198,12 @@ if($action == 'createguild')
|
||||
|
||||
if($todo == 'save')
|
||||
{
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
$guild_name = '';
|
||||
}
|
||||
|
||||
if(!check_name($name)) {
|
||||
if(!Validator::characterName($name)) {
|
||||
$guild_errors[] = 'Invalid character name format.';
|
||||
$name = '';
|
||||
}
|
||||
@@ -1293,8 +1293,8 @@ else {
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'manager') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($guild_errors)) {
|
||||
@@ -1345,8 +1345,8 @@ if(!empty($guild_errors)) {
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'changelogo') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -1463,8 +1463,8 @@ if($action == 'changelogo') {
|
||||
if($action == 'deleterank') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
$rank_to_delete = (int) $_REQUEST['rankid'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
}
|
||||
if(empty($guild_errors)) {
|
||||
$guild = $ots->createObject('Guild');
|
||||
@@ -1567,11 +1567,11 @@ echo '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigBu
|
||||
if($action == 'addrank') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
$ranknew = $_REQUEST['rank_name'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
}
|
||||
if(empty($guild_errors)) {
|
||||
if(!check_rank_name($ranknew)) {
|
||||
if(!Validator::rankName($ranknew)) {
|
||||
$guild_errors[] = 'Invalid rank name format.';
|
||||
}
|
||||
if(!$logged) {
|
||||
@@ -1630,8 +1630,8 @@ echo '<br/><center><form action="?subtopic=guilds" METHOD=post><div class="BigBu
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'changedescription') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -1696,8 +1696,8 @@ if($action == 'changedescription') {
|
||||
if($action == 'passleadership') {
|
||||
$guild_name = isset($_REQUEST['guild']) ? $_REQUEST['guild'] : NULL;
|
||||
$pass_to = isset($_REQUEST['player']) ? stripslashes($_REQUEST['player']) : NULL;
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$guild_errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$guild_errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($guild_errors)) {
|
||||
@@ -1709,7 +1709,7 @@ if($action == 'passleadership') {
|
||||
}
|
||||
if(empty($guild_errors)) {
|
||||
if(isset($_POST['todo']) && $_POST['todo'] == 'save') {
|
||||
if(!check_name($pass_to)) {
|
||||
if(!Validator::characterName($pass_to)) {
|
||||
$guild_errors2[] = 'Invalid player name format.';
|
||||
}
|
||||
|
||||
@@ -1806,8 +1806,8 @@ if($action == 'passleadership') {
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'deleteguild') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -1878,8 +1878,8 @@ if($action == 'deleteguild') {
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'deletebyadmin') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -1936,8 +1936,8 @@ if($action == 'deletebyadmin') {
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'changemotd' && MOTD_EXISTS) {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::getLastError();
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -2000,8 +2000,8 @@ if($action == 'changemotd' && MOTD_EXISTS) {
|
||||
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
|
||||
if($action == 'saveranks') {
|
||||
$guild_name = $_REQUEST['guild'];
|
||||
if(!check_guild_name($guild_name)) {
|
||||
$errors[] = 'Invalid guild name format.';
|
||||
if(!Validator::guildName($guild_name)) {
|
||||
$errors[] = Validator::get;
|
||||
}
|
||||
|
||||
if(empty($errors)) {
|
||||
@@ -2033,7 +2033,7 @@ if($action == 'saveranks') {
|
||||
$rank_id = $rank->getId();
|
||||
$name = $_REQUEST[$rank_id.'_name'];
|
||||
$level = (int) $_REQUEST[$rank_id.'_level'];
|
||||
if(check_rank_name($name)) {
|
||||
if(Validator::rankName($name)) {
|
||||
$rank->setName($name);
|
||||
}
|
||||
else {
|
||||
|
@@ -33,7 +33,7 @@ $type = '';
|
||||
{
|
||||
$beds = array("", "one", "two", "three", "fourth", "fifth");
|
||||
$houseName = $_REQUEST['house'];
|
||||
$houseId = (check_number($_REQUEST['house']) ? $_REQUEST['house'] : -1);
|
||||
$houseId = (Validator::number($_REQUEST['house']) ? $_REQUEST['house'] : -1);
|
||||
$house = $db->query('SELECT * FROM ' . $db->tableName('houses') . ' WHERE ' . $db->fieldName('name') . ' LIKE ' . $db->quote($houseName) . ' OR `id` = ' . $db->quote($houseId));
|
||||
|
||||
if($house->rowCount() > 0)
|
||||
|
@@ -30,7 +30,7 @@ else if($action == 'step1' && $action_type == '') {
|
||||
elseif($action == 'step1' && $action_type == 'email')
|
||||
{
|
||||
$nick = stripslashes($_REQUEST['nick']);
|
||||
if(check_name($nick))
|
||||
if(Validator::characterName($nick))
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$account = new OTS_Account();
|
||||
@@ -77,7 +77,7 @@ elseif($action == 'sendcode')
|
||||
{
|
||||
$email = $_REQUEST['email'];
|
||||
$nick = stripslashes($_REQUEST['nick']);
|
||||
if(check_name($nick))
|
||||
if(Validator::characterName($nick))
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$account = new OTS_Account();
|
||||
@@ -139,7 +139,7 @@ elseif($action == 'sendcode')
|
||||
elseif($action == 'step1' && $action_type == 'reckey')
|
||||
{
|
||||
$nick = stripslashes($_REQUEST['nick']);
|
||||
if(check_name($nick))
|
||||
if(Validator::characterName($nick))
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$account = new OTS_Account();
|
||||
@@ -181,7 +181,7 @@ elseif($action == 'step2')
|
||||
{
|
||||
$rec_key = trim($_REQUEST['key']);
|
||||
$nick = stripslashes($_REQUEST['nick']);
|
||||
if(check_name($nick))
|
||||
if(Validator::characterName($nick))
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$account = new OTS_Account();
|
||||
@@ -272,7 +272,7 @@ elseif($action == 'step3')
|
||||
$nick = stripslashes($_REQUEST['nick']);
|
||||
$new_pass = trim($_REQUEST['passor']);
|
||||
$new_email = trim($_REQUEST['email']);
|
||||
if(check_name($nick))
|
||||
if(Validator::characterName($nick))
|
||||
{
|
||||
$player = new OTS_Player();
|
||||
$account = new OTS_Account();
|
||||
@@ -286,9 +286,9 @@ elseif($action == 'step3')
|
||||
{
|
||||
if($account_key == $rec_key)
|
||||
{
|
||||
if(check_password($new_pass))
|
||||
if(Validator::password($new_pass))
|
||||
{
|
||||
if(check_mail($new_email))
|
||||
if(Validator::email($new_email))
|
||||
{
|
||||
$account->setEMail($new_email);
|
||||
|
||||
@@ -345,10 +345,10 @@ elseif($action == 'step3')
|
||||
</TD></TR></FORM></TABLE></TABLE>';
|
||||
}
|
||||
else
|
||||
echo 'Wrong e-mail format.';
|
||||
echo Validator::getLastError();
|
||||
}
|
||||
else
|
||||
echo 'Wrong password format. Use only a-Z, A-Z, 0-9. Minimum password length is 7 characters and maximum 32.';
|
||||
echo Validator::getLastError();
|
||||
}
|
||||
else
|
||||
echo 'Wrong recovery key!';
|
||||
@@ -478,7 +478,7 @@ elseif($action == 'setnewpassword')
|
||||
{
|
||||
if($account->getCustomField('email_code') == $code)
|
||||
{
|
||||
if(check_password($newpassword))
|
||||
if(Validator::password($newpassword))
|
||||
{
|
||||
if($config_salt_enabled)
|
||||
{
|
||||
@@ -523,7 +523,7 @@ elseif($action == 'setnewpassword')
|
||||
</TD></TR></FORM></TABLE></TABLE>';
|
||||
}
|
||||
else
|
||||
$error= 'Wrong password format. Use only a-z, A-Z, 0-9. Minimum password length is 7 characters and maximum 32.';
|
||||
$error= Validator::getLastError();
|
||||
}
|
||||
else
|
||||
$error= 'Wrong code to change password.';
|
||||
|
Reference in New Issue
Block a user