Guilds: You can not invite a player to your guild if he is already in a guild. Fix #136

This commit is contained in:
Stefan Brannfjell 2014-06-17 18:08:05 +02:00
parent d3807bfafe
commit d7adcd1990

View File

@ -369,22 +369,36 @@ if ($highest_access >= 2) {
} }
if (!empty($_POST['invite'])) { if (!empty($_POST['invite'])) {
if (user_character_exist($_POST['invite'])) { if (user_character_exist($_POST['invite'])) {
// // Make sure they are not in another guild
$status = false;
if ($inv_data !== false) { if ($config['TFSVersion'] != 'TFS_10') {
foreach ($inv_data as $inv) { $charname = sanitize($_POST['invite']);
if ($inv['player_id'] == user_character_id($_POST['invite'])) $status = true; $playerdata = mysql_select_single("SELECT `id`, `rank_id` FROM `players` WHERE `name`='$charname' LIMIT 1;");
} $charid = $playerdata['id'];
} $membership = ($playerdata['rank_id'] > 0) ? true : false;
foreach ($players as $player) { } else {
if ($player['name'] == $_POST['invite']) $status = true; $charid = user_character_id($_POST['invite']);
} $membership = mysql_select_single("SELECT `rank_id` FROM `guild_membership` WHERE `player_id`='$charid' LIMIT 1;");
}
if (!$membership) {
//
$status = false;
if ($inv_data !== false) {
foreach ($inv_data as $inv) {
if ($inv['player_id'] == user_character_id($_POST['invite'])) $status = true;
}
}
foreach ($players as $player) {
if ($player['name'] == $_POST['invite']) $status = true;
}
if ($status == false) {
guild_invite_player($charid, $gid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
} else echo '<font color="red" size="4">That character is already invited(or a member) on this guild.</font>';
} else echo '<font color="red" size="4">That character is already in a guild.</font>';
if ($status == false) {
guild_invite_player(user_character_id($_POST['invite']), $gid);
header('Location: guilds.php?name='. $_GET['name']);
exit();
} else echo '<font color="red" size="4">That character is already invited(or a member) on this guild.</font>';
} else echo '<font color="red" size="4">That character name does not exist.</font>'; } else echo '<font color="red" size="4">That character name does not exist.</font>';
} }
// Guild Message (motd) // Guild Message (motd)