userdata['acclevel'] < 80)
die ('Access denied!');
function setdefaults($key)
{
global $db;
// get default values
$db->query("DELETE FROM hlstats_Servers_Config WHERE serverId=$key;");
$db->query("INSERT INTO hlstats_Servers_Config (serverId, parameter, value) SELECT $key,parameter,value FROM hlstats_Servers_Config_Default");
// get server ip and port
$db->query("SELECT CONCAT(address, ':', port) AS addr FROM hlstats_Servers WHERE serverId=$key;");
$r = $db->fetch_array();
}
if (isset($_GET['key'])) {
$key = valid_request(intval($_GET['key']),1);
} else {
if (isset($_POST['key'])) {
$key = valid_request(intval($_POST['key']),1);
} else {
$key = 0;
}
}
if ($key==0)
die('Server ID not set!');
if (isset($_POST['sourceId'])) {
$sourceId = valid_request(intval($_POST['sourceId']),1);
} else {
$sourceId = 0;
}
?>
Note: For changes on this page to take effect, you must">reload or restart the HLX:CE daemon.
query("SELECT parameter,description FROM hlstats_Servers_Config_Default");
$helptexts = array();
while ($r = $db->fetch_array())
$helptexts[strtolower($r['parameter'])] = $r['description'];
$edlist = new EditList('serverConfigId', 'hlstats_Servers_Config','', false);
$footerscript = $edlist->setHelp('helpdiv','parameter',$helptexts);
$edlist->columns[] = new EditListColumn('serverId', 'Server ID', 0, true, 'hidden', $key);
$edlist->columns[] = new EditListColumn('parameter', 'Server parameter name', 30, true, 'readonly', '', 50);
$edlist->columns[] = new EditListColumn('value', 'Parameter value', 60, false, 'text', '', 128);
if ($_POST)
if ($_POST['setdefaults']=='defaults') {
setdefaults($key);
} else
if ($_POST['sourceId']!='0') {
// copy server settings from another server
$db->query("DELETE FROM hlstats_Servers_Config WHERE serverId=$key");
$db->query("INSERT INTO hlstats_Servers_Config (serverId, parameter, value) SELECT $key,parameter,value FROM hlstats_Servers_Config WHERE serverId=$sourceId");
// get server ip and port
$db->query("SELECT CONCAT(address, ':', port) AS addr FROM hlstats_Servers WHERE serverId=$key;");
$r = $db->fetch_array();
} else {
if ($edlist->update())
message('success', 'Operation successful.');
else
message('warning', $edlist->error());
}
?>
These are the actual server parameters used by the hlstats.pl script.
query("
SELECT
*
FROM
hlstats_Servers_Config
WHERE
serverId=$key
ORDER BY
parameter ASC
");
if ($db->num_rows($result) == 0) {
setdefaults($key);
$result = $db->query("
SELECT
*
FROM
hlstats_Servers_Config
WHERE
serverId=$key
ORDER BY
parameter ASC
");
}
$edlist->draw($result);
// get all other server id's
$sourceIds = '';
$db->query("SELECT CONCAT(name,' (',address,':',port,')') AS name, serverId FROM hlstats_Servers WHERE serverId<>$key ORDER BY name, address, port");
while ($r = $db->fetch_array())
$sourceIds .= '