예제 #1
0
function minecraftServerDelete($service_id, $filename, $type = "plugins")
{
    global $config;
    //get the identifier
    $id = stripAlphaNumeric(getServiceParam($service_id, "id"));
    if ($id === false) {
        return "Error: the identifier for this service is not set.";
    }
    //if type is current directory, then it's for backups and restrict the extensions
    if ($type == "." && getExtension($filename) != 'uxbakzip') {
        return "Error: invalid world backup filename to delete.";
    }
    //escape the plugin
    $filename = escapeFile(baseName($filename));
    $relTarget = $type . "/" . $filename;
    $target = $config['minecraft_path'] . $id . "/" . $relTarget;
    //unlink plugin (even if jail, the file itself is still stored in the minecraft_path folder
    if (file_exists($target)) {
        unlink($target);
    }
    //now, delete the symlink from the jail
    $jail = jailEnabled($service_id);
    if ($jail) {
        jailFileDelete($service_id, $relTarget);
    }
}
예제 #2
0
function ghostReplayDownload($service_id, $replay)
{
    global $config;
    //get the identifier
    $id = stripAlphaNumeric(getServiceParam($service_id, "id"));
    if ($id === false) {
        return;
    }
    //escape the replay
    $replay = escapeFile(baseName($replay));
    $target = $config['ghost_path'] . $id . "/replays/" . $replay;
    fileDownload($target);
}