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

www: php filesize field removed - DHCP/Static IP added to main menu

- Php filesize field has been removed(user cannot change it).
		- Permanently set to 40M.
	- DHCP/Static IP is now accesible from the main menu.

minor format fixes
parent 286d76b1
......@@ -19,23 +19,17 @@
<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 session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
<?php $_SESSION['advance']="";?>
<table border="0" align="center">
<tr>
<form method="post">
<th>New PHP filesize: (<?php wrs_php_filesize();?>M) <INPUT type="text" name="size" ></th>
<input type="hidden" name="cmd" value="size">
<th><input type="submit" value="Change" class="btn"></th>
</form>
</tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><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>
<th><INPUT type=submit value="Flash Firmware" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE= <?php wrs_php_filesize();?>000></th>
<th><INPUT type=submit value="Flash Firmware" class="btn" ><INPUT type=hidden name=MAX_FILE_SIZE VALUE=<?php echo wrs_php_filesize();?>000></th>
</FORM>
</tr><tr></tr><tr></tr><tr>
<FORM method="POST" ENCTYPE="multipart/form-data" >
<th>Download a backup of the entire wrs</th>
<th align=center>Download a backup of the entire Switch</th>
<th><INPUT type=submit value="Backup Firmware" class="btn"><input type="hidden" name="cmd" value="backup-wrs"></th>
</FORM>
</tr>
......
......@@ -7,7 +7,8 @@ $ppsiconf="ppsi.conf";
$wrswhalconf="wrsw_hal.conf";
$sfpdatabaseconf="sfp_database.conf";
$wrdateconf="wr_date.conf";
$vlancolor = array("#27DE2A", "#B642A8", "#6E42B6", "#425DB6" , "#428DB6", "#42B6B4", "#42B68B", "#42B65F", "#82B642", "#B6AE42", "#B67E42");
$vlancolor = array("#27DE2A", "#B642A8", "#6E42B6", "#425DB6" , "#428DB6", "#4686B6", "#43B88B", "#42B65F", "#82B642", "#B6AE42", "#B67E42");
$MAX_PHP_FILESIZE = 40;
/*
* Displays the current status of each enpoint.
......@@ -100,6 +101,9 @@ function wrs_header_ports(){
*/
function wrs_main_info(){
//Changing php filesize in case it is necessary
if(wrs_php_filesize()<$MAX_PHP_FILESIZE){php_file_transfer_size($MAX_PHP_FILESIZE);}
if(empty($_SESSION["utc"])) $_SESSION["utc"]="UTC";
echo "<table border='1' align='center' class='altrowstabledash' id='alternatecolor'>";
......@@ -114,20 +118,20 @@ function wrs_main_info(){
echo '<tr><th align=center> <b><font color="darkblue">HW Address</font></b> </th><th><center>'; $mac = shell_exec("ifconfig eth0 | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'"); echo $mac; echo '</center></th></tr>';
//echo '<tr><th> <b>OS Release:</b> </th><th><center>'; $str = shell_exec("uname -r"); echo $str; echo '</center></th></tr>';
//echo '<tr><th> <b>OS name:</b> </th><th><center>'; $str = shell_exec("uname -s"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">OS Version</font></b> </th><th><center>'; $str = shell_exec("uname -r"); echo $str; $str = shell_exec("uname -v"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Kernel Version</font></b> </th><th><center>'; $str = shell_exec("uname -r"); echo $str; $str = shell_exec("uname -v"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Gateware Version</font></b> </th><th><center> '; $str = shell_exec("/wr/bin/shw_ver -g | grep version | awk '{ print $4}'");
echo '<tr><th align=center> <b><font color="darkblue">Firmware Version</font></b> </th><th><center> '; $str = shell_exec("/wr/bin/shw_ver | awk '{print $4}'");
echo '<a href="showfile.php?help_id=gateware&name=GateWare Info" onClick="showPopup(this.href);return(false);"</a>';
echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">PCB Version</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -p"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">FPGA</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -f"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Compiling Time</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -c"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Compiling Date</font></b> </th><th><center>'; $str = shell_exec("/wr/bin/shw_ver -c"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">White-Rabbit Date</font></b></th><th><center>'; $str = shell_exec("TZ=".$_SESSION['utc']." /wr/bin/wr_date get"); echo $str; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">PPSi</font></b> </th><th><center>'; echo wrs_check_ptp_status() ? '[<A HREF="ptp.php">on</A>]' : '[<A HREF="ptp.php">off</A>]'; echo '</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Net-SNMP Server</font></b> </th><th><center>'; echo check_snmp_status() ? '[on] ' : '[off] '; echo '&nbsp;&nbsp;ver. '; echo shell_exec("snmpd -v | grep version | awk '{print $3}'");
echo '( port '; $str = shell_exec("cat ".$GLOBALS['etcdir']."snmpd.conf | grep agent | cut -d: -f3 | awk '{print $1}'"); echo $str; echo ')'; echo " <a href='help.php?help_id=snmp' onClick='showPopup(this.href);return(false);'> [OIDs]</a></center></th></tr>";
echo '<tr><th align=center> <b><font color="darkblue">NTP Server</font></b> </th><th><center> <A HREF="management.php">'; $str = check_ntp_server(); echo $str; echo $_SESSION['utc']; echo '</A></center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">NTP Server</font></b> </th><th><center> <A HREF="management.php">'; $str = check_ntp_server(); echo $str; echo '</A> ['.$_SESSION['utc'].']</center></th></tr>';
echo '<tr><th align=center> <b><font color="darkblue">Max. Filesize Upload</font> </b></th><th><center>'; echo shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'"); echo '</center></th></tr>';
echo '</table>';
......@@ -224,6 +228,8 @@ function php_file_transfer_size($size){
// We remove the blank space
$size=trim($size);
wrs_change_wrfs("rw");
// We modify fist upload_max_filesize in php.ini
$prev_size = shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
$prev_size=trim($prev_size);
......@@ -235,6 +241,7 @@ function php_file_transfer_size($size){
$prev_size=trim($prev_size);
$cmd ="sed -i 's/post_max_size = ".$prev_size."/post_max_size = ".$size."M/g' /etc/php.ini";
shell_exec($cmd);
wrs_change_wrfs("ro");
//echo '<p align=center>File upload size changed to '.$size.'</p>';
}
......@@ -431,7 +438,7 @@ function wrs_php_filesize(){
$size=shell_exec("cat /etc/php.ini | grep upload_max_filesize | awk '{print $3}'");
$size=substr($size, 0, -2);
echo $size;
return $size;
}
......@@ -1049,7 +1056,6 @@ function wrs_display_help($help_id, $name){
} else if (!strcmp($help_id, "firmware")){
$message = "<p>Firmware features: <br>
- <b>PHP Filesize</b>: It changes the max. size of the files that can be uploaded to the switch (40 MegaBytes by default)<br>
- <b>Flash firmware</b>: It moves a binary file into the /tmp folder<br>
- <b>Backup firmware</b>: It downloads a copy of the entire WRS to your PC<br>
</p>";
......
......@@ -24,6 +24,7 @@ echo '<div class="login">
}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"> PPSi Setup </a></li>';
echo '<li><a href="endpointmode.php"> Endpoint Mode</a></li>';
echo '<li><a href="vlan.php"> VLAN Setup </a></li>';
......
......@@ -16,7 +16,7 @@
</div>
<div class="rightpanel">
<div class="rightbody">
<h1 class="title">Network Interface Setup <a href='help.php?help_id=network' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<h1 class="title">Network Management <a href='help.php?help_id=network' onClick='showPopup(this.href);return(false);'><img align=right src="./img/question.png"></a></h1>
<?php session_is_started() ?>
<?php $_SESSION['advance']=""; ?>
......@@ -39,9 +39,12 @@
if((empty($_POST["networkgroup"]))){
echo '<center>Current eth0 setup<br></center>';
echo '
<table border="0" align="center">
<table border="0" class="altrowstable" id="alternatecolor" align="center">
<tr>
<th><font color="blue">Current eth0</font></th>
</tr><tr></tr><tr></tr>
<tr>
<th align=left>IP Address: </th>
<th ><INPUT type="text" STYLE="text-align:center;" align="center" value="'.shell_exec("ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'").'" readonly name="ip" ></th>
......@@ -86,7 +89,7 @@
if ((!empty($_POST["networkgroup"])) && (!strcmp(htmlspecialchars($_POST["networkgroup"]),"Static"))){
//shell_exec('sed -i "s/iface eth0 inet dhcp/#iface eth0 inet dhcp/g" /etc/network/interfaces');
echo '<FORM method="POST">
<table border="0" align="center">
<table border="0" align="center" class="altrowstable" id="alternatecolor">
<tr>
<th align=left>IP Address: </th>
<th><INPUT STYLE="text-align:center;" type="text" value="192.168.1.10" name="ip" ></th>
......
......@@ -103,7 +103,7 @@
}
}
echo '<tr><th></th><th></th><th></th><th></th><th align=center><FORM method="POST" action="port2vlan.php"><INPUT type=submit align=center value="Edit Table" class="btn"></form></th></tr>';
echo '</table>';
?>
......
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