Ejemplo n.º 1
0
<?php

// ACTIONS
if (isset($_POST['save']) && isset($_POST['list']) && $_POST['list'] != null) {
    $serverList = ServerConfig::$SERVERS;
    $list = explode(',', $_POST['list']);
    $newServerList = array();
    foreach ($list as $listServerName) {
        $newServerList[$listServerName] = array('address' => $serverList[$listServerName]['address'], 'port' => $serverList[$listServerName]['port'], 'mapsbasepath' => isset($serverList[$listServerName]['mapsbasepath']) ? $serverList[$listServerName]['mapsbasepath'] : '', 'matchsettings' => $serverList[$listServerName]['matchsettings'], 'adminlevel' => $serverList[$listServerName]['adminlevel']);
    }
    AdminServServerConfig::saveServerConfig(array(), -1, $newServerList);
    AdminServLogs::add('action', 'Order server list');
    Utils::redirection(false, '?p=' . USER_PAGE);
}
// SERVERLIST
$data['servers'] = array();
if (is_array(ServerConfig::$SERVERS) && !empty(ServerConfig::$SERVERS)) {
    $data['servers'] = ServerConfig::$SERVERS;
}
Ejemplo n.º 2
0
    // SET
    $setServerData = array('name' => trim(htmlspecialchars(addslashes($_POST['server'][0] . ' - ' . Utils::t('copy')))), 'address' => trim($getServerData['address']), 'port' => intval($getServerData['port']), 'matchsettings' => trim($getServerData['matchsettings']), 'adminlevel' => array('SuperAdmin' => $getServerData['adminlevel']['SuperAdmin'], 'Admin' => $getServerData['adminlevel']['Admin'], 'User' => $getServerData['adminlevel']['User']));
    if (AdminServServerConfig::saveServerConfig($setServerData)) {
        $action = Utils::t('This server has been duplicated.');
        AdminServ::info($action);
        AdminServLogs::add('action', $action);
        Utils::redirection(false, '?p=' . USER_PAGE);
    } else {
        AdminServ::error(Utils::t('Unable to duplicate server.'));
    }
}
// SUPPRESSION
if (isset($_POST['deleteserver'])) {
    $servers = ServerConfig::$SERVERS;
    unset($servers[$_POST['server'][0]]);
    if (($result = AdminServServerConfig::saveServerConfig(array(), -1, $servers)) !== true) {
        AdminServ::error(Utils::t('Unable to delete server.') . ' (' . $result . ')');
    } else {
        $action = Utils::t('The "!serverName" server has been deleted.', array('!serverName' => $_POST['server'][0]));
        AdminServ::info($action);
        AdminServLogs::add('action', $action);
        Utils::redirection(false, '?p=' . USER_PAGE);
    }
}
// SERVERLIST
$data['servers'] = array();
if (is_array(ServerConfig::$SERVERS) && !empty(ServerConfig::$SERVERS)) {
    $data['servers'] = ServerConfig::$SERVERS;
}
$data['count'] = count($data['servers']);
$data['adminLevelsType'] = AdminServAdminLevel::getDefaultType();
Ejemplo n.º 3
0
    $serverData = array('name' => $serverName, 'address' => $serverAddress, 'port' => $serverPort, 'mapsbasepath' => $serverMapsBasePath, 'matchsettings' => $serverMatchSet, 'adminlevel' => array());
    foreach ($serverAdmLvl as $admLvlId => $admLvlValue) {
        $serverData['adminlevel'][$admLvlId] = $admLvlValue;
    }
    // Édition
    if ($args['id'] !== -1) {
        if (($result = AdminServServerConfig::saveServerConfig($serverData, $args['id'])) !== true) {
            AdminServ::error(Utils::t('Unable to modify the server.') . ' (' . $result . ')');
        } else {
            $action = Utils::t('This server has been modified.');
            AdminServ::info($action);
            AdminServLogs::add('action', $action);
            Utils::redirection(false, '?p=config-servers');
        }
    } else {
        if (($result = AdminServServerConfig::saveServerConfig($serverData)) !== true) {
            AdminServ::error(Utils::t('Unable to add the server.') . ' (' . $result . ')');
        } else {
            $action = Utils::t('This server has been added.');
            AdminServ::info($action);
            AdminServLogs::add('action', $action);
            Utils::redirection(false, '?p=' . USER_PAGE);
        }
    }
}
// LECTURE
$data = array('name' => null, 'address' => 'localhost', 'port' => 5000, 'mapsbasepath' => null, 'matchsettings' => 'MatchSettings/', 'adminlevel' => array('SuperAdmin' => 'all', 'Admin' => 'all', 'User' => 'all'));
if ($args['id'] !== -1) {
    define('IS_SERVER_EDITION', true);
    $data['name'] = AdminServServerConfig::getServerName($args['id']);
    if ($data['name']) {