diff options
author | Phil Davis <phil.davis@inf.org> | 2015-12-17 16:38:25 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-12-17 16:38:25 +0545 |
commit | d61309a07ce3fd295cb4f9903b4c62245facfdd4 (patch) | |
tree | 43696d918e15be1efa49baea8323866c2077dc30 /src | |
parent | 0cf1b4f4f29f2ad63691d598e83a9327ae9867ff (diff) | |
download | pfsense-d61309a07ce3fd295cb4f9903b4c62245facfdd4.zip pfsense-d61309a07ce3fd295cb4f9903b4c62245facfdd4.tar.gz |
Code style system_*
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/system_gateway_groups.php | 10 | ||||
-rw-r--r-- | src/usr/local/www/system_gateway_groups_edit.php | 41 | ||||
-rw-r--r-- | src/usr/local/www/system_gateways.php | 36 | ||||
-rw-r--r-- | src/usr/local/www/system_gateways_edit.php | 15 | ||||
-rw-r--r-- | src/usr/local/www/system_groupmanager.php | 48 | ||||
-rw-r--r-- | src/usr/local/www/system_groupmanager_addprivs.php | 16 | ||||
-rwxr-xr-x | src/usr/local/www/system_hasync.php | 3 | ||||
-rw-r--r-- | src/usr/local/www/system_routes.php | 14 | ||||
-rw-r--r-- | src/usr/local/www/system_routes_edit.php | 25 | ||||
-rw-r--r-- | src/usr/local/www/system_update_settings.php | 29 | ||||
-rw-r--r-- | src/usr/local/www/system_usermanager.php | 64 | ||||
-rw-r--r-- | src/usr/local/www/system_usermanager_addprivs.php | 13 | ||||
-rw-r--r-- | src/usr/local/www/system_usermanager_settings.php | 19 | ||||
-rw-r--r-- | src/usr/local/www/system_usermanager_settings_ldapacpicker.php | 2 |
14 files changed, 188 insertions, 147 deletions
diff --git a/src/usr/local/www/system_gateway_groups.php b/src/usr/local/www/system_gateway_groups.php index c5b1817..cd914d9 100644 --- a/src/usr/local/www/system_gateway_groups.php +++ b/src/usr/local/www/system_gateway_groups.php @@ -126,11 +126,13 @@ $shortcut_section = "gateway-groups"; include("head.inc"); -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} -if (is_subsystem_dirty('staticroutes')) +if (is_subsystem_dirty('staticroutes')) { print_info_box_np(sprintf(gettext("The gateway configuration has been changed.%sYou must apply the changes in order for them to take effect."), "<br />")); +} $tab_array = array(); $tab_array[] = array(gettext("Gateways"), false, "system_gateways.php"); @@ -161,7 +163,7 @@ foreach ($a_gateway_groups as $gateway_group): </td> <td> <?php - foreach($gateway_group['item'] as $item) { + foreach ($gateway_group['item'] as $item) { $itemsplit = explode("|", $item); print(htmlspecialchars(strtoupper($itemsplit[0])) . "<br />\n"); } @@ -169,7 +171,7 @@ foreach ($a_gateway_groups as $gateway_group): </td> <td> <?php - foreach($gateway_group['item'] as $item) { + foreach ($gateway_group['item'] as $item) { $itemsplit = explode("|", $item); print("Tier ". htmlspecialchars($itemsplit[1]) . "<br />\n"); } diff --git a/src/usr/local/www/system_gateway_groups_edit.php b/src/usr/local/www/system_gateway_groups_edit.php index 930b491..24b48ee 100644 --- a/src/usr/local/www/system_gateway_groups_edit.php +++ b/src/usr/local/www/system_gateway_groups_edit.php @@ -65,8 +65,9 @@ require("guiconfig.inc"); require_once("ipsec.inc"); require_once("vpn.inc"); -if (!is_array($config['gateways']['gateway_group'])) +if (!is_array($config['gateways']['gateway_group'])) { $config['gateways']['gateway_group'] = array(); +} $a_gateway_groups = &$config['gateways']['gateway_group']; $a_gateways = return_gateways_array(); @@ -193,11 +194,13 @@ function build_carp_list() { $list = array('address' => gettext('Interface Address')); - foreach($carplist as $vip => $address) { - if(($gateway['ipprotocol'] == "inet") && (!is_ipaddrv4($address))) + foreach ($carplist as $vip => $address) { + if (($gateway['ipprotocol'] == "inet") && (!is_ipaddrv4($address))) { continue; - if(($gateway['ipprotocol'] == "inet6") && (!is_ipaddrv6($address))) + } + if (($gateway['ipprotocol'] == "inet6") && (!is_ipaddrv6($address))) { continue; + } $list[$vip] = "$vip - $address"; } @@ -212,8 +215,9 @@ $gateway_array = array_keys($a_gateways); $protocol_array = array_values($gateway_protocol); $protocol_array = array_values(array_unique($gateway_protocol)); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form(); @@ -231,11 +235,11 @@ $carplist = get_configured_carp_interface_list($interface); $row = 0; $numrows = count($a_gateways) - 1; -foreach($a_gateways as $gwname => $gateway) { - if(!empty($pconfig['item'])) { +foreach ($a_gateways as $gwname => $gateway) { + if (!empty($pconfig['item'])) { $af = explode("|", $pconfig['item'][0]); $family = $a_gateways[$af[0]]['ipprotocol']; - if($gateway['ipprotocol'] != $family) { + if ($gateway['ipprotocol'] != $family) { $rows++; continue; } @@ -243,9 +247,9 @@ foreach($a_gateways as $gwname => $gateway) { $interface = $gateway['friendlyiface']; - foreach((array)$pconfig['item'] as $item) { + foreach ((array)$pconfig['item'] as $item) { $itemsplit = explode("|", $item); - if($itemsplit[0] == $gwname) { + if ($itemsplit[0] == $gwname) { $selected = $itemsplit[1]; break; } else { @@ -355,28 +359,29 @@ print($form); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Hides all elements of the specified class. This will usually be a section or group function hideClass(s_class, hide) { - if(hide) + if (hide) { $('.' + s_class).hide(); - else + } else { $('.' + s_class).show(); + } } // On changing a Tier selector on any row, find which protocol it uses (class) // and disable the opposite $('.row').on('change', function() { // If user selects 'Never', unhide all rows - if($(this).find(":selected").index() == 0) { + if ($(this).find(":selected").index() == 0) { hideClass('inet', false); hideClass('inet6', false); - } - else { // Otherwise hide the rows that are ont of 'this' protocol - if($(this).hasClass('inet6')) + } else { // Otherwise hide the rows that are not of 'this' protocol + if ($(this).hasClass('inet6')) { hideClass('inet', true); - else + } else { hideClass('inet6', true); + } } }); }); diff --git a/src/usr/local/www/system_gateways.php b/src/usr/local/www/system_gateways.php index f40a19e..e297053 100644 --- a/src/usr/local/www/system_gateways.php +++ b/src/usr/local/www/system_gateways.php @@ -153,9 +153,9 @@ function delete_gateway_item($id) { } /* NOTE: Cleanup static routes for the interface route if any */ - if (!empty($a_gateways[$id]) && is_ipaddr($a_gateways[$id]['gateway']) && - $gateway['gateway'] != $a_gateways[$id]['gateway'] && - isset($a_gateways[$id]["nonlocalgateway"])) { + if (!empty($a_gateways[$id]) && is_ipaddr($a_gateways[$id]['gateway']) && + $gateway['gateway'] != $a_gateways[$id]['gateway'] && + isset($a_gateways[$id]["nonlocalgateway"])) { $realif = get_real_interface($a_gateways[$id]['interface']); $inet = (!is_ipaddrv4($a_gateways[$id]['gateway']) ? "-inet6" : "-inet"); $cmd = "/sbin/route delete $inet " . escapeshellarg($a_gateways[$id]['gateway']) . " -iface " . escapeshellarg($realif); @@ -163,9 +163,9 @@ function delete_gateway_item($id) { } /* NOTE: Cleanup static routes for the monitor ip if any */ if (!empty($a_gateways[$id]['monitor']) && - $a_gateways[$id]['monitor'] != "dynamic" && - is_ipaddr($a_gateways[$id]['monitor']) && - $a_gateways[$id]['gateway'] != $a_gateways[$id]['monitor']) { + $a_gateways[$id]['monitor'] != "dynamic" && + is_ipaddr($a_gateways[$id]['monitor']) && + $a_gateways[$id]['gateway'] != $a_gateways[$id]['monitor']) { if (is_ipaddrv4($a_gateways[$id]['monitor'])) { mwexec("/sbin/route delete " . escapeshellarg($a_gateways[$id]['monitor'])); } else { @@ -246,13 +246,16 @@ $shortcut_section = "gateways"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); -if ($savemsg) +} +if ($savemsg) { print_info_box($savemsg, 'success'); +} -if (is_subsystem_dirty('staticroutes')) +if (is_subsystem_dirty('staticroutes')) { print_info_box_np(gettext("The gateway configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect.")); +} $tab_array = array(); $tab_array[0] = array(gettext("Gateways"), true, "system_gateways.php"); @@ -276,25 +279,28 @@ display_top_tabs($tab_array); <tbody> <?php foreach ($a_gateways as $i => $gateway): - if (isset($gateway['inactive'])) + if (isset($gateway['inactive'])) { $icon = 'fa-times-circle-o'; - elseif (isset($gateway['disabled'])) + } elseif (isset($gateway['disabled'])) { $icon = 'fa-ban'; - else + } else { $icon = 'fa-check-circle-o'; + } - if (isset($gateway['inactive'])) + if (isset($gateway['inactive'])) { $title = gettext("This gateway is inactive because interface is missing"); - else + } else { $title = ''; + } ?> <tr<?=($icon != 'fa-check-circle-o')? ' class="disabled"' : ''?>> <td title="<?=$title?>"><i class="fa <?=$icon?>"></i></td> <td> <?=$gateway['name']?> <?php - if (isset($gateway['defaultgw'])) + if (isset($gateway['defaultgw'])) { echo " <strong>(default)</strong>"; + } ?> </td> <td> diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php index 7acb07b..cbd51be 100644 --- a/src/usr/local/www/system_gateways_edit.php +++ b/src/usr/local/www/system_gateways_edit.php @@ -536,17 +536,17 @@ if ($_POST) { /* NOTE: If gateway ip is changed need to cleanup the old static interface route */ if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['gateway']) && - $gateway['gateway'] != $a_gateway_item[$realid]['gateway'] && - isset($a_gateway_item[$realid]["nonlocalgateway"])) { + $gateway['gateway'] != $a_gateway_item[$realid]['gateway'] && + isset($a_gateway_item[$realid]["nonlocalgateway"])) { $realif = get_real_interface($a_gateway_item[$realid]['interface']); $inet = (!is_ipaddrv4($a_gateway_item[$realid]['gateway']) ? "-inet6" : "-inet"); $cmd = "/sbin/route delete $inet " . escapeshellarg($a_gateway_item[$realid]['gateway']) . " -iface " . escapeshellarg($realif); mwexec($cmd); } - + /* NOTE: If monitor ip is changed need to cleanup the old static route */ if ($_POST['monitor'] != "dynamic" && !empty($a_gateway_item[$realid]) && is_ipaddr($a_gateway_item[$realid]['monitor']) && - $_POST['monitor'] != $a_gateway_item[$realid]['monitor'] && $gateway['gateway'] != $a_gateway_item[$realid]['monitor']) { + $_POST['monitor'] != $a_gateway_item[$realid]['monitor'] && $gateway['gateway'] != $a_gateway_item[$realid]['monitor']) { if (is_ipaddrv4($a_gateway_item[$realid]['monitor'])) { mwexec("/sbin/route delete " . escapeshellarg($a_gateway_item[$realid]['monitor'])); } else { @@ -634,13 +634,14 @@ $shortcut_section = "gateways"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form; /* If this is a system gateway we need this var */ -if(($pconfig['attribute'] == "system") || is_numeric($pconfig['attribute'])) { +if (($pconfig['attribute'] == "system") || is_numeric($pconfig['attribute'])) { $form->addGlobal(new Form_Input( 'attribute', null, @@ -781,7 +782,7 @@ if (!(!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) || $form->add($section); $section = new Form_Section('Advanced'); -if(isset($advdflt)) { +if (isset($advdflt)) { $section->addClass('collapse'); } diff --git a/src/usr/local/www/system_groupmanager.php b/src/usr/local/www/system_groupmanager.php index b3e0444..a934ad3 100644 --- a/src/usr/local/www/system_groupmanager.php +++ b/src/usr/local/www/system_groupmanager.php @@ -245,7 +245,7 @@ function build_priv_table() { $privhtml .= '<td>' . htmlspecialchars($priv['descr']) . '</td>'; $privhtml .= '<td><a class="fa fa-trash" title="'.gettext('Delete Privilege').'" href="system_groupmanager.php?act=delpriv&groupid='.$id.'&privid='.$i.'"></a></td>'; $privhtml .= '</tr>'; - + } $privhtml .= '</tbody>'; @@ -261,10 +261,12 @@ function build_priv_table() { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); -if ($savemsg) +} +if ($savemsg) { print_info_box($savemsg); +} $tab_array = array(); $tab_array[] = array(gettext("Users"), false, "system_usermanager.php"); @@ -273,8 +275,7 @@ $tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.ph $tab_array[] = array(gettext("Servers"), false, "system_authservers.php"); display_top_tabs($tab_array); -if (!($_GET['act'] == "new" || $_GET['act'] == "edit")) -{ +if (!($_GET['act'] == "new" || $_GET['act'] == "edit")) { ?> <div class="table-responsive"> <table class="table table-striped table-hover table-condensed sortable-theme-bootstrap" data-sortable> @@ -288,11 +289,12 @@ if (!($_GET['act'] == "new" || $_GET['act'] == "edit")) </thead> <tbody> <?php - foreach($a_group as $i => $group): - if ($group["name"] == "all") + foreach ($a_group as $i => $group): + if ($group["name"] == "all") { $groupcount = count($config['system']['user']); - else + } else { $groupcount = count($group['member']); + } ?> <tr> <td> @@ -306,7 +308,7 @@ if (!($_GET['act'] == "new" || $_GET['act'] == "edit")) </td> <td> <a class="fa fa-pencil" title="<?=gettext("Edit group"); ?>" href="?act=edit&groupid=<?=$i?>"></a> - <?php if($group['scope'] != "system"): ?> + <?php if ($group['scope'] != "system"): ?> <a class="fa fa-trash" title="<?=gettext("Delete group")?>" href="?act=delgroup&groupid=<?=$i?>&groupname=<?=$group['name']?>"></a> <?php endif;?> </td> @@ -356,8 +358,7 @@ if (isset($id) && $a_group[$id]){ $section = new Form_Section('Group properties'); -if ($_GET['act'] != "new") -{ +if ($_GET['act'] != "new") { $section->addInput(new Form_StaticText( 'Defined by', strtoupper($pconfig['gtype']) @@ -371,8 +372,9 @@ $section->addInput($input = new Form_Input( $pconfig['name'] )); -if ($pconfig['gtype'] == "system") +if ($pconfig['gtype'] == "system") { $input->setReadonly(); +} $section->addInput(new Form_Input( 'description', @@ -382,8 +384,8 @@ $section->addInput(new Form_Input( ))->setHelp('Group description, for your own information only'); $form->add($section); -if ($pconfig['gid'] != 1998) // all users group -{ +if ($pconfig['gid'] != 1998) { // all users group + // ==== Group membership ================================================== $group = new Form_Group('Group membership'); @@ -393,10 +395,11 @@ if ($pconfig['gid'] != 1998) // all users group $usersGroups = array(); foreach ($config['system']['user'] as $user) { - if (is_array($pconfig['members']) && in_array($user['uid'], $pconfig['members'])) + if (is_array($pconfig['members']) && in_array($user['uid'], $pconfig['members'])) { $usersGroups[ $user['uid'] ] = $user['name']; // Add it to the user's list - else + } else { $systemGroups[ $user['uid'] ] = $user['name']; // Add it to the 'not a member of' list + } } $group->add(new Form_Select( @@ -434,8 +437,7 @@ if ($pconfig['gid'] != 1998) // all users group } -if ($_GET['act'] != "new") -{ +if ($_GET['act'] != "new") { $section = new Form_Section('Assigned Privileges'); $section->addInput(new Form_StaticText( @@ -451,7 +453,7 @@ print $form; ?> <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Select every option in the specified multiselect function AllServers(id, selectAll) { @@ -465,9 +467,9 @@ events.push(function(){ var len = From.length; var option, value; - if(len > 1) { - for(i=0; i<len; i++) { - if(From.eq(i).is(':selected')) { + if (len > 1) { + for (i=0; i<len; i++) { + if (From.eq(i).is(':selected')) { option = From.eq(i).val(); value = From.eq(i).text(); To.append(new Option(value, option)); @@ -492,7 +494,7 @@ events.push(function(){ }); // On submit mark all the user's groups as "selected" - $('form').submit(function(){ + $('form').submit(function() { AllServers($('[name="members[]"] option'), true); }); }); diff --git a/src/usr/local/www/system_groupmanager_addprivs.php b/src/usr/local/www/system_groupmanager_addprivs.php index af7777f..5882727 100644 --- a/src/usr/local/www/system_groupmanager_addprivs.php +++ b/src/usr/local/www/system_groupmanager_addprivs.php @@ -158,9 +158,10 @@ function build_priv_list() { $list = array(); - foreach($priv_list as $pname => $pdata) { - if (in_array($pname, $a_group['priv'])) + foreach ($priv_list as $pname => $pdata) { + if (in_array($pname, $a_group['priv'])) { continue; + } $list[$pname] = $pdata; } @@ -170,11 +171,13 @@ function build_priv_list() { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, success); +} $tab_array = array(); $tab_array[] = array(gettext("Users"), false, "system_usermanager.php"); @@ -184,8 +187,7 @@ $tab_array[] = array(gettext("Servers"), false, "system_authservers.php"); display_top_tabs($tab_array); $form = new Form; -if (isset($groupid)) -{ +if (isset($groupid)) { $form->addGlobal(new Form_Input( 'groupid', null, @@ -216,7 +218,7 @@ print $form; <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { <?php diff --git a/src/usr/local/www/system_hasync.php b/src/usr/local/www/system_hasync.php index d8f55bf..a20d621 100755 --- a/src/usr/local/www/system_hasync.php +++ b/src/usr/local/www/system_hasync.php @@ -63,8 +63,9 @@ require("guiconfig.inc"); -if (!is_array($config['hasync'])) +if (!is_array($config['hasync'])) { $config['hasync'] = array(); +} $a_hasync = &$config['hasync']; diff --git a/src/usr/local/www/system_routes.php b/src/usr/local/www/system_routes.php index e56394f..0a75571 100644 --- a/src/usr/local/www/system_routes.php +++ b/src/usr/local/www/system_routes.php @@ -247,12 +247,15 @@ $shortcut_section = "routing"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); -if ($savemsg) +} +if ($savemsg) { print_info_box($savemsg); -if (is_subsystem_dirty('staticroutes')) +} +if (is_subsystem_dirty('staticroutes')) { print_info_box_np(gettext("The static route configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect.")); +} $tab_array = array(); $tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php"); @@ -275,10 +278,11 @@ display_top_tabs($tab_array); <tbody> <?php foreach ($a_routes as $i => $route): - if (isset($route['disabled'])) + if (isset($route['disabled'])) { $icon = 'fa-ban'; - else + } else { $icon = 'fa-check-circle-o'; + } ?> <tr<?=($icon != 'fa-check-circle-o')? ' class="disabled"' : ''?>> <td><i class="fa <?=$icon?>"></i></td> diff --git a/src/usr/local/www/system_routes_edit.php b/src/usr/local/www/system_routes_edit.php index 202ea09..78c6f2c 100644 --- a/src/usr/local/www/system_routes_edit.php +++ b/src/usr/local/www/system_routes_edit.php @@ -199,17 +199,17 @@ if ($_POST) { if (is_array($config['interfaces'])) { foreach ($config['interfaces'] as $if) { if (is_ipaddrv4($_POST['network']) && - isset($if['ipaddr']) && isset($if['subnet']) && - is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet']) && - ($_POST['network_subnet'] == $if['subnet']) && - (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet']))) { - $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']); + isset($if['ipaddr']) && isset($if['subnet']) && + is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet']) && + ($_POST['network_subnet'] == $if['subnet']) && + (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet']))) { + $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']); } else if (is_ipaddrv6($_POST['network']) && - isset($if['ipaddrv6']) && isset($if['subnetv6']) && - is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6']) && - ($_POST['network_subnet'] == $if['subnetv6']) && - (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6']))) { - $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']); + isset($if['ipaddrv6']) && isset($if['subnetv6']) && + is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6']) && + ($_POST['network_subnet'] == $if['subnetv6']) && + (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6']))) { + $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']); } } } @@ -258,8 +258,9 @@ $pgtitle = array(gettext("System"), gettext("Static Routes"), gettext("Edit rout $shortcut_section = "routing"; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} $form = new Form; @@ -314,7 +315,7 @@ print $form; ?> <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // --------- Autocomplete ----------------------------------------------------------------------------------------- var addressarray = <?= json_encode(get_alias_list(array("host", "network"))) ?>; diff --git a/src/usr/local/www/system_update_settings.php b/src/usr/local/www/system_update_settings.php index b940fc6..27ab063 100644 --- a/src/usr/local/www/system_update_settings.php +++ b/src/usr/local/www/system_update_settings.php @@ -75,9 +75,9 @@ if ($_POST) { if (!$input_errors) { // Set the firmware branch, but only if we are not using it already if ($_POST['fwbranch']) { - if(($_POST['fwbranch'] == "development") && is_pkg_installed($g['product_name'] . "-repo")) { + if (($_POST['fwbranch'] == "development") && is_pkg_installed($g['product_name'] . "-repo")) { pkg_switch_repo(true); - } else if(($_POST['fwbranch'] == "stable") && is_pkg_installed($g['product_name'] . "-repo-devel")) { + } else if (($_POST['fwbranch'] == "stable") && is_pkg_installed($g['product_name'] . "-repo-devel")) { pkg_switch_repo(false); } } @@ -113,11 +113,13 @@ if (file_exists("{$g['tmp_path']}/manifest")) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $tab_array = array(); $tab_array[] = array(gettext("System Update"), false, "pkg_mgr_install.php?id=firmware"); @@ -156,7 +158,7 @@ $section->addInput(new Form_Checkbox( $form->add($section); -if(file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { +if (file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { $section = new Form_Section('GitSync'); $section->addInput(new Form_Checkbox( @@ -166,10 +168,11 @@ if(file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { isset($gitcfg['synconupgrade']) ))->setHelp('After updating, sync with the following repository/branch before reboot'); - if(is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) { + if (is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) { exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git config remote.origin.url", $output_str); - if(is_array($output_str) && !empty($output_str[0])) + if (is_array($output_str) && !empty($output_str[0])) { $lastrepositoryurl = $output_str[0]; + } unset($output_str); } @@ -180,11 +183,11 @@ if(file_exists("/usr/local/bin/git") && $g['platform'] == $g['product_name']) { ($gitcfg['repositoryurl'] ? $gitcfg['repositoryurl'] : '') ))->setHelp('The most recently used repository was %s. This repository will be used if the field is left blank.', [$lastrepositoryurl]); - if(is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) { + if (is_dir("/root/pfsense/pfSenseGITREPO/pfSenseGITREPO")) { exec("cd /root/pfsense/pfSenseGITREPO/pfSenseGITREPO && git branch", $output_str); - if(is_array($output_str)) { - foreach($output_str as $output_line) { - if(strstr($output_line, '* ')) { + if (is_array($output_str)) { + foreach ($output_str as $output_line) { + if (strstr($output_line, '* ')) { $lastbranch = substr($output_line, 2); break; } @@ -210,7 +213,7 @@ print($form); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Update firmwareurl from preseturls or from the saved alternate if "Unofficial" is checked function update_firmwareurl() { if (!$('#alturlenable').prop('checked')) { @@ -224,7 +227,7 @@ events.push(function(){ // Call it when preseturls changes - $('#preseturls, #alturlenable').on('change', function(){ + $('#preseturls, #alturlenable').on('change', function() { update_firmwareurl(); }) diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php index bc5ecc2..85c92dc 100644 --- a/src/usr/local/www/system_usermanager.php +++ b/src/usr/local/www/system_usermanager.php @@ -120,8 +120,7 @@ if ($_GET['act'] == "deluser") { write_config(); $savemsg = gettext("User")." {$userdeleted} ". gettext("successfully deleted")."<br />"; -} -else if ($act == "new") { +} else if ($act == "new") { /* * set this value cause the text field is read only * and the user should not be able to mess with this @@ -353,7 +352,7 @@ if ($_POST['save']) { } /* Add user to groups so PHP can see the memberships properly or else the user's shell account does not get proper permissions (if applicable) See #5152. */ - local_user_set_groups($userent,$_POST['groups']); + local_user_set_groups($userent, $_POST['groups']); local_user_set($userent); /* Add user to groups again to ensure they are set everywhere, otherwise the user may not appear to be a member of the group. See commit:5372d26d9d25d751d16865ed9d46869d3b0ec5e1. */ local_user_set_groups($userent, $_POST['groups']); @@ -396,14 +395,16 @@ function build_priv_table() { $privhtml .= '<td>' . htmlspecialchars($priv['name']) . '</td>'; $privhtml .= '<td>' . htmlspecialchars($priv['descr']) . '</td>'; $privhtml .= '<td>'; - if (!$group) + if (!$group) { $privhtml .= '<a class="fa fa-trash no-confirm icon-pointer" title="'.gettext('Delete Privilege').'" id="delprivid' .$i. '"></a></td>'; + } $privhtml .= '</td>'; $privhtml .= '</tr>'; - if(!$group) + if (!$group) { $i++; + } } $privhtml .= '</tbody>'; @@ -466,11 +467,13 @@ function build_cert_table() { $closehead = false; include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $tab_array = array(); $tab_array[] = array(gettext("Users"), true, "system_usermanager.php"); @@ -495,7 +498,7 @@ if (!($act == "new" || $act == "edit" || $input_errors)) { </thead> <tbody> <?php -foreach($a_user as $i => $userent): +foreach ($a_user as $i => $userent): ?> <tr> <td> @@ -503,20 +506,21 @@ foreach($a_user as $i => $userent): </td> <td> <?php - if($userent['scope'] != "user") + if ($userent['scope'] != "user") { $usrimg = 'eye-open'; - else + } else { $usrimg = 'user'; + } ?> <i class="fa fa-<?=$usrimg?>"></i> <?=htmlspecialchars($userent['name'])?> </td> <td><?=htmlspecialchars($userent['descr'])?></td> - <td><?php if(isset($userent['disabled'])) echo "*"?></td> - <td><?=implode(",",local_user_get_groups($userent))?></td> + <td><?php if (isset($userent['disabled'])) echo "*"?></td> + <td><?=implode(",", local_user_get_groups($userent))?></td> <td> <a class="fa fa-pencil" title="<?=gettext("Edit user"); ?>" href="?act=edit&userid=<?=$i?>"></a> -<?php if($userent['scope'] != "system"): ?> +<?php if ($userent['scope'] != "system"): ?> <a class="fa fa-trash" title="<?=gettext("Delete user")?>" href="?act=deluser&userid=<?=$i?>&username=<?=$userent['name']?>"></a> <?php endif; ?> </td> @@ -617,8 +621,9 @@ if ($act == "new" || $act == "edit" || $input_errors): $pconfig['usernamefld'] )); - if ($ro) + if ($ro) { $input->setReadonly(); + } $form->addGlobal(new Form_Input( 'oldusername', @@ -648,8 +653,9 @@ if ($act == "new" || $act == "edit" || $input_errors): htmlspecialchars($pconfig['descr']) ))->setHelp('User\'s full name, for your own information only'); - if ($ro) + if ($ro) { $input->setDisabled(); + } $section->addInput(new Form_Input( 'expires', @@ -670,11 +676,12 @@ if ($act == "new" || $act == "edit" || $input_errors): $usergid = [$pconfig['usernamefld']]; foreach ($config['system']['group'] as $Ggroup) { - if($Ggroup['name'] != "all") { - if(($act == 'edit') && $Ggroup['member'] && in_array($pconfig['uid'], $Ggroup['member'])) + if ($Ggroup['name'] != "all") { + if (($act == 'edit') && $Ggroup['member'] && in_array($pconfig['uid'], $Ggroup['member'])) { $usersGroups[ $Ggroup['name'] ] = $Ggroup['name']; // Add it to the user's list - else + } else { $systemGroups[ $Ggroup['name'] ] = $Ggroup['name']; // Add it to the 'not a member of' list + } } } @@ -712,7 +719,7 @@ if ($act == "new" || $act == "edit" || $input_errors): $section->add($group); // ==== Button for adding user certificate ================================ - if($act == 'new') { + if ($act == 'new') { $section->addInput(new Form_Checkbox( 'showcert', 'Certificate', @@ -778,9 +785,10 @@ else; $section->addClass('cert-options'); $nonPrvCas = array(); - foreach( $config['ca'] as $ca) { - if (!$ca['prv']) + foreach($config['ca'] as $ca) { + if (!$ca['prv']) { continue; + } $nonPrvCas[ $ca['refid'] ] = $ca['descr']; } @@ -853,7 +861,7 @@ print $form; ?> <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { // Select every option in the specified multiselect function AllServers(id, selectAll) { @@ -867,9 +875,9 @@ events.push(function(){ var len = From.length; var option; - if(len > 0) { - for(i=0; i<len; i++) { - if(From.eq(i).is(':selected')) { + if (len > 0) { + for (i=0; i<len; i++) { + if (From.eq(i).is(':selected')) { option = From.eq(i).val(); value = From.eq(i).text(); To.append(new Option(value, option)); @@ -902,7 +910,7 @@ events.push(function(){ }); $('[id^=delcert]').click(function(event) { - if(confirm(event.target.title)) { + if (confirm(event.target.title)) { $('#certid').val(event.target.id.match(/\d+$/)[0]); $('#userid').val('<?=$id;?>'); $('#act').val('delcert'); @@ -911,7 +919,7 @@ events.push(function(){ }); $('[id^=delprivid]').click(function(event) { - if(confirm(event.target.title)) { + if (confirm(event.target.title)) { $('#privid').val(event.target.id.match(/\d+$/)[0]); $('#userid').val('<?=$id;?>'); $('#act').val('delprivid'); @@ -927,7 +935,7 @@ events.push(function(){ hideCheckbox('showkey', true); // On submit mark all the user's groups as "selected" - $('form').submit(function(){ + $('form').submit(function() { AllServers($('[name="groups[]"] option'), true); }); }); diff --git a/src/usr/local/www/system_usermanager_addprivs.php b/src/usr/local/www/system_usermanager_addprivs.php index cce0c83..61984bd 100644 --- a/src/usr/local/www/system_usermanager_addprivs.php +++ b/src/usr/local/www/system_usermanager_addprivs.php @@ -141,9 +141,10 @@ function build_priv_list() { $list = array(); - foreach($spriv_list as $pname => $pdata) { - if (in_array($pname, $a_user['priv'])) + foreach ($spriv_list as $pname => $pdata) { + if (in_array($pname, $a_user['priv'])) { continue; + } $list[$pname] = $pdata['name']; } @@ -158,11 +159,13 @@ if (isAjax()) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, 'success'); +} $tab_array = array(); $tab_array[] = array(gettext("Users"), true, "system_usermanager.php"); @@ -201,7 +204,7 @@ print($form); <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { <?php diff --git a/src/usr/local/www/system_usermanager_settings.php b/src/usr/local/www/system_usermanager_settings.php index 0ae4da5..875837e 100644 --- a/src/usr/local/www/system_usermanager_settings.php +++ b/src/usr/local/www/system_usermanager_settings.php @@ -66,8 +66,7 @@ require("guiconfig.inc"); $pconfig['session_timeout'] = &$config['system']['webgui']['session_timeout']; if (isset($config['system']['webgui']['authmode'])) { $pconfig['authmode'] = &$config['system']['webgui']['authmode']; -} -else { +} else { $pconfig['authmode'] = "Local Database"; } $pconfig['backend'] = &$config['system']['webgui']['backend']; @@ -88,7 +87,7 @@ if ($_POST) { } } - if(($_POST['authmode'] == "Local Database") && $_POST['savetest']) { + if (($_POST['authmode'] == "Local Database") && $_POST['savetest']) { $savemsg = gettext("Settings have been saved, but the test was not performed because it is not supported for local databases."); } @@ -123,13 +122,15 @@ if ($_POST) { include("head.inc"); -if ($input_errors) +if ($input_errors) { print_input_errors($input_errors); +} -if ($savemsg) +if ($savemsg) { print_info_box($savemsg, success); +} -if($save_and_test) { +if ($save_and_test) { echo "<script>\n"; echo "//<![CDATA[\n"; echo "myRef = window.open('system_usermanager_settings_test.php?authserver=".$pconfig['authmode']."','mywin','left=20,top=20,width=700,height=550,toolbar=1,resizable=0');\n"; @@ -146,8 +147,9 @@ $tab_array[] = array(gettext("Servers"), false, "system_authservers.php"); display_top_tabs($tab_array); /* Default to pfsense backend type if none is defined */ -if(!$pconfig['backend']) +if (!$pconfig['backend']) { $pconfig['backend'] = "pfsense"; +} $form = new Form; @@ -164,8 +166,9 @@ $section->addInput(new Form_Input( 'risk!'); $auth_servers = array(); -foreach (auth_get_authserver_list() as $auth_server) +foreach (auth_get_authserver_list() as $auth_server) { $auth_servers[ $auth_server['name'] ] = $auth_server['name']; +} $section->addInput(new Form_Select( 'authmode', diff --git a/src/usr/local/www/system_usermanager_settings_ldapacpicker.php b/src/usr/local/www/system_usermanager_settings_ldapacpicker.php index 1ec02b5..2543e41 100644 --- a/src/usr/local/www/system_usermanager_settings_ldapacpicker.php +++ b/src/usr/local/www/system_usermanager_settings_ldapacpicker.php @@ -153,7 +153,7 @@ function post_choices() { </table> </div> <p/> - + <input type='button' class="btn btn-sm btn-primary" value='<?=gettext("Save");?>' onClick="post_choices();"> <?php endif; ?> </form> |