1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

fixed up dhcp template

This commit is contained in:
glaszig 2019-08-19 01:06:44 +01:00
parent b04661171a
commit df429064c6
2 changed files with 23 additions and 33 deletions

View File

@ -132,12 +132,16 @@ function DisplayDHCPConfig()
} }
} }
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces);
exec('cat ' . RASPI_DNSMASQ_LEASES, $leases);
echo renderTemplate("dhcp", compact( echo renderTemplate("dhcp", compact(
"status", "status",
"serviceStatus", "serviceStatus",
"RangeStart", "RangeEnd", "RangeStart", "RangeEnd",
"arrRangeLeaseTime", "arrRangeLeaseTime",
"mselected", "hselected", "dselected", "infiniteselected", "mselected", "hselected", "dselected", "infiniteselected",
"dnsmasq_state", "conf", "dhcpHost" "dnsmasq_state", "conf", "dhcpHost",
"interfaces", "leases"
)); ));
} }

View File

@ -26,19 +26,11 @@
<div class="form-group col-md-4"> <div class="form-group col-md-4">
<label for="code">Interface</label> <label for="code">Interface</label>
<select class="form-control" name="interface"> <select class="form-control" name="interface">
<?php <?php foreach ($interfaces as $if): ?>
exec("ip -o link show | awk -F': ' '{print $2}'", $interfaces); <?php $if_quoted = htmlspecialchars($if, ENT_QUOTES) ?>
<?php $selected = $if === $conf['interface'] ? ' selected="selected"' : '' ?>
foreach ($interfaces as $inet) { <option value="<?php echo $if_quoted ?>"<?php echo $selected ?>><?php echo $if_quoted ?></option>
$select = ''; <?php endforeach ?>
if ($inet === $conf['interface']) {
$select = ' selected="selected"';
}
echo ' <option value="'.htmlspecialchars($inet, ENT_QUOTES).'"'.
$select.'>'.htmlspecialchars($inet, ENT_QUOTES).'</option>' , PHP_EOL;
}
?>
</select> </select>
</div> </div>
</div> </div>
@ -73,14 +65,12 @@ $select.'>'.htmlspecialchars($inet, ENT_QUOTES).'</option>' , PHP_EOL;
</div> </div>
<input type="submit" class="btn btn-outline btn-primary" value="<?php echo _("Save settings"); ?>" name="savedhcpdsettings" /> <input type="submit" class="btn btn-outline btn-primary" value="<?php echo _("Save settings"); ?>" name="savedhcpdsettings" />
<?php
if ($dnsmasq_state) { <?php if ($dnsmasq_state): ?>
echo '<input type="submit" class="btn btn-warning" value="' . _("Stop dnsmasq") . '" name="stopdhcpd" />'; <input type="submit" class="btn btn-warning" value="<?php echo _("Stop dnsmasq") ?>" name="stopdhcpd" />
} else { <?php else: ?>
echo'<input type="submit" class="btn btn-success" value="' . _("Start dnsmasq") . '" name="startdhcpd" />'; <input type="submit" class="btn btn-success" value="<?php echo _("Start dnsmasq") ?>" name="startdhcpd" />
} <?php endif ?>
?>
</div><!-- /.tab-pane --> </div><!-- /.tab-pane -->
<div class="tab-pane fade in" id="client-list"> <div class="tab-pane fade in" id="client-list">
@ -103,17 +93,13 @@ if ($dnsmasq_state) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php foreach ($leases as $lease): ?>
exec('cat ' . RASPI_DNSMASQ_LEASES, $leases); <?php foreach (explode(' ', $lease) as $prop): ?>
foreach ($leases as $lease) { <tr>
echo ' <tr>'.PHP_EOL; <td><?php echo htmlspecialchars($prop, ENT_QUOTES) ?></td>
$lease_items = explode(' ', $lease); </tr>
foreach ($lease_items as $lease_item) { <?php endforeach ?>
echo ' <td>'.htmlspecialchars($lease_item, ENT_QUOTES).'</td>'.PHP_EOL; <?php endforeach ?>
}
echo ' </tr>'.PHP_EOL;
};
?>
</tbody> </tbody>
</table> </table>
</div><!-- /.table-responsive --> </div><!-- /.table-responsive -->