mirror of
https://github.com/billz/raspap-webgui.git
synced 2025-03-01 10:31:47 +00:00
Processed with phpcs for PSR-2 coding standard
This commit is contained in:
@@ -5,19 +5,19 @@ require('../../includes/csrf.php');
|
||||
include_once('../../includes/config.php');
|
||||
include_once('../../includes/functions.php');
|
||||
|
||||
if(isset($_POST['generate'])) {
|
||||
$cnfNetworking = array_diff(scandir(RASPI_CONFIG_NETWORKING, 1),array('..','.','dhcpcd.conf'));
|
||||
$cnfNetworking = array_combine($cnfNetworking,$cnfNetworking);
|
||||
if (isset($_POST['generate'])) {
|
||||
$cnfNetworking = array_diff(scandir(RASPI_CONFIG_NETWORKING, 1), array('..','.','dhcpcd.conf'));
|
||||
$cnfNetworking = array_combine($cnfNetworking, $cnfNetworking);
|
||||
$strConfFile = "";
|
||||
foreach($cnfNetworking as $index=>$file) {
|
||||
if($index != "defaults") {
|
||||
foreach ($cnfNetworking as $index => $file) {
|
||||
if ($index != "defaults") {
|
||||
$cnfFile = parse_ini_file(RASPI_CONFIG_NETWORKING.'/'.$file, false, INI_SCANNER_RAW);
|
||||
if($cnfFile['static'] === 'true') {
|
||||
if ($cnfFile['static'] === 'true') {
|
||||
$strConfFile .= "interface ".$cnfFile['interface']."\n";
|
||||
$strConfFile .= "static ip_address=".$cnfFile['ip_address']."\n";
|
||||
$strConfFile .= "static routers=".$cnfFile['routers']."\n";
|
||||
$strConfFile .= "static domain_name_servers=".$cnfFile['domain_name_server']."\n";
|
||||
} elseif($cnfFile['static'] === 'false' && $cnfFile['failover'] === 'true') {
|
||||
} elseif ($cnfFile['static'] === 'false' && $cnfFile['failover'] === 'true') {
|
||||
$strConfFile .= "profile static_".$cnfFile['interface']."\n";
|
||||
$strConfFile .= "static ip_address=".$cnfFile['ip_address']."\n";
|
||||
$strConfFile .= "static routers=".$cnfFile['routers']."\n";
|
||||
@@ -32,7 +32,7 @@ if(isset($_POST['generate'])) {
|
||||
}
|
||||
}
|
||||
|
||||
if(file_put_contents(RASPI_CONFIG_NETWORKING.'/dhcpcd.conf',$strConfFile)) {
|
||||
if (file_put_contents(RASPI_CONFIG_NETWORKING.'/dhcpcd.conf', $strConfFile)) {
|
||||
exec('sudo /bin/cp /etc/raspap/networking/dhcpcd.conf /etc/dhcpcd.conf');
|
||||
$output = ['return'=>0,'output'=>'Settings successfully applied'];
|
||||
} else {
|
||||
@@ -40,5 +40,3 @@ if(isset($_POST['generate'])) {
|
||||
}
|
||||
echo json_encode($output);
|
||||
}
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user