Esempio n. 1
0
                    resetTorrentTotals(urldecode($element), false);
                    break;
                default:
                    if ($torrentRunningFlag != 0) {
                        // stop torrent first
                        $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient);
                        $clientHandler->stopTorrentClient(urldecode($element), $alias);
                        // give the torrent some time to die
                        sleep(8);
                    }
                    // if it was running... hope the thing is down... rock on
                    switch ($action) {
                        case "torrentWipe":
                            /* torrentWipe */
                            deleteTorrentData(urldecode($element));
                            resetTorrentTotals(urldecode($element), true);
                            break;
                        case "torrentData":
                            /* torrentData */
                            deleteTorrentData(urldecode($element));
                        case "torrent":
                            /* torrent */
                            deleteTorrent(urldecode($element), $alias);
                    }
            }
        }
}
/* redirect */
if (isset($_SERVER["HTTP_REFERER"])) {
    header("location: " . $_SERVER["HTTP_REFERER"]);
} else {
Esempio n. 2
0
function cliWipeTorrent($torrent = "")
{
    global $cfg;
    if (isset($torrent) && $torrent != "") {
        echo "Wipe " . $torrent . " ...";
        $torrentRunningFlag = isTorrentRunning($torrent);
        $btclient = getTorrentClient($torrent);
        $cfg["user"] = getOwner($torrent);
        $alias = getAliasName($torrent) . ".stat";
        if ($torrentRunningFlag == 1) {
            // stop torrent first
            $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient);
            $clientHandler->stopTorrentClient($torrent, $alias);
            // give the torrent some time to die
            sleep(6);
        }
        deleteTorrentData($torrent);
        resetTorrentTotals($torrent, true);
        echo "done\n";
    } else {
        printUsage();
    }
    exit;
}