<?php
# PHP Half-Life Monitor 1.0.2-beta
#
# $Id: bans.php,v 1.10 2004/04/02 21:06:12 sloede Exp $
#
# This file is part of the PHP Half-Life Monitor program
#
# (c) 2002-2004 by Michael Schlottke <hide@address.com> <http://phlmon.sloede.com>
#
# PHP Half-Life Monitor (short: PHLMon) 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 PHLMon; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
if (!file_exists("default.php")) {
die("ERROR - Default file missing: <b>default.php</b><br><br>Aborting...");
}
include("default.php");
openServer();
if ($action == "unbanPlayer") {
$halfc->unbanPlayer($ID);
} else if ($action == "banPlayer") {
$halfc->banPlayer($_POST['banTime'], $ID);
}
$halfc->updateBanList();
$template = new template($phlmonConfig['templateSet']);
$template -> assign('langBans', $language[3]);
$template -> assign('banMode', $language[63]);
$template -> assign('identifier', $language[64]);
$template -> assign('banTime', $language[65]);
$template -> assign('langUnbanPlayer', $language[66]);
$template -> assign('manualBan', $language[67]);
$template -> assign('banTimeInput', $language[68]);
$template -> assign('banPlayer', $language[69]);
$template -> assign("langNoBanTime", $language[113]);
$template -> assign("langNotAnInteger", $language[116]);
$template -> assign("langIdent", $language[117]);
$template -> assign("langBanPermanently", $language[114]);
$template -> assign("banPlayerFormLink", wrapLink("bans.php?action=banPlayer"));
if(count($halfc -> bans) == 0) {
$template -> assign("langNoBansAvailable", $language[83]);
$template -> assign("noBansAvailable", $template->get("bans_nobansavailable.tpl"));
} else {
$template -> assign("noBansAvailable", "");
}
$bantable = "";
foreach ($halfc->bans AS $value) {
$mode = str_replace('IP', 'ban by IP', $value['Mode']);
$mode = str_replace('WonID', 'ban by WonID', $mode);
$value['Ident'] = str_replace(' ', '', $value['Ident']);
$template->assign("mode", $mode);
$template->assign("ident", $value['Ident']);
$template->assign("time", $value['Time']);
$template -> assign("unbanPlayerLink", wrapLink("bans.php?action=unbanPlayer&ID=".$value['Ident']));
$bantable .= $template->get("bans_bantable.tpl");
}
$template -> assign('banTable', $bantable);
$content = $template->get("bans.tpl");
showContent($content);
?>