From 9ff0fdb44308fd838238fabc871eb4d91f7c6b47 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Tue, 27 Sep 2011 13:22:38 +0000 Subject: [PATCH] syntaxer run, removes dos newlines from 2 files git-svn-id: http://www.observium.org/svn/observer/trunk@2597 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/bills.inc.php | 344 ++++++++++++++++---------------- html/pages/device/ports.inc.php | 237 +++++++++++----------- html/pages/device/vlans.inc.php | 2 +- includes/polling/ports.inc.php | 4 +- 4 files changed, 293 insertions(+), 294 deletions(-) diff --git a/html/pages/bills.inc.php b/html/pages/bills.inc.php index 7dab6a56b2..d24e13c0ea 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
- -
- - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Description
Billing Type - CDR 95th: KBps -
- Quota: GB - -
Billing Day

Optional Information

Customer Reference
Billing Reference
Notes
-
-
- - - - - - - - - - - - - - - - -
Bills
- - - - - - - - - - - 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 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
+ +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Description
Billing Type + CDR 95th: KBps +
+ Quota: GB + +
Billing Day

Optional Information

Customer Reference
Billing Reference
Notes
+
+
+ + + + + + + + + + + + + + + + +
Bills
+ + + + + + + + + + + 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 Edit + + "); + $i++; + } ### PERMITTED + } + echo(""); +} + +echo(""); + +?> diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index 9c21ae4b10..b8fb777ecc 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(""); } - echo(generate_link($text,$link_array,array('view'=>$option))); - 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(generate_link($descr,$link_array,array('view'=>'graphs','graph'=>$type))); - if ($vars['graph'] == $type && $vars['view'] == "graphs") { echo(""); } - - echo(' ('); - if ($vars['graph'] == $type && $vars['view'] == "minigraphs") { echo(""); } - echo(generate_link('Mini',$link_array,array('view'=>'minigraphs','graph'=>$type))); - 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("
-
".makeshortif($port['ifDescr'])."
- ".$device['hostname']." - ".$port['ifDescr']."
\ - ".$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(""); } + echo(generate_link($text,$link_array,array('view'=>$option))); + 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(generate_link($descr,$link_array,array('view'=>'graphs','graph'=>$type))); + if ($vars['graph'] == $type && $vars['view'] == "graphs") { echo(""); } + + echo(' ('); + if ($vars['graph'] == $type && $vars['view'] == "minigraphs") { echo(""); } + echo(generate_link('Mini',$link_array,array('view'=>'minigraphs','graph'=>$type))); + 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("
+
".makeshortif($port['ifDescr'])."
+ ".$device['hostname']." - ".$port['ifDescr']."
\ + ".$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 932b80a82b..6e33b4dd1b 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 dbc4fc9037..4076a68e44 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'];