diff --git a/html/.htaccess b/html/.htaccess index 15a61d8da..24978ad47 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -9,7 +9,13 @@ RewriteCond %{REQUEST_URI} !^(.*)\.gif$ RewriteCond %{REQUEST_URI} !^(.*)\.png$ RewriteRule ^bare/(.+)/ index-bare.php?page=$1 +RewriteRule ^bare/(.+)/(.+)/ index-bare.php?page=$1&opta=$2 +RewriteRule ^bare/(.+)/(.+)/(.+)/ index-bare.php?page=$1&opta=$2&optb=$3 +RewriteRule ^mobile/([a-z|0-9]+)/(.+)/(.+)/ mobile.php?page=$1&opta=$2&optb=$3 +RewriteRule ^mobile/([a-z|0-9]+)/(.+)/ mobile.php?page=$1&opta=$2 +RewriteRule ^mobile/([a-z|0-9]+)/ mobile.php?page=$1 +RewriteRule ^mobile/ mobile.php ## Rewrites for Devices @@ -24,16 +30,13 @@ RewriteRule ^vrf/(.+)/(.+)/(.+)/ ?page=vrf&id=$1&opta=$2&optb=$3 RewriteRule ^vrf/(.+)/(.+)/ ?page=vrf&id=$1&opta=$2 RewriteRule ^vrf/(.+)/ ?page=vrf&id=$1 - -RewriteRule ^bill/([0-9]+) ?page=bills&bill=$1 - RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4&optc=$5 RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3&optb=$4 RewriteRule ^device/([0-9]+)/([a-z]+)/(.+)/ ?page=device&id=$1§ion=$2&opta=$3 RewriteRule ^device/([0-9]+)/([a-z]+)/ ?page=device&id=$1§ion=$2 RewriteRule ^device/([0-9]+) ?page=device&id=$1 -RewriteRule ^([a-z|0-9]+)/$ ?page=$1 +RewriteRule ^([a-z|0-9\-]+)/$ ?page=$1 RewriteRule ^([a-z|0-9]+)/(.+)/$ ?page=$1&opta=$2 diff --git a/html/css/styles.css b/html/css/styles.css index cc77dc5f3..1bb0ff0fb 100644 --- a/html/css/styles.css +++ b/html/css/styles.css @@ -1,3 +1,41 @@ +.rounded{display:block} +.rounded *{ + display:block; + height:1px; + overflow:hidden; + font-size:.01em; + background:#e5e5e5} +.rounded1{ + margin-left:3px; + margin-right:3px; + padding-left:1px; + padding-right:1px; + border-left:1px solid #f3f36b; + border-right:1px solid #f3f36b; + background:#ebebaf} +.rounded2{ + margin-left:1px; + margin-right:1px; + padding-right:1px; + padding-left:1px; + border-left:1px solid #fcfc24; + border-right:1px solid #fcfc24; + background:#e9e9bc} +.rounded3{ + margin-left:1px; + margin-right:1px; + border-left:1px solid #e9e9bc; + border-right:1px solid #e9e9bc;} +.rounded4{ + border-left:1px solid #f3f36b; + border-right:1px solid #f3f36b} +.rounded5{ + border-left:1px solid #ebebaf; + border-right:1px solid #ebebaf} +.roundedfg{ + background:#e5e5e5} + + .content-box{display:block} .content-box *{ display:block; diff --git a/html/includes/billing.php b/html/includes/billing.php deleted file mode 100644 index accceee6c..000000000 --- a/html/includes/billing.php +++ /dev/null @@ -1,185 +0,0 @@ -= 1000000) { $paidrate_text = $paid_mb . "Mbps is the CDR."; } - -$day_data = getDates($dayofmonth); -$datefrom = $day_data['0']; -$dateto = $day_data['1']; -$rate_data = getRates($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 ($rate_95th > $paid_kb) { - $over = $rate_95th - $paid_kb; - $bill_text = $over . "Kbit excess."; - $bill_color = "#cc0000"; -} else { - $under = $paid_kb - $rate_95th; - $bill_text = $under . "Kbit headroom."; - $bill_color = "#0000cc"; -} - -$fromtext = mysql_result(mysql_query("SELECT DATE_FORMAT($datefrom, '%M %D %Y')"), 0); -$totext = mysql_result(mysql_query("SELECT DATE_FORMAT($dateto, '%M %D %Y')"), 0); -$unixfrom = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$datefrom')"), 0); -$unixto = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$dateto')"), 0); - -echo("

-" . $bill_name . "

"); - - -echo("

Billed Ports

"); - -$ports = mysql_query("SELECT * FROM interfaces AS I, devices AS D, bill_ports as B WHERE B.bill_id = '$bill_id' AND B.port_id = I.interface_id AND I.device_id = D.device_id"); - -while ($port = mysql_fetch_array($ports)) { - - echo(generateiflink($port) . " on " . generatedevicelink($port) . "
"); - -} - -echo("

Bill Summary

"); - -if($bill_data['bill_type'] == "quota") { - - // The Customer is billed based on a pre-paid quota - - $percent = round(($total_data / 1024) / $bill_data['bill_gb'] * 100, 2); - $unit = "MB"; - $total_data = round($total_data, 2); - echo("Billing Period from " . $fromtext . " to " . $totext . " -
Transferred ".formatStorage($total_data * 1024 * 1024)." of ".formatStorage($bill_data['bill_gb'] * 1024 * 1024 * 1024)." (".$percent."%) -
Average rate " . formatRates($rate_average * 1000)); - if ($percent > 100) { $percent = "100"; } - echo("

"); - - $type="&ave=yes"; - - -} elseif($bill_data['bill_type'] == "cdr") { - - // The customer is billed based on a CDR with 95th%ile overage - - $unit = "kbps"; - $cdr = $bill_data['bill_cdr']; - if($rate_95th > "1000") { $rate_95th = $rate_95th / 1000; $cdr = $cdr / 1000; $unit = "Mbps"; } - if($rate_95th > "1000") { $rate_95th = $rate_95th / 1000; $cdr = $cdr / 1000; $unit = "Gps"; } - $rate_95th = round($rate_95th, 2); - - $percent = round(($rate_95th) / $cdr * 100, 2); - - $type="&95th=yes"; - - - echo("" . $fromtext . " to " . $totext . " -
Measured ".$rate_95th."$unit of ".$cdr."$unit (".$percent."%)"); - if ($percent > 100) { $percent = "100"; } - echo("

"); - -# echo("

Billing Period : " . $fromtext . " to " . $totext . "
-# " . $paidrate_text . "
-# " . $total_data . "MB transfered in the current billing cycle.
-# " . $rate_average . "Kbps Average during the current billing cycle.

-# " . $rate_95th . "Kbps @ 95th Percentile. (" . $dir_95th . ") (" . $bill_text . ") -#
-#
"); - -} - -echo(""); - -$bi = ""; - -$lastmonth = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))"), 0); -$yesterday = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))"), 0); -$now = date(U); - -$di = ""; - -$mi = ""; - -if($null) { - -echo(" - - -
- - - - - - From: - - - To: - - - -
- -"); - -} - - if ($_GET[all]) { - $ai = ""; - echo("

Entire Data View

$ai"); - } elseif ($_GET[custom]) { - $cg = ""; - echo("

Custom Graph

$cg"); - } else { - echo("

Billing View

$bi

24 Hour View

$di"); - #echo("

Monthly View

$li"); - #echo("
Graph All Data (SLOW)"); - } -} - - - -if($_GET['bill'] && billpermitted($_GET['bill'])){ - - $bill_id = $_GET['bill']; - printReport($bill_id); - -} - -?> - diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 8e4d2da52..416901ff0 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -1,224 +1,225 @@ - - - + + + diff --git a/html/includes/print-vlan.inc b/html/includes/print-vlan.inc index 58893ff8e..7cdd3b6ea 100644 --- a/html/includes/print-vlan.inc +++ b/html/includes/print-vlan.inc @@ -1,18 +1,37 @@ "); -echo(" Vlan " . $vlan['vlan_vlan'] . ""); -echo("" . $vlan['vlan_descr'] . ""); +echo(" Vlan " . $vlan['vlan_vlan'] . ""); +echo("" . $vlan['vlan_descr'] . ""); echo(""); $ports_query = mysql_query("SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' "); while($port = mysql_fetch_array($ports_query)) { - echo($vlan['port_sep'] . generateiflink($port, makeshortif($port['ifDescr']))); - $vlan['port_sep'] = ", "; + if($_GET['opta']) { + $graph_type = $_GET['opta']; + + 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']), 22, '')."
+ "); + + + + } else { + echo($vlan['port_sep'] . generateiflink($port, makeshortif($port['ifDescr']))); + $vlan['port_sep'] = ", "; + } } echo(""); echo(""); diff --git a/html/includes/print-vrf.inc b/html/includes/print-vrf.inc index 28ac7f5cd..7700532a7 100644 --- a/html/includes/print-vrf.inc +++ b/html/includes/print-vrf.inc @@ -4,17 +4,31 @@ if(is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_ echo(""); -echo("" . $vrf['vrf_name'] . ""); -echo("" . $vrf['mplsVpnVrfDescription'] . ""); -echo("" . $vrf['mplsVpnVrfRouteDistinguisher'] . ""); +echo("" . $vrf['vrf_name'] . ""); +echo("" . $vrf['mplsVpnVrfDescription'] . ""); +echo("" . $vrf['mplsVpnVrfRouteDistinguisher'] . ""); echo(""); $ports_query = mysql_query("SELECT * FROM interfaces WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVrf` = '" . $vrf['vrf_id'] . "' "); while($port = mysql_fetch_array($ports_query)) { - - echo($vrf['port_sep'] . generateiflink($port, makeshortif($port['ifDescr']))); - $vrf['port_sep'] = ", "; + if($_GET['opta']) { + $graph_type = $_GET['opta']; + 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']), 22, '')."
+ "); + } else { + echo($vrf['port_sep'] . generateiflink($port, makeshortif($port['ifDescr']))); + $vrf['port_sep'] = ", "; + } } echo(""); echo(""); diff --git a/html/pages/bills.php b/html/pages/bills.php index 2dc98fd4f..bf0d122f0 100644 --- a/html/pages/bills.php +++ b/html/pages/bills.php @@ -1,57 +1,127 @@ -"); - -if($_GET['bill']) { - - $bill_id = $_GET['bill']; - include("includes/billing.php"); - -} else { - - $sql = "SELECT * FROM `bills` ORDER BY `bill_name`"; - $query = mysql_query($sql); - if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } - echo(""); - while($bill = mysql_fetch_array($query)) { - 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); - } - - echo(" - - - - - - - - - - "); - } - echo("
".$bill['bill_name']."$notes$type$allowed$used $percent%
"); - -} - -echo(""); - -?> + + +"); + +if($_GET['opta'] == "add") { + +?> +
Add Bill
+ +
+ + + + + + + +
+ Content +
+ + + + + + + +
+ + + + + + + +
Bills
+ + + + + + + + +
+ + + + + + + + + + + Add Add Bill +
+ + "); + $i=1; + while($bill = mysql_fetch_array($query)) { + 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); + } + if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + echo(" + + + ".$bill['bill_name']." + $notes + $type + $allowed + $used + $percent% + + Edit Edit + + "); + } + echo(""); + $i++; +} + +echo(""); + +?> diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index e24829e4e..aec9d01bb 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -1,72 +1,57 @@ - -Basic | -Details | Graphs: -Bits -(Mini) | -Packets -(Mini) | -NU Packets -(Mini) | -Errors -(Mini) - "); - -if($_GET['opta'] == graphs ) { - if($_GET['optb']) { - $graph_type = $_GET['optb']; - } else { - $graph_type = "bits"; - } - $dographs = 1; -} - -if($_GET['optc'] == thumbs) { - - $timeperiods = array('-1day','-1week','-1month','-1year'); - - $from = '-1day'; - - echo("
"); - $sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; - $query = mysql_query($sql); - unset ($seperator); - while($interface = mysql_fetch_array($query)) { - echo("
-
".makeshortif($interface['ifDescr'])."
- ".$device['hostname']." - ".$interface['ifDescr']."
\ - ".$interface['ifAlias']." \ - \ - ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". - " - -
".truncate(short_port_descr($interface['ifAlias']), 32, '')."
-
"); - } - echo(""); - -} else { - -if($_GET['opta'] == "details" ) { - $port_details = 1; -} - - -$hostname = gethostbyid($device['device_id']); - -echo("
"); -$i = "1"; -$interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC"); -while($interface = mysql_fetch_array($interface_query)) { - include("includes/print-interface.inc"); - $i++; -} -echo("
"); - -echo("
"); - -} - -?> + +Basic | +Details | Graphs: +Bits +(Mini) | +Packets +(Mini) | +NU Packets +(Mini) | +Errors +(Mini) + "); + +if($_GET['opta'] == graphs ) { + if($_GET['optb']) { $graph_type = $_GET['optb']; } else { $graph_type = "bits"; } + $dographs = 1; +} + +if($_GET['optc'] == thumbs) { + + $timeperiods = array('-1day','-1week','-1month','-1year'); + $from = '-1day'; + echo("
"); + $sql = "select * from interfaces WHERE device_id = '".$device['device_id']."' ORDER BY ifIndex"; + $query = mysql_query($sql); + unset ($seperator); + while($interface = mysql_fetch_array($query)) { + echo("
+
".makeshortif($interface['ifDescr'])."
+ ".$device['hostname']." - ".$interface['ifDescr']."
\ + ".$interface['ifAlias']." \ + \ + ', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 150);\" onmouseout=\"return nd();\" >". + " + +
".truncate(short_port_descr($interface['ifAlias']), 32, '')."
+
"); + } + echo(""); +} else { + if($_GET['opta'] == "details" ) { $port_details = 1; } + $hostname = gethostbyid($device['device_id']); + echo("
"); + $i = "1"; + $interface_query = mysql_query("select * from interfaces WHERE device_id = '$_GET[id]' AND deleted = '0' ORDER BY `ifIndex` ASC"); + while($interface = mysql_fetch_array($interface_query)) { + include("includes/print-interface.inc"); + $i++; + } + echo("
"); + echo("
"); +} + +?> diff --git a/html/pages/logon.inc b/html/pages/logon.inc index ed7609bd1..6fdc1ca74 100644 --- a/html/pages/logon.inc +++ b/html/pages/logon.inc @@ -1,44 +1,59 @@ -
- - - - - -
-
-

Please log in:

- -
- - - - - - - - - - - - - - - "); - -if($auth_message) { - echo(""); -} - -echo("
Username
Password
- Remember Me
$auth_message
-
-"); - -if($config['login_message']) { - echo("
".$config['login_message']."
"); -} - -?> + + + + + + + +
+
+ + + + + +
+
+

Please log in:

+
+ + + + + + + + + + + + + + + "); + +if($auth_message) { + echo(""); +} + +echo("
Username
Password
+ Remember Me
$auth_message
+
+
+
+ + + + + + +"); + +if($config['login_message']) { + echo("
".$config['login_message']."
"); +} + +?> diff --git a/includes/discovery/bgp-peers.php b/includes/discovery/bgp-peers.php index c75d16f4d..28aa245dd 100755 --- a/includes/discovery/bgp-peers.php +++ b/includes/discovery/bgp-peers.php @@ -8,7 +8,7 @@ $as_cmd .= ".1.3.6.1.2.1.15.2"; $bgpLocalAs = trim(shell_exec($as_cmd)); - if($bgpLocalAs && !strstr($bgpLocalAs, "No")) { + if($bgpLocalAs && !strstr($bgpLocalAs, " ")) { echo("AS$bgpLocalAs \n"); @@ -65,7 +65,12 @@ echo("\n"); } # If Peer } # Foreach - } else { echo("No BGP on host"); } # End if + } else { + echo("No BGP on host"); + if($device['bgpLocalAs']) { + mysql_query("UPDATE devices SET bgpLocalAs = NULL WHERE device_id = '".$device['device_id']."'"); echo(" (Removed ASN)\n"); + } # End if + } # End if ## Delete removed peers diff --git a/includes/graphing.php b/includes/graphing.php index 792f3ea4c..6487d6a4b 100644 --- a/includes/graphing.php +++ b/includes/graphing.php @@ -731,6 +731,7 @@ function pktsgraph ($rrd, $graph, $from, $to, $width, $height) { $database = $config['rrd_dir'] . "/" . $rrd; $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; + if($height < "99") { $options .= " --only-graph"; unset ($legend); } if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:INUCASTPKTS:AVERAGE"; $options .= " DEF:out=$database:OUTUCASTPKTS:AVERAGE"; @@ -755,6 +756,7 @@ function errorgraph ($rrd, $graph, $from, $to, $width, $height) { $database = $config['rrd_dir'] . "/" . $rrd; $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; + if($height < "99") { $options .= " --only-graph"; unset ($legend); } if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:INERRORS:AVERAGE"; $options .= " DEF:out=$database:OUTERRORS:AVERAGE"; @@ -779,6 +781,7 @@ function nucastgraph ($rrd, $graph, $from, $to, $width, $height) { $database = $config['rrd_dir'] . "/" . $rrd; $imgfile = $config['install_dir'] . "/graphs/" . "$graph"; $options = "--alt-autoscale-max -E --start $from --end $to --width $width --height $height "; + if($height < "99") { $options .= " --only-graph"; unset ($legend); } if($width <= "300") { $options .= " --font LEGEND:7:".$config['mono_font']." --font AXIS:6:".$config['mono_font']." --font-render-mode normal "; } $options .= " DEF:in=$database:INNUCASTPKTS:AVERAGE"; $options .= " DEF:out=$database:OUTNUCASTPKTS:AVERAGE";