From e0af4cc9f52808637c741d4074c5884477d703b9 Mon Sep 17 00:00:00 2001 From: markjcrane Date: Thu, 5 Apr 2018 01:16:03 +0000 Subject: [PATCH] Delete traffic_graph will move to fusionpbx-apps repo --- app/traffic_graph/app_config.php | 37 --- app/traffic_graph/app_languages.php | 124 --------- app/traffic_graph/app_menu.php | 28 -- app/traffic_graph/root.php | 90 ------ app/traffic_graph/status_graph.php | 139 --------- app/traffic_graph/status_interface.php | 139 --------- app/traffic_graph/svg_graph.php | 372 ------------------------- 7 files changed, 929 deletions(-) delete mode 100644 app/traffic_graph/app_config.php delete mode 100644 app/traffic_graph/app_languages.php delete mode 100644 app/traffic_graph/app_menu.php delete mode 100644 app/traffic_graph/root.php delete mode 100644 app/traffic_graph/status_graph.php delete mode 100644 app/traffic_graph/status_interface.php delete mode 100644 app/traffic_graph/svg_graph.php diff --git a/app/traffic_graph/app_config.php b/app/traffic_graph/app_config.php deleted file mode 100644 index 74f6ef6ac6..0000000000 --- a/app/traffic_graph/app_config.php +++ /dev/null @@ -1,37 +0,0 @@ - \ No newline at end of file diff --git a/app/traffic_graph/app_languages.php b/app/traffic_graph/app_languages.php deleted file mode 100644 index 9c9d8f37c0..0000000000 --- a/app/traffic_graph/app_languages.php +++ /dev/null @@ -1,124 +0,0 @@ - diff --git a/app/traffic_graph/app_menu.php b/app/traffic_graph/app_menu.php deleted file mode 100644 index 4ddaab920a..0000000000 --- a/app/traffic_graph/app_menu.php +++ /dev/null @@ -1,28 +0,0 @@ - \ No newline at end of file diff --git a/app/traffic_graph/root.php b/app/traffic_graph/root.php deleted file mode 100644 index 6fdf32f37b..0000000000 --- a/app/traffic_graph/root.php +++ /dev/null @@ -1,90 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ - -// make sure the PATH_SEPARATOR is defined - umask(2); - if (!defined("PATH_SEPARATOR")) { - if (strpos($_ENV["OS"], "Win") !== false) { - define("PATH_SEPARATOR", ";"); - } else { - define("PATH_SEPARATOR", ":"); - } - } - - if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html'; - - // make sure the document_root is set - $_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]); - if(PHP_SAPI == 'cli'){ - chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME)); - $script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]); - $dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME)); - if (file_exists('/project_root.php')) { - $path = '/'; - } else { - $i = 1; - $path = ''; - while ($i < count($dirs)) { - $path .= '/' . $dirs[$i]; - if (file_exists($path. '/project_root.php')) { - break; - } - $i++; - } - } - $_SERVER["DOCUMENT_ROOT"] = $path; - }else{ - $_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]); - } - $_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]); -// try to detect if a project path is being used - if (!defined('PROJECT_PATH')) { - if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) { - define('PROJECT_PATH', '/fusionpbx'); - } elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) { - define('PROJECT_PATH', ''); - } else { - $dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME))); - $i = 1; - $path = $_SERVER["DOCUMENT_ROOT"]; - while ($i < count($dirs)) { - $path .= '/' . $dirs[$i]; - if (file_exists($path. '/project_root.php')) { - break; - } - $i++; - } - if(!file_exists($path. '/project_root.php')){ - die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance"); - } - $project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path); - define('PROJECT_PATH', $project_path); - } - $_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH); - set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]); - } - -?> \ No newline at end of file diff --git a/app/traffic_graph/status_graph.php b/app/traffic_graph/status_graph.php deleted file mode 100644 index f504473a6b..0000000000 --- a/app/traffic_graph/status_graph.php +++ /dev/null @@ -1,139 +0,0 @@ -. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('traffic_graph_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//add multi-lingual support - $language = new text; - $text = $language->get(); - -if ($_REQUEST['interface']) { - $interface = $_REQUEST['interface']; -} -else { - $interface = ''; -} -if ($_REQUEST['width']) { - $width = $_REQUEST['width']; -} -else { - $width = "660"; //550 //660 //792 -} - -if ($_REQUEST['height']) { - $height = $_REQUEST['height']; -} -else { - $height = "330"; //275 //330 //396 -} - -require_once "resources/header.php"; -$document['title'] = $text['title-traffic_graph']; - -?> - - - - -
- $value) { - if ($value != "Kernel Interface table") { - if ($x != 0) { - //get the values - $interface_info = preg_split("/\s+/", $result_array[$key]); - //list all the interfaces - $options[] = ""; - //auto-select first interface - if ($interface == '') { $interface = $interface_info[0]; } - } - $x++; - } - } - //output form, if interfaces exist' - if (sizeof($options)) { - ?> -
-    - - - -
- -
- -

- -

- -
-

- 0) { - ?> - - - - -



"; - echo $text['message-no_interfaces_found']; - echo "




"; - } - ?> -
-


- - diff --git a/app/traffic_graph/status_interface.php b/app/traffic_graph/status_interface.php deleted file mode 100644 index 2e81f1a283..0000000000 --- a/app/traffic_graph/status_interface.php +++ /dev/null @@ -1,139 +0,0 @@ - - Portions created by the Initial Developer are Copyright (C) 2008-2012 - the Initial Developer. All Rights Reserved. - - Contributor(s): - Mark J Crane -*/ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('traffic_graph_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -//http get saved to a php variable - $interface_name = $_GET['interface']; - -//notes - //links to get netstat working in a jail - //http://ggeek.blogspot.com/2008/10/freebsd-jails-and-net-snmp.html - //http://am-productions.biz/docs/devfs.rules.php - //http://ggeek.blogspot.com/2008/10/freebsd-jails-and-net-snmp.html - - //freebsd - //netstat -i -nWb -f link - //Name Mtu Network Address Ipkts Ierrs Ibytes Opkts Oerrs Obytes Coll - //dc0 1500 00:07:95:b3:e9:14 38081447 0 1267085007 10894865 0 1825820736 0 - //xl0 1500 00:08:74:11:f8:44 10910693 0 1855752990 24502116 7466 459761069 4074482 - - //linux get the info need to parse it - //list a single interface doesn't work on all versions of linux - //netstat -I=eth0 - //list all interfaces - //netstat -i - //Kernel Interface table - //Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg - //eth0 1500 0 25878419 0 0 0 32196826 0 0 0 BMRU - //eth1 1500 0 17537 0 0 0 27819 0 0 0 BMRU - //lo 16436 0 99683 0 0 0 99683 0 0 0 LRU - - //osx - //list all interfaces - //netstat -i - //Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll - //lo0 16384 2761841 0 2761840 0 0 - //lo0 16384 localhost ::1 2761841 - 2761840 - - - //lo0 16384 localhost fe80:1::1 2761841 - 2761840 - - - //lo0 16384 127 localhost 2761841 - 2761840 - - - //gif0* 1280 0 0 0 0 0 - //stf0* 1280 0 0 0 0 0 - //en0 1500 c4:2c:03:0b:52:de 3242578 0 3286461 0 0 - //en0 1500 macolantern fe80:4::c62c:3ff: 3242578 - 3286461 - - - //en0 1500 192.168.2 744.ssenn.net 3242578 - 3286461 - - - - //example code - //exec("/usr/bin/netstat -i", $result_array); - //echo "
\n";
-		//print_r($result_array);
-		//echo "
\n"; - - //$interface_name_info = preg_split("/\s+/", $result_array[0]); - //$interface_value_info = preg_split("/\s+/", $result_array[1]); - //$netstat_array = array(); - //foreach ($interface_name_info as $key => $value) { - // $netstat_array[$value] = $interface_value_info[$key]; - //} - //echo "
\n";
-		//print_r($netstat_array);
-		//echo "
\n"; - -// run netstat to determine interface info - exec("netstat -i -nWb -f link", $result_array); - if (count($result_array) == 0) { - exec("netstat -i", $result_array); - } - -//parse the data into a named array - $x = 0; - foreach ($result_array as $key => $value) { - if ($value != "Kernel Interface table") { - if ($x == 0) { - //get the names of the values - $interface_name_info = preg_split("/\s+/", $result_array[$key]); - } - else { - //get the values - $interface_value_info = preg_split("/\s+/", $result_array[$key]); - //find data for the selected interface - if ($interface_name == $interface_value_info[0]) { - $netstat_array = array(); - foreach ($interface_name_info as $sub_key => $sub_value) { - $netstat_array[$sub_value] = $interface_value_info[$sub_key]; - } - } - } - $x++; - } - } - -//set the correct tx and rx values - if (strlen($netstat_array['Iface']) > 0) { - $in_bytes = ($netstat_array['RX-OK']*1024); - $out_bytes = ($netstat_array['TX-OK']*1024); - } - if (strlen($netstat_array['Name']) > 0) { - $in_bytes = $netstat_array['Ibytes']; - $out_bytes = $netstat_array['Obytes']; - } - -//get the timing - $tmp_time = gettimeofday(); - $timing = (double)$tmp_time["sec"] + (double)$tmp_time["usec"] / 1000000.0; - -//provide the timing, input bytes and output bytes - echo "$timing|" . $in_bytes . "|" . $out_bytes . "\n"; - -?> diff --git a/app/traffic_graph/svg_graph.php b/app/traffic_graph/svg_graph.php deleted file mode 100644 index 9188c9c7da..0000000000 --- a/app/traffic_graph/svg_graph.php +++ /dev/null @@ -1,372 +0,0 @@ -, Manuel Kasper - and Jonathan Watt . - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ -include "root.php"; -require_once "resources/require.php"; -require_once "resources/check_auth.php"; -if (permission_exists('traffic_graph_view')) { - //access granted -} -else { - echo "access denied"; - exit; -} - -header("Last-Modified: " . gmdate( "D, j M Y H:i:s" ) . " GMT" ); -header("Expires: " . gmdate( "D, j M Y H:i:s", time() ) . " GMT" ); -header("Cache-Control: no-store, no-cache, must-revalidate" ); // HTTP/1.1 -header("Cache-Control: post-check=0, pre-check=0", FALSE ); -header("Pragma: no-cache"); // HTTP/1.0 -header("Content-type: image/svg+xml"); - -//http get saved to a php variable - $interface = $_GET['interface']; - -/********** HTTP GET Based Conf ***********/ -//$ifnum=@$_GET["ifnum"]; // BSD / SNMP interface name / number -$ifname=@$_GET["interface"]?$_GET["interface"]:"Interface $interface"; //Interface name that will be showed on top right of graph - -/********* Other conf *******/ -$scale_type="up"; //Autoscale default setup : "up" = only increase scale; "follow" = increase and decrease scale according to current graphed datas -$nb_plot=120; //NB plot in graph -if ($_GET["timeint"]) - $time_interval = $_GET["timeint"]; //Refresh time Interval -else - $time_interval = 3; - -$fetch_link = "status_interface.php?interface=".$interface; - -//SVG attributes -$attribs['axis']='fill="black" stroke="black"'; -$attribs['in']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"'; -$attribs['out']='fill="#000000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="7"'; -$attribs['graph_in']='fill="none" stroke="#FF0000" stroke-opacity="0.8"'; -$attribs['graph_out']='fill="none" stroke="#000000" stroke-opacity="0.8"'; -$attribs['legend']='fill="black" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4"'; -$attribs['graphname']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="8"'; -$attribs['grid_txt']='fill="gray" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="6"'; -$attribs['grid']='stroke="gray" stroke-opacity="0.5"'; -$attribs['switch_unit']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4" text-decoration="underline"'; -$attribs['switch_scale']='fill="#FF0000" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4" text-decoration="underline"'; -$attribs['error']='fill="blue" font-family="Arial" font-size="4"'; -$attribs['collect_initial']='fill="gray" font-family="Tahoma, Verdana, Arial, Helvetica, sans-serif" font-size="4"'; - -//Error text if we cannot fetch data : depends on which method is used -$error_text = "Cannot get data about interface $interface"; - -$height=100; //SVG internal height : do not modify -$width=200; //SVG internal width : do not modify - -/********* Graph DATA **************/ -print('' . "\n");?> - - - - /> - /> - /> - /> - /> - text-anchor="end"> - text-anchor="end"> - text-anchor="end"> - >In - >Out - > - > - text-anchor="end"> - >Switch to bytes/s - >AutoScale () - > - >Graph shows last seconds - points=" "/> - text-anchor="middle"> - text-anchor="middle">Collecting initial data, please wait... - - - \ No newline at end of file