Commit c3dd8042 authored by José Luis  Gutiérrez's avatar José Luis Gutiérrez Committed by Alessandro Rubini

www: removing blank spaces and adding DOTCONFIG_URL

Blank spaces and lines have been removed.
Now in management.php users can modify DOT_CONFIG_URL
A warning message when uploading or adding URL dotconfig is now shown.
parent 30f6d7d1
......@@ -20,8 +20,8 @@
<?php session_is_started() ?>
<?php
<?php
$_SESSION['advance']="yes";
header('Location: index.php');
?>
......
......@@ -19,10 +19,10 @@
<h1 class="title">WRS Aux Clock (Out CLK2)<a href='help.php?help_id=auxclk' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
$infoname = "Aux. Clock Info";
......
......@@ -28,22 +28,21 @@
$format = "list";
$section = "WRS_TABLE_INFO";
$subsection = "CONTACT";
print_info($section, $subsection, $formatID, $class, $infoname, $format);
?>
</div>
<br>
<div>
<p align=right>
<strong>Open Hardware Repository
<strong>Open Hardware Repository
<a href="http://www.ohwr.org/projects/white-rabbit/wiki">
http://www.ohwr.org/projects/white-rabbit/wiki</a>
</strong>
</p>
<br>
<p align=right>
<strong>White-Rabbit Mailing List
<strong>White-Rabbit Mailing List
<a href="mailto:white-rabbit-dev@ohwr.org?subject=[White-Rabbit Switch Local Management Tool]">
(white-rabbit-dev@ohwr.org)</a>
</strong>
......@@ -59,7 +58,7 @@
<IMG SRC="img/ugr.gif" WIDTH=140 ALT="University of Granada">
</center>
</div>
<div>
<p align=right><strong>Developers: </strong>Alessandro Rubini,
Tomasz Wlostowski,
......
......@@ -4,7 +4,7 @@ session_start();
ob_start();
if (empty($_SESSION["WRS_INFO"])){
$wrsinfogenerator = "/var/www/data/wrs-info-generator.php";
shell_exec("/usr/bin/php-cgi ".$wrsinfogenerator."> /dev/null 2>&1 &");
sleep(2);
......@@ -77,49 +77,49 @@ $WRS_TABLE_INFO = Array (
name => COMPILEDBY,
value => $_SESSION["WRS_INFO"][COMPILEDBY],
),
CONTACT_03 => Array(
CONTACT_03 => Array(
name => KERNELCOMPILEDDATE,
value => $_SESSION["WRS_INFO"][KERNELCOMPILEDDATE],
),
CONTACT_04 => Array(
CONTACT_04 => Array(
name => HARDWARE,
value => $_SESSION["WRS_INFO"][HARDWARE],
),
CONTACT_05 => Array(
),
CONTACT_05 => Array(
name => FPGA,
value => $_SESSION["WRS_INFO"][FPGA],
),
CONTACT_06 => Array(
),
CONTACT_06 => Array(
name => MANUFACTURER,
value => $_SESSION["WRS_INFO"][MANUFACTURER],
),
CONTACT_07 => Array(
),
CONTACT_07 => Array(
name => SERIALNUMBER,
value => $_SESSION["WRS_INFO"][SERIALNUMBER],
),
CONTACT_08 => Array(
),
CONTACT_08 => Array(
name => GATEWARE,
value => $_SESSION["WRS_INFO"][GATEWARE],
),
CONTACT_09 => Array(
),
CONTACT_09 => Array(
name => GATEWAREBUILD,
value => $_SESSION["WRS_INFO"][GATEWAREBUILD],
),
CONTACT_10 => Array(
),
CONTACT_10 => Array(
name => WRSHDLCOMMIT,
value => $_SESSION["WRS_INFO"][WRSHDLCOMMIT],
),
CONTACT_11 => Array(
),
CONTACT_11 => Array(
name => GCORESCOMMIT,
value => $_SESSION["WRS_INFO"][GCORESCOMMIT],
),
CONTACT_12 => Array(
),
CONTACT_12 => Array(
name => WRCORESCOMMIT,
value => $_SESSION["WRS_INFO"][WRCORESCOMMIT],
),
),
),
);
$WRS_FORMS = Array(
DNS_SETUP => Array(
DNS_SETUP_00 => Array(
......@@ -135,7 +135,7 @@ $WRS_FORMS = Array(
vname => "dnsdomain",
),
),
SYSTEM_LOGS => Array(
SYSTEM_LOGS_00 => Array(
key => "CONFIG_WRS_LOG_HAL",
......@@ -174,7 +174,7 @@ $WRS_FORMS = Array(
vname => "logsnmp",
),
),
NETWORK_SETUP => Array(
NETWORK_SETUP_00 => Array(
key => "CONFIG_ETH0_IP",
......@@ -201,7 +201,7 @@ $WRS_FORMS = Array(
vname => "ethmac",
),
),
CONFIG_PPSI => Array(
CONFIG_PPSI_00 => Array(
name => "Clock Class",
......@@ -214,7 +214,7 @@ $WRS_FORMS = Array(
vname => "clkacc",
),
),
CONFIG_WRSAUXCLK => Array(
CONFIG_WRSAUXCLK_00 => Array(
key => "CONFIG_WRSAUXCLK_FREQ",
......
<?php
<?php
/*
* Generates data/wrs-info.php
*
*
* @author José Luis Gutiérrez <jlgutierrez@ugr.es>
*
* Generates a data/wrs-info.php with the $options marked as "y" en
*
* Generates a data/wrs-info.php with the $options marked as "y" en
* the last field.
* It is generated once per session.
*
*
* Result: A file in $outputfilename with some info from the WRS.
*
*
*/
$outputfilename = "/var/www/data/wrs-info.php";
// Organized as (CONST,
// FULL STRING,
// BASH COMMAND TO GET THE VALUE,
// Organized as (CONST,
// FULL STRING,
// BASH COMMAND TO GET THE VALUE,
// ENABLED/DISABLED)
$options = Array (
Array ("IPADDRESS", "IP Address", "ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'", "y"),
......@@ -48,7 +48,7 @@ $output = '<?php
// This file has been automatically generated by wrs-info-generator.php
// Do not touch it.
// If you want to perform changes, use wrs-info.generator.php';
$defines = "\n\n// ---- BEGINNING OF DEFINE SECTION ----- //\n";
$datastructure = "\$WRS_INFO = Array(\n";
......
......@@ -27,11 +27,10 @@
$_SESSION["KCONFIG"]["CONFIG_SFP".$sfp."_PARAMS"]="";
save_kconfig();
apply_kconfig();
header ('Location: sfpcalibration.php');
?>
</div>
</div>
</div>
......
......@@ -21,20 +21,13 @@
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
<?php
if(!strcmp($_GET['vlan'],"all")){ // Delete all vlans and free ports
shell_exec("/wr/bin/wrs_vlans --clear");
}else{
shell_exec("/wr/bin/wrs_vlans --rvid ".$_GET['vlan']." --del");
}
header('Location: vlan.php');
?>
......
......@@ -20,27 +20,25 @@
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
$infoname = "DNS Configuration";
$format = "table";
$section = "WRS_FORMS";
$subsection = "DNS_SETUP";
print_form($section, $subsection, $formatID, $class, $infoname, $format);
$modified = process_form($section, $subsection);
if($modified){
save_kconfig();
apply_kconfig();
header ('Location: network.php');
}
?>
......
......@@ -23,41 +23,38 @@
<?php
echo '<form method=POST>
Select an Endpoint: <select name="endpoint" class="sec">';
for($op = 0; $op < 18; $op++){
echo '<option value="wr'.$op.'">wr'.$op.'</option>';
echo '<option value="wr'.$op.'">wr'.$op.'</option>';
}
echo '</select>';
echo '<select name="option1" class="sec">';
echo '<option value="txcal1">Enable Calibration Transmission</option>';
echo '<option value="txcal0">Disable Calibration Transmission</option>';
echo '<option value="dump">See Registers</option>';
echo '<option value="wr">Modify Registers</option>';
//echo '<option value="rt">Show Flags</option>';
echo '<option value="lock">Lock Endpoint</option>';
//echo '<option value="master">Make Master</option>';
//echo '<option value="gm">Make GrandMaster</option>';
echo '<option value="txcal1">Enable Calibration Transmission</option>';
echo '<option value="txcal0">Disable Calibration Transmission</option>';
echo '<option value="dump">See Registers</option>';
echo '<option value="wr">Modify Registers</option>';
//echo '<option value="rt">Show Flags</option>';
echo '<option value="lock">Lock Endpoint</option>';
//echo '<option value="master">Make Master</option>';
//echo '<option value="gm">Make GrandMaster</option>';
echo '</select>
<input type="submit" value="Go!" class="btn">
</form>';
</form>';
//Second option levels:
$option1=htmlspecialchars($_POST['option1']);
$endpoint=htmlspecialchars($_POST['endpoint']);
//Calling phytool.
if(!empty($option1)){
wr_endpoint_phytool($option1, $endpoint);
wr_endpoint_phytool($option1, $endpoint);
}
echo '<br><hr><br>';
wr_show_endpoint_rt_show();
echo '<br><hr><br>';
......
......@@ -22,21 +22,20 @@
<?php session_is_started() ?>
<?php
<?php
// Warning message
echo "<hr>
<center>NOTE: If you do not know how to calibrate endpoints
please click on <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
<center>NOTE: If you do not know how to calibrate endpoints
please click on <a href='http://www.ohwr.org/projects/white-rabbit/wiki/Calibration'
target='_blank'> here </a>*<hr><br>";
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
$infoname = "Endpoint Configuration";
$size = "6";
$header = array ("WR port","Protocol","Tx","Rx","Mode","Fiber");
$matrix = array ("key=CONFIG_PORT00_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT00_PARAMS"],
$header = array ("WR port","Protocol","Tx","Rx","Mode","Fiber");
$matrix = array ("key=CONFIG_PORT00_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT00_PARAMS"],
"key=CONFIG_PORT01_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT01_PARAMS"],
"key=CONFIG_PORT02_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT02_PARAMS"],
"key=CONFIG_PORT03_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT03_PARAMS"],
......@@ -53,32 +52,30 @@
"key=CONFIG_PORT14_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT14_PARAMS"],
"key=CONFIG_PORT15_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT15_PARAMS"],
"key=CONFIG_PORT16_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT16_PARAMS"],
"key=CONFIG_PORT17_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT17_PARAMS"],
"key=CONFIG_PORT17_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_PORT17_PARAMS"],
);
print_multi_form($matrix, $header, $formatID, $class, $infoname, $size);
if(process_multi_form($matrix)){
save_kconfig();
apply_kconfig();
header ('Location: endpointcalibration.php');
}
$formatID = "alternatecolor1";
$class = "altrowstable firstcol";
$infoname = "Available Fibers";
$size = "10";
$header = array ("#","Alpha");
$header = array ("#","Alpha");
$matrix = array ("id=0,key=CONFIG_FIBER00_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_FIBER00_PARAMS"],
"id=1,key=CONFIG_FIBER01_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_FIBER01_PARAMS"],
"id=2,key=CONFIG_FIBER02_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_FIBER02_PARAMS"],
"id=3,key=CONFIG_FIBER03_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_FIBER03_PARAMS"]);
print_multi_form($matrix, $header, $formatID, $class, $infoname, $size);
?>
</div>
......
......@@ -20,25 +20,24 @@
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
//Load all
//Load all
$modes = parse_endpoint_modes();
echo '<table class="altrowstable" id="alternatecolor" style="width:100%;text-align:center">';
for($i = 0; $i < 9; $i++){
echo '<tr>';
echo '<th>wr'.($i).'</td>';
echo '<td><a href="modifymode.php?wr='.($i).'&mode='.$modes[$i].'">'.$modes[$i].'</a></th>';
echo '<th>wr'.($i+9).'</th>';
echo '<td><a href="modifymode.php?wr='.($i+9).'&mode='.$modes[$i+9].'">'.$modes[$i+9].'</a></td>';
echo '</tr>';
}
}
echo '</table>';
echo '<br>';
echo '<p align="right">Go to <a href="endpointcalibration.php">advanced mode</a></p>';
?>
......
......@@ -18,12 +18,12 @@
<div class="rightbody">
<h1 class="title">Firmware Management <a href='help.php?help_id=firmware' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php
<?php
session_is_started();
if(wrs_php_filesize()<30) php_file_transfer_size(30);
?>
<table border="0" align="center">
<table border="0" align="center">
<tr>
<FORM method="POST" ENCTYPE="multipart/form-data" onsubmit="return confirm('Are you sure you want to upload and flash a new firmware?');">
<th ><INPUT type=file name="file" ></th>
......@@ -41,7 +41,7 @@
<?php
//Include downloading and flashing from OHWR if file wr-switch-sw-v4.0-rc1-20140710_binaries.tar is available
//$ohwrlink="http://www.ohwr.org/attachments/download/3095/wr-switch-sw-v4.0-rc1-20140710_binaries.tar";
//echo '<tr></tr><tr></tr><tr><tr></tr><tr></tr><tr><tr></tr><tr></tr><tr>';
//echo ' <tr>
//<th >Download binaries from OHWR <FORM method="POST" onsubmit="return confirm("Are you sure you want to upload and flash a new firmware?");"></th>
......@@ -49,7 +49,7 @@
//<INPUT type=submit value="Download&Flash Firmware from OHWR" class="btn" ></th>
//</FORM>
//</tr>';
?>
</table>
<div id="bottommsg">
......@@ -59,9 +59,8 @@
</p>
<hr>
</div>
<?php
<?php
wrs_management();
?>
......
......@@ -5,9 +5,9 @@
<link href="css/help.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFD100">
<h1><center>Help</center></h1>
<h1><center>Help</center></h1>
<hr>
<?php
wrs_display_help($_GET['help_id'],"");
?>
......
......@@ -20,7 +20,7 @@
<?php
wrs_main_info();
wrs_main_info();
?>
......
......@@ -20,8 +20,8 @@
<?php session_is_started() ?>
<table border="0" align="center">
<table border="0" align="center">
<tr>
<th><FORM method="POST" ENCTYPE="multipart/form-data" onsubmit="return confirm('Are you sure you want to upload a new FPGA binary file? \nThis could result in the malfunction of the switch.');">
<INPUT type=file name="fpgafile" >
......@@ -37,33 +37,33 @@
</FORM></th>
</tr>
</table>
<!--
<br><br><br><center>Max. filesize is now <?php //echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
<br><br><br><center>Max. filesize is now <?php //echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
?></center>
<table border="0" align="center">
<table border="0" align="center">
<tr>
<form align="center" method="post">
<th>New PHP Filesize: </th><th><INPUT type="text" name="size" > </th>
<th><input type="submit" value="Change" class="btn"></th>
</tr>
</form>
</table>
-->
-->
<div id="bottommsg">
<center>
*NOTE: After loading a FPGA or lm32 binary the switch will reboot.
</center>
</div>
<?
<?
wrs_load_files();
?>
</div>
</div>
......
......@@ -23,22 +23,22 @@
$message="";
if(count($_POST)>0) {
//If /etc/phpusers does not exist we create the file and "admin" "" user&pass
if (!file_exists($GLOBALS['phpusersfile'])) {
$username = "admin";
$password = "";
$salt="wrs4.0salt";
$pass = $password;
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
$output= $username." ".$hash_md5_double."\n";
$file = fopen($GLOBALS['phpusersfile'],"w+");
fwrite($file,$output);
fclose($file);
}
$username = $_POST["login"];
$password = $_POST["password"];
$saved_hash = shell_exec("cat ".$GLOBALS['phpusersfile']." | grep '".$username."' | awk '{print $2}'");
......@@ -46,27 +46,24 @@
$saved_user = preg_replace('/\s+/', '', $saved_user);
$saved_hash = str_replace("\n","",$saved_hash);
$user_exists = shell_exec("cat ".$GLOBALS['phpusersfile']." | grep -c ".$username);
$salt="wrs4.0salt";
$pass = $password;
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
$hash = md5($pass); // md5 hash #1
$hash_md5 = md5($salt.$pass); // md5 hash with salt #2
$hash_md5_double = md5(sha1($salt.$pass)); // md5 hash with salt & sha1 #3
if (!strcmp($hash_md5_double,$saved_hash) && $user_exists>0 && (strcmp($saved_user, $username) == 0)){
session_start();
session_start();
$_SESSION["myusername"] = $username;
echo 'Logged in as '.$_SESSION["myusername"];
header('Location: index.php');
}else{
echo 'Invalid Username or Password';
}
}
?>
......
......@@ -19,21 +19,20 @@
<h1 class="title">System Logs <a href='help.php?help_id=logs' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
$infoname = "System Logs";
$format = "table";
$section = "WRS_FORMS";
$subsection = "SYSTEM_LOGS";
print_form($section, $subsection, $formatID, $class, $infoname, $format);
$modified = process_form($section, $subsection);
if($modified){
check_add_existing_kconfig("CONFIG_WRS_LOG_WRSWATCHDOG=");
check_add_existing_kconfig("CONFIG_WRS_LOG_MONIT=");
......
......@@ -23,7 +23,7 @@
<center>
<table border="0" align="center">
<table border="0" align="center">
<tr>
<form method="post">
<th>Reboot system: </th>
......@@ -37,7 +37,7 @@
<form method="post">
<th align=left>Net-SNMP Server: </th>
<input type="hidden" name="cmd" value="snmp">
<th><INPUT type="submit" STYLE="text-align:center;" value="<?php echo (check_snmp_status()) ? 'Disable SNMP' : 'Enable SNMP'; ?>" class="btn"></th>
<th><INPUT type="submit" STYLE="text-align:center;" value="<?php echo (check_snmp_status()) ? 'Disable SNMP' : 'Enable SNMP'; ?>" class="btn"></th>
</form>
</tr>
-->
......@@ -45,38 +45,45 @@
<form method="post">
<th align=left>System Monitor: </th>
<input type="hidden" name="cmd" value="monit">
<th><INPUT type="submit" STYLE="text-align:center;" value="<?php echo (check_monit_status()) ? 'Disable Monitor' : 'Enable Monitor'; ?>" class="btn"></th>
<th><INPUT type="submit" STYLE="text-align:center;" value="<?php echo (check_monit_status()) ? 'Disable Monitor' : 'Enable Monitor'; ?>" class="btn"></th>
</form>
</tr>
</table>
<hr>
<br><br>
<center><p><strong>Load configuration files</strong></p></center>
<table class='altrowstable' id='alternatecolor' width="100%">
<tr>
<FORM method="POST" ENCTYPE="multipart/form-data">
<FORM method="POST" ENCTYPE="multipart/form-data" onsubmit="return confirm('Are you sure you want to upload a dotconfig file? \nThis could result in the malfunction of the switch.');">
<td ><INPUT type=file name="kconfig" ></td>
<td><INPUT type=submit value="Load dot-config" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></td>
</form>
</tr>
<tr>
<FORM method="POST" onsubmit="return confirm('Are you sure you want to set an URL for dotconfig? \nThis could result in the malfunction of the switch.');">
<td><INPUT type=text name="dotconfigURL" size="44%" VALUE= <?php echo $_SESSION['KCONFIG']['CONFIG_DOTCONF_URL'];?>></td>
<input type="hidden" name="cmd" value="kconfigURL">
<td><INPUT type=submit value="Load from URL" class="btn" ></td>
</form>
</tr>
<tr>
</table>
</center>
<br>
<FORM align="center" method="POST" ENCTYPE="multipart/form-data">
Backup configuration file to your computer</center>
<input type="hidden" name="cmd" value="Backup">
<INPUT type=submit value="Backup" class="btn" >
</form>
<div id="bottommsg">
<hr>
<p align="right">Click <A HREF="showfile.php?help_id=dotconfig" target="_blank">here</A> to display the current dotconfig file</p>
</div>
<?php
<?php
wrs_management();
?>
......
<ul>
<li><a href="index.php"> Dashboard </a></li>
<?php
<li><a href="index.php"> Dashboard </a></li>
<?php
//session_start();
if (!isset($_SESSION['myusername'])) {
......@@ -22,7 +20,7 @@ echo '<div class="login">
</form>
</div>';
}else{
//The rest of the menu for logged users
echo '<li><a href="network.php"> Network Setup </a></li>';
echo '<li><a href="ptp.php"> WR-PPSi Setup </a></li>';
......@@ -45,7 +43,7 @@ echo '<div class="login">
echo '</ul>';
}
echo '</ul><br><hr>';
echo '<b>User: <font color="blue"><a href="change_passwd.php">'.$_SESSION["myusername"].'</a> </font></b>';
echo '<a href="./logout.php">(logout)</a>';
}
......
......@@ -19,15 +19,15 @@
<h1 class="title"> Endpoint Mode Configuration <a href='help.php?help_id=dashboard' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php
$endpoint = intval($_GET["wr"]);
$endpoint = sprintf("%02s", $endpoint);
$endpoint = strval($endpoint);
$mode = $_GET["mode"];
switch ($mode) {
case "master":
$new_mode = "slave";
......@@ -41,17 +41,17 @@
case "non-wr":
$new_mode = "master";
}
$string = $_SESSION["KCONFIG"]["CONFIG_PORT".$endpoint."_PARAMS"];
$string = str_replace($mode,$new_mode,$string);
$_SESSION["KCONFIG"]["CONFIG_PORT".$endpoint."_PARAMS"] = $string;
save_kconfig();
apply_kconfig();
header('Location: endpointmode.php');
exit;
?>
<hr>
<FORM align="right" action="endpointmode.php" method="post">
......
......@@ -24,9 +24,9 @@
<?php
if((empty($_POST["networkgroup"]))){
echo '<FORM method="POST">
<table id="daemon" border="0" align="center">
<table id="daemon" border="0" align="center">
<tr>
<td align=left>eth0 Setup: </td>
<td><input type="radio" name="networkgroup" value="DHCPONLY"'; if(!strcmp(wrs_interface_setup(), "dhcponly")) echo "checked";
......@@ -35,21 +35,21 @@
echo ' > DHCP + Static<br>
<input type="radio" name="networkgroup" value="STATIC"'; if(!strcmp(wrs_interface_setup(), "static")) echo "checked";
echo ' > Static IP<br></td>
<td><INPUT type="submit" value="Change" class="btn"></td>
<td><INPUT type="submit" value="Change" class="btn"></td>
</tr>
</table>
</table>
</FORM>
<br>';
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
$infoname = "Current eth0";
$format = "table";
$section = "WRS_FORMS";
$subsection = "NETWORK_SETUP";
print_info($section, $subsection, $formatID, $class, $infoname, $format);
echo '<br>';
$formatID = "alternatecolor1";
$class = "altrowstable firstcol";
......@@ -57,18 +57,18 @@
$format = "table";
$section = "WRS_FORMS";
$subsection = "DNS_SETUP";
print_info($section, $subsection, $formatID, $class, $infoname, $format);
echo '<hr><p align="right">Click <A HREF="dns.php">here</A> to modify DNS configuration</p>';
}
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"DHCPONLY"))){
$_SESSION["KCONFIG"]["CONFIG_ETH0_DHCP"]="y";
check_add_existing_kconfig("CONFIG_ETH0_DHCP=");
delete_from_kconfig("CONFIG_ETH0_DHCP_ONCE=");
delete_from_kconfig("CONFIG_ETH0_STATIC=");
delete_from_kconfig("CONFIG_ETH0_IP=");
......@@ -79,29 +79,29 @@
save_kconfig();
apply_kconfig();
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
$infoname = "Current eth0";
$format = "table";
$section = "WRS_FORMS";
$subsection = "NETWORK_SETUP";
print_info($section, $subsection, $formatID, $class, $infoname, $format);
echo '<br><div id="alert"><center>"DHCP Only" is now set for eth0<br>
Changes will take place after reboot.</center></div>';
echo '<form action="reboot.php">
<INPUT style="float: right;" type="submit" value="Reboot Now" class="btn last">
</form>';
}
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"DHCPONCE"))){
echo '<p>Please enter the static setup in case DHCP fails: </p><br>';
echo '<FORM method="POST">
<table border="0" align="center" class="altrowstable" id="alternatecolor">
<table border="0" align="center" class="altrowstable" id="alternatecolor">
<tr>
<td>IP Address: </td>
<td><INPUT type="text" value="192.168.1.10" name="ip" ></td>
......@@ -127,12 +127,12 @@
<INPUT type="hidden" value="DHCPONCE" name="dhcp">
</FORM>';
}
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"STATIC"))){
echo '<FORM method="POST">
<table border="0" align="center" class="altrowstable" id="alternatecolor">
<table border="0" align="center" class="altrowstable" id="alternatecolor">
<tr>
<td>IP Address: </td>
<td><INPUT type="text" value="192.168.1.10" name="ip" ></td>
......@@ -156,69 +156,68 @@
</table>
<INPUT type="submit" value="Save New Configuration" class="btn last">
</FORM>';
}
if ((!empty($_POST["ip"])) && (!empty($_POST["netmask"])) && (!empty($_POST["broadcast"]))){
if (!empty($_POST["dhcp"])){
$_SESSION["KCONFIG"]["CONFIG_ETH0_DHCP_ONCE"]="y";
$_SESSION["KCONFIG"]["CONFIG_ETH0_IP"]=$_POST["ip"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_MASK"]=$_POST["netmask"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_NETWORK"]=$_POST["network"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_BROADCAST"]=$_POST["broadcast"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_GATEWAY"]=$_POST["gateway"];
check_add_existing_kconfig("CONFIG_ETH0_DHCP_ONCE=");
check_add_existing_kconfig("CONFIG_ETH0_IP=");
check_add_existing_kconfig("CONFIG_ETH0_MASK=");
check_add_existing_kconfig("CONFIG_ETH0_NETWORK=");
check_add_existing_kconfig("CONFIG_ETH0_BROADCAST=");
check_add_existing_kconfig("CONFIG_ETH0_GATEWAY=");
delete_from_kconfig("CONFIG_ETH0_DHCP=");
delete_from_kconfig("CONFIG_ETH0_STATIC=");
echo '<br><div id="alert"><center>"DHCP Once" is now set for eth0<br>
Changes will take place after reboot.</center></div>';
echo '<form action="reboot.php">
<INPUT style="float: right;" type="submit" value="Reboot Now" class="btn last">
</form>';
}else{
$_SESSION["KCONFIG"]["CONFIG_ETH0_STATIC"]="y";
$_SESSION["KCONFIG"]["CONFIG_ETH0_IP"]=$_POST["ip"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_MASK"]=$_POST["netmask"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_NETWORK"]=$_POST["network"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_BROADCAST"]=$_POST["broadcast"];
$_SESSION["KCONFIG"]["CONFIG_ETH0_GATEWAY"]=$_POST["gateway"];
check_add_existing_kconfig("CONFIG_ETH0_STATIC=");
check_add_existing_kconfig("CONFIG_ETH0_IP=");
check_add_existing_kconfig("CONFIG_ETH0_MASK=");
check_add_existing_kconfig("CONFIG_ETH0_NETWORK=");
check_add_existing_kconfig("CONFIG_ETH0_BROADCAST=");
check_add_existing_kconfig("CONFIG_ETH0_GATEWAY=");
delete_from_kconfig("CONFIG_ETH0_DHCP_ONCE=");
delete_from_kconfig("CONFIG_ETH0_DHCP=");
echo '<br><div id="alert"><center>"Static Only" is now set for eth0<br>
Changes will take place after reboot.</center></div>';
echo '<form action="reboot.php">
<INPUT style="float: right;" type="submit" value="Reboot Now" class="btn last">
</form>';
}
save_kconfig();
apply_kconfig();
}
?>
?>
</div>
......
......@@ -21,21 +21,17 @@
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
<?php
$vlan_cmd = "/wr/bin/wrs_vlans ";
if(!empty($_POST['vid'])){ $vlan_cmd .= " --rvid ".$_POST['vid'];}
if(!empty($_POST['fid'])){$vlan_cmd .= " --rfid ".$_POST['fid'];}
if(!empty($_POST['mask'])){$vlan_cmd .= " --rmask ".$_POST['mask'];}
if(!empty($_POST['drop'])){$vlan_cmd .= " --rdrop ".$_POST['drop'];}
if(!empty($_POST['prio'])){$vlan_cmd .= " --rprio ".$_POST['prio'];}
shell_exec($vlan_cmd);
header('Location: vlan.php');
?>
......
......@@ -16,13 +16,13 @@
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Port-VLAN Assigment <a href='help.php?help_id=vlanassignment' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<h1 class="title">Port-VLAN Assigment <a href='help.php?help_id=vlanassignment' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
// Get VLANS
echo '<center><strong>Port-VLAN List</strong></center><hr>';
$tmp_vlan_file="/tmp/vlans.conf";
......@@ -33,91 +33,86 @@
$counter = 0;
foreach($vlans as $line){
$counter++;
if($counter>=3 && !empty($line)){
$line = explode(" ", $line);
$name_vlans .= $line[1]." ";
}
}
$name_vlans = explode(" ", $name_vlans);
// Get Previous assignment
$tmp_assign_file="/tmp/port2vlan.conf";
$vlans_assignment = shell_exec("/wr/bin/wrs_vlans --elist >".$tmp_assign_file);
$vlans_assignment = shell_exec("cat ".$tmp_assign_file." | sed -n '/ /s/ \+/ /gp'");
$vlans_assignment = explode("\n", $vlans_assignment);
echo '<table align=center border="1" class="altrowstable" id="alternatecolor">';
echo '<tr class="sub" align=center><th>Endpoint</th><th>VLAN ID</th><th>Mode</font></th><th>Priority</th><th>Mask</th></tr>';
echo '<form method=POST>';
for($i = 0; $i < 18; $i++){
$single_line = explode(" ",$vlans_assignment[$i+1]); //info per endpoint line
echo '<tr>';
echo '<th><center><b>wr'.($i+1).'</b></center></th>';
//Show the Vlan option button
echo '<th>';
//echo '<select name=vlan'.($i).'>';
/*foreach($name_vlans as $vlan){
if(!empty($vlan[0])){
echo '<option class="btn" value="'.$vlan[0].$vlan[1].'"><center>ID'.$vlan[0].$vlan[1].'</center></option>';
}
if(!empty($vlan[0])){
echo '<option class="btn" value="'.$vlan[0].$vlan[1].'"><center>ID'.$vlan[0].$vlan[1].'</center></option>';
}
}*/
echo '<input STYLE="background-color:'.$vlancolor[$single_line[6]].';text-align:center;" size="5" type="text" value="'.$single_line[6].'" name="vlan'.($i).'">';
//echo '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>';
echo '<input STYLE="background-color:'.$vlancolor[$single_line[6]].';text-align:center;" size="5" type="text" value="'.$single_line[6].'" name="vlan'.($i).'">';
//echo '<option class="btn" selected="selected" value="disabled"><center>Disabled</center></option>';
//echo '</select>'; // end Vlan ID assignation
echo '</th>';
echo '<th>'; // Mode selection
echo '<select name=mode'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"0")) ? 'selected="selected"' : ''; echo ' value="0"><center>Access</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"1")) ? 'selected="selected"' : ''; echo ' value="1"><center>Trunk</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"2")) ? 'selected="selected"' : ''; echo ' value="2"><center>VLAN Disabled</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"3")) ? 'selected="selected"' : ''; echo ' value="3"><center>Unqualified port</center></option>';
echo '</select>'; // end mode
echo '<select name=mode'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"0")) ? 'selected="selected"' : ''; echo ' value="0"><center>Access</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"1")) ? 'selected="selected"' : ''; echo ' value="1"><center>Trunk</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"2")) ? 'selected="selected"' : ''; echo ' value="2"><center>VLAN Disabled</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[2],"3")) ? 'selected="selected"' : ''; echo ' value="3"><center>Unqualified port</center></option>';
echo '</select>'; // end mode
echo '</th>';
echo '<th>'; // Priority selection
echo '<select name=prio'.($i).'>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"0")) ? 'selected="selected"' : ''; echo 'value="0"><center>0</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"1")) ? 'selected="selected"' : ''; echo 'value="1"><center>1</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"2")) ? 'selected="selected"' : ''; echo 'value="2"><center>2</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"3")) ? 'selected="selected"' : ''; echo 'value="3"><center>3</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"4")) ? 'selected="selected"' : ''; echo 'value="4"><center>4</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"0")) ? 'selected="selected"' : ''; echo 'value="0"><center>0</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"1")) ? 'selected="selected"' : ''; echo 'value="1"><center>1</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"2")) ? 'selected="selected"' : ''; echo 'value="2"><center>2</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"3")) ? 'selected="selected"' : ''; echo 'value="3"><center>3</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"4")) ? 'selected="selected"' : ''; echo 'value="4"><center>4</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"5")) ? 'selected="selected"' : ''; echo 'value="5"><center>5</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"6")) ? 'selected="selected"' : ''; echo 'value="6"><center>6</center></option>';
echo '<option class="btn" '; echo (!strcmp($single_line[5],"7")) ? 'selected="selected"' : ''; echo 'value="7"><center>7</center></option>';
echo '</select>'; // end Priority
echo '</select>'; // end Priority
echo '</th>';
echo '<th align=center><INPUT type="text" size="8" name="mask'.$i.'" ></th>';
echo '</tr>';
}
echo '<tr><th></th><th></th><th></th><th></th><th align=center><input type="submit" value="Update" class="btn" name="updatevlan" ></th></tr>
</form>';
</form>';
echo '</table>';
echo '<br>'.$_POST['mode0'];
//Parse input and run the command
if (!empty($_POST['updatevlan'])){
$vlan_cmd= "/wr/bin/wrs_vlans ";
for($i = 0; $i < 18; $i++){
//if(strcmp($_POST['vlan'.$i],"disabled")){ //VLAN selected
$vlan_cmd .= " --ep ".$i;
......@@ -128,7 +123,7 @@
$output = shell_exec($vlan_cmd);
echo $vlan_cmd;
echo '<br><p><center>Port WR'.($i+1).' added to VLAN'.$_POST['vlan'.$i].'</center></p>';
//}else{
if(!strcmp($_POST['mode'.$i],"2")){ //Disable VLAN for endpoint
$vlan_cmd .= " --ep ".$i;
......@@ -136,16 +131,14 @@
$output = shell_exec($vlan_cmd);
echo '<br><p><center>VLAN removed for port WR'.($i+1).'</center></p>';
}
//}
$vlan_cmd= "/wr/bin/wrs_vlans ";
}
header('Location: vlan.php');
}
?>
<br><br><FORM align="right" method="POST" action="vlan.php" ENCTYPE="multipart/form-data">
<INPUT type=submit value="Go back" class="btn" >
......
......@@ -20,10 +20,10 @@
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<center>
<FORM method="POST">
<table id="mode" border="0" align="center">
<table id="mode" border="0" align="center">
<tr>
<td align=left><b>Switch Mode:</b></td>
<td><input type="radio" name="modegroup" value="GM" <?php if(!strcmp(check_switch_mode(), "GM")) echo "checked"; ?>
......@@ -32,14 +32,14 @@
> Boundary Clock <br>
<input type="radio" name="modegroup" value="FM"<?php if(!strcmp(check_switch_mode(), "FM")) echo "checked"; ?>
> Free-Running Master <br></td>
<td><INPUT type="submit" value="Change" class="btn"></td>
<td><INPUT type="submit" value="Change" class="btn"></td>
</tr>
</table>
</table>
</FORM>
<hr>
<table border="0" align="center">
<tr>
<form method="post" <?php if(!strcmp(check_switch_mode(), "BC"))
<form method="post" <?php if(!strcmp(check_switch_mode(), "BC"))
echo 'onsubmit="return confirm(\'Please notice that UTC time from a NTP Server is overriden by White-Rabbit for Boundary Clocks. Do you want to proceed?\');"'; ?> >
<th><center>NTP Server:</center></th><th><INPUT type="text" STYLE="text-align:center;" name="ntpip" value="<?php $str = check_ntp_server(); echo $str; ?>"> </th>
<th><input type="hidden" name="cmd" value="ntp">
......@@ -48,35 +48,34 @@
</tr>
</table>
<hr>
<?php
$PPSi_daemon = (wrs_check_ptp_status()) ? 'ENABLED' : 'DISABLED';
$PPSi_boot = ($_SESSION["KCONFIG"]["CONFIG_PPSI"]=="y") ? 'ENABLED' : 'DISABLED';
/* This code enables or disables PPSi, not shown at the moment.
* It might be something for the future
echo '
<FORM method="POST">
<table id="daemon" border="0" align="center">
<table id="daemon" border="0" align="center">
<tr>
<th align=center>PPSi Daemon: </th>
<input type="hidden" name="cmd" value="ppsiupdate">
<th><INPUT type="submit" value='.$PPSi_daemon.' class="btn"></th>
</tr>
</table>
</table>
</FORM>';
echo'
<FORM method="POST">
<table id="daemon" border="0" align="center">
<table id="daemon" border="0" align="center">
<tr>
<th align=center>PPSi @ Boot: </th>
<input type="hidden" name="cmd" value="ppsibootupdate">
<th><INPUT type="submit" value='.$PPSi_boot.' class="btn"></th>
<th><INPUT type="submit" value='.$PPSi_boot.' class="btn"></th>
</tr>
</table>
</table>
</FORM>';*/
$formatID = "alternatecolor";
$class = "altrowstable firstcol";
......@@ -84,19 +83,19 @@
$format = "table";
$section = "WRS_FORMS";
$subsection = "CONFIG_PPSI";
$_SESSION["WRS_FORMS"]["CONFIG_PPSI"][CONFIG_PPSI_00]["value"]=
shell_exec("cat /wr/etc/ppsi-pre.conf | grep clock-class | awk '{print $2}'");
$_SESSION["WRS_FORMS"]["CONFIG_PPSI"][CONFIG_PPSI_01]["value"]=
shell_exec("cat /wr/etc/ppsi-pre.conf | grep clock-accuracy | awk '{print $2}'");;
print_form($section, $subsection, $formatID, $class, $infoname, $format);
wrs_ptp_configuration();
wrs_management();
if ((!empty($_POST["modegroup"]))){
if (!strcmp(htmlspecialchars($_POST["modegroup"]),"GM")){
$_SESSION["KCONFIG"]["CONFIG_TIME_GM"]="y";
if(!empty($_SESSION["KCONFIG"]["CONFIG_TIME_BC"]))
......@@ -104,7 +103,7 @@
if(!empty($_SESSION["KCONFIG"]["CONFIG_TIME_FM"]))
$_SESSION["KCONFIG"]["CONFIG_TIME_FM"]="n";
}
if (!strcmp(htmlspecialchars($_POST["modegroup"]),"BC")){
$_SESSION["KCONFIG"]["CONFIG_TIME_BC"]="y";
if(!empty($_SESSION["KCONFIG"]["CONFIG_TIME_GM"]))
......@@ -112,7 +111,7 @@
if(!empty($_SESSION["KCONFIG"]["CONFIG_TIME_FM"]))
$_SESSION["KCONFIG"]["CONFIG_TIME_FM"]="n";
}
if (!strcmp(htmlspecialchars($_POST["modegroup"]),"FM")){
$_SESSION["KCONFIG"]["CONFIG_TIME_FM"]="y";
if(!empty($_SESSION["KCONFIG"]["CONFIG_TIME_GM"]))
......
......@@ -18,7 +18,7 @@
<div class="rightbody">
<?php session_is_started() ?>
<div id="rebootmsg">
<p align=center>
<img src="./img/loader.gif">
......@@ -26,16 +26,16 @@
<br>
<div id="rebootingtext" align=center>...Saving changes...</div>
</div>
<div id="rebooting"></div>
<div id="rebootwrlogo">
<br><br>
<img src="./img/ryanlerch_The_White_Rabbit.png">
<p align=right>Alice: How long is forever?
<p align=right>Alice: How long is forever?
<br>White Rabbit: Sometimes, just a nanosecond.</p>
</div>
</div>
</div>
......
......@@ -3,9 +3,9 @@
session_start();
ob_start();
session_is_started();
// This php file must be only called from reboot.php
if(!empty($_SERVER['HTTP_REFERER'])){
if(!empty($_SERVER['HTTP_REFERER'])){
shell_exec("reboot");
}else{
header('Location: index.php');
......
......@@ -21,10 +21,10 @@
<?php session_is_started() ?>
<br>
<?php
<?php
$formatID = "alternatecolor";
$class = "altrowstablesmall firstcol";
$infoname = "SFP Calibration";
......@@ -33,21 +33,21 @@
$vn = 0;
$vs = 0;
$counter = 0;
$header = array ("Vendor Name","Vendor Serial","Model", "tx", "rx", "wl_txrx");
$header = array ("Vendor Name","Vendor Serial","Model", "tx", "rx", "wl_txrx");
$matrix = array();
for($i = 0; $i < 10; $i++){
$sfp = intval($i);
$sfp = sprintf("%02s", $sfp);
$sfp = strval($sfp);
if(!empty($_SESSION["KCONFIG"]["CONFIG_SFP".$sfp."_PARAMS"])){
array_push($matrix, "key=CONFIG_SFP".$sfp."_PARAMS,".$_SESSION["KCONFIG"]["CONFIG_SFP".$sfp."_PARAMS"]);
$last = $i;
}
}
if(!empty($_GET["add"])){
/* look for first empty */
for($i = 0; $i < 10 && !$empty; $i++){
......@@ -59,16 +59,16 @@
$empty = 1;
}
}
if (!$empty){
echo "<div id='alert'><center>There is only space for 10 SFP configurations.</center></div><br>";
}
}
echo '<FORM method="POST">
<table border="0" align="center" class="'.$class.'" id="'.$formatID.'">';
if (!empty($infoname)) echo '<tr><th>'.$infoname.'</th></tr>';
// Printing fist line with column names.
if (!empty($header)){
echo "<tr class='sub'>";
......@@ -77,15 +77,15 @@
}
echo "</tr>";
}
$i = 0;
// Printing the content of the form.
// Printing the content of the form.
foreach ($matrix as $elements) {
echo "<tr>";
$element = explode(",",$elements);
for ($j = 0; $j < 7; $j++) {
$columns = explode("=",$element[$j]);
if($columns[0]=="key"){
echo '<INPUT type="hidden" value="'.$columns[1].'" name="key'.$i.'" >';
$sfp_number=$columns[1][11];
......@@ -114,7 +114,6 @@
if($columns[0]=="wl_txrx" ){
echo '<td align="center"><INPUT style="font-size: '.$font_size.';" size="'.($size-4).'" type="text" value="'.$columns[1].'" name="wl_txrx'.$i.'" ></td>';
}
}
echo '<td align="center"><a href="deletesfp.php?id='.$sfp_number.'"><img src="img/delete.png" title="Delete SFP"></a></td>';
echo "</tr>";
......@@ -123,14 +122,14 @@
$vn=0;
}
echo '</table>';
echo '<INPUT type="hidden" value="yes" name="update">';
echo '<INPUT type="submit" value="Save New Configuration" class="btn last">';
echo '</FORM>';
echo '<INPUT type="submit" value="Save New Configuration" class="btn last">';
echo '</FORM>';
$error = 0;
if (!empty($_POST["update"])){
for($j=0; $j<$i && !$error; $j++){
if(empty($_POST["pn".$j]) || empty($_POST["tx".$j]) || empty($_POST["tx".$j]) || empty($_POST["wl_txrx".$j])){
echo "<p>Model, Tx, Rx and WL_TXRX cannot be empty.</p>";
......@@ -153,28 +152,24 @@
$_SESSION["KCONFIG"][$_POST["key".$j]] .= empty($_POST["rx".$j]) ? "" : ",rx=".$_POST["rx".$j];
$_SESSION["KCONFIG"][$_POST["key".$j]] .= empty($_POST["wl_txrx".$j]) ? "" : ",wl_txrx=".$_POST["wl_txrx".$j];
}
}
if(!$error){
save_kconfig();
apply_kconfig();
header ('Location: sfpcalibration.php');
}
}
echo '<hr><div align="right">
<A HREF="sfpcalibration.php?add=y">
<img src="img/add.png" style="width:30px;height:30px;vertical-align:center">
<span style="">Add new SFP</span></A>
</div>';
?>
</div>
</div>
</div>
......
......@@ -4,9 +4,9 @@
<title></title>
</head>
<body >
<h1><center><?php echo $_GET['name'];?></center></h1>
<h1><center><?php echo $_GET['name'];?></center></h1>
<hr>
<?php
wrs_display_help($_GET['help_id'], $_GET['name']);
?>
......
......@@ -18,8 +18,8 @@
<div class="rightbody">
<h1 class="title">White-Rabbit Switch Console <a href='help.php?help_id=console' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started();
<?php session_is_started();
$hostname = $_SESSION['hostname'];
$ip = $_SESSION['ip'];
if(empty($hostname) || empty($ip)){
......@@ -28,49 +28,44 @@
$hostname = $_SESSION['hostname'];
$ip = $_SESSION['ip'];
}
echo '<FORM action="terminal.php" method="POST" accept-charset="UTF-8">
'.$hostname.'@'.$_SESSION["ip"].'$: <input type="text" name="cmd" autofocus="autofocus" autocomplete="off">
<input type="submit" value="Enter" class="btn">
</FORM>';
/*$path = shell_exec("echo $PATH");
if(substr_count($path , "/wr/bin")==0){
//$new_path = shell_exec("export PATH=/wr/bin:$PATH");
$path = htmlspecialchars(shell_exec("echo $PATH"));
echo "PATH=".$path;
}*/
// If pwd is empty, we go to the root directory
if(empty($_SESSION["pwd"])){$_SESSION["pwd"]="/";}
shell_exec("cd ".$_SESSION["pwd"]);
$cmd = htmlspecialchars($_POST["cmd"]);
// user is moving to another directory
$cmd_aux = $cmd;
if(substr_count($cmd_aux , "cd")>0){
//$cmd = " ls ";
// moving backwards
if(substr_count($cmd_aux , "cd ..")>0){
$back = explode("/", $_SESSION["pwd"]);
$size = count($back);
$_SESSION["pwd"] = str_replace("/".$back[$size-1],"",$_SESSION["pwd"]);
// moving forwards
}else{
$cmd_aux = explode(" ", $cmd_aux);
if(!strstr($cmd_aux[1][0],"/")){
if(file_exists($_SESSION["pwd"]."/".$cmd_aux[1])){
if (!strcmp($_SESSION["pwd"], "/")){
......@@ -78,52 +73,47 @@
}else{
$_SESSION["pwd"].= "/".$cmd_aux[1];
}
}else{
$output = "folder not found";
}
}else{
if(file_exists($cmd_aux[1])){
$_SESSION["pwd"] = $cmd_aux[1];
}else{
$output = "folder not found";
}
}
}
}else{
}
$path = "PATH=/sbin:/usr/sbin:/bin:/usr/bin:/wr/bin";
if(strstr($output,"folder not found")){
$output = 'folder "'.$cmd_aux[1].'" not found';
$cmd = "";
}else{
$output = shell_exec( $path." ; cd ".$_SESSION["pwd"]." ; ".$cmd);
}
//Format output
$output=str_replace("\n","<br>",$output);
echo '<div align="center"> <div id="preview" style= "BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 0px;
BORDER-TOP: #000 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; WORD-SPACING: 1px; OVERFLOW: scroll;
BORDER-LEFT: #000 1px solid; WIDTH: 100%; PADDING-TOP: 1px;
BORDER-BOTTOM: #000 2px solid; HEIGHT: 350px; TEXT-ALIGN: left">
echo '<div align="center"> <div id="preview" style= "BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 0px;
BORDER-TOP: #000 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; WORD-SPACING: 1px; OVERFLOW: scroll;
BORDER-LEFT: #000 1px solid; WIDTH: 100%; PADDING-TOP: 1px;
BORDER-BOTTOM: #000 2px solid; HEIGHT: 350px; TEXT-ALIGN: left">
<p>'.$hostname.'@'.$ip.':'.$_SESSION["pwd"].'$ '.$cmd.'<br>'.$output.'</p> </div></div>';
?>
......
......@@ -16,10 +16,9 @@ echo '<ul>
<li '.echoSelectedClassIfRequestMatches("endpointmode").'><a href="endpointmode.php"> Endpoint Mode</a></li>
<li '.echoSelectedClassIfRequestMatches("management").'><a href="management.php"> Switch Management </a></li>
<li '.echoSelectedClassIfRequestMatches("contact").'><a href="contact.php"> About </a></li>
</ul>';
}
?>
......@@ -20,34 +20,32 @@
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php
echo '<center><strong>Existing VLANs</strong></center><hr>';
$tmp_vlan_file="/tmp/vlans.conf";
$vlans = shell_exec("/wr/bin/wrs_vlans --list >".$tmp_vlan_file);
$vlans = shell_exec("cat ".$tmp_vlan_file." | sed -n '/ /s/ \+/ /gp'");
$vlans = explode("\n", $vlans);
echo '<table class="altrowstable firstcol" id="alternatecolor" width="100%">';
echo '<tr class="sub" align=center><th>Vlan ID</th><th>FID</th><th>Ports</th><th>Drop?</th><th>Priority</th><th>Action</th></tr>';
$counter = 0;
foreach($vlans as $line){
$counter++;
if($counter>=2 && !empty($line)){
$line = explode(" ", $line);
if(strcmp($line[3],"0x")){
echo '<tr align=center><td bgcolor="'.$vlancolor[$line[1]].'">VLAN '.$line[1].'</td><td>'.$line[2].'</td><td>'.parse_mask2ports($line[3]).'</td><td>'.$line[4].'</td><td>'.$line[5].'</td><td><A HREF="delvlan.php?vlan='.$line[1].'.">Delete</A></td></tr>';
}else{
echo '<tr align=center><td>'.$line[1].'</td><td>'.$line[2].'</td><td>'.parse_mask2ports($line[3].$line[4]).'</td><td>'.$line[5].'</td><td>'.$line[6].'</td><td><A HREF="delvlan.php?vlan='.$line[1].'.">Delete</A></td></tr>';
}
}
}
//Form for a new one:
echo '<tr align=center>
......@@ -79,44 +77,39 @@
</tr>';
echo '</table>';
?>
<br><p align="right"><A HREF="delvlan.php?vlan=all" onclick="return confirm('You are deleting all VLANs, are you sure?')">Delete All VLANs</A></p>
<?php
//Display Port2Vlan assignment
echo '<br><br>';
echo '<center><strong>Port2Vlan assignments</strong></center><hr>';
echo '<table class="altrowstable firstcol" id="alternatecolor1" width="100%">';
echo '<tr><th>Port</strong></th><th>QMode</th><th>Priority</th><th>VLAN ID</th><th>MAC Address</th></tr>';
$tmp_vlan_file="/tmp/port2vlan.conf";
$vlans = shell_exec("/wr/bin/wrs_vlans --elist >".$tmp_vlan_file);
$vlans = shell_exec("cat ".$tmp_vlan_file." | sed -n '/ /s/ \+/ /gp'");
$vlans = explode("\n", $vlans);
$counter = 0;
foreach($vlans as $line){
$counter++;
if($counter>=2 && !empty($line)){
$line = explode(" ", $line);
echo '<tr align=center><td>WR'.($line[1]+1).'</td><td>'.$line[2]." (".$line[3].')</td><td>'.($line[5]).'</td><td bgcolor="'.$vlancolor[$line[6]].'">VLAN '.$line[6].'</td><td>'.$line[7].'</td></td></tr>';
}
}
echo '<tr><td></td><td></td><td></td><td></td><td align=center><FORM method="POST" action="port2vlan.php"><INPUT type=submit align=center value="Edit Table" class="btn"></form></td></tr>';
echo '</table>';
?>
<div id="bottommsg"><hr><p align="right"><A HREF="port2vlan.php">Assign Ports to VLANs</A></p></div>
<div id="bottommsg"><hr><p align="right"><A HREF="port2vlan.php">Assign Ports to VLANs</A></p></div>
</div>
</div>
......
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