diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md index b73270d7..db4e7e55 100644 --- a/ISSUE_TEMPLATE.md +++ b/ISSUE_TEMPLATE.md @@ -1,3 +1,6 @@ +### Before submitting an issue +The [FAQs](https://github.com/billz/raspap-webgui/wiki/FAQs) have answers to many common issues. Please check this before creating a new issue. + ### Subject of the issue Describe your issue here. diff --git a/README.md b/README.md index 604708ef..34b28953 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ ![](http://i.imgur.com/xeKD93p.png) -# `$ raspap-webgui` [![Release 1.3.1](https://img.shields.io/badge/Release-1.3.1-green.svg)](https://github.com/billz/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) +# `$ raspap-webgui` [![Release 1.3.1](https://img.shields.io/badge/Release-1.3.1-green.svg)](https://github.com/billz/raspap-webgui/releases) [![Awesome](https://awesome.re/badge.svg)](https://github.com/thibmaek/awesome-raspberry-pi) [![Beerpay](https://img.shields.io/beerpay/hashdog/scrapfy-chrome-extension.svg)](https://beerpay.io/billz/raspap-webgui) + A simple, responsive web interface to control wifi, hostapd and related services on the Raspberry Pi. This project was inspired by a [**blog post**](http://sirlagz.net/2013/02/06/script-web-configuration-page-for-raspberry-pi/) by SirLagz about using a web page rather than ssh to configure wifi and hostapd settings on the Raspberry Pi. I mostly just prettified the UI by wrapping it in [**SB Admin 2**](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2), a Bootstrap based admin theme. Since then, the project has evolved to include greater control over many aspects of a networked RPi, better security, authentication, a Quick Installer, support for themes and more. RaspAP has been featured on sites such as [Instructables](http://www.instructables.com/id/Raspberry-Pi-As-Completely-Wireless-Router/), [Adafruit](https://blog.adafruit.com/2016/06/24/raspap-wifi-configuration-portal-piday-raspberrypi-raspberry_pi/), [Raspberry Pi Weekly](https://www.raspberrypi.org/weekly/commander/) and [Awesome Raspberry Pi](https://project-awesome.org/thibmaek/awesome-raspberry-pi) and implemented in countless projects. diff --git a/includes/dhcp.php b/includes/dhcp.php index 0ffb096b..5c7752a1 100755 --- a/includes/dhcp.php +++ b/includes/dhcp.php @@ -29,7 +29,7 @@ function DisplayDHCPConfig() { $errors .= _('Invalid DHCP range end.').'
'.PHP_EOL; } - if (!ctype_digit($_POST['RangeLeaseTime'])) { + if (!ctype_digit($_POST['RangeLeaseTime']) && $_POST['RangeLeaseTimeUnits'] !== 'infinite') { $errors .= _('Invalid DHCP lease time, not a number.').'
'.PHP_EOL; } @@ -41,7 +41,12 @@ function DisplayDHCPConfig() { if (empty($errors)) { $config = 'interface='.$_POST['interface'].PHP_EOL. 'dhcp-range='.$_POST['RangeStart'].','.$_POST['RangeEnd']. - ',255.255.255.0,'.$_POST['RangeLeaseTime'].$_POST['RangeLeaseTimeUnits']; + ',255.255.255.0,'; + if ($_POST['RangeLeaseTimeUnits'] !== 'infinite') { + $config .= $_POST['RangeLeaseTime']; + } + + $config .= $_POST['RangeLeaseTimeUnits']; exec('echo "'.$config.'" > /tmp/dhcpddata', $temp); system('sudo cp /tmp/dhcpddata '.RASPI_DNSMASQ_CONFIG, $return); } else { @@ -107,25 +112,30 @@ function DisplayDHCPConfig() { $RangeStart = $arrRange[0]; $RangeEnd = $arrRange[1]; $RangeMask = $arrRange[2]; - preg_match( '/([0-9]*)([a-z])/i', $arrRange[3], $arrRangeLeaseTime ); + $leaseTime = $arrRange[3]; $hselected = ''; $mselected = ''; $dselected = ''; - - switch( $arrRangeLeaseTime[2] ) { - case 'h': - $hselected = ' selected="selected"'; - break; - case 'm': - $mselected = ' selected="selected"'; - break; - case 'd': - $dselected = ' selected="selected"'; - break; + $infiniteselected = ''; + preg_match( '/([0-9]*)([a-z])/i', $leaseTime, $arrRangeLeaseTime ); + if ($leaseTime === 'infinite') { + $infiniteselected = ' selected="selected"'; + } else { + switch( $arrRangeLeaseTime[2] ) { + case 'h': + $hselected = ' selected="selected"'; + break; + case 'm': + $mselected = ' selected="selected"'; + break; + case 'd': + $dselected = ' selected="selected"'; + break; + } } - ?> +?>
@@ -156,7 +166,7 @@ function DisplayDHCPConfig() { foreach( $interfaces as $inet ) { $select = ''; if( $inet === $conf['interface'] ) { - $select = ' selected="selected"'; // FIXED use xhtml valid attribute + $select = ' selected="selected"'; } echo '
diff --git a/includes/functions.php b/includes/functions.php index 8f835ab6..98a2d691 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -89,8 +89,13 @@ function isAssoc($arr) { * If $options is an associative array this should be the key * */ -function SelectorOptions($name, $options, $selected = null) { - echo '' , PHP_EOL; foreach ( $options as $opt => $label) { $select = ''; $key = isAssoc($options) ? $opt : $label; diff --git a/includes/hostapd.php b/includes/hostapd.php index c5a41bd3..20224812 100755 --- a/includes/hostapd.php +++ b/includes/hostapd.php @@ -6,22 +6,21 @@ include_once( 'includes/status_messages.php' ); * * */ -function DisplayHostAPDConfig(){ - +function DisplayHostAPDConfig() +{ $status = new StatusMessages(); $arrHostapdConf = parse_ini_file('/etc/raspap/hostapd.ini'); $arrConfig = array(); - $arrChannel = array('a','b','g'); - $arrSecurity = array( 1 => 'WPA', 2 => 'WPA2',3=> 'WPA+WPA2'); + $arr80211Standard = array('a','b','g','n'); + $arrSecurity = array(1 => 'WPA', 2 => 'WPA2', 3 => 'WPA+WPA2', 'none' => _("None")); $arrEncType = array('TKIP' => 'TKIP', 'CCMP' => 'CCMP', 'TKIP CCMP' => 'TKIP+CCMP'); exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); - if( isset($_POST['SaveHostAPDSettings']) ) { if (CSRFValidate()) { - SaveHostAPDConfig($arrSecurity, $arrEncType, $arrChannel, $interfaces, $status); + SaveHostAPDConfig($arrSecurity, $arrEncType, $arr80211Standard, $interfaces, $status); } else { error_log('CSRF violation'); } @@ -47,7 +46,7 @@ function DisplayHostAPDConfig(){ } } - exec( 'cat '. RASPI_HOSTAPD_CONFIG, $return ); + exec( 'cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig ); exec( 'pidof hostapd | wc -l', $hostapdstatus); if( $hostapdstatus[0] == 0 ) { @@ -56,9 +55,13 @@ function DisplayHostAPDConfig(){ $status->addMessage('HostAPD is running', 'success'); } - foreach( $return as $a ) { - if( $a[0] != "#" ) { - $arrLine = explode( "=",$a) ; + foreach( $hostapdconfig as $hostapdconfigline ) { + if (strlen($hostapdconfigline) === 0) { + continue; + } + + if ($hostapdconfigline[0] != "#" ) { + $arrLine = explode("=", $hostapdconfigline) ; $arrConfig[$arrLine[0]]=$arrLine[1]; } }; @@ -88,28 +91,55 @@ function DisplayHostAPDConfig(){
- +
- - + +
- - + +
- - + +
@@ -117,20 +147,20 @@ function DisplayHostAPDConfig(){

- - + +
- - + +
- - + +
@@ -153,25 +183,38 @@ function DisplayHostAPDConfig(){

-
- + /> +
+
+
+
+
+ + /> +
- + - @@ -424,7 +467,7 @@ if ($arrHostapdConf['LogEnable'] == 1) {