$htmlMain .= ' - ' . $torrent . ""; $htmlMain .= "\n"; // just 2 sec.. sleep(2); } } $htmlMain .= '</pre>'; $htmlMain .= '<hr><br>'; break; } $htmlMain .= '<br><strong>Torrents :</strong><br>'; $htmlMain .= '<pre>'; $torrents = getTorrentListFromFS(); foreach ($torrents as $torrent) { $htmlMain .= ' - ' . $torrent . ""; if (isTorrentRunning($torrent)) { $htmlMain .= " (running)"; } $htmlMain .= "\n"; } $htmlMain .= '</pre>'; printPage(); exit; } } // standard-action buildPage(@trim($_REQUEST["a"])); printPage(); exit; // ----------------------------------------------------------------------------- // functions
} } break; /* ---------------------------------------------------- selected torrents */ /* ---------------------------------------------------- selected torrents */ default: foreach ($_POST['torrent'] as $key => $element) { // is valid transfer ? if (isValidTransfer(urldecode($element)) !== true) { AuditAction($cfg["constants"]["error"], "Invalid Transfer for " . $action . " : " . $cfg["user"] . " tried to " . $action . " " . $element); showErrorPage("Invalid Transfer for " . htmlentities($action, ENT_QUOTES) . " : <br>" . htmlentities($element, ENT_QUOTES)); } // process $alias = getAliasName($element) . ".stat"; $settingsAry = loadTorrentSettings(urldecode($element)); $torrentRunningFlag = isTorrentRunning(urldecode($element)); $btclient = $settingsAry["btclient"]; switch ($action) { case "torrentStart": /* torrentStart */ if ($torrentRunningFlag == 0) { if ($cfg["enable_file_priority"]) { include_once "setpriority.php"; // Process setPriority Request. setPriority(urldecode($element)); } $clientHandler = ClientHandler::getClientHandlerInstance($cfg, $btclient); $clientHandler->startTorrentClient(urldecode($element), 0); // just 2 sec.. sleep(2); }
/** * dequeueTorrent * @param $torrent name of the torrent */ function dequeueTorrent($torrent) { $torrent = urldecode($torrent); $alias_file = getRequestVar('alias_file'); if (isTorrentRunning($torrent)) { // torrent has been started... try and kill it. AuditAction($this->cfg["constants"]["unqueued_torrent"], $torrent . "has been started -- TRY TO KILL IT"); header("location: index.php?alias_file=" . $alias_file . "&kill=true&kill_torrent=" . urlencode($torrent)); exit; } else { if ($this->isQueueManagerRunning()) { // send command to daemon $this->sendQueueCommand('remove ' . substr($torrent, 0, -8)); // flag the torrent as stopped (in db) stopTorrentSettings($torrent); // update the stat file. parent::updateStatFile($torrent, $alias_file); // log AuditAction($this->cfg["constants"]["unqueued_torrent"], $torrent); } else { header("location: admin.php?op=queueSettings"); exit; } } }
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; }