if ($hash == $config->matchHash) { // Make sure special chars for MySQL are escaped $nameOfBanned = addslashes($nameOfBanned); $nameOfBanned = str_ireplace(array("\"", "\r\n", "\n", "\r", ";"), "", $nameOfBanned); // Remove ; to prevent kick command inyection like name; quit or ; _restart $banQueries = new BanQueries(); $userQueries = new UserQueries(); $lengthQueries = new LengthQueries(); $user = $userQueries->getUserInfoBySteamId($banner); // i for ignore if ($timeScale == "i") { $length = $lengthQueries->getBanLength($lengthId); } else { $length = new Length(); $length->setLength($lengthId); $length->setTimeScale($timeScale); } $isUserMember = false; // If we are not allowing admin bans, then make sure the one being banned is not an admin if (!$config->allowAdminBans) { $isUserMember = $userQueries->isMember($steamId); } $username = trim($user->getName()); $pending = 0; // Default pending state is off // HARDCODED: 4 = member if ($user->getAccessLevel() == 4) { $pending = 1; } // Validate IP if (!preg_match("/^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\$/", $ipOfBanned)) {
$information2 .= "</tr>"; // Ban history of the user $banHistory = $banQueries->getBanHistory($bannedUser->getBanId()); // Loop through banned users and display them foreach ($banHistory as $banHistUser) { // list($expireDateHist, $expireTimeHist) = split(' ', $banHistUser->getExpireDate()); list($addDateHist, $addTimeHist) = split(' ', $banHistUser->getAddDate()); $commentsHist = str_replace(array("\r\n", "\n", "\r"), "<br>", $banHistUser->getComments()); // Convert newlines into html line breaks $commentsHist = str_replace("\"", """, $commentsHist); // Replace quotes with the HTML code $commentsHist = str_replace("'", """, $commentsHist); // Replace quotes with the HTML code $banLengthHist = new Length(); $banLengthHist->setLength($banHistUser->getLength()); $banLengthHist->setTimeScale($banHistUser->getTimeScale()); /* if($banHistUser->getLength() == 0) { $expireDateHist = $LAN_BANLIST_033; $expireTimeHist = ""; } if($banHistUser->getExpireDate() == 'Expired') { $expireDateHist = "<i>".$LAN_BANLIST_024."</i>"; $expireTimeHist = ""; } */ $information2 .= " <tr>"; $information2 .= " <td class='colColor1' nowrap align='center'>" . str_replace('"', """, $banHistUser->getName()); if ($banHistUser->getKickCounter() > 0) { $information2 .= " <span class='kickCounter'>(" . $banHistUser->getKickCounter() . ")</span>";
$kickedByBan = false; // No point checking if they were kicked by name if (!$kickedByName) { // Determine if this user is IP banned, if so kick them if ($banQueries->isIpBanned($ipOfBanned)) { kickUser($steamId, $serverId, eregi_replace("gb_time", $LANCHECKUSER_003, $config->banMessage), $messageTOserver); $kickedByBan = true; } // Check to see if the user does exist in the ban list (if active) if ($banQueries->doesUserExist($steamId)) { $now = time(); // Get the time now in seconds $bannedUser = $banQueries->getBannedUserBySteamId($steamId); $length = new Length(); $length->setLength($bannedUser->getLength()); $length->setTimeScale($bannedUser->getTimeScale()); $lengthInSec = $length->getLengthInSeconds(); $reasonQueries = new ReasonQueries(); $menssageTOplayer = eregi_replace("gb_reason", $reasonQueries->getReason($bannedUser->getReasonId()), eregi_replace("gb_time", $length->getReadable(), $config->banMessage)); // Pending bans are banned for X days if ($bannedUser->getPending() == 1) { // Kick the user if the ban is 24 hours or less if ($lengthInSec > 0 && $lengthInSec / 3600 <= 24) { kickUser($steamId, $serverId, $menssageTOplayer, $messageTOserver); $kickedByBan = true; } else { // Kick the user for the first 5 days that their ban is in pending mode $addDate = $bannedUser->getAddDate(); $daysToKeepBanned = 24 * 3600 * $config->daysBanPending; $expireDate = $addDate + $daysToKeepBanned; // Kick the user if it's still within X days of the pending ban add
function getBanLength($id) { $query = "SELECT length_id, length, time_scale FROM gban_length\r\n WHERE length_id = '" . $id . "'"; $this->db->sql_query($query); $temp = $this->db->get_row(); $length = new Length(); $length->setId($temp['length_id']); $length->setLength($temp['length']); $length->setTimeScale($temp['time_scale']); return $length; }