Ejemplo n.º 1
0
    httpseeds = optional list of http-seed URLs, in the format:
            url[|url...]
*****/
include_once "config.php";
include_once "functions.php";
// is enabled ?
if ($cfg["enable_maketorrent"] != 1) {
    AuditAction($cfg["constants"]["error"], "ILLEGAL ACCESS: " . $cfg["user"] . " tried to use maketorrent");
    showErrorPage("maketorrent is disabled.");
}
// Variable information
$tpath = $cfg["torrent_file_path"];
$tfile = @$_POST['torrent'];
$file = @$_GET['path'];
$torrent = cleanFileName(StripFolders(trim($file))) . ".torrent";
$announce = @$_POST['announce'] ? $_POST['announce'] : "http://";
$ancelist = @$_POST['announcelist'];
$comment = @$_POST['comments'];
$peice = @$_POST['piecesize'];
$alert = @$_POST['alert'] ? 1 : "''";
$private = @($_POST['Private'] == "Private") ? true : false;
$dht = @($_POST['DHT'] == "DHT") ? true : false;
// Let's create the torrent
if (!empty($announce) && $announce != "http://") {
    // Create maketorrent directory if it doesn't exist
    if (!is_dir($tpath)) {
        @mkdir($tpath);
    }
    // Clean up old files
    if (@file_exists($tpath . $tfile)) {
Ejemplo n.º 2
0
    AuditAction($cfg["constants"]["error"], "ILLEGAL ACCESS: " . $cfg["user"] . " tried to use maketorrent");
    @error("maketorrent is disabled", "index.php?iid=index", "");
}
// check the needed bins
// python
if (@file_exists($cfg['pythonCmd']) !== true) {
    @error("Required binary could not be found", "", "", $cfg['isAdmin'] ? array('python is required for maketorrent', 'Specified python-binary does not exist: ' . $cfg['pythonCmd'], 'Check Settings on Admin-Server-Settings Page') : array('Please contact an Admin'));
}
/*******************************************************************************
 * create + page
 ******************************************************************************/
// file + torrent vars
$path = tfb_getRequestVarRaw('path');
$torrent = "";
if (!empty($path)) {
    $torrent = tfb_cleanFileName(StripFolders($path) . ".torrent");
    if ($torrent === false) {
        @error("Invalid torrent-name", "", "", array($path));
    }
}
// only valid dirs + entries with permission
if (!(tfb_isValidPath($cfg["path"] . $path) && hasPermission($path, $cfg["user"], 'w'))) {
    AuditAction($cfg["constants"]["error"], "ILLEGAL MAKETORRENT: " . $cfg["user"] . " tried to maketorrent with " . $path);
    @error("Illegal maketorrent. Action has been logged.", "", "");
}
// check if there is a var sent for client, if not use default
$client = isset($_REQUEST["client"]) ? tfb_getRequestVar('client') : $cfg["dir_maketorrent_default"];
// client-generic vars
$tfile = tfb_getRequestVar('torrent');
$comment = tfb_getRequestVar('comments');
$alert = isset($_POST["alert"]) ? 1 : 0;