<?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);
</a></li>
				<?php 
    }
    ?>
				<?php 
    if (AdminServAdminLevel::hasPermission('folder_move')) {
        ?>
					<li><a class="button light move" id="moveFolder" href="."><?php 
        echo Utils::t('Move');
        ?>
</a></li>
				<?php 
    }
    ?>
				<?php 
    if (AdminServAdminLevel::hasPermission('folder_delete')) {
        ?>
					<li><a class="button light delete" id="deleteFolder" href="." data-confirm-text="<?php 
        echo Utils::t('Do you really want to remove this folder !currentDir?', array('!currentDir' => $currentDir));
        ?>
>"><?php 
        echo Utils::t('Delete');
        ?>
</a></li>
				<?php 
    }
    ?>
			</ul>
		</div>
		<input type="hidden" name="optionFolderHiddenFieldAction" id="optionFolderHiddenFieldAction" value="" />
		<input type="hidden" name="optionFolderHiddenFieldValue" id="optionFolderHiddenFieldValue" value="" />
Esempio n. 3
0
 /**
  * @deprecated
  * Récupère le login du serveur principal à partir d'un serveur Relai
  *
  * @return string
  */
 public static function getMainServerLoginFromRelay()
 {
     global $client;
     $out = null;
     if (AdminServAdminLevel::isType('Admin')) {
         if (!$client->query('GameDataDirectory')) {
             self::error();
         } else {
             // Récupération du login
             $out = null;
         }
     }
     return $out;
 }
Esempio n. 4
0
<?php

// GAMEDATA
if (AdminServAdminLevel::isType('Admin')) {
    if (!$client->query('GameDataDirectory')) {
        AdminServ::error();
    } else {
        $data['gameDataDirectory'] = $client->getResponse();
        $data['playlistDirectory'] = Folder::read($data['gameDataDirectory'] . 'Config', array(), array(), intval(AdminServConfig::RECENT_STATUS_PERIOD * 3600));
    }
}
// ACTIONS
// Vider la liste
if (isset($_GET['clean'])) {
    $clean = strtolower($_GET['clean']);
    if ($clean == 'banlist') {
        if (!$client->query('CleanBanList')) {
            AdminServ::error();
        } else {
            AdminServLogs::add('action', 'Clean banlist');
        }
    } else {
        if ($clean == 'ignorelist') {
            if (!$client->query('CleanIgnoreList')) {
                AdminServ::error();
            } else {
                AdminServLogs::add('action', 'Clean ignorelist');
            }
        } else {
            if ($clean == 'guestlist') {
                if (!$client->query('CleanGuestList')) {
Esempio n. 5
0
images/16/mapauthor.png" alt="" /><?php 
        echo $map['Author'];
        ?>
</div>
							</li>
						<?php 
    }
    ?>
					<?php 
}
?>
				</ul>
			</div>
			
			<?php 
if (SERVER_MATCHSET && AdminServAdminLevel::hasPermission('maps_matchsettings_save')) {
    ?>
				<div class="fleft options-checkbox">
					<input class="text inline" type="checkbox" name="SaveCurrentMatchSettings" id="SaveCurrentMatchSettings"<?php 
    if (AdminServConfig::AUTOSAVE_MATCHSETTINGS === true) {
        echo ' checked="checked"';
    }
    ?>
 value="" /><label for="SaveCurrentMatchSettings" title="<?php 
    echo SERVER_MATCHSET;
    ?>
"><?php 
    echo Utils::t('Save the current MatchSettings');
    ?>
</label>
				</div>
Esempio n. 6
0
<?php

if (!empty($data['menuList'])) {
    ?>
	<nav class="vertical-nav">
		<ul>
			<?php 
    foreach ($data['menuList'] as $page => $title) {
        ?>
				<?php 
        if (AdminServAdminLevel::hasAccess($page)) {
            ?>
					<li><a <?php 
            if (USER_PAGE == $page) {
                echo 'class="active"';
            }
            ?>
href="?p=<?php 
            echo $page;
            if ($args['directory']) {
                echo '&amp;d=' . $args['directory'];
            }
            ?>
"><?php 
            echo Utils::t($title);
            ?>
</a></li>
				<?php 
        }
        ?>
			<?php 
Esempio n. 7
0
									<?php 
    }
    ?>
								</select>
								<span class="changeauthpassword-arrow"> </span>
								<input class="text" type="password" name="ChangeAuthPassword" id="ChangeAuthPassword" value="" />
							</td>
						</tr>
					</table>
				</fieldset>
			<?php 
}
?>
			
			<?php 
if (defined('IS_LOCAL') && IS_LOCAL && AdminServAdminLevel::hasPermission('srvopts_importexport')) {
    ?>
				<fieldset class="srvopts_importexport">
					<legend><img src="<?php 
    echo AdminServConfig::$PATH_RESOURCES;
    ?>
images/16/rt_team.png" alt="" /><?php 
    echo Utils::t('Manage server options');
    ?>
</legend>
					<table>
						<tr>
							<td class="key"><label for="srvoptsImport"><?php 
    echo Utils::t('Import');
    ?>
</label></td>
Esempio n. 8
0
 /**
  * Retourne une liste html pour le menu des plugins
  *
  * @return html
  */
 public static function getMenuList()
 {
     $out = null;
     $pluginsList = array();
     if (count(ExtensionConfig::$PLUGINS) > 0) {
         foreach (ExtensionConfig::$PLUGINS as $plugin) {
             $pluginInfos = self::getConfig($plugin);
             if (($pluginInfos['game'] == 'all' || $pluginInfos['game'] == SERVER_VERSION_NAME) && AdminServAdminLevel::isType($pluginInfos['adminlevel'])) {
                 $pluginsList[$plugin] = $pluginInfos;
             }
         }
     }
     if (count($pluginsList) > 0) {
         $out = '<nav class="vertical-nav">' . '<ul>';
         foreach ($pluginsList as $plugin => $infos) {
             $out .= '<li><a ';
             if (self::getCurrent() == $plugin) {
                 $out .= 'class="active" ';
             }
             $out .= 'href="?p=plugins-' . $plugin . '" title="' . Utils::t('Version') . ' : ' . $infos['version'] . '">' . $infos['name'] . '</a></li>';
         }
         $out .= '</ul>' . '</nav>';
     }
     return $out;
 }
Esempio n. 9
0
    ?>
</span>
						<span class="selected-files-count">(0)</span>
						<div class="selected-files-option">
							<?php 
    if (AdminServAdminLevel::hasPermission('maps_list_removetolist')) {
        ?>
								<input class="button dark" type="submit" name="removeMap" id="removeMap" value="<?php 
        echo Utils::t('Delete');
        ?>
" />
							<?php 
    }
    ?>
							<?php 
    if (AdminServAdminLevel::hasPermission('maps_list_moveaftercurrent')) {
        ?>
								<input class="button dark" type="submit" name="chooseNextMap" id="chooseNextMap" value="<?php 
        echo Utils::t('Move after the current map');
        ?>
" />
							<?php 
    }
    ?>
						</div>
					</div>
				</div>
			<?php 
}
?>
		</div>
Esempio n. 10
0
 /**
  * Ititialise une page en back office
  */
 public static function initBackPage()
 {
     global $client, $data, $args;
     // Pages list
     $pagesList = array('general', 'srvopts', 'gameinfos', 'chat', 'plugins-list', 'guestban');
     $pagesList = array_merge($pagesList, array_keys(ExtensionConfig::$MAPSMENU));
     $firstPage = array_shift($pagesList);
     // Render page
     if (in_array(USER_PAGE, $pagesList)) {
         $pageKey = array_search(USER_PAGE, $pagesList);
         if (AdminServAdminLevel::hasAccess($pagesList[$pageKey])) {
             self::renderPage($pagesList[$pageKey]);
         } else {
             $data = array('errorTitle' => Utils::t('Erreur d\'accès à la page'), 'errorMessage' => Utils::t('Vous n\'avez pas les droits requis pour accéder à cette page. Veuillez contacter votre administrateur.'));
             self::renderPage('page-error');
         }
     } else {
         if (self::isPageType('config')) {
             session_unset();
             session_destroy();
             Utils::redirection(false, './config/');
         } elseif (USER_PLUGIN) {
             AdminServPlugin::renderPlugin();
         } else {
             self::renderPage($firstPage);
         }
     }
 }
Esempio n. 11
0
    $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();
Esempio n. 12
0
        }
        ?>
" href="?p=gameinfos"><?php 
        echo Utils::t('Game infos');
        ?>
</a></li>
								<?php 
    }
    ?>
								<?php 
    if (AdminServAdminLevel::hasAccess('chat')) {
        ?>
									<li><a tabindex="5" class="button light<?php 
        if (USER_PAGE == 'chat') {
            echo ' active';
        }
        ?>
" href="?p=chat"><?php 
        echo Utils::t('Chat');
        ?>
</a></li>
								<?php 
    }
    ?>
								<?php 
    if (AdminServAdminLevel::hasAccess('maps_list')) {
        ?>
									<li><a tabindex="6" class="button light<?php 
        if (AdminServUI::isPageType('maps')) {
            echo ' active';
        }
Esempio n. 13
0
echo Utils::t('Show server lines');
?>
"><?php 
echo Utils::t('Hide server lines');
?>
</a></li>
		</ul>
	</div>
	
	<div id="chat"><?php 
echo $data['serverLines'];
?>
</div>
	
	<?php 
if (AdminServAdminLevel::hasPermission('chat_sendmessage')) {
    ?>
		<div class="options">
			<input class="text" type="text" name="chatNickname" id="chatNickname" value="<?php 
    echo $data['nickname'];
    ?>
" data-default-value="<?php 
    echo Utils::t('Nickname');
    ?>
" />
			<select name="chatColor" id="chatColor" title="<?php 
    echo Utils::t('Default color: yellow');
    ?>
">
				<?php 
    echo $data['colorOptions'];
Esempio n. 14
0
    }
    // 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();
Esempio n. 15
0
" />
							<?php 
    }
    ?>
							<?php 
    if (AdminServAdminLevel::hasPermission('maps_matchsettings_load')) {
        ?>
								<input class="button dark" type="submit" name="loadMatchset" id="loadMatchset" value="<?php 
        echo Utils::t('Load');
        ?>
" />
							<?php 
    }
    ?>
							<?php 
    if (AdminServAdminLevel::hasPermission('maps_matchsettings_save')) {
        ?>
								<input class="button dark" type="submit" name="saveMatchset" id="saveMatchset" value="<?php 
        echo Utils::t('Save ');
        ?>
" />
							<?php 
    }
    ?>
						</div>
					</div>
				</div>
			<?php 
}
?>
		</div>
Esempio n. 16
0
<?php

// ACTIONS
if (isset($_POST['save']) && isset($_POST['list']) && $_POST['list'] != null) {
    $adminLevelList = AdminLevelConfig::$ADMINLEVELS;
    $list = explode(',', $_POST['list']);
    $newAdminLevelList = array();
    foreach ($list as $listLevelName) {
        $newAdminLevelList[$listLevelName] = array('adminlevel' => $adminLevelList[$listLevelName]['adminlevel'], 'access' => $adminLevelList[$listLevelName]['access'], 'permission' => $adminLevelList[$listLevelName]['permission']);
    }
    AdminServAdminLevel::saveConfig(array(), -1, $newAdminLevelList);
    AdminServLogs::add('action', 'Order admin level list');
    Utils::redirection(false, '?p=' . USER_PAGE);
}
// LEVELLIST
$data['levels'] = array();
if (AdminServAdminLevel::hasLevel()) {
    $data['levels'] = AdminLevelConfig::$ADMINLEVELS;
}
Esempio n. 17
0
" />
					<?php 
}
?>
					<?php 
if (AdminServAdminLevel::hasPermission('player_forcetospectator')) {
    ?>
						<input class="button dark" type="submit" name="ForceSpectatorList" id="ForceSpectatorList" value="<?php 
    echo Utils::t('Spectator');
    ?>
" />
					<?php 
}
?>
					<?php 
if (AdminServAdminLevel::hasPermission('player_forcetoplayer')) {
    ?>
						<input class="button dark" type="submit" name="ForcePlayerList" id="ForcePlayerList" value="<?php 
    echo Utils::t('Player');
    ?>
" />
					<?php 
}
?>
				</div>
			</div>
		</div>
	</div>
	
	<input type="hidden" id="currentSort" name="currentSort" value="" />
	<input type="hidden" id="isTeamGameMode" name="isTeamGameMode" value="<?php 
Esempio n. 18
0
				</td>
			</tr>
		<?php 
}
?>
			<?php 
if (AdminServAdminLevel::hasPermission('gameinfos_general_warmup')) {
    ?>
				<?php 
    echo AdminServUI::getGameInfosField($data['gameInfos'], 'All WarmUp duration', 'AllWarmUpDuration');
    ?>
			<?php 
}
?>
		<?php 
if (AdminServAdminLevel::hasPermission('gameinfos_general_options')) {
    ?>
			<tr>
				<td class="key"><label for="NextDisableRespawn"><?php 
    echo Utils::t('Respawn');
    ?>
</label></td>
				<?php 
    if ($data['gameInfos']['curr'] != null) {
        ?>
					<td class="value">
						<input class="text width2" type="text" name="CurrDisableRespawn" id="CurrDisableRespawn" readonly="readonly" value="<?php 
        echo $data['gameInfos']['curr']['DisableRespawn'] === false ? Utils::t('Enable') : Utils::t('Disable');
        ?>
" />
					</td>
Esempio n. 19
0
" />
								<?php 
        }
        ?>
								<?php 
        if (AdminServAdminLevel::hasPermission('guestban_playlist_load')) {
            ?>
									<input class="button dark" type="submit" name="loadPlaylist" id="loadPlaylist" value="<?php 
            echo Utils::t('Load');
            ?>
" />
								<?php 
        }
        ?>
								<?php 
        if (AdminServAdminLevel::hasPermission('guestban_playlist_save')) {
            ?>
									<input class="button dark" type="submit" name="savePlaylist" id="savePlaylist" value="<?php 
            echo Utils::t('Save ');
            ?>
" />
								<?php 
        }
        ?>
							</div>
						</div>
					</div>
				</div>
			<?php 
    }
    ?>
Esempio n. 20
0
        } else {
            $action = Utils::t('This admin level has been modified.');
            AdminServ::info($action);
            AdminServLogs::add('action', $action);
            Utils::redirection(false, '?p=config-adminlevel');
        }
    } else {
        if (($result = AdminServAdminLevel::saveConfig($levelData)) !== true) {
            AdminServ::error(Utils::t('Unable to add the admin level.') . ' (' . $result . ')');
        } else {
            $action = Utils::t('This admin level has been added.');
            AdminServ::info($action);
            AdminServLogs::add('action', $action);
            Utils::redirection(false, '?p=' . USER_PAGE);
        }
    }
}
// LECTURE
$defaultAccess = AdminServAdminLevel::getDefaultAccess();
$defaultPermission = AdminServAdminLevel::getDefaultPermission();
$data = array('name' => null, 'types' => AdminServAdminLevel::getDefaultType(), 'adminlevel' => array('type' => null), 'access' => array('default' => array(), 'selected' => $defaultAccess), 'permission' => array('default' => array(), 'selected' => $defaultPermission));
if ($args['id'] !== -1) {
    define('IS_LEVEL_EDITION', true);
    $data['name'] = AdminServAdminLevel::getName($args['id']);
    if ($data['name']) {
        $levelData = AdminServAdminLevel::getData($data['name']);
        $data['adminlevel'] = array('type' => $levelData['adminlevel']['type']);
        $data['access'] = array('default' => array_diff($defaultAccess, $levelData['access']), 'selected' => $levelData['access']);
        $data['permission'] = array('default' => array_diff($defaultPermission, $levelData['permission']), 'selected' => $levelData['permission']);
    }
}