2019-08-19 01:38:41 +02:00
< div class = " row " >
2019-08-19 01:51:26 +02:00
< div class = " col-lg-12 " >
2021-03-07 18:36:48 +01:00
< div class = " card " >
< div class = " card-header " >
< div class = " row " >
< div class = " col " >
< i class = " fas fa-network-wired mr-2 " ></ i >< ? php echo _ ( " Networking " ); ?>
</ div >
</ div ><!-- ./ row -->
</ div ><!-- ./ card - header -->
2019-10-13 00:04:27 +02:00
< div class = " card-body " >
2019-08-19 01:38:41 +02:00
< div id = " msgNetworking " ></ div >
2019-08-19 01:51:26 +02:00
< ul class = " nav nav-tabs " >
2019-10-14 22:57:29 +02:00
< li role = " presentation " class = " nav-item " >< a class = " nav-link active " href = " #summary " aria - controls = " summary " role = " tab " data - toggle = " tab " >< ? php echo _ ( " Summary " ); ?> </a></li>
2021-03-07 18:36:48 +01:00
< ? php if ( ! $bridgedEnabled ) : // no interface details when bridged ?>
2021-04-15 10:05:01 +02:00
< li role = " presentation " class = " nav-item " >< a class = " nav-link " href = " #netdevices " aria - controls = " netdevices " role = " tab " data - toggle = " tab " >< ? php echo _ ( " Network Devices " ); ?> </a></li>
< li role = " presentation " class = " nav-item " >< a class = " nav-link " href = " #mobiledata " aria - controls = " mobiledata " role = " tab " data - toggle = " tab " >< ? php echo _ ( " Mobile Data Settings " ); ?> </a></li>
2021-03-07 18:36:48 +01:00
< ? php endif ?>
2019-08-19 01:51:26 +02:00
</ ul >
< div class = " tab-content " >
2020-06-25 16:56:53 +02:00
< div role = " tabpanel " class = " tab-pane active " id = " summary " >
2020-06-25 16:00:41 +02:00
< h4 class = " mt-3 " >< ? php echo _ ( " Internet connection " ); ?> </h4>
< div class = " row " >
2021-04-22 17:35:14 +02:00
< div class = " col-sm-12 " >
< div class = " table-responsive " >
< table class = " table " >
< thead >
< tr >
< th >< ? php echo _ ( " Interface " ); ?> </th>
< th >< ? php echo _ ( " IP Address " ); ?> </th>
< th >< ? php echo _ ( " Gateway " ); ?> </th>
< th colspan = " 2 " >< ? php echo _ ( " Internet Access " ); ?> </th>
</ tr >
</ thead >
< tbody >
< ? php if ( isset ( $routeInfo [ " error " ]) || empty ( $routeInfo )) : ?>
< tr >< td colspan = 5 > No route to the internet found </ td ></ tr >
< ? php else : ?>
< ? php foreach ( $routeInfo as $route ) : ?>
< tr >
< td >< ? php echo $route [ 'interface' ] ?> </td>
< td >< ? php echo $route [ 'ip-address' ] ?> </td>
< td >< ? php echo $route [ 'gateway' ] ?> <br><?php $route['gw-name'] ?></td>
< td >
< p class = " m-0 " >
< i class = " fas <?php echo $route["access-ip"] ? " fa - check " : " fa - times " ; ?> " ></ i > < ? php echo RASPI_ACCESS_CHECK_IP ?>
</ p >
< p class = " m-0 " >
< i class = " fas <?php echo $route["access-dns"] ? " fa - check " : " fa - times " ; ?> " ></ i > < ? php echo RASPI_ACCESS_CHECK_DNS ?>
</ p >
</ td >
</ tr >
< ? php endforeach ?>
< ? php endif ?>
</ tbody >
</ table >
2020-06-25 16:00:41 +02:00
</ div >
</ div >
</ div >
2019-10-14 22:57:29 +02:00
< h4 class = " mt-3 " >< ? php echo _ ( " Current settings " ) ?> </h4>
2019-08-19 01:51:26 +02:00
< div class = " row " >
2021-04-22 17:35:14 +02:00
< ? php if ( ! $bridgedEnabled ) : // No interface details when bridged ?>
< ? php foreach ( $interfaces as $if ) : ?>
< ? php $if_quoted = htmlspecialchars ( $if , ENT_QUOTES ) ?>
2021-04-22 17:51:10 +02:00
< div class = " col-md mb-3 " >
< div class = " card h-100 w-100 " >
2021-04-22 17:35:14 +02:00
< div class = " card-header " >< ? php echo $if_quoted ?> </div>
< div class = " card-body " >
< pre class = " unstyled " id = " <?php echo $if_quoted ?>-summary " ></ pre >
</ div >
</ div >
2019-08-19 01:51:26 +02:00
</ div >
2021-04-22 17:35:14 +02:00
< ? php endforeach ?>
< ? php endif ?>
2019-08-19 01:51:26 +02:00
</ div ><!-- /. row -->
2021-04-22 17:35:59 +02:00
< button type = " button " onClick = " window.location.reload(); " class = " btn btn-outline btn-primary " >< i class = " fas fa-sync-alt " ></ i > < ? php echo _ ( " Refresh " ) ?> </a>
2021-03-07 18:36:48 +01:00
</ div >
2021-05-21 14:57:14 +02:00
< ? php $arrMD = file_exists (( $f = RASPI_MOBILEDATA_CONFIG )) ? parse_ini_file ( $f ) : false ;
2021-03-07 18:36:48 +01:00
if ( $arrMD == false ) { $arrMD = []; $arrMD [ " pin " ] = $arrMD [ " apn " ] = $arrMD [ " apn_user " ] = $arrMD [ " apn_pw " ] = $arrMD [ " router_user " ] = $arrMD [ " router_pw " ] = " " ; }
?>
< div role = " tabpanel " class = " tab-pane fade in " id = " netdevices " >
< h4 class = " mt-3 " >< ? php echo _ ( " Properties of network devices " ) ?> </h4>
< div class = " row " >
< div class = " col-sm-12 " >
< div class = " card " >
< div class = " card-body " >
< form id = " frm-netdevices " >
< ? php echo CSRFTokenFieldTag () ?>
< div class = " table-responsive " >
< table class = " table table-hover " >
< thead >
< tr >
< th >< ? php echo _ ( " Device " ); ?> </th>
< th >< ? php echo _ ( " Interface " ); ?> </th>
< th ></ th >
< th >< ? php echo _ ( " MAC " ); ?> </th>
< th >< ? php echo _ ( " USB vid/pid " ); ?> </th>
< th >< ? php echo _ ( " Device type " ); ?> </th>
< th style = " min-width:6em " >< ? php echo _ ( " Fixed name " ); ?> </th>
< th ></ th >
</ tr >
</ thead >
< tbody >
< ? php
if ( ! empty ( $clients )) {
$ncl = $clients [ " clients " ];
if ( $ncl > 0 ) {
foreach ( $clients [ " device " ] as $id => $dev ) {
echo " <tr> " ;
echo " <td> " . $dev [ " vendor " ] . " " . $dev [ " model " ] . " </td> \n " ;
echo " <td> " . $dev [ " name " ] . " </td> \n " ;
$ty = " Client " ;
if ( isset ( $dev [ " isAP " ]) && $dev [ " isAP " ]) $ty = " Access Point " ;
echo " <td> " . $ty . " </td> \n " ;
echo " <td> " . $dev [ " mac " ] . " </td> \n " ;
2021-03-20 10:24:19 +01:00
if ( isset ( $dev [ " vid " ]) && ! empty ( $dev [ " vid " ])) echo " <td> " . $dev [ " vid " ] . " / " . $dev [ " pid " ] . " </td> \n " ;
else echo " <td> - </td> \n " ;
2021-03-07 18:36:48 +01:00
$udevfile = $_SESSION [ " udevrules " ][ " udev_rules_file " ];
$isStatic = array ();
exec ( 'find /etc/udev/rules.d/ -type f \( -iname "*.rules" ! -iname "' . basename ( $udevfile ) . '" \) -exec grep -i ' . $dev [ " mac " ] . ' {} \; ' , $isStatic );
if ( empty ( $isStatic ))
exec ( 'find /etc/udev/rules.d/ -type f \( -iname "*.rules" ! -iname "' . basename ( $udevfile ) . '" \) -exec grep -i ' . $dev [ " vid " ] . ' {} \; | grep -i ' . $dev [ " pid " ] . ' ' , $isStatic );
$isStatic = empty ( $isStatic ) ? false : true ;
$devname = array ();
exec ( 'grep -i ' . $dev [ " vid " ] . ' ' . $udevfile . ' | grep -i ' . $dev [ " pid " ] . ' | sed -rn \'s/.*name=\"(\w*)\".*/\1/ip\' ' , $devname );
if ( ! empty ( $devname )) $devname = $devname [ 0 ];
else {
exec ( 'grep -i ' . $dev [ " mac " ] . ' ' . $udevfile . ' | sed -rn \'s/.*name=\"(\w*)\".*/\1/ip\' ' , $devname );
if ( ! empty ( $devname )) $devname = $devname [ 0 ];
}
if ( empty ( $devname )) $devname = " " ;
2021-03-27 17:43:15 +01:00
$isStatic = $isStatic || in_array ( $dev [ " type " ], array ( " ppp " , " tun " ));
2021-03-07 18:36:48 +01:00
$txtdisabled = $isStatic ? " disabled " : " " ;
2021-03-27 20:34:35 +01:00
echo '<td><select ' . $txtdisabled . ' class="selectpicker form-control" id="int-new-type-' . $dev [ " name " ] . '">' ;
2021-03-07 18:36:48 +01:00
foreach ( $_SESSION [ " net-device-types " ] as $i => $type ) {
$txt = $_SESSION [ " net-device-types-info " ][ $i ];
2021-03-27 17:43:15 +01:00
$txtdisabled = in_array ( $type , array ( " ppp " , " tun " )) ? " disabled " : " " ;
2021-03-29 15:16:23 +02:00
if ( preg_match ( " /^ " . $_SESSION [ " net-device-name-prefix " ][ $i ] . " .* $ / " , $dev [ " type " ]) === 1 ) echo '<option ' . $txtdisabled . ' selected value="' . $type . '">' . $txt . '</option>' ;
2021-03-07 18:36:48 +01:00
else echo '<option ' . $txtdisabled . ' value="' . $type . '">' . $txt . '</option>' ;
}
echo " </select></td> " ;
echo '<td>' ;
if ( ! $isStatic ) echo '<input type="text" class="form-control" id="int-name-' . $dev [ " name " ] . '" value="' . $devname . '" >' . " \n " ;
else echo $dev [ " name " ];
echo '<input type="hidden" class="form-control" id="int-vid-' . $dev [ " name " ] . '" value="' . $dev [ " vid " ] . '" >' . " \n " ;
echo '<input type="hidden" class="form-control" id="int-pid-' . $dev [ " name " ] . '" value="' . $dev [ " pid " ] . '" >' . " \n " ;
echo '<input type="hidden" class="form-control" id="int-mac-' . $dev [ " name " ] . '" value="' . $dev [ " mac " ] . '" >' . " \n " ;
echo '<input type="hidden" class="form-control" id="int-type-' . $dev [ " name " ] . '" value="' . $dev [ " type " ] . '" >' . " \n " ;
echo '</td>' . " \n " ;
echo '<td>' ;
2021-04-16 14:42:51 +02:00
if ( ! $isStatic ) echo '<a href="#" class="btn btn-secondary intsave" data-opts="' . $dev [ " name " ] . '" data-int="netdevices">' . _ ( " Change " ) . '</a>' ;
2021-03-07 18:36:48 +01:00
echo " </td> \n " ;
echo " </tr> \n " ;
}
}
} else echo " <tr><td colspan=4>No network devices found</td></tr> " ;
?>
</ tbody >
</ table >
</ div >
</ form >
</ div >
</ div >
</ div >
2021-02-02 13:26:14 +01:00
</ div >
2021-03-07 18:36:48 +01:00
</ div ><!-- /. tab - panel -->
2021-03-10 23:45:04 +01:00
< div role = " tabpanel " class = " tab-pane fade in " id = " mobiledata " >
< div class = " row " >
< div class = " col-lg-6 " >
< h4 class = " mt-3 " >< ? php echo _ ( " Settings for Mobile Data Devices " ) ?> </h4>
< hr />
< form id = " frm-mobiledata " >
< ? php echo CSRFTokenFieldTag () ?>
< div class = " form-group " >
< label for = " pin-mobile " >< ? php echo _ ( " PIN of SIM card " ) ?> </label>
< input type = " number " class = " form-control " id = " pin-mobile " placeholder = " 1234 " value = " <?php echo $arrMD["pin"] ?> " >
</ div >
< h4 class = " mt-3 " >< ? php echo _ ( " APN Settings (Modem device ppp0) " ) ?> </h4>
< div class = " form-group " >
< label for = " apn-mobile " >< ? php echo _ ( " Access Point Name (APN) " ) ?> </label>
< input type = " text " class = " form-control " id = " apn-mobile " placeholder = " web.myprovider.com " value = " <?php echo $arrMD["apn"] ?> " >
< label for = " apn-user-mobile " >< ? php echo _ ( " Username " ) ?> </label>
< input type = " text " class = " form-control " id = " apn-user-mobile " value = " <?php echo $arrMD["apn_user"] ?> " >
< label for = " apn-pw-mobile " >< ? php echo _ ( " Password " ) ?> </label>
< input type = " text " class = " form-control " id = " apn-pw-mobile " value = " <?php echo $arrMD["apn_pw"] ?> " >
</ div >
< a href = " # " class = " btn btn-outline btn-primary intsave " data - int = " mobiledata " >< ? php echo _ ( " Save settings " ) ?> </a>
</ form >
</ div >
</ div >
</ div ><!-- /. tab - panel -->
2021-02-02 13:26:14 +01:00
</ div >
2019-10-13 00:04:27 +02:00
</ div ><!-- /. card - body -->
2021-04-22 17:35:14 +02:00
2019-10-13 00:04:27 +02:00
< div class = " card-footer " >< ? php echo _ ( " Information provided by /sys/class/net " ); ?> </div>
</ div ><!-- /. card -->
2019-08-19 01:38:41 +02:00
</ div ><!-- /. col - lg - 12 -->
2021-02-02 13:26:14 +01:00
</ div ><!-- /. row -->