if ($cfg['enable_xfer'] != 0 && $cfg['xfer_realtime'] != 0) { echo '<td class="tiny" align="left" valign="bottom">'; echo '<b>' . _SERVERXFERSTATS . '</b><br>'; echo _TOTALXFER . ': <strong>' . formatFreeSpace($xfer_total['total']['total'] / (1024 * 1024)) . '</strong><br>'; echo _MONTHXFER . ': <strong>' . formatFreeSpace($xfer_total['month']['total'] / (1024 * 1024)) . '</strong><br>'; echo _WEEKXFER . ': <strong>' . formatFreeSpace($xfer_total['week']['total'] / (1024 * 1024)) . '</strong><br>'; echo _DAYXFER . ': <strong>' . formatFreeSpace($xfer_total['day']['total'] / (1024 * 1024)) . '</strong><br>'; echo '</td>'; } if ($queueActive) { include_once "QueueManager.php"; $queueManager = QueueManager::getQueueManagerInstance($cfg); echo '<td align="center" valign="bottom">'; echo '<div class="tiny">'; echo '<b>' . _QUEUEMANAGER . ' (' . $queueManager->managerName . ')</b><br>'; 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>';
<?php } ?> </tr> </table> <form method="POST"> <input type="submit" value="Run all!" name="runAll"> </form> <table width="100%" cellpadding="5"> <tr> <td width="33%"> <div class="tiny"> <?php if (checkQManager() > 0) { echo "<img src=\"images/green.gif\" align=\"absmiddle\" title=\"Queue Manager Running\" align=\"absmiddle\"> Queue Manager Running<br>"; echo "<strong>" . strval(getRunningTorrentCount()) . "</strong> torrent(s) running and <strong>" . strval(getNumberOfQueuedTorrents()) . "</strong> queued.<br>"; echo "Total torrents server will run: <strong>" . $cfg["maxServerThreads"] . "</strong><br>"; echo "Total torrents a user may run: <strong>" . $cfg["maxUserThreads"] . "</strong><br>"; echo "* Torrents are queued when limits are met.<br>"; } else { echo "<img src=\"images/black.gif\" title=\"Queue Manager Off\" align=\"absmiddle\"> Queue Manager Off<br><br>"; } ?> </div> </td> <td width="33%" valign="bottom"> <div align="center" class="tiny"> <?php if (!isset($_SESSION['prefresh']) || $_SESSION['prefresh'] == true) { echo "*** " . _PAGEWILLREFRESH . " <span id='span_refresh'>" . $cfg["page_refresh"] . "</span> " . _SECONDS . " ***<br>"; echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?pagerefresh=false\"><font class=\"tiny\">" . _TURNOFFREFRESH . "</font></a>";
function queueSettings() { global $cfg; include_once "AliasFile.php"; include_once "RunningTorrent.php"; DisplayHead("Administration - Search Settings"); // Admin Menu displayMenu(); // Queue Manager Section echo "<div align=\"center\">"; echo "<a name=\"QManager\" id=\"QManager\"></a>"; echo "<table width=\"100%\" border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"" . $cfg["table_data_bg"] . "\">"; echo "<tr><td bgcolor=\"" . $cfg["table_header_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\">"; echo "<font class=\"title\">"; if (checkQManager() > 0) { echo " <img src=\"images/green.gif\" align=\"absmiddle\" align=\"absmiddle\"> Queue Manager Running [PID=" . getQManagerPID() . " with " . strval(getRunningTorrentCount()) . " torrent(s)]"; } else { echo " <img src=\"images/black.gif\" align=\"absmiddle\"> Queue Manager Off"; } echo "</font>"; echo "</td></tr><tr><td align=\"center\">"; ?> <script language="JavaScript"> function validateSettings() { var rtnValue = true; var msg = ""; if (isNumber(document.theForm.maxServerThreads.value) == false) { msg = msg + "* Max Server Threads must be a valid number.\n"; document.theForm.maxServerThreads.focus(); } if (isNumber(document.theForm.maxUserThreads.value) == false) { msg = msg + "* Max User Threads must be a valid number.\n"; document.theForm.maxUserThreads.focus(); } if (isNumber(document.theForm.sleepInterval.value) == false) { msg = msg + "* Sleep Interval must be a valid number.\n"; document.theForm.sleepInterval.focus(); } if (msg != "") { rtnValue = false; alert("Please check the following:\n\n" + msg); } return rtnValue; } function isNumber(sText) { var ValidChars = "0123456789."; var IsNumber = true; var Char; for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber; } </script> <div align="center"> <table cellpadding="5" cellspacing="0" border="0" width="100%"> <form name="theForm" action="admin.php?op=updateConfigSettings" method="post" onsubmit="return validateSettings()"> <input type="Hidden" name="continue" value="queueSettings"> <tr> <td align="left" width="350" valign="top"><strong>Enable Queue Manager</strong><br> Enable the Queue Manager to allow users to queue torrents: </td> <td> <select name="AllowQueing"> <option value="1">true</option> <option value="0" <?php if (!$cfg["AllowQueing"]) { echo "selected"; } ?> >false</option> </select> </td> </tr> <tr> <td align="left" width="350" valign="top"><strong>tfQManager Path</strong><br> Specify the path to the tfQManager python script: </td> <td valign="top"> <input name="tfQManager" type="Text" maxlength="254" value="<?php echo $cfg["tfQManager"]; ?> " size="55"><?php echo validateFile($cfg["tfQManager"]); ?> </td> </tr> <!-- Only used for develpment or if you really really know what you are doing <tr> <td align="left" width="350" valign="top"><strong>Enable Queue Manager Debugging</strong><br> Creates huge log files only for debugging. DO NOT KEEP THIS MODE ON: </td> <td> <select name="debugTorrents"> <option value="1">true</option> <option value="0" <?php if (array_key_exists("debugTorrents", $cfg)) { if (!$cfg["debugTorrents"]) { echo "selected"; } } else { insertSetting("debugTorrents", false); echo "selected"; } ?> >false</option> </select> </td> </tr> --> <tr> <td align="left" width="350" valign="top"><strong>Max Server Threads</strong><br> Specify the maximum number of torrents the server will allow to run at one time (admins may override this): </td> <td valign="top"> <input name="maxServerThreads" type="Text" maxlength="3" value="<?php echo $cfg["maxServerThreads"]; ?> " size="3"> </td> </tr> <tr> <td align="left" width="350" valign="top"><strong>Max User Threads</strong><br> Specify the maximum number of torrents a single user may run at one time: </td> <td valign="top"> <input name="maxUserThreads" type="Text" maxlength="3" value="<?php echo $cfg["maxUserThreads"]; ?> " size="3"> </td> </tr> <tr> <td align="left" width="350" valign="top"><strong>Polling Interval</strong><br> Number of seconds the Queue Manager will sleep before checking for new torrents to run: </td> <td valign="top"> <input name="sleepInterval" type="Text" maxlength="3" value="<?php echo $cfg["sleepInterval"]; ?> " size="3"> </td> </tr> <tr> <td align="center" colspan="2"> <br><br> <input type="Submit" value="Update Settings"> </td> </tr> </form> </table> </div> <br> <?php echo "</td></tr>"; echo "</table></div>"; $displayQueue = True; $displayRunningTorrents = True; // Its a timming thing. if ($displayRunningTorrents) { // get Running Torrents. $runningTorrents = getRunningTorrents(); } if ($displayQueue) { $output = ""; echo "\n"; echo "<table width=\"760\" border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"" . $cfg["table_data_bg"] . "\">"; echo "<tr><td colspan=6 bgcolor=\"" . $cfg["table_header_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\">"; echo "<table width=\"100%\" cellpadding=0 cellspacing=0 border=0><tr>"; echo "<td><img src=\"images/properties.png\" width=18 height=13 border=0> <font class=\"title\"> Queued Items </font></td>"; echo "</tr></table>"; echo "</td></tr>"; echo "<tr>"; echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"15%\"><div align=center class=\"title\">" . _USER . "</div></td>"; echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\"><div align=center class=\"title\">" . _FILE . "</div></td>"; echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"15%\"><div align=center class=\"title\">" . _TIMESTAMP . "</div></td>"; echo "</tr>"; echo "\n"; $qDir = $cfg["torrent_file_path"] . "queue/"; if (is_dir($cfg["torrent_file_path"])) { if (is_writable($cfg["torrent_file_path"]) && !is_dir($qDir)) { @mkdir($qDir, 0777); } // get Queued Items and List them out. $output .= ""; $handle = @opendir($qDir); while ($filename = readdir($handle)) { if ($filename != "tfQManager.log") { if ($filename != "." && $filename != ".." && strpos($filename, ".pid") == 0) { $output .= "<tr>"; $output .= "<td><div class=\"tiny\">"; $af = new AliasFile(str_replace("queue/", "", $qDir) . str_replace(".Qinfo", "", $filename), ""); $output .= $af->torrentowner; $output .= "</div></td>"; $output .= "<td><div align=center><div class=\"tiny\" align=\"left\">" . str_replace(array(".Qinfo", ".stat"), "", $filename) . "</div></td>"; $output .= "<td><div class=\"tiny\" align=\"center\">" . date(_DATETIMEFORMAT, strval(filectime($qDir . $filename))) . "</div></td>"; $output .= "</tr>"; $output .= "\n"; } } } closedir($handle); } if (strlen($output) == 0) { $output = "<tr><td colspan=3><div class=\"tiny\" align=center>Queue is Empty</div></td></tr>"; } echo $output; echo "</table>"; } if ($displayRunningTorrents) { $output = ""; echo "\n"; echo "<table width=\"760\" border=1 bordercolor=\"" . $cfg["table_admin_border"] . "\" cellpadding=\"2\" cellspacing=\"0\" bgcolor=\"" . $cfg["table_data_bg"] . "\">"; echo "<tr><td colspan=6 bgcolor=\"" . $cfg["table_header_bg"] . "\" background=\"themes/" . $cfg["theme"] . "/images/bar.gif\">"; echo "<table width=\"100%\" cellpadding=0 cellspacing=0 border=0><tr>"; echo "<td><img src=\"images/properties.png\" width=18 height=13 border=0> <font class=\"title\"> Running Items </font></td>"; echo "</tr></table>"; echo "</td></tr>"; echo "<tr>"; echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"15%\"><div align=center class=\"title\">" . _USER . "</div></td>"; echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\"><div align=center class=\"title\">" . _FILE . "</div></td>"; echo "<td bgcolor=\"" . $cfg["table_header_bg"] . "\" width=\"1%\"><div align=center class=\"title\">" . str_replace(" ", "<br>", _FORCESTOP) . "</div></td>"; echo "</tr>"; echo "\n"; // get running torrents and List them out. $runningTorrents = getRunningTorrents(); if (is_array($runningTorrents)) { foreach ($runningTorrents as $key => $value) { $rt = new RunningTorrent($value); $output .= $rt->BuildAdminOutput(); } } if (strlen($output) == 0) { $output = "<tr><td colspan=3><div class=\"tiny\" align=center>No Running Torrents</div></td></tr>"; } echo $output; echo "</table>"; } DisplayFoot(); }