function unBanUser($steamId, $bannedIP)
{
    // This will send an RCON command to the server
    $serverQueries = new ServerQueries();
    // Get the list of servers
    $servers = $serverQueries->getServers();
    // Cycle through each server
    foreach ($servers as $server) {
        $r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());
        if ($r->isValid()) {
            $r->Auth();
            $r->sendRconCommand("removeid " . $steamId);
            $r->sendRconCommand("removeip " . $bannedIP);
        }
    }
}
function kickUser($steamId, $serverId, $menssageTOplayer, $menssageTOserver)
{
    // Leave this in to be compatible with the alternate thread version
    $kick = "kickid";
    $command = $kick . " \"" . $steamId . "\" " . $menssageTOplayer;
    echo $command;
    // This will send an RCON command to the server
    $serverQueries = new ServerQueries();
    $server = $serverQueries->getServer($serverId);
    $r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());
    if ($r->isValid()) {
        $r->Auth();
        $r->kickUser($steamId, $menssageTOplayer);
        $r->sendRconCommand("banid 5 " . "\"" . $steamId . "\" ");
        $r->sendRconCommand("es_msg " . $menssageTOserver);
    }
}
    (at your option) any later version.

    GlobalBan is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
$id = $_GET['id'];
$name = $_GET['name'];
$description = $_GET['description'];
// Update the server status
$serverQueries = new ServerQueries();
if (!empty($id) && !empty($name) && !empty($description)) {
    //$success = "true";
    $success = $serverQueries->updateServerGroup($id, $name, $description);
} else {
    $success = "false";
}
// Send back the new active state
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
function convertXmlSpecial($string)
{
    $string = str_replace("&", "&amp;", $string);
    $string = str_replace("'", "&apos;", $string);
    $string = str_replace("\"", "&quot;", $string);
    $string = str_replace("<", "&lt;", $string);
require_once ROOTDIR . "/include/class.rcon.php";
function selfURL()
{
    $s = empty($_SERVER["HTTPS"]) ? '' : $_SERVER["HTTPS"] == "on" ? "s" : "";
    $protocol = strleft(strtolower($_SERVER["SERVER_PROTOCOL"]), "/") . $s;
    $port = $_SERVER["SERVER_PORT"] == "80" ? "" : ":" . $_SERVER["SERVER_PORT"];
    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $_SERVER['REQUEST_URI'];
}
function strleft($s1, $s2)
{
    return substr($s1, 0, strpos($s1, $s2));
}
$url = selfURL();
$url = substr($url, 0, strrpos($url, "/")) . "/";
$serverId = $_GET['serverId'];
$serverQueries = new ServerQueries();
$server = $serverQueries->getServer($serverId);
// Create an rcon object to connect to a single server on each iteration
$r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());
$success = 0;
// Make sure it connected to the server
if ($r->isValid()) {
    // Is admin banning allowed
    $adminBanning = 0;
    if ($config->allowAdminBans) {
        $adminBanning = 1;
    }
    $r->Auth();
    // Establish the connection
    $command = "gb_saveConfig \"" . $server->getId() . "\" \"" . $url . "\" \"" . $config->banMessage . "\" \"" . $config->matchHash . "\" \"" . $config->teachAdmins . "\" \"" . $config->siteName . "\" \"" . $adminBanning . "\" ";
    $r->sendRconCommand($command);
    GlobalBan is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GlobalBan is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/class.rcon.php";
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
$serverQueries = new ServerQueries();
$servers = $serverQueries->getServers();
// Cycle through each server
foreach ($servers as $server) {
    ?>
  <h3 id="server:<?php 
    echo $server->getId();
    ?>
">Updating Ban Reasons for <?php 
    echo $server->getName();
    ?>
 <img src="images/wait.gif"/></h3>
  <?php 
}
?>
<h5>Note: The Ban Length List will continue to upload if you navigate off this page.  However, reloading this page or navigating
    (at your option) any later version.

    GlobalBan is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
$server_group_id = $_GET['server_group_id'];
$admin_id = $_GET['admin_id'];
$name = $_GET['name'];
// Update the server status
$serverQueries = new ServerQueries();
if (!empty($server_group_id) && !empty($admin_id)) {
    //$success = "true";
    $success = $serverQueries->deleteServerAdmin($server_group_id, $admin_id);
} else {
    $success = "false";
}
// Send back the new active state
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
function convertXmlSpecial($string)
{
    $string = str_replace("&", "&amp;", $string);
    $string = str_replace("'", "&apos;", $string);
    $string = str_replace("\"", "&quot;", $string);
    $string = str_replace("<", "&lt;", $string);
    This file is part of GlobalBan.

    Written by Stefan Jonasson <*****@*****.**>
    Copyright 2008 Stefan Jonasson
    
    GlobalBan is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GlobalBan is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
// Determines what plugins are enabled for the specified server
$serverId = $_GET['serverId'];
$serverQueries = new ServerQueries();
$allPlugins = $serverQueries->getAllPlugins();
$serverPlugins = $serverQueries->getServerPlugins($serverId);
for ($i = 0; $i < count($allPlugins); $i++) {
    if (in_array($allPlugins[$i], $serverPlugins)) {
        echo $allPlugins[$i] . " = 1\n";
    } else {
        echo $allPlugins[$i] . " = 0\n";
    }
}
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
$id = $_GET['id'];
$name = $_GET['name'];
$ip = $_GET['ip'];
$port = $_GET['port'];
$type = $_GET['type'];
$rcon = $_GET['rcon'];
$currentRcon = $_GET['currentRcon'];
$plugin = $_GET['plugin'];
// Update the server status
$serverQueries = new ServerQueries();
if (!empty($currentRcon)) {
    $success = $serverQueries->updateServer($name, $ip, $port, $rcon, $currentRcon, $type, $id, $plugin);
} else {
    $success = "false";
}
// Send back the new active state
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
function convertXmlSpecial($string)
{
    $string = str_replace("&", "&amp;", $string);
    $string = str_replace("'", "&apos;", $string);
    $string = str_replace("\"", "&quot;", $string);
    $string = str_replace("<", "&lt;", $string);
    $string = str_replace(">", "&gt;", $string);
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
require_once ROOTDIR . "/include/objects/class.Server.php";
require_once ROOTDIR . "/include/database/class.UserQueries.php";
require_once ROOTDIR . "/include/objects/class.User.php";
require_once ROOTDIR . "/include/database/class.AdminGroupQueries.php";
// Only those with full privs can access this page
if ($fullPower) {
    $serverId = 0;
    $groupId = 0;
    if (isset($_POST['serverId'])) {
        $serverId = $_POST['serverId'];
    }
    if (isset($_POST['serverGroupId'])) {
        $groupId = $_POST['serverGroupId'];
    }
    $serverQueries = new ServerQueries();
    $userQueries = new UserQueries();
    $error = false;
    // Set the server Id to nothing so that we are only editing the group
    if (isset($_POST['switchGroup'])) {
        $serverId = -1;
    }
    // Get selected server info
    $server = $serverQueries->getServer($serverId);
    // This will set the group for the server
    if (isset($_POST['setGroup'])) {
        // Only set if a server is selected
        if ($serverId > 0) {
            $serverQueries->setServerGroup($serverId, $groupId);
        }
    }
  if(confirm("<?php 
/*?><?php echo $LAN_MANAGESERVERGROUPS_001 ?><?php */
?>
 .  "+serverName+"<?php 
/*?><?php echo $LAN_MANAGESERVERGROUPS_002 ?><?php */
?>
")) {
    document.getElementById("deleteServer"+serverId).submit();
  }
}
</script> -->

<?php 
// Only those with full privs can remove or add servers to the list
if ($fullPower) {
    $serverQueries = new ServerQueries();
    $error = false;
    // If this is set, then that means a server is being added
    if (isset($_POST['submitAdd'])) {
        if (!empty($_POST['groupName'])) {
            $description = '';
            if (!empty($_POST['description'])) {
                $description = $_POST['description'];
            }
            $newGroupId = $serverQueries->addServerGroup($_POST['groupName'], $description);
            echo '<br>$newGroupId: ' . $newGroupId . '</br>';
            if ($newGroupId < 0) {
                $error = true;
            }
        } else {
            $error = true;
    return false;
  }

  return true;
}

function deleteVerify(serverId, serverName) {
  if(confirm("Do you really want to delete "+serverName+"?")) {
    document.getElementById("deleteServer"+serverId).submit();
  }
}
</script>
<?php 
// Only those with full privs can remove or add servers to the list
if ($fullPower) {
    $serverQueries = new ServerQueries();
    $error = false;
    // If this is set, then that means a server is being added
    if (isset($_POST['submitAdd'])) {
        $newServerId = $serverQueries->addServer($_POST['serverName'], $_POST['serverIp'], $_POST['serverPort'], $_POST['serverRcon'], $_POST['serverType'], $_POST['serverPlugin']);
        if ($newServerId < 0) {
            $error = true;
        }
    }
    // If a server is being deleted
    if (isset($_POST['deleteServer'])) {
        $serverQueries->deleteServer($_POST['serverId']);
    }
    // Get list of server objects
    $servers = $serverQueries->getServers();
    ?>
 if (isset($_POST['submitImport'])) {
     // Parse input and add bans
     $reason = $_POST['reason'];
     // Reason Id
     $tempName = $_FILES['cfgfile']['tmp_name'];
     // Temp name of when it is uploaded
     if (is_uploaded_file($tempName)) {
         $bans = "";
         $f = fopen($tempName, 'r');
         while ($data = fread($f, 4096)) {
             $bans .= $data;
         }
         fclose($f);
         $banLines = explode("\n", $bans);
         $banQueries = new BanQueries();
         $serverQueries = new ServerQueries();
         // Constant Variables
         $serverId = $serverQueries->getFirstServer();
         // We need to assign it to a valid server for it to display
         $nameOfBanned = "";
         // Name is unknown
         $banner = "";
         // Don't know who banner is, so leave empty
         $count = 0;
         $failed = 0;
         $failedIDs = "";
         foreach ($banLines as $banLine) {
             echo $banLine . "<br>";
             $ban = explode(" ", $banLine);
             // 0 = banid (discard)
             // 1 = length
Exemplo n.º 13
0
if (!empty($_GET['sd'])) {
    $sortDirection = $_GET['sd'];
    // Direction to sort by
} else {
    $sortDirection = "DESC";
}
if (!empty($_POST['searchText'])) {
    $searchText = $_POST['searchText'];
    // Search text
} else {
    $searchText = "";
}
$lan_file = ROOTDIR . '/languages/' . $LANGUAGE . '/lan_demos.php';
include file_exists($lan_file) ? $lan_file : ROOTDIR . "/languages/English/lan_demos.php";
// Initialize Objects
$serverQueries = new ServerQueries();
$reasonQueries = new ReasonQueries();
$demoQueries = new DemoQueries();
$success = "";
// Submit button was pushed
if (!empty($_POST['submitDemo']) && $_POST['submitDemo']) {
    $filename = $_FILES['file']['name'];
    // Get the name of the file
    $tempName = $_FILES['file']['tmp_name'];
    // Temp name of when it is uploaded
    $fileType = $_FILES['userfile']['type'];
    // We check for multiple page types as apache may be configured to support them
    $filename = str_ireplace(".php", "_", $filename);
    $filename = str_ireplace(".jsp", "_", $filename);
    $filename = str_ireplace(".asp", "_", $filename);
    $filename = str_ireplace(".html", "_", $filename);
function kickUser($steamId, $serverId, $config)
{
    $serverQueries = new ServerQueries();
    $server = $serverQueries->getServer($serverId);
    $r = new rcon($server->getIp(), $server->getPort(), $server->getRcon());
    $r->Auth();
    $r->rconCommand("kickid " . $steamId . " '" . $config->banMessage . "'");
}
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    GlobalBan is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GlobalBan.  If not, see <http://www.gnu.org/licenses/>.
*/
require_once ROOTDIR . "/include/database/class.ServerQueries.php";
$id = $_GET['id'];
$name = $_GET['name'];
// Update the server status
$serverQueries = new ServerQueries();
if (!empty($id)) {
    //$success = "true";
    $success = $serverQueries->deleteServerGroup($id, $name);
} else {
    $success = "false";
}
// Send back the new active state
header('Content-Type: text/xml');
header("Cache-Control: no-cache, must-revalidate");
function convertXmlSpecial($string)
{
    $string = str_replace("&", "&amp;", $string);
    $string = str_replace("'", "&apos;", $string);
    $string = str_replace("\"", "&quot;", $string);
    $string = str_replace("<", "&lt;", $string);