diff options
author | Phil Davis <phil.davis@inf.org> | 2015-05-24 11:08:55 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-05-24 11:08:55 +0545 |
commit | 5fcc3079bb0f540f252477dbe26a09d0f0f712c6 (patch) | |
tree | 4939c846a2c3e53dc4ac701b7396ec0681b241f2 /usr/local/www/services_captiveportal_mac_edit.php | |
parent | 88cbd0049b78bd731648be68c13e08161e5e943c (diff) | |
download | pfsense-5fcc3079bb0f540f252477dbe26a09d0f0f712c6.zip pfsense-5fcc3079bb0f540f252477dbe26a09d0f0f712c6.tar.gz |
Code style www services captive portal
Diffstat (limited to 'usr/local/www/services_captiveportal_mac_edit.php')
-rw-r--r-- | usr/local/www/services_captiveportal_mac_edit.php | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/usr/local/www/services_captiveportal_mac_edit.php b/usr/local/www/services_captiveportal_mac_edit.php index 50a28db..191c9bb 100644 --- a/usr/local/www/services_captiveportal_mac_edit.php +++ b/usr/local/www/services_captiveportal_mac_edit.php @@ -46,7 +46,7 @@ function passthrumacscmp($a, $b) { function passthrumacs_sort() { global $config, $cpzone; - usort($config['captiveportal'][$cpzone]['passthrumac'],"passthrumacscmp"); + usort($config['captiveportal'][$cpzone]['passthrumac'], "passthrumacscmp"); } require("guiconfig.inc"); @@ -58,29 +58,34 @@ require("captiveportal.inc"); global $cpzone; global $cpzoneid; -$pgtitle = array(gettext("Services"),gettext("Captive portal"),gettext("Edit MAC address rules")); +$pgtitle = array(gettext("Services"), gettext("Captive portal"), gettext("Edit MAC address rules")); $shortcut_section = "captiveportal"; $cpzone = $_GET['zone']; -if (isset($_POST['zone'])) +if (isset($_POST['zone'])) { $cpzone = $_POST['zone']; +} if (empty($cpzone) || empty($config['captiveportal'][$cpzone])) { header("Location: services_captiveportal_zones.php"); exit; } -if (!is_array($config['captiveportal'])) +if (!is_array($config['captiveportal'])) { $config['captiveportal'] = array(); +} $a_cp =& $config['captiveportal']; -if (is_numericint($_GET['id'])) +if (is_numericint($_GET['id'])) { $id = $_GET['id']; -if (isset($_POST['id']) && is_numericint($_POST['id'])) +} +if (isset($_POST['id']) && is_numericint($_POST['id'])) { $id = $_POST['id']; +} -if (!is_array($a_cp[$cpzone]['passthrumac'])) +if (!is_array($a_cp[$cpzone]['passthrumac'])) { $a_cp[$cpzone]['passthrumac'] = array(); +} $a_passthrumacs = &$a_cp[$cpzone]['passthrumac']; if (isset($id) && $a_passthrumacs[$id]) { @@ -118,16 +123,19 @@ if ($_POST) { $input_errors[] = sprintf("%s. [%s]", gettext("A valid MAC address must be specified"), $_POST['mac']); } } - if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) + if ($_POST['bw_up'] && !is_numeric($_POST['bw_up'])) { $input_errors[] = gettext("Upload speed needs to be an integer"); - if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) + } + if ($_POST['bw_down'] && !is_numeric($_POST['bw_down'])) { $input_errors[] = gettext("Download speed needs to be an integer"); + } foreach ($a_passthrumacs as $macent) { - if (isset($id) && ($a_passthrumacs[$id]) && ($a_passthrumacs[$id] === $macent)) + if (isset($id) && ($a_passthrumacs[$id]) && ($a_passthrumacs[$id] === $macent)) { continue; + } - if ($macent['mac'] == $_POST['mac']){ + if ($macent['mac'] == $_POST['mac']) { $input_errors[] = sprintf("[%s] %s.", $_POST['mac'], gettext("already exists")); break; } @@ -137,12 +145,15 @@ if ($_POST) { $mac = array(); $mac['action'] = $_POST['action']; $mac['mac'] = $_POST['mac']; - if ($_POST['bw_up']) + if ($_POST['bw_up']) { $mac['bw_up'] = $_POST['bw_up']; - if ($_POST['bw_down']) + } + if ($_POST['bw_down']) { $mac['bw_down'] = $_POST['bw_down']; - if ($_POST['username']) + } + if ($_POST['username']) { $mac['username'] = $_POST['username']; + } $mac['descr'] = $_POST['descr']; @@ -208,11 +219,12 @@ include("head.inc"); <?php $ip = getenv('REMOTE_ADDR'); $mac = `/usr/sbin/arp -an | grep {$ip} | cut -d" " -f4`; - $mac = str_replace("\n","",$mac); + $mac = str_replace("\n", "", $mac); ?> <a onclick="document.forms[0].mac.value='<?=$mac?>';" href="#"><?=gettext("Copy my MAC address");?></a> <br /> - <span class="vexpl"><?=gettext("MAC address (6 hex octets separated by colons)"); ?></span></td> + <span class="vexpl"><?=gettext("MAC address (6 hex octets separated by colons)"); ?></span> + </td> </tr> <tr> <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td> |