diff options
Diffstat (limited to 'src/usr/local/www/system_usermanager.php')
-rw-r--r-- | src/usr/local/www/system_usermanager.php | 64 |
1 files changed, 36 insertions, 28 deletions
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); }); }); |