Exemplo n.º 1
0
    } else {
        $currentDir = Folder::read($path, AdminServConfig::$MATCHSET_HIDDEN_FOLDERS, AdminServConfig::$MATCHSET_EXTENSION, intval(AdminServConfig::RECENT_STATUS_PERIOD * 3600));
        $mapsImport = AdminServ::getLocalMapList($currentDir, $directory);
    }
    // Faire une sélection
    if ($operation == 'setSelection') {
        // On supprime les maps non sélectionnées
        if ($selection != null && count($selection) > 0) {
            foreach ($mapsImport['lst'] as $id => $values) {
                if (!in_array($id, $selection)) {
                    unset($mapsImport['lst'][$id]);
                }
            }
        } else {
            foreach ($mapsImport['lst'] as $id => $values) {
                unset($mapsImport['lst'][$id]);
            }
        }
    }
    // Enregistrement de la sélection du MatchSettings
    if ($operation != 'getSelection') {
        AdminServ::saveMatchSettingSelection($mapsImport);
    }
    $client->Terminate();
}
// OUT
if ($operation == 'getSelection') {
    echo json_encode($mapsImport);
} else {
    echo json_encode($_SESSION['adminserv']['matchset_maps_selected']);
}
// INCLUDES
session_start();
$configPath = '../../' . $_SESSION['adminserv']['path'] . 'config/';
require_once $configPath . 'adminserv.cfg.php';
require_once '../core/adminserv.php';
AdminServConfig::$PATH_RESOURCES = '../';
AdminServ::getClass();
AdminServUI::lang();
// DATA
if (!isset($_SESSION['adminserv']['matchset_maps_selected'])) {
    // Retourne "Aucune map"
    AdminServ::saveMatchSettingSelection();
} else {
    // Enlever une map de la sélection
    if (isset($_GET['remove'])) {
        $removeSelection = intval($_GET['remove']);
        $mapsSelection = $_SESSION['adminserv']['matchset_maps_selected'];
        // Liste
        if (isset($mapsSelection['lst']) && is_array($mapsSelection['lst']) && count($mapsSelection['lst']) > 0) {
            foreach ($mapsSelection['lst'] as $id => $values) {
                if ($id == $removeSelection) {
                    unset($mapsSelection['lst'][$id]);
                    break;
                }
            }
        }
        $_SESSION['adminserv']['matchset_maps_selected'] = $mapsSelection;
        AdminServ::saveMatchSettingSelection();
    }
}
echo json_encode($_SESSION['adminserv']['matchset_maps_selected']);