示例#1
0
function processQueues($altqstats, $level, $parent_name)
{
    global $g;
    global $if_queue_list;
    $parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
    $prev_if = $altqstats['interface'];
    foreach ($altqstats['queue'] as $q) {
        $if_name = "";
        foreach ($if_queue_list as $oif => $real_name) {
            if ($oif == $q['interface']) {
                $if_name = $real_name;
                break;
            }
        }
        if ($prev_if != $q['interface']) {
            echo "<tr><td colspan=\"8\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>\n";
            $prev_if = $q['interface'];
        }
        ?>
		<tr class="<?php 
        echo $parent_name;
        ?>
">
			<td class="<?php 
        echo $row_class;
        ?>
" style="padding-left:<?php 
        echo $level * 20;
        ?>
px;">
				<?php 
        if (is_array($q['queue'])) {
            echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>";
        }
        if (strstr($q['name'], "root_")) {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$if_name}&amp;action=show\">Root queue</a>";
        } else {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$q['name']}&amp;action=show\">" . htmlspecialchars($q['name']) . "</a>";
        }
        ?>
			</td>
<?php 
        $cpuUsage = 0;
        print '<td>';
        print '<div class="progress" style="height: 7px;width: 170px;">';
        print '		<div class="progress-bar" role="progressbar" id="queue' . $q['name'] . $q['interface'] . 'width" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width: ' . $cpuUsage * 100 . '%;\\"></div>';
        print '	  </div>';
        print '</td>';
        print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'pps"      id="queue' . $q['name'] . $q['interface'] . 'pps"      value="(' . gettext("Loading") . ')" /></td>';
        print '<td><input readonly style="border:0;width:80px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'bps"      id="queue' . $q['name'] . $q['interface'] . 'bps"      value="" /></td>';
        print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'borrows"  id="queue' . $q['name'] . $q['interface'] . 'borrows"  value="" /></td>';
        print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'suspends" id="queue' . $q['name'] . $q['interface'] . 'suspends" value="" /></td>';
        print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'drops"    id="queue' . $q['name'] . $q['interface'] . 'drops"    value="" /></td>';
        print '<td><input readonly style="border:0;width:70px;text-align:right;" name="queue' . $q['name'] . $q['interface'] . 'length"   id="queue' . $q['name'] . $q['interface'] . 'length"   value="" /></td>';
        ?>
		</tr>
<?php 
        if (is_array($q['queue'])) {
            processQueues($q, $level + 1, $parent_name);
        }
    }
}
示例#2
0
function processQueues($altqstats, $level, $parent_name)
{
    global $g;
    global $if_queue_list;
    $gray_value = 190 + $level * 10;
    if ($gray_value > 250) {
        $gray_value = 255;
    }
    $row_background = str_repeat(dechex($gray_value), 3);
    $parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
    $prev_if = $altqstats['interface'];
    foreach ($altqstats['queue'] as $q) {
        $if_name = "";
        foreach ($if_queue_list as $oif => $real_name) {
            if ($oif == $q['interface']) {
                $if_name = $real_name;
                break;
            }
        }
        if ($prev_if != $q['interface']) {
            echo "<tr><td><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>";
            $prev_if = $q['interface'];
        }
        ?>
		<tr class="<?php 
        echo $parent_name;
        ?>
">
			<td bgcolor="#<?php 
        echo $row_background;
        ?>
" style="padding-left: <?php 
        echo $level * 20;
        ?>
px;">
				<font color="#000000">
					<?php 
        if (is_array($q['queue'])) {
            echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> ";
        }
        if (strstr($q['name'], "root_")) {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$if_name}&amp;action=show\">Root queue</a>";
        } else {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$q['name']}&amp;action=show\">" . htmlspecialchars($q['name']) . "</a>";
        }
        ?>
				</font>
			</td>
<?php 
        $cpuUsage = 0;
        echo "<td bgcolor=\"#{$row_background}\">";
        echo "<div class='progress' style='height: 7px;width: 170px;'>\n\t\t\t\t<div class='progress-bar' role='progressbar' name='queue{$q['name']}{$q['interface']}width' id='queue{$q['name']}{$q['interface']}width' aria-valuenow='70' aria-valuemin='0' aria-valuemax='100' style='width: " . $cpuUsage * 100 . "%;'></div>\n\t\t\t  </div>";
        echo " </td>";
        echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>";
        echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>";
        echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>";
        echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>";
        echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>";
        echo "<td bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>";
        ?>
		</tr>
<?php 
        if (is_array($q['queue'])) {
            processQueues($q, $level + 1, $parent_name);
        }
    }
}
示例#3
0
function processQueues($altqstats, $level, $parent_name)
{
    global $g;
    global $if_queue_list;
    $gray_value = 190 + $level * 10;
    if ($gray_value > 250) {
        $gray_value = 255;
    }
    $row_background = str_repeat(dechex($gray_value), 3);
    $parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
    $prev_if = $altqstats['interface'];
    foreach ($altqstats['queue'] as $q) {
        $if_name = "";
        foreach ($if_queue_list as $oif => $real_name) {
            if ($oif == $q['interface']) {
                $if_name = $real_name;
                break;
            }
        }
        if ($prev_if != $q['interface']) {
            echo "<tr><td colspan=\"8\" style=\"padding: 2px;\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>";
            $prev_if = $q['interface'];
        }
        ?>
		<tr class="<?php 
        echo $parent_name;
        ?>
">
			<td bgcolor="#<?php 
        echo $row_background;
        ?>
" style="padding-left: <?php 
        echo $level * 20;
        ?>
px;">
				<font color="#000000">
					<?php 
        if (strstr($q['name'], "root_")) {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$if_name}&amp;action=show\">Root queue</a>";
        } else {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$q['name']}&amp;action=show\">" . htmlspecialchars($q['name']) . "</a>";
        }
        ?>
				</font>
			</td>
			<?php 
        $cpuUsage = 0;
        echo "<td class=\"nowrap\" width=\"1%\" bgcolor=\"#{$row_background}\">";
        echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_left.gif' height='10' width='4' border='0' align='middle' alt='' />";
        echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_blue.gif' height='10' name='queue{$q['name']}{$q['interface']}widtha' id='queue{$q['name']}{$q['interface']}widtha' width='" . $cpuUsage . "' border='0' align='middle' alt='" . htmlspecialchars($q['name']) . "' />";
        echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_gray.gif' height='10' name='queue{$q['name']}{$q['interface']}widthb' id='queue{$q['name']}{$q['interface']}widthb' width='" . (150 - $cpuUsage) . "' border='0' align='middle' alt='" . htmlspecialchars($q['name']) . "' />";
        echo "<img src='./themes/" . $g['theme'] . "/images/misc/bar_right.gif' height='10' width='5' border='0' align='middle' alt='' /> ";
        if (is_array($q['queue'])) {
            echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a> ";
        }
        echo " </td>";
        echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}pps' id='queue{$q['name']}{$q['interface']}pps' value='(" . gettext("Loading") . ")' align='left' /></td>";
        echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:80px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}bps' id='queue{$q['name']}{$q['interface']}bps' value='' align='right' /></td>";
        echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}borrows' id='queue{$q['name']}{$q['interface']}borrows' value='' align='right' /></td>";
        echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}suspends' id='queue{$q['name']}{$q['interface']}suspends' value='' align='right' /></td>";
        echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}drops' id='queue{$q['name']}{$q['interface']}drops' value='' align='right' /></td>";
        echo "<td width=\"1%\" bgcolor=\"#{$row_background}\"><input style='border: 0px solid white; background-color:#{$row_background}; color:#000000;width:70px;text-align:right;' size='10' name='queue{$q['name']}{$q['interface']}length' id='queue{$q['name']}{$q['interface']}length' value='' align='right' /></td>";
        ?>
		</tr>
		<?php 
        if (is_array($q['queue'])) {
            processQueues($q, $level + 1, $parent_name);
        }
    }
}
示例#4
0
function processQueues($altqstats, $level, $parent_name)
{
    global $g;
    global $if_queue_list;
    $gray_value = 190 + $level * 10;
    if ($gray_value > 250) {
        $gray_value = 255;
    }
    $row_background = str_repeat(dechex($gray_value), 3);
    $parent_name = $parent_name . " queuerow" . $altqstats['name'] . $altqstats['interface'];
    $prev_if = $altqstats['interface'];
    foreach ($altqstats['queue'] as $q) {
        $if_name = "";
        foreach ($if_queue_list as $oif => $real_name) {
            if ($oif == $q['interface']) {
                $if_name = $real_name;
                break;
            }
        }
        if ($prev_if != $q['interface']) {
            echo "<tr><td colspan=\"8\"><b>Interface " . htmlspecialchars(convert_real_interface_to_friendly_descr($q['interface'])) . "</b></td></tr>\n";
            $prev_if = $q['interface'];
        }
        ?>
		<tr class="<?php 
        echo $parent_name;
        ?>
">
			<td style="background-color:#<?php 
        echo $row_background;
        ?>
;padding-left:<?php 
        echo $level * 20;
        ?>
px;">
				<?php 
        if (is_array($q['queue'])) {
            echo "<a href=\"#\" onclick=\"StatsShowHide('queuerow{$q['name']}{$q['interface']}');return false\">+/-</a>";
        }
        if (strstr($q['name'], "root_")) {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$if_name}&amp;action=show\">Root queue</a>";
        } else {
            echo "<a href=\"firewall_shaper.php?interface={$if_name}&amp;queue={$q['name']}&amp;action=show\">" . htmlspecialchars($q['name']) . "</a>";
        }
        ?>
			</td>
<?php 
        $cpuUsage = 0;
        echo "<td style=\"background-color:#{$row_background}\" >";
        echo "<div class=\"progress\" style=\"height: 7px;width: 170px;\">\n\t\t\t\t<div class=\"progress-bar\" role=\"progressbar\" id=\"queue{$q['name']}{$q['interface']}width\" aria-valuenow=\"70\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width: " . $cpuUsage * 100 . "%;\"></div>\n\t\t\t  </div>";
        echo "</td>";
        echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}pps\" id=\"queue{$q['name']}{$q['interface']}pps\" value=\"(" . gettext("Loading") . ")\" /></td>";
        echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:80px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}bps\" id=\"queue{$q['name']}{$q['interface']}bps\" value=\"\" /></td>";
        echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}borrows\" id=\"queue{$q['name']}{$q['interface']}borrows\" value=\"\" /></td>";
        echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}suspends\" id=\"queue{$q['name']}{$q['interface']}suspends\" value=\"\" /></td>";
        echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}drops\" id=\"queue{$q['name']}{$q['interface']}drops\" value=\"\" /></td>";
        echo "<td style=\"background-color:#{$row_background}\"><input style=\"border:0;width:70px;text-align:right;\" size=\"10\" name=\"queue{$q['name']}{$q['interface']}length\" id=\"queue{$q['name']}{$q['interface']}length\" value=\"\" /></td>";
        ?>
		</tr>
<?php 
        if (is_array($q['queue'])) {
            processQueues($q, $level + 1, $parent_name);
        }
    }
}