Commit d190fa5a authored by Benoit Rat's avatar Benoit Rat Committed by Adam Wujek

www: fix slave/master detection in topmenu

Remove the stderr in the shell_execution to improve parsing without the
state of the ports properly.

According to php manual (http://php.net/manual/en/function.strpos.php)
strpos must be used the indentical comperator because strpos can return
0 if string found at position 0.
parent bf55fe94
......@@ -82,7 +82,7 @@ function wrs_header_ports(){
}
function draw_table(){
$ports = shell_exec("/wr/bin/wr_mon -w | tail -20 | head -18");
$ports = shell_exec("/wr/bin/wr_mon -w | tail -20 | head -18 2>/dev/null");
$ports = explode(PHP_EOL, $ports);
echo "<table id='sfp_panel' border='0' align='center' vspace='15'>";
......@@ -90,10 +90,10 @@ function draw_table(){
$cont = 0;
for($i=0; $i<18; $i=$i+1){
if (strpos($ports[$i], "up")){
if (!strpos($ports[$i],"Master")){
$mode="master";
}else{
if (strpos($ports[$i],"Master") === false){
$mode="slave";
}else{
$mode="master";
}
}
else $mode="linkdown";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment