//Stats
/*
$globalinfo['stats'] = tr_sessionStats();
*/
//###########################################################
// Actions
//###########################################################
if (isset($_REQUEST['list'])) {
    $tor_IdList = parse_torrent_list($_REQUEST['list']);
    if (isset($_REQUEST['action-delete'])) {
        tr_torrentRemove($tor_IdList);
        Header("Location: " . $globalinfo["scriptIndex"] . "?t=" . $globalinfo["torrentId"] . "&pg=" . $globalinfo["page"]);
        exit;
    } else {
        if (isset($_REQUEST['action-start'])) {
            tr_torrentStart($tor_IdList);
        } else {
            if (isset($_REQUEST['action-stop'])) {
                tr_torrentStop($tor_IdList);
            } else {
                if (isset($_REQUEST['action-save'])) {
                }
            }
        }
    }
    Header("Location: " . $globalinfo["scriptName"] . "?t=" . $globalinfo["torrentId"] . "&pg=" . $globalinfo["page"]);
    exit;
}
//###########################################################
// Interface
//###########################################################
function tr_torrentStartAll()
{
    global $globalinfo;
    $torrents = tr_torrentAccessor();
    if (!is_array($torrents)) {
        return;
    }
    $tor_IdList = array();
    foreach ($torrents as $_torrent) {
        $tor_IdList[] = tor_getId($_torrent);
    }
    tr_torrentStart($tor_IdList);
}