Ejemplo n.º 1
0
         foreach ($clients as $client) {
             $ch = ClientHandler::getInstance($client);
             array_push($process_list, array('client' => $client, 'RunningProcessInfo' => $ch->runningProcessInfo(), 'pinfo' => shell_exec("ps auxww | " . $cfg['bin_grep'] . " " . tfb_shellencode($ch->binClient) . " | " . $cfg['bin_grep'] . " -v grep")));
         }
         $tmpl->setloop('process_list', $process_list);
     }
     // drivespace-bar
     tmplSetDriveSpaceBar();
     break;
     // netstat
 // netstat
 case "netstat":
     // set vars
     if ($cfg['isAdmin']) {
         // set vars
         $tmpl->setvar('netstatConnectionsSum', netstatConnectionsSum());
         $tmpl->setvar('netstatPortList', netstatPortList());
         $tmpl->setvar('netstatHostList', netstatHostList());
     }
     // language
     $tmpl->setvar('_ID_HOSTS', $cfg['_ID_HOSTS']);
     $tmpl->setvar('_ID_PORTS', $cfg['_ID_PORTS']);
     $tmpl->setvar('_ID_CONNECTIONS', $cfg['_ID_CONNECTIONS']);
     // drivespace-bar
     tmplSetDriveSpaceBar();
     break;
     // xfer
 // xfer
 case "xfer":
     // is enabled ?
     if ($cfg["enable_xfer"] != 1) {
Ejemplo n.º 2
0
 /**
  * Show Transfers
  *
  * @return mixed
  */
 function _transfers()
 {
     global $cfg;
     // print out transfers
     echo "Transfers:\n";
     $transferHeads = getTransferListHeadArray();
     echo "* Name * " . implode(" * ", $transferHeads) . "\n";
     $transferList = getTransferListArray();
     foreach ($transferList as $transferAry) {
         echo "- " . implode(" - ", $transferAry) . "\n";
     }
     // print out stats
     echo "Server:\n";
     if (!array_key_exists("total_download", $cfg)) {
         $cfg["total_download"] = 0;
     }
     if (!array_key_exists("total_upload", $cfg)) {
         $cfg["total_upload"] = 0;
     }
     echo $cfg['_UPLOADSPEED'] . "\t" . ': ' . number_format($cfg["total_upload"], 2) . ' kB/s' . "\n";
     echo $cfg['_DOWNLOADSPEED'] . "\t" . ': ' . number_format($cfg["total_download"], 2) . ' kB/s' . "\n";
     echo $cfg['_TOTALSPEED'] . "\t" . ': ' . number_format($cfg["total_download"] + $cfg["total_upload"], 2) . ' kB/s' . "\n";
     echo $cfg['_ID_CONNECTIONS'] . "\t" . ': ' . netstatConnectionsSum() . "\n";
     return true;
 }
/**
 * get server stats
 * note : this can only be used after a call to update transfer-values in cfg-
 *        array (eg by getTransferListArray)
 *
 * @return array
 *
 * "speedDown"            0
 * "speedUp"              1
 * "speedTotal"           2
 * "cons"                 3
 * "freeSpace"            4
 * "loadavg"              5
 * "running"              6
 * "queued"               7
 * "speedDownPercent"     8
 * "speedUpPercent"       9
 * "driveSpacePercent"   10
 *
 */
function getServerStats()
{
    global $cfg;
    $serverStats = array();
    // speedDown
    $speedDown = "n/a";
    $speedDown = @number_format($cfg["total_download"], 2);
    array_push($serverStats, $speedDown);
    // speedUp
    $speedUp = "n/a";
    $speedUp = @number_format($cfg["total_upload"], 2);
    array_push($serverStats, $speedUp);
    // speedTotal
    $speedTotal = "n/a";
    $speedTotal = @number_format($cfg["total_download"] + $cfg["total_upload"], 2);
    array_push($serverStats, $speedTotal);
    // cons
    $cons = "n/a";
    $cons = @netstatConnectionsSum();
    array_push($serverStats, $cons);
    // freeSpace
    $freeSpace = "n/a";
    $freeSpace = @formatFreeSpace($cfg["free_space"]);
    array_push($serverStats, $freeSpace);
    // loadavg
    $loadavg = "n/a";
    $loadavg = @getLoadAverageString();
    array_push($serverStats, $loadavg);
    // running
    $running = "n/a";
    $running = @getRunningTransferCount();
    array_push($serverStats, $running);
    // queued
    $queued = FluxdQmgr::countQueuedTransfers();
    array_push($serverStats, $queued);
    // speedDownPercent
    $percentDownload = 0;
    $maxDownload = $cfg["bandwidth_down"] / 8;
    $percentDownload = $maxDownload > 0 ? @number_format($cfg["total_download"] / $maxDownload * 100, 0) : 0;
    array_push($serverStats, $percentDownload);
    // speedUpPercent
    $percentUpload = 0;
    $maxUpload = $cfg["bandwidth_up"] / 8;
    $percentUpload = $maxUpload > 0 ? @number_format($cfg["total_upload"] / $maxUpload * 100, 0) : 0;
    array_push($serverStats, $percentUpload);
    // driveSpacePercent
    $driveSpacePercent = 0;
    $driveSpacePercent = @getDriveSpace($cfg["path"]);
    array_push($serverStats, $driveSpacePercent);
    // return
    return $serverStats;
}
Ejemplo n.º 4
0
?>

<br>
<div align="left" id="BodyLayer" name="BodyLayer" style="border: thin solid <?php 
echo $cfg["main_bgcolor"];
?>
; position:relative; width:740; height:500; padding-left: 5px; padding-right: 5px; z-index:1; overflow: scroll; visibility: visible">

<?php 
echo "<pre>";
echo "<strong>" . _DRIVESPACE . "</strong>\n\n";
echo $result;
echo "<br><hr><br>";
echo $result2;
echo "<br><hr><br>";
echo "<strong>" . _SERVERSTATS . "</strong>\n\n";
echo $result4;
echo "<br><hr><br>";
echo $result5;
echo "<br><hr><br>";
echo "<strong>" . _ID_CONNECTIONS . " : </strong>";
echo netstatConnectionsSum();
echo "<br>\n";
echo "<strong>" . _ID_PORTS . " : </strong>\n";
echo netstatPortList();
echo "<br>\n";
echo "<strong>" . _ID_HOSTS . " : </strong>\n";
echo netstatHostList();
echo "</pre>";
echo "</div>";
DisplayFoot();
Ejemplo n.º 5
0
    $jGrowls .= "jQuery.jGrowl('" . addslashes($msgGrowl) . "',{sticky:" . ($msgSticky ? 'true' : 'false') . "});";
}
$onLoad .= $jGrowls;
//Hide Seeds
if ($_SESSION['settings']['index_show_seeding'] != 0) {
    $tmpl->setvar('index_show_seeding', $_SESSION['settings']['index_show_seeding']);
}
// onLoad
if ($onLoad != "") {
    $tmpl->setvar('onLoad', $onLoad);
    $tmpl->setvar('_SECONDS', $cfg['_SECONDS']);
    $tmpl->setvar('_TURNOFFREFRESH', $cfg['_TURNOFFREFRESH']);
}
// connections
if ($cfg["index_page_connections"] != 0) {
    $netstatConnectionsSum = @netstatConnectionsSum();
    $netstatConnectionsMax = isset($transfers['sum']['maxcons']) ? "(" . $transfers['sum']['maxcons'] . ")" : "(0)";
} else {
    $netstatConnectionsSum = "n/a";
    $netstatConnectionsMax = "";
}
// loadavg
$loadavgString = $cfg["show_server_load"] != 0 ? @getLoadAverageString() : "n/a";
// Width of top right stats cell:
$stats_cell_width = 0;
// links
if ($cfg["ui_displaylinks"] != "0") {
    $stats_cell_width += 200;
    if (isset($cfg['linklist'])) {
        $tmpl->setloop('linklist', $cfg['linklist']);
    }
Ejemplo n.º 6
0
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";
}