/**
 * initGlobalTransfersArray
 */
function initGlobalTransfersArray()
{
    global $transfers;
    // transfers
    $transfers = array();
    // settings
    $transferSettings =& loadAllTransferSettings();
    $transfers['settings'] = $transferSettings;
    // totals
    $transferTotals =& loadAllTransferTotals();
    $transfers['totals'] = $transferTotals;
    // sum
    $transfers['sum'] = array('maxcons' => getSumMaxCons(), 'rate' => getSumMaxUpRate(), 'drate' => getSumMaxDownRate());
    // owner
    $transferOwner =& loadAllTransferOwner();
    $transfers['owner'] = $transferOwner;
}
function printTorrents()
{
    echo "\n";
    echo "----------------------------------------\n";
    echo "          TorrentFlux-Torrents          \n";
    echo "----------------------------------------\n";
    echo "\n";
    global $cfg;
    $torrents = getTorrentListFromFS();
    foreach ($torrents as $torrent) {
        echo ' - ' . $torrent;
        if (isTorrentRunning($torrent)) {
            echo " (running)";
        }
        echo "\n";
    }
    echo "\n";
    define("_DOWNLOADSPEED", "Download Speed");
    define("_UPLOADSPEED", "Upload Speed");
    $dirList = @getDirList($cfg["torrent_file_path"]);
    if (!array_key_exists("total_download", $cfg)) {
        $cfg["total_download"] = 0;
    }
    if (!array_key_exists("total_upload", $cfg)) {
        $cfg["total_upload"] = 0;
    }
    $sumMaxUpRate = getSumMaxUpRate();
    $sumMaxDownRate = getSumMaxDownRate();
    $sumMaxRate = $sumMaxUpRate + $sumMaxDownRate;
    echo _DOWNLOADSPEED . "\t" . ': ' . number_format($cfg["total_download"], 2) . ' (' . number_format($sumMaxDownRate, 2) . ') kB/s' . "\n";
    echo _UPLOADSPEED . "\t" . ': ' . number_format($cfg["total_upload"], 2) . ' (' . number_format($sumMaxUpRate, 2) . ') kB/s' . "\n";
    echo _TOTALSPEED . "\t" . ': ' . number_format($cfg["total_download"] + $cfg["total_upload"], 2) . ' (' . number_format($sumMaxRate, 2) . ') kB/s' . "\n";
    echo _ID_CONNECTIONS . "\t" . ': ' . netstatConnectionsSum() . ' (' . getSumMaxCons() . ')' . "\n";
    echo "\n";
}
     echo '<strong>' . strval(getRunningTorrentCount()) . '</strong> torrent(s) running and <strong>' . strval($queueManager->countQueuedTorrents()) . '</strong> queued.<br>';
     echo 'Total torrents server will run: <strong>' . $queueManager->limitGlobal . '</strong><br>';
     echo 'Total torrents a user may run: <strong>' . $queueManager->limitUser . '</strong><br>';
     echo '</div>';
     echo '</td>';
 }
 echo '<td class="tiny" align="center" valign="bottom">';
 echo '<b>' . _OTHERSERVERSTATS . '</b><br>';
 $sumMaxUpRate = getSumMaxUpRate();
 $sumMaxDownRate = getSumMaxDownRate();
 $sumMaxRate = $sumMaxUpRate + $sumMaxDownRate;
 echo _DOWNLOADSPEED . ': <strong>' . number_format($cfg["total_download"], 2) . ' (' . number_format($sumMaxDownRate, 2) . ')</strong> kB/s<br>';
 echo _UPLOADSPEED . ': <strong>' . number_format($cfg["total_upload"], 2) . ' (' . number_format($sumMaxUpRate, 2) . ')</strong> kB/s<br>';
 echo _TOTALSPEED . ': <strong>' . number_format($cfg["total_download"] + $cfg["total_upload"], 2) . ' (' . number_format($sumMaxRate, 2) . ')</strong> kB/s<br>';
 if ($cfg["index_page_connections"] != 0) {
     echo _ID_CONNECTIONS . ': <strong>' . $netstatConnectionsSum . ' (' . getSumMaxCons() . ')</strong><br>';
 }
 echo _DRIVESPACE . ': <strong>' . formatFreeSpace($cfg["free_space"]) . '</strong><br>';
 if ($cfg["show_server_load"] != 0) {
     echo _SERVERLOAD . ': <strong>' . $loadavgString . '</strong>';
 }
 echo '</td>';
 if ($cfg['enable_xfer'] != 0 && $cfg['xfer_realtime'] != 0) {
     echo '<td class="tiny" align="right" valign="bottom">';
     echo '<b>' . _YOURXFERSTATS . '</b><br>';
     echo _TOTALXFER . ': <strong>' . formatFreeSpace($xfer[$cfg['user']]['total']['total'] / (1024 * 1024)) . '</strong><br>';
     echo _MONTHXFER . ': <strong>' . formatFreeSpace($xfer[$cfg['user']]['month']['total'] / (1024 * 1024)) . '</strong><br>';
     echo _WEEKXFER . ': <strong>' . formatFreeSpace($xfer[$cfg['user']]['week']['total'] / (1024 * 1024)) . '</strong><br>';
     echo _DAYXFER . ': <strong>' . formatFreeSpace($xfer[$cfg['user']]['day']['total'] / (1024 * 1024)) . '</strong><br>';
     echo '</td>';
 }