Example #1
0
 /**
  * Supprime un fichier de cache
  *
  * @param string $key -> Clef du cache à supprimer
  * @return bool
  */
 public function delete($key)
 {
     $out = false;
     $file = $this->folder . $key . '.json';
     if (file_exists($file)) {
         if (($result = File::delete($file)) !== true) {
             AdminServ::error($result);
         } else {
             $out = true;
         }
     }
     return $out;
 }
Example #2
0
        $srvoptsImportExport = $_POST['srvoptsImportExport'];
    }
    // Enregistrement
    if ($ChangeAuthPassword) {
        if (USER_ADMINLEVEL === $ChangeAuthLevel) {
            $_SESSION['adminserv']['password'] = $ChangeAuthPassword;
        }
        AdminServ::info(Utils::t('You changed the password "!authLevel", remember it at the next connection!', array('!authLevel' => $ChangeAuthLevel)));
        AdminServLogs::add('action', 'Change authentication password for ' . $ChangeAuthLevel . ' level');
    } elseif ($srvoptsImportExport) {
        // Import
        if ($srvoptsImportExport == 'Import') {
            $srvoptsImportName = $_POST['srvoptsImportName'];
            if ($srvoptsImportName != 'none') {
                $struct = AdminServ::importServerOptions($srvoptsConfigDirectory . $srvoptsImportName);
                if (AdminServ::setServerOptions($struct)) {
                    AdminServLogs::add('action', 'Import server options from ' . $srvoptsConfigDirectory . $srvoptsImportName);
                }
            }
        } elseif ($srvoptsImportExport == 'Export') {
            $srvoptsExportName = Str::replaceChars($_POST['srvoptsExportName']);
            AdminServ::exportServerOptions($srvoptsConfigDirectory . $srvoptsExportName . '.txt', $struct);
        }
    } elseif (AdminServ::setServerOptions($struct)) {
        AdminServLogs::add('action', 'Save server options');
    }
    Utils::redirection(false, '?p=' . USER_PAGE);
}
// LECTURE
$data['srvOpt'] = AdminServ::getServerOptions();
$data['adminLevels'] = AdminServAdminLevel::getServerList();
Example #3
0
					<?php 
    if (isset($data['playlistDirectory']['files']) && !empty($data['playlistDirectory']['files'])) {
        ?>
						<?php 
        $i = 0;
        $defaultFilename = array('guestlist.txt', 'blacklist.txt', 'guestlist.xml', 'blacklist.xml');
        ?>
						<?php 
        foreach ($data['playlistDirectory']['files'] as $file) {
            ?>
							<?php 
            if (in_array($file['filename'], $defaultFilename) || ($isDoubleExt = in_array(File::getDoubleExtension($file['filename']), AdminServConfig::$PLAYLIST_EXTENSION))) {
                ?>
								<?php 
                // Playlist data
                $playlistData = AdminServ::getPlaylistData($data['gameDataDirectory'] . 'Config/' . $file['filename']);
                if (isset($playlistData['logins'])) {
                    $countDataLogins = count($playlistData['logins']);
                    $nbPlayers = $countDataLogins > 1 ? $countDataLogins . ' ' . Utils::t('players') : '1 ' . Utils::t('player');
                } else {
                    $nbPlayers = '0 ' . Utils::t('player');
                }
                // Filename
                $parseExtIndex = $isDoubleExt ? -13 : -4;
                $filename = substr($file['filename'], 0, $parseExtIndex);
                ?>
								<tr class="<?php 
                echo $i % 2 ? 'even' : 'odd';
                ?>
">
									<td class="imgleft"><img src="<?php 
Example #4
0
                                            AdminServLogs::add('action', $action);
                                        }
                                    }
                                } else {
                                    if (isset($_POST['CancelVote'])) {
                                        if (!$client->query('CancelVote')) {
                                            AdminServ::error();
                                        } else {
                                            Utils::redirection();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
// Info serveur
$data['serverInfo'] = AdminServ::getCurrentServerInfo();
$data['isTeamGameMode'] = AdminServ::checkDisplayTeamMode($data['serverInfo']['srv']['gameModeId'], $data['serverInfo']['srv']['gameModeScriptName']);
// Si on est en mode équipe, on force l'affichage en mode détail
if ($data['isTeamGameMode']) {
    $_SESSION['adminserv']['mode']['general'] = 'detail';
}
if (defined('IS_RELAY') && IS_RELAY) {
    // @deprecated $mainServerLogin = AdminServ::getMainServerLoginFromRelay();
    $data['mainServerLogin'] = null;
}
Example #5
0
<?php

// LECTURE
$data['serverLines'] = AdminServ::getChatServerLines();
$lastNicknameUsed = Utils::readCookieData('adminserv_user', 2);
$data['nickname'] = $lastNicknameUsed != null ? $lastNicknameUsed : Utils::t('Nickname');
$colorList = array('$ff0' => Utils::t('Color'), '$000' => Utils::t('Black'), '$f00' => Utils::t('Red'), '$0f0' => Utils::t('Green'), '$00f' => Utils::t('Blue'), '$f80' => Utils::t('Orange'), '$f0f' => Utils::t('Pink'), '$888' => Utils::t('Grey'), '$fff' => Utils::t('White'));
$data['colorOptions'] = null;
$lastColorUsed = Utils::readCookieData('adminserv_user', 3);
foreach ($colorList as $colorCode => $colorName) {
    $selected = $colorCode == $lastColorUsed ? ' selected="selected"' : null;
    $data['colorOptions'] .= '<option value="' . $colorCode . '"' . $selected . '>' . $colorName . '</option>';
}
$lastDestination = null;
$lastDestinationTitle = Utils::t('server');
if (isset($_SESSION['adminserv']['chat_dst'])) {
    $lastDestination = $lastDestinationTitle = $_SESSION['adminserv']['chat_dst'];
}
$data['destination']['list'] = AdminServUI::getPlayerList($lastDestination);
$data['destination']['title'] = Utils::t('Message destination') . ' : ' . $lastDestinationTitle;
<?php

// INCLUDES
session_start();
if (!isset($_SESSION['adminserv']['sid'])) {
    exit;
}
$configPath = '../../' . $_SESSION['adminserv']['path'] . 'config/';
require_once $configPath . 'adminlevel.cfg.php';
require_once $configPath . 'adminserv.cfg.php';
require_once $configPath . 'extension.cfg.php';
require_once $configPath . 'servers.cfg.php';
require_once '../core/adminserv.php';
AdminServConfig::$PATH_RESOURCES = '../';
AdminServ::getClass();
// DATA
$out = array();
if (AdminServ::initialize()) {
    $path = AdminServ::getMapsDirectoryPath();
    $out = Folder::getArborescence($path, AdminServConfig::$MAPS_HIDDEN_FOLDERS, substr_count($path, '/'));
}
// OUT
$client->Terminate();
echo json_encode($out);
Example #7
0
            $NextRoundCustomPointsArray = array();
            if (count($NextRoundCustomPoints) > 0) {
                foreach ($NextRoundCustomPoints as $point) {
                    $NextRoundCustomPointsArray[] = intval(trim($point));
                }
            }
            if (!$client->query('SetRoundCustomPoints', $NextRoundCustomPointsArray)) {
                AdminServ::error();
            }
        }
        // MatchSettings
        if (SERVER_MATCHSET) {
            $mapsDirectory = AdminServ::getMapsDirectoryPath();
            if (array_key_exists('SaveCurrentMatchSettings', $_POST)) {
                if (!$client->query('SaveMatchSettings', $mapsDirectory . SERVER_MATCHSET)) {
                    AdminServ::error();
                }
            }
        }
        AdminServLogs::add('action', 'Save game infos');
        Utils::redirection(false, '?p=' . USER_PAGE);
    }
}
// LECTURE
$gameInfos = AdminServ::getGameInfos();
$data['gameInfos'] = array('curr' => $gameInfos['curr'], 'next' => $gameInfos['next']);
$data['teamInfo'] = array('team1' => array('name' => Utils::t('Blue'), 'color' => '0.667', 'colorhex' => '#0000ff', 'country' => 'World|France'), 'team2' => array('name' => Utils::t('Red'), 'color' => '0', 'colorhex' => '#ff0000', 'country' => 'World|France'));
if (isset($_SESSION['adminserv']['teaminfo']) && count($_SESSION['adminserv']['teaminfo']) > 0) {
    $data['teamInfo'] = array('team1' => $_SESSION['adminserv']['teaminfo']['team1'], 'team2' => $_SESSION['adminserv']['teaminfo']['team2']);
}
unset($gameInfos);
Example #8
0
<?php

// ENREGISTREMENT
if (isset($_POST['savepassword'])) {
    $current = md5($_POST['changePasswordCurrent']);
    $new = md5($_POST['changePasswordNew']);
    if (isset($_SESSION['adminserv']['path'])) {
        $adminservPath = $_SESSION['adminserv']['path'];
    } else {
        $adminservPath = null;
    }
    $pathConfig = $adminservPath . 'config/';
    if (OnlineConfig::PASSWORD !== $current) {
        AdminServ::error(Utils::t('The current password doesn\'t match.'));
    } else {
        if (($result = AdminServServerConfig::savePasswordConfig($pathConfig . 'adminserv.cfg.php', $new)) !== true) {
            AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
        } else {
            $info = Utils::t('The password has been changed.');
            AdminServ::info($info);
            AdminServLogs::add('action', $info);
        }
    }
    Utils::redirection(false, '?p=' . USER_PAGE);
}
Example #9
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();
Example #10
0
// ISSET
if (isset($_POST['nic'])) {
    $nickname = $_POST['nic'];
} else {
    $nickname = null;
}
if (isset($_POST['clr'])) {
    $color = $_POST['clr'];
} else {
    $color = null;
}
if (isset($_POST['msg'])) {
    $message = $_POST['msg'];
} else {
    $message = null;
}
if (isset($_POST['dst'])) {
    $destination = $_POST['dst'];
} else {
    $destination = null;
}
// DATA
$out = null;
if ($message != null && $destination != null) {
    if (AdminServ::initialize(false)) {
        $out = AdminServ::addChatServerLine($message, $nickname, $color, $destination, true);
    }
    $client->Terminate();
}
// OUT
echo json_encode($out);
Example #11
0
                }
            } else {
                AdminServ::error(Utils::t('You are not allowed to configure the servers'));
                Utils::redirection(false, '..');
            }
        } else {
            if (isset($_POST['configsavepassword'])) {
                $password = md5($_POST['savePassword']);
                if (($result = AdminServServerConfig::savePasswordConfig('./adminserv.cfg.php', $password)) !== true) {
                    AdminServ::error(Utils::t('Unable to save password.') . ' (' . $result . ')');
                    Utils::redirection(false, '..');
                } else {
                    session_unset();
                    session_destroy();
                    session_start();
                    $_SESSION['adminserv']['allow_config_servers'] = true;
                    Utils::redirection(false, '../?p=config-addserver');
                }
            } else {
                // Création du mot de passe
                $_SESSION['adminserv']['get_password'] = true;
                Utils::redirection(false, '..');
            }
        }
    } else {
        AdminServ::info(Utils::t('The online configuration is disabled. Use "./config/servers.cfg.php" file.'));
        Utils::redirection(false, '..');
    }
} else {
    Utils::redirection(false, '../?error=' . urlencode(Utils::t('The servers configuration file isn\'t recognized by AdminServ.')));
}
Example #12
0
                    if (!$client->query('InsertPlaylistFromMatchSettings', $data['mapsDirectoryPath'] . $matchset)) {
                        AdminServ::error();
                    } else {
                        AdminServLogs::add('action', 'Insert playlist from matchsettings: ' . $matchset);
                    }
                }
                Utils::redirection(false, '?p=' . USER_PAGE . $data['hasDirectory']);
            } else {
                if (isset($_POST['editMatchset']) && isset($_POST['matchset']) && count($_POST['matchset']) > 0) {
                    AdminServLogs::add('action', 'Edit matchsettings: ' . $_POST['matchset'][0]);
                    // Redirection sur la page de création d'un matchsettings
                    Utils::redirection(false, '?p=maps-creatematchset' . $data['hasDirectory'] . '&f=' . $_POST['matchset'][0]);
                } else {
                    if (isset($_POST['deleteMatchset']) && isset($_POST['matchset']) && count($_POST['matchset']) > 0) {
                        foreach ($_POST['matchset'] as $matchset) {
                            if (!File::delete($data['mapsDirectoryPath'] . $matchset)) {
                                AdminServ::error(Utils::t('Unable to delete the playlist') . ' : ' . $matchset);
                            } else {
                                AdminServLogs::add('action', 'Delete matchsettings: ' . $matchset);
                            }
                        }
                        Utils::redirection(false, '?p=' . USER_PAGE . $data['hasDirectory']);
                    }
                }
            }
        }
    }
}
// MATCH SETTINGS LIST
$data['matchsettingsList'] = AdminServ::getLocalMatchSettingList($data['currentDir'], $args['directory']);
Example #13
0
 /**
  * Récupère la liste des dossiers du répertoire "Maps"
  *
  * @require class "Folder"
  *
  * @param string $path        -> Le chemin du dossier "Maps"
  * @param string $currentPath -> Le chemin à partir de "Maps"
  * @param bool   $showOptions -> Afficher les options (nouveau, renommer, déplacer, supprimer)
  * @return template maps-directorylist
  */
 public static function getMapsDirectoryList($directory, $currentPath = null, $showOptions = true)
 {
     global $data;
     if (class_exists('Folder')) {
         $data += array('folders' => array(), 'currentPath' => $currentPath, 'parentPath' => null, 'showOptions' => $showOptions);
         // Liste des dossiers
         if (is_array($directory)) {
             // Dossier parent
             if ($currentPath) {
                 $params = null;
                 $parentPathEx = explode('/', $currentPath);
                 array_pop($parentPathEx);
                 array_pop($parentPathEx);
                 if (!empty($parentPathEx)) {
                     $parentPath = null;
                     foreach ($parentPathEx as $part) {
                         $parentPath .= $part . '/';
                     }
                     $data['parentPath'] = $parentPath;
                 }
             }
             // Dossiers
             if (!empty($directory['folders'])) {
                 $data['folders'] = $directory['folders'];
             }
             // Template
             self::getTemplate('maps-directorylist');
         } else {
             AdminServ::error($directory);
         }
     } else {
         AdminServ::error('Class "Folder" not exists');
     }
 }
Example #14
0
    ?>
" href="./"><?php 
    echo Utils::t('General');
    ?>
</a></li>
								<?php 
    if (AdminServAdminLevel::hasAccess('server_options')) {
        ?>
									<li><a tabindex="3" class="button light<?php 
        if (USER_PAGE == 'srvopts') {
            echo ' active';
        }
        ?>
" href="?p=srvopts"><?php 
        echo Utils::t('Server options');
        ?>
</a></li>
								<?php 
    }
    ?>
								<?php 
    if (AdminServAdminLevel::hasAccess('game_infos')) {
        ?>
									<li><a tabindex="4" class="button light<?php 
        if (USER_PAGE == 'gameinfos') {
            echo ' active';
        }
        ?>
" href="?p=gameinfos"><?php 
        echo Utils::t('Game infos');
        ?>
Example #15
0
            } else {
                $_SESSION['adminserv']['transfer_billid'] = $client->getResponse();
                AdminServLogs::add('action', 'Transfer ' . $playerToServerAmount . ' planets from to ' . $playerToServerLogin . ' player login');
            }
        }
    }
    Utils::redirection(false, '?p=' . USER_PAGE);
}
/* GET */
$client->addCall('GetServerPlanets');
if (isset($_SESSION['adminserv']['transfer_billid']) && $_SESSION['adminserv']['transfer_billid'] != null) {
    $client->addCall('GetBillState', array($_SESSION['adminserv']['transfer_billid']));
}
if (!$client->multiquery()) {
    AdminServ::error();
} else {
    $queriesData = $client->getMultiqueryResponse();
    // Planets number
    $nbPlanets = $queriesData['GetServerPlanets'];
    // Transfer status
    if (isset($queriesData['GetBillState'])) {
        $billState = $queriesData['GetBillState'];
        $transferState = Utils::t('Transaction') . ' #' . $billState['TransactionId'] . ' : ' . $billState['StateName'];
    } else {
        $transferState = '<i>' . Utils::t('No transfer made.') . '</i>';
    }
}
// Players
$playerCount = AdminServ::getNbPlayers();
$getPlayerListUI = AdminServUI::getPlayerList();
$client->Terminate();
Example #16
0
                                Utils::redirection(false, '?p=' . USER_PAGE);
                            }
                        }
                    }
                }
            }
        }
    }
}
// LECTURE
$client->addCall('GetBanList', array(AdminServConfig::LIMIT_PLAYERS_LIST, 0));
$client->addCall('GetBlackList', array(AdminServConfig::LIMIT_PLAYERS_LIST, 0));
$client->addCall('GetGuestList', array(AdminServConfig::LIMIT_PLAYERS_LIST, 0));
$client->addCall('GetIgnoreList', array(AdminServConfig::LIMIT_PLAYERS_LIST, 0));
if (!$client->multiquery()) {
    AdminServ::error();
} else {
    $queriesData = $client->getMultiqueryResponse();
    $data['banlist']['list'] = $queriesData['GetBanList'];
    $data['blacklist']['list'] = $queriesData['GetBlackList'];
    $data['guestlist']['list'] = $queriesData['GetGuestList'];
    $data['ignorelist']['list'] = $queriesData['GetIgnoreList'];
    $data['banlist']['count'] = count($data['banlist']['list']);
    $data['blacklist']['count'] = count($data['blacklist']['list']);
    $data['guestlist']['count'] = count($data['guestlist']['list']);
    $data['ignorelist']['count'] = count($data['ignorelist']['list']);
}
// Liste des joueurs présent sur le serveur
$data['players']['listOptions'] = AdminServUI::getPlayerList();
$data['players']['count'] = AdminServ::getNbPlayers();
}
$configPath = '../../' . $_SESSION['adminserv']['path'] . 'config/';
require_once $configPath . 'adminlevel.cfg.php';
require_once $configPath . 'adminserv.cfg.php';
require_once $configPath . 'extension.cfg.php';
require_once $configPath . 'servers.cfg.php';
require_once '../core/adminserv.php';
AdminServConfig::$PATH_RESOURCES = '../';
AdminServ::getClass();
AdminServUI::lang();
// ISSET
if (isset($_GET['mode'])) {
    $mode = addslashes($_GET['mode']);
} else {
    $mode = null;
}
if (isset($_GET['sort'])) {
    $sort = addslashes($_GET['sort']);
} else {
    $sort = null;
}
if ($mode) {
    $_SESSION['adminserv']['mode']['general'] = $mode;
}
// DATA
if (AdminServ::initialize()) {
    $out = AdminServ::getCurrentServerInfo($sort);
}
// OUT
$client->Terminate();
echo json_encode($out);
Example #18
0
 /**
  * Inclue les fichiers pour le rendu d'un plugin
  *
  * @param string $pluginName -> Le nom du dossier plugin
  * @return html
  */
 public static function renderPlugin($pluginName = null)
 {
     global $client, $translate, $args;
     if ($pluginName === null) {
         $pluginName = USER_PLUGIN;
     }
     // Tente de récupérer les plugins d'une autre config
     self::setPluginsList();
     // Création du rendu du plugin
     $pluginPath = AdminServConfig::$PATH_PLUGINS . $pluginName . '/';
     $scriptFile = $pluginPath . 'script.php';
     $viewFile = $pluginPath . 'view.php';
     if (file_exists($scriptFile) && file_exists($viewFile)) {
         // Process
         require_once $scriptFile;
         // Terminate client
         if (isset($client) && $client->socket != null) {
             $client->Terminate();
         }
         // Header
         AdminServUI::getHeader();
         // Content
         echo '<section class="plugins hasMenu">' . '<section class="cadre left menu">' . self::getMenuList() . '</section>' . '<section class="cadre right">' . '<h1>' . self::getConfig($pluginName, 'name') . '</h1>';
         require_once $viewFile;
         echo '</section>' . '</section>';
         // Footer
         AdminServUI::getFooter();
         AdminServLogs::add('access', 'Plugin: ' . $pluginName);
     } else {
         AdminServ::error(Utils::t('Plugin error: script.php or view.php file is missing.'));
         AdminServUI::getHeader();
         AdminServUI::getFooter();
     }
 }
Example #19
0
                        AdminServ::error(Utils::t('Connection error: invalid session.'));
                    }
                }
            }
        } else {
            if (OnlineConfig::ACTIVATE === true) {
                Utils::redirection(false, './config/');
            } else {
                AdminServ::info(Utils::t('No server available. To add one, configure "config/servers.cfg.php" file.'));
            }
        }
    } else {
        if (OnlineConfig::ACTIVATE === true && !isset($_GET['error'])) {
            Utils::redirection(false, './config/');
        } else {
            AdminServ::error(Utils::t('The servers configuration file isn\'t recognized by AdminServ.'));
        }
    }
} else {
    if (isset($_SESSION['adminserv']['get_password'])) {
        AdminServ::info(Utils::t('It\'s your first connection and no server configured. Choose a password to configure your servers.'));
    }
}
// HTML
if (isset($_GET['error'])) {
    AdminServ::error($_GET['error']);
} else {
    if (isset($_GET['info'])) {
        AdminServ::info($_GET['info']);
    }
}
Example #20
0
                                $result = File::delete($data['mapsDirectoryPath'] . $map);
                                if ($result !== true) {
                                    AdminServ::error(Utils::t('Unable to delete the map') . ' : ' . $map . ' (' . $result . ')');
                                    break;
                                } else {
                                    AdminServLogs::add('action', 'Delete map: ' . $map);
                                }
                            }
                            Utils::redirection(false, '?p=' . USER_PAGE . $hasDirectory);
                        }
                    }
                }
            }
        }
    }
}
// Save MatchSettings
if ((isset($_POST['addMap']) || isset($_POST['insertMap'])) && SERVER_MATCHSET) {
    if (isset($_POST['SaveCurrentMatchSettings']) && array_key_exists('SaveCurrentMatchSettings', $_POST)) {
        if (!$client->query('SaveMatchSettings', $data['mapsDirectoryPath'] . SERVER_MATCHSET)) {
            AdminServ::error();
        }
    }
}
// MAPLIST
$sort = null;
if (isset($_GET['sort']) && $_GET['sort'] != null) {
    $sort = addslashes($_GET['sort']);
}
$data['maps'] = AdminServ::getLocalMapList($data['currentDir'], $args['directory'], $sort);
Example #21
0
 /**
  * Enregistre les infos sur les équipes
  * @param array $team1 -> (assoc) array(name, color (0 to 1), country)
  * @param array $team2
  * @return bool
  */
 public static function setTeamInfo($team1, $team2)
 {
     global $client;
     $out = false;
     if (!$client->query('SetTeamInfo', 'Unused', 0.0, 'World', $team1['name'], (double) $team1['color'], $team1['country'], $team2['name'], (double) $team2['color'], $team2['country'])) {
         AdminServ::error();
     } else {
         $_SESSION['adminserv']['teaminfo'] = array('team1' => $team1, 'team2' => $team2);
         $out = true;
     }
     return $out;
 }
Example #22
0
<?php

// GAME VERSION
if (SERVER_VERSION_NAME == 'TmForever') {
    $queries = array('chooseNextMap' => 'ChooseNextChallengeList');
} else {
    $queries = array('chooseNextMap' => 'ChooseNextMapList');
}
// ACTIONS
if (isset($_POST['save']) && isset($_POST['list']) && $_POST['list'] != null) {
    $list = explode(',', $_POST['list']);
    if (!$client->query($queries['chooseNextMap'], $list)) {
        AdminServ::error();
    } else {
        AdminServLogs::add('action', 'Order map list');
        Utils::redirection(false, '?p=' . USER_PAGE);
    }
}
// MAPLIST
$data['maps'] = AdminServ::getMapList();
unset($data['maps']['lst'][$data['maps']['cid']]);
<?php

// INCLUDES
session_start();
$configPath = '../../' . $_SESSION['adminserv']['path'] . 'config/';
require_once $configPath . 'adminlevel.cfg.php';
require_once $configPath . 'adminserv.cfg.php';
require_once $configPath . 'servers.cfg.php';
require_once '../core/adminserv.php';
AdminServConfig::$PATH_RESOURCES = '../';
AdminServ::getClass();
// ISSET
if (isset($_GET['srv'])) {
    $serverName = $_GET['srv'];
} else {
    $serverName = null;
}
$out = array();
if ($serverName != null) {
    $out = AdminServAdminLevel::getServerList($serverName);
}
echo json_encode($out);
Example #24
0
<?php

// SESSION
if (!isset($_SESSION['adminserv']['allow_config_servers'])) {
    AdminServ::error(Utils::t('You are not allowed to configure the servers'));
    Utils::redirection();
}
// VERIFICATION
if (class_exists('ServerConfig')) {
    // Si on n'autorise pas la configuration en ligne
    if (OnlineConfig::ACTIVATE !== true) {
        AdminServ::info(Utils::t('No server available. To add one, configure "config/servers.cfg.php" file.'));
        Utils::redirection();
    } elseif (USER_PAGE != 'config-addserver') {
        if (OnlineConfig::ADD_ONLY === true) {
            Utils::redirection(false, './?p=addserver');
        }
    }
} else {
    AdminServ::error(Utils::t('The servers configuration file isn\'t recognized by AdminServ.'));
    Utils::redirection();
}
Example #25
0
</td>
					<td class="value" id="map_currentcallvote">
						<?php 
    echo $data['serverInfo']['map']['callvote']['login'] . ' : ' . $data['serverInfo']['map']['callvote']['cmdname'] . ' (' . $data['serverInfo']['map']['callvote']['cmdparam'] . ')';
    ?>
						<input class="button light" type="submit" name="CancelVote" id="CancelVote" value="<?php 
    echo Utils::t('Cancel vote');
    ?>
" />
					</td>
				</tr>
			<?php 
}
?>
			<?php 
if (AdminServ::isGameMode('Team', $data['serverInfo']['srv']['gameModeId']) && AdminServAdminLevel::hasPermission('force_scores')) {
    ?>
				<tr>
					<td class="key"><?php 
    echo Utils::t('Scores');
    ?>
</td>
					<td class="value" id="map_teamscore">
						<span class="team_0" title="<?php 
    echo Utils::t('Blue team');
    ?>
"></span>
						<input class="text" type="number" min="0" name="ScoreTeamBlue" id="ScoreTeamBlue" value="<?php 
    echo $data['serverInfo']['map']['scores']['blue'];
    ?>
" />
Example #26
0
            $newPath = addslashes($_POST['optionFolderHiddenFieldValue']);
            if ($newPath == '.') {
                $newPath = $data['mapsDirectoryPath'];
            }
            $newPath .= basename($args['directory']) . '/';
            $newPathFromMapsPath = str_replace($data['mapsDirectoryPath'], '', $newPath);
            if ($newPathFromMapsPath) {
                $newPathFromMapsPath = '&d=' . $newPathFromMapsPath;
            }
            if (($result = Folder::rename($data['mapsDirectoryPath'] . $args['directory'], $newPath)) !== true) {
                AdminServ::error(Utils::t('Unable to move the folder') . ' : ' . $args['directory'] . ' (' . $result . ')');
            } else {
                AdminServLogs::add('action', 'Move folder: ' . $args['directory'] . ' to ' . $newPathFromMapsPath);
                Utils::redirection(false, '?p=' . USER_PAGE . $newPathFromMapsPath);
            }
        } else {
            if (isset($_POST['optionFolderHiddenFieldAction']) && $_POST['optionFolderHiddenFieldAction'] == 'delete') {
                if (($result = Folder::delete($data['mapsDirectoryPath'] . $args['directory'])) !== true) {
                    AdminServ::error(Utils::t('Unable to delete the folder') . ' : ' . $args['directory'] . ' (' . $result . ')');
                } else {
                    // Clean cache
                    $cache = new AdminServCache();
                    $cacheKey = 'mapslist-' . Str::replaceChars($data['mapsDirectoryPath'] . $args['directory']);
                    $cache->delete($cacheKey);
                    AdminServLogs::add('action', 'Delete folder: ' . $args['directory']);
                    Utils::redirection(false, '?p=' . USER_PAGE);
                }
            }
        }
    }
}
Example #27
0
					</div><!-- #content-inner -->
				</div><!-- #content -->
				
				<footer>
					<div id="footer-inner">
						© 2006-<?php 
echo date('Y');
?>
 <a href="http://www.zone-kev717.info"><strong>Kev717</strong></a> | AdminServ <?php 
echo ADMINSERV_VERSION;
?>
						
						<span id="path_resources" hidden="hidden"><?php 
echo AdminServConfig::$PATH_RESOURCES;
?>
</span>
						<?php 
if (ADMINSERV_TIMER) {
    ?>
							<p>Script executé en <?php 
    echo AdminServ::endTimer();
    ?>
 sec</p>
						<?php 
}
?>
					</div>
				</footer>
				
			</div><!-- #page-inner -->
		</div><!-- #page -->
</legend>
	<table>
		<?php 
if (AdminServAdminLevel::hasPermission('gameinfos_general_gamemode')) {
    ?>
			<tr>
				<td class="key"><label for="NextGameMode"><?php 
    echo Utils::t('Game mode');
    ?>
</label></td>
				<?php 
    if ($data['gameInfos']['curr'] != null) {
        ?>
					<td class="value">
						<input class="text width2" type="text" name="CurrGameMode" id="CurrGameMode" readonly="readonly" value="<?php 
        echo AdminServ::getGameModeName($data['gameInfos']['curr']['GameMode']);
        ?>
" />
					</td>
				<?php 
    }
    ?>
				<td class="value">
					<select class="width2" name="NextGameMode" id="NextGameMode">
						<?php 
    echo AdminServUI::getGameModeList($data['gameInfos']['next']['GameMode']);
    ?>
					</select>
				</td>
				<td class="preview"></td>
			</tr>
Example #29
0
define('USER_THEME', AdminServUI::theme($args['theme']));
// LANG
define('USER_LANG', AdminServUI::lang($args['lang']));
// VÉRIFICATION DES DROITS
$checkRightsList = array('./config/adminserv.cfg.php' => 666, './config/servers.cfg.php' => 666, './config/adminlevel.cfg.php' => 666);
if (in_array(true, AdminServConfig::$LOGS)) {
    if (!Utils::isWinServer()) {
        $checkRightsList['./logs/'] = 777;
    }
}
AdminServ::checkRights($checkRightsList);
// LOGOUT
AdminServEvent::logout();
// LOGS
AdminServLogs::initialize();
// PLUGINS
define('USER_PLUGIN', AdminServPlugin::getCurrent());
// INDEX
unset($args['theme'], $args['lang']);
if (AdminServEvent::isLoggedIn()) {
    // SWITCH SERVER
    AdminServEvent::switchServer();
    // SERVER CONNECTION
    if (AdminServ::initialize()) {
        // PAGES BACKOFFICE
        AdminServUI::initBackPage();
    }
} else {
    // PAGES FRONTOFFICE
    AdminServUI::initFrontPage();
}
	<table class="game_infos">
		<?php 
echo AdminServUI::getGameInfosField($data['gameInfos'], 'Number of laps', 'LapsNbLaps');
?>
		<?php 
echo AdminServUI::getGameInfosField($data['gameInfos'], Utils::t('Time limit') . ' <span>(' . Utils::t('sec') . ')</span>', 'LapsTimeLimit');
?>
	</table>
</fieldset>

<fieldset id="gameMode-cup" class="gameinfos_cup" hidden="hidden">
	<legend><img src="<?php 
echo AdminServConfig::$PATH_RESOURCES;
?>
images/16/rt_cup.png" alt="" /><?php 
echo AdminServ::getGameModeName(5);
?>
</legend>
	<table class="game_infos">
		<?php 
echo AdminServUI::getGameInfosField($data['gameInfos'], 'Points limit', 'CupPointsLimit');
?>
		<?php 
echo AdminServUI::getGameInfosField($data['gameInfos'], 'Rounds per map', 'CupRoundsPerMap');
?>
		<?php 
echo AdminServUI::getGameInfosField($data['gameInfos'], 'Number of winners', 'CupNbWinners');
?>
		<?php 
echo AdminServUI::getGameInfosField($data['gameInfos'], 'All WarmUp duration', 'CupWarmUpDuration');
?>