Ejemplo n.º 1
0
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.

 To read the license please visit http://www.gnu.org/copyleft/gpl.html

*******************************************************************************/
include_once "config.php";
include_once "functions.php";
$result = shell_exec("df -h " . $cfg["path"]);
$result2 = shell_exec("du -sh " . $cfg["path"] . "*");
DisplayHead(_DRIVESPACE);
echo "<table width=\"740\" border=0 cellpadding=0 cellspacing=0><tr><td>";
echo displayDriveSpaceBar(getDriveSpace($cfg["path"]));
echo "</td></tr></table>";
?>

<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 $result;
echo "<br><hr><br>";
echo $result2;
echo "</pre>";
/**
 * 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.º 3
0
        $cfg["theme"] = CheckandSetUserTheme();
    }
    // Run internal maintenance regularly
    if (!empty($_SESSION['next_int_maintenance']) && $_SESSION['next_int_maintenance'] < time()) {
        require_once "inc/classes/MaintenanceAndRepair.php";
        MaintenanceAndRepair::maintenance(MAINTENANCEANDREPAIR_TYPE_INT);
        $_SESSION['next_int_maintenance'] = null;
    }
}
// schedule next internal maintenance if needed
if (empty($_SESSION['next_int_maintenance'])) {
    $_SESSION['next_int_maintenance'] = time() + 2 * 3600 + mt_rand(-1200, 1200);
}
// 2h (+/- 20m)
// free space in MB var
$cfg["free_space"] = @disk_free_space($cfg["path"]) / 1048576;
// drive space var
$cfg['driveSpace'] = getDriveSpace($cfg["path"]);
// free space formatted var
$cfg['freeSpaceFormatted'] = formatFreeSpace($cfg["free_space"]);
// Fluxd
Fluxd::initialize();
// Qmgr
FluxdServiceMod::initializeServiceMod('Qmgr');
// xfer
if ($cfg['enable_xfer'] == 1 && $cfg['xfer_realtime'] == 1) {
    // set xfer-newday
    Xfer::setNewday();
}
// vlib
require_once "inc/lib/vlib/vlibTemplate.php";
Ejemplo n.º 4
0
        }
        // Write out the new Stat File
        $af->WriteFile();
        // Remove Qinfo file.
        @unlink($cfg["torrent_file_path"] . "queue/" . $alias_file . ".Qinfo");
        AuditAction($cfg["constants"]["unqueued_torrent"], $QEntry);
    } else {
        // torrent has been started... try and kill it.
        AuditAction($cfg["constants"]["unqueued_torrent"], $QEntry . "has been started -- TRY TO KILL IT");
        header("location: index.php?alias_file=" . $alias_file . "&kill=true&kill_torrent=" . urlencode($QEntry));
        exit;
    }
    header("location: index.php");
    exit;
}
$drivespace = getDriveSpace($cfg["path"]);
/************************************************************
 ************************************************************/
?>
<html>
<head>
    <title><?php 
echo $cfg["pagetitle"];
?>
</title>
    <link rel="icon" href="images/favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
    <LINK REL="StyleSheet" HREF="themes/<?php 
echo $cfg["theme"];
?>
/style.css" TYPE="text/css">
Ejemplo n.º 5
0
        require_once "inc/classes/MaintenanceAndRepair.php";
        MaintenanceAndRepair::maintenance(MAINTENANCEANDREPAIR_TYPE_INT);
        $_SESSION['next_int_maintenance'] = null;
    }
}
// schedule next internal maintenance if needed
if (empty($_SESSION['next_int_maintenance'])) {
    $_SESSION['next_int_maintenance'] = time() + 2 * 3600 + mt_rand(-1200, 1200);
}
// 2h (+/- 20m)
if (is_dir($cfg["path"] . '/' . $currentUser)) {
    $user_dir = $cfg["path"] . '/' . $currentUser;
} else {
    $user_dir = $cfg["path"];
}
// free space in MB and drive space vars
$cfg["free_space"] = @disk_free_space($user_dir) / 1048576;
$cfg['driveSpace'] = getDriveSpace($user_dir);
// free space formatted var
$cfg['freeSpaceFormatted'] = formatFreeSpace($cfg["free_space"]);
// Fluxd
Fluxd::initialize();
// Qmgr
FluxdServiceMod::initializeServiceMod('Qmgr');
// xfer
if ($cfg['enable_xfer'] == 1 && $cfg['xfer_realtime'] == 1) {
    // set xfer-newday
    Xfer::setNewday();
}
// vlib
require_once "inc/lib/vlib/vlibTemplate.php";