diff --git a/html/pages/bills.inc.php b/html/pages/bills.inc.php
index 7dab6a56b..d24e13c0e 100644
--- a/html/pages/bills.inc.php
+++ b/html/pages/bills.inc.php
@@ -1,172 +1,172 @@
- $_POST['bill_name'], 'bill_type' => $_POST['bill_type'], 'bill_cdr' => $_POST['bill_cdr'], 'bill_day' => $_POST['bill_day'], 'bill_gb' => $_POST['bill_quota'],
- 'bill_custid' => $_POST['bill_custid'], 'bill_ref' => $_POST['bill_ref'], 'bill_notes' => $_POST['bill_notes']);
-
- $affected = dbInsert($insert, 'bills');
-
- $message .= $message_break . "Bill ".mres($_POST['bill_name'])." added!";
- $message_break .= "
";
-}
-
-echo("");
-
-if ($_GET['opta'] == "add")
-{
-
-?>
-
Add Bill
-
-
-
-
-
-
-
-
-");
- $i=1;
- foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
- {
- if (bill_permitted($bill['bill_id']))
- {
- unset($class);
- $day_data = getDates($bill['bill_day']);
- $datefrom = $day_data['0'];
- $dateto = $day_data['1'];
- $rate_data = getRates($bill['bill_id'],$datefrom,$dateto);
- $rate_95th = $rate_data['rate_95th'];
- $dir_95th = $rate_data['dir_95th'];
- $total_data = $rate_data['total_data'];
- $rate_average = $rate_data['rate_average'];
-
- if ($bill['bill_type'] == "cdr")
- {
- $type = "CDR";
- $allowed = formatRates($bill['bill_cdr'] * 1000);
- $used = formatRates($rate_data['rate_95th'] * 1000);
- $percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2);
- } elseif ($bill['bill_type'] == "quota") {
- $type = "Quota";
- $allowed = formatStorage($bill['bill_gb']* 1024 * 1024 * 1024);
- $used = formatStorage($rate_data['total_data'] * 1024 * 1024);
- $percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1024)) * 100,2);
- }
-
- $background = get_percentage_colours($percent);
- $right_background = $background['right'];
- $left_background = $background['left'];
-
- if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
- echo("
-
- |
- ".$bill['bill_name']." |
- $notes |
- $type |
- $allowed |
- $used |
- ".print_percentage_bar (350, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." |
- Edit |
-
- ");
- $i++;
- } ### PERMITTED
- }
- echo("");
-}
-
-echo("");
-
-?>
+ $_POST['bill_name'], 'bill_type' => $_POST['bill_type'], 'bill_cdr' => $_POST['bill_cdr'], 'bill_day' => $_POST['bill_day'], 'bill_gb' => $_POST['bill_quota'],
+ 'bill_custid' => $_POST['bill_custid'], 'bill_ref' => $_POST['bill_ref'], 'bill_notes' => $_POST['bill_notes']);
+
+ $affected = dbInsert($insert, 'bills');
+
+ $message .= $message_break . "Bill ".mres($_POST['bill_name'])." added!";
+ $message_break .= "
";
+}
+
+echo("");
+
+if ($_GET['opta'] == "add")
+{
+
+?>
+Add Bill
+
+
+
+
+
+
+
+
+");
+ $i=1;
+ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_name`") as $bill)
+ {
+ if (bill_permitted($bill['bill_id']))
+ {
+ unset($class);
+ $day_data = getDates($bill['bill_day']);
+ $datefrom = $day_data['0'];
+ $dateto = $day_data['1'];
+ $rate_data = getRates($bill['bill_id'],$datefrom,$dateto);
+ $rate_95th = $rate_data['rate_95th'];
+ $dir_95th = $rate_data['dir_95th'];
+ $total_data = $rate_data['total_data'];
+ $rate_average = $rate_data['rate_average'];
+
+ if ($bill['bill_type'] == "cdr")
+ {
+ $type = "CDR";
+ $allowed = formatRates($bill['bill_cdr'] * 1000);
+ $used = formatRates($rate_data['rate_95th'] * 1000);
+ $percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2);
+ } elseif ($bill['bill_type'] == "quota") {
+ $type = "Quota";
+ $allowed = formatStorage($bill['bill_gb']* 1024 * 1024 * 1024);
+ $used = formatStorage($rate_data['total_data'] * 1024 * 1024);
+ $percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1024)) * 100,2);
+ }
+
+ $background = get_percentage_colours($percent);
+ $right_background = $background['right'];
+ $left_background = $background['left'];
+
+ if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
+ echo("
+
+ |
+ ".$bill['bill_name']." |
+ $notes |
+ $type |
+ $allowed |
+ $used |
+ ".print_percentage_bar (350, 20, $perc, NULL, "ffffff", $background['left'], $percent . "%", "ffffff", $background['right'])." |
+ Edit |
+
+ ");
+ $i++;
+ } ### PERMITTED
+ }
+ echo("");
+}
+
+echo("");
+
+?>
diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php
index 9c21ae4b1..b8fb777ec 100644
--- a/html/pages/device/ports.inc.php
+++ b/html/pages/device/ports.inc.php
@@ -1,119 +1,118 @@
- 'device',
- 'device' => $device['device_id'],
- 'tab' => 'ports');
-
-print_optionbar_start();
-
-$menu_options['basic'] = 'Basic';
-$menu_options['details'] = 'Details';
-$menu_options['arp'] = 'ARP Table';
-
-if(dbFetchCell("SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"))
-{
- $menu_options['neighbours'] = 'Neighbours';
-}
-if(dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `ifType` = 'adsl'"))
-{
- $menu_options['adsl'] = 'ADSL';
-}
-
-
-$sep = "";
-foreach ($menu_options as $option => $text)
-{
- echo($sep);
- if ($vars['view'] == $option) { echo(""); }
- $sep = " | ";
-}
-
-unset($sep);
-
-echo(' | Graphs: ');
-
-$graph_types = array("bits" => "Bits",
- "upkts" => "Unicast Packets",
- "nupkts" => "Non-Unicast Packets",
- "errors" => "Errors",
- "etherlike" => "Etherlike");
-
-foreach ($graph_types as $type => $descr)
-{
- echo("$type_sep");
- if ($vars['graph'] == $type && $vars['view'] == "graphs") { echo(""); }
-
- echo(' (');
- if ($vars['graph'] == $type && $vars['view'] == "minigraphs") { echo(""); }
- echo(')');
- $type_sep = " | ";
-}
-
-print_optionbar_end();
-
-if ($vars['view'] == 'minigraphs')
-{
- $timeperiods = array('-1day','-1week','-1month','-1year');
- $from = '-1day';
- echo("");
- unset ($seperator);
-
- ## FIX THIS. UGLY.
-
- foreach (dbFetchRows("select * from ports WHERE device_id = ? ORDER BY ifIndex", array($device['device_id'])) as $port)
- {
- echo("
\
- ".$port['ifAlias']." \
-

\
- ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
- "

-
-
".truncate(short_port_descr($port['ifAlias']), 32, '')."
-
");
- }
- echo("");
-} elseif ($vars['view'] == "arp" || $vars['view'] == "adsl" || $vars['view'] == "neighbours") {
- include("ports/".$vars['view'].".inc.php");
-} else {
- if ($vars['view'] == "details") { $port_details = 1; }
- echo("");
- $i = "1";
-
- global $port_cache;
- global $port_index_cache;
-
- $ports = dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0' ORDER BY `ifIndex` ASC", array($device['device_id']));
- ### As we've dragged the whole database, lets pre-populate our caches :)
- ### FIXME - we should probably split the fetching of link/stack/etc into functions and cache them here too to cut down on single row queries.
- foreach($ports as $port)
- {
- $port_cache[$port['interface_id']] = $port;
- $port_index_cache[$port['device_id']][$port['ifIndex']] = $port;
- }
-
- foreach ($ports as $port)
- {
- include("includes/print-interface.inc.php");
- $i++;
- }
- echo("
");
-}
-
-
-?>
+ 'device',
+ 'device' => $device['device_id'],
+ 'tab' => 'ports');
+
+print_optionbar_start();
+
+$menu_options['basic'] = 'Basic';
+$menu_options['details'] = 'Details';
+$menu_options['arp'] = 'ARP Table';
+
+if(dbFetchCell("SELECT * FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"))
+{
+ $menu_options['neighbours'] = 'Neighbours';
+}
+if(dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `ifType` = 'adsl'"))
+{
+ $menu_options['adsl'] = 'ADSL';
+}
+
+
+$sep = "";
+foreach ($menu_options as $option => $text)
+{
+ echo($sep);
+ if ($vars['view'] == $option) { echo(""); }
+ $sep = " | ";
+}
+
+unset($sep);
+
+echo(' | Graphs: ');
+
+$graph_types = array("bits" => "Bits",
+ "upkts" => "Unicast Packets",
+ "nupkts" => "Non-Unicast Packets",
+ "errors" => "Errors",
+ "etherlike" => "Etherlike");
+
+foreach ($graph_types as $type => $descr)
+{
+ echo("$type_sep");
+ if ($vars['graph'] == $type && $vars['view'] == "graphs") { echo(""); }
+
+ echo(' (');
+ if ($vars['graph'] == $type && $vars['view'] == "minigraphs") { echo(""); }
+ echo(')');
+ $type_sep = " | ";
+}
+
+print_optionbar_end();
+
+if ($vars['view'] == 'minigraphs')
+{
+ $timeperiods = array('-1day','-1week','-1month','-1year');
+ $from = '-1day';
+ echo("");
+ unset ($seperator);
+
+ ## FIX THIS. UGLY.
+
+ foreach (dbFetchRows("select * from ports WHERE device_id = ? ORDER BY ifIndex", array($device['device_id'])) as $port)
+ {
+ echo("
\
+ ".$port['ifAlias']." \
+

\
+ ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >".
+ "

+
+
".truncate(short_port_descr($port['ifAlias']), 32, '')."
+
");
+ }
+ echo("");
+} elseif ($vars['view'] == "arp" || $vars['view'] == "adsl" || $vars['view'] == "neighbours") {
+ include("ports/".$vars['view'].".inc.php");
+} else {
+ if ($vars['view'] == "details") { $port_details = 1; }
+ echo("");
+ $i = "1";
+
+ global $port_cache, $port_index_cache;
+
+ $ports = dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0' ORDER BY `ifIndex` ASC", array($device['device_id']));
+ ### As we've dragged the whole database, lets pre-populate our caches :)
+ ### FIXME - we should probably split the fetching of link/stack/etc into functions and cache them here too to cut down on single row queries.
+ foreach($ports as $port)
+ {
+ $port_cache[$port['interface_id']] = $port;
+ $port_index_cache[$port['device_id']][$port['ifIndex']] = $port;
+ }
+
+ foreach ($ports as $port)
+ {
+ include("includes/print-interface.inc.php");
+ $i++;
+ }
+ echo("
");
+}
+
+
+?>
diff --git a/html/pages/device/vlans.inc.php b/html/pages/device/vlans.inc.php
index 932b80a82..6e33b4dd1 100644
--- a/html/pages/device/vlans.inc.php
+++ b/html/pages/device/vlans.inc.php
@@ -14,7 +14,7 @@ if ($vars['view'] == 'graphs' || $vars['view'] == 'minigraphs')
}
if (!$vars['view']) { $vars['view'] = "basic"; }
-
+
$menu_options['basic'] = 'Basic';
#$menu_options['details'] = 'Details';
diff --git a/includes/polling/ports.inc.php b/includes/polling/ports.inc.php
index dbc4fc903..4076a68e4 100755
--- a/includes/polling/ports.inc.php
+++ b/includes/polling/ports.inc.php
@@ -199,8 +199,8 @@ foreach ($ports as $port)
$this_port['ifTrunk'] = $this_port['vlanTrunkPortEncapsulationOperType'];
}
$this_port['ifVlan'] = $this_port['vmVlan'];
- if(isset($this_port['vlanTrunkPortNativeVlan'])) { $this_port['ifVlan'] = $this_port['vlanTrunkPortNativeVlan']; }
-
+ if (isset($this_port['vlanTrunkPortNativeVlan'])) { $this_port['ifVlan'] = $this_port['vlanTrunkPortNativeVlan']; }
+
if (isset($this_port['dot1qPvid']))
{
$this_port['ifVlan'] = $this_port['dot1qPvid'];