Exemplo n.º 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);
    }
}
Exemplo n.º 2
0
function ghostMapDelete($service_id, $filename, $mapcfg = false)
{
    global $config;
    //get the identifier
    $id = stripAlphaNumeric(getServiceParam($service_id, "id"));
    if ($id === false) {
        return "Error: the identifier for this service is not set.";
    }
    //escape the map
    $filename = escapeFile(baseName($filename));
    $relTarget = ($mapcfg ? "mapcfgs/" : "maps/") . $filename;
    $target = $config['ghost_path'] . $id . "/" . $relTarget;
    $jail = jailEnabled($service_id);
    //unlink if this is a map, or if we're not jailed (maps are not jailed)
    if (!$jail || !$mapcfg) {
        if (file_exists($target)) {
            unlink($target);
        }
    } else {
        jailFileDelete($service_id, $relTarget);
    }
}