Fix indent and whitespaces

This commit is contained in:
Renato Botelho 2014-08-05 08:35:56 -03:00
parent 4c4c59b94d
commit 4c291f4c3c
2 changed files with 339 additions and 314 deletions

View File

@ -1,27 +1,27 @@
<?php
<?php
/*
$Id: system_groupmanager.php
$Id: system_groupmanager.php
part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2008 Shrew Soft Inc.
All rights reserved.
All rights reserved.
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
All rights reserved.
All rights reserved.
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
@ -117,15 +117,15 @@ if ($_POST) {
/* input validation */
$reqdfields = explode(" ", "groupname");
$reqdfieldsn = array(gettext("Group Name"));
do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors);
if (preg_match("/[^a-zA-Z0-9\.\-_ ]/", $_POST['groupname']))
$input_errors[] = gettext("The group name contains invalid characters.");
if (strlen($_POST['groupname']) > 16)
$input_errors[] = gettext("The group name is longer than 16 characters.");
if (!$input_errors && !(isset($id) && $a_group[$id])) {
/* make sure there are no dupes */
foreach ($a_group as $group) {
@ -135,12 +135,12 @@ if ($_POST) {
}
}
}
if (!$input_errors) {
$group = array();
if (isset($id) && $a_group[$id])
$group = $a_group[$id];
$group['name'] = $_POST['groupname'];
$group['description'] = $_POST['description'];
@ -170,7 +170,7 @@ if ($_POST) {
}
write_config();
header("Location: system_groupmanager.php");
exit;
}
@ -248,29 +248,30 @@ function presubmit() {
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="group manager">
<tr>
<td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
?>
<?php
$tab_array = array();
$tab_array[] = array(gettext("Users"), false, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), true, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
?>
</td>
</tr>
</tr>
<tr>
<td id="mainarea">
<div class="tabcont">
<?php if($_GET['act']=="new" || $_GET['act']=="edit"): ?>
<?php
if($_GET['act']=="new" || $_GET['act']=="edit"):
?>
<form action="system_groupmanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<?php
$ro = "";
if ($pconfig['gtype'] == "system")
$ro = "readonly=\"readonly\"";
?>
<?php
$ro = "";
if ($pconfig['gtype'] == "system")
$ro = "readonly=\"readonly\"";
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
<td width="78%" class="vtable">
@ -278,23 +279,23 @@ function presubmit() {
<input name="gtype" type="hidden" value="<?=htmlspecialchars($pconfig['gtype'])?>"/>
</td>
</tr>
<tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Group name");?></td>
<td width="78%" class="vtable">
<td width="78%" class="vtable">
<input name="groupname" type="text" class="formfld group" id="groupname" size="20" maxlength="16" value="<?=htmlspecialchars($pconfig['name']);?>" <?=$ro;?> />
</td>
</tr>
<tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Description");?></td>
<td width="78%" class="vtable">
<td width="78%" class="vtable">
<input name="description" type="text" class="formfld unknown" id="description" size="20" value="<?=htmlspecialchars($pconfig['description']);?>" />
<br />
<?=gettext("Group description, for your own information only");?>
</td>
</tr>
<?php if ($pconfig['gid'] != 1998): // all users group ?>
<?php
if ($pconfig['gid'] != 1998): // all users group
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Group Memberships");?></td>
<td width="78%" class="vtable" align="center">
@ -304,20 +305,21 @@ function presubmit() {
<strong><?=gettext("Not Members");?></strong><br />
<br />
<select size="10" style="width: 75%" name="notmembers[]" class="formselect" id="notmembers" onchange="clear_selected('members')" multiple="multiple">
<?php
$rowIndex = 0;
foreach ($config['system']['user'] as $user):
if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
continue;
$rowIndex++;
?>
<?php
$rowIndex = 0;
foreach ($config['system']['user'] as $user):
if (is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members']))
continue;
$rowIndex++;
?>
<option value="<?=$user['uid'];?>" <?=$selected;?>>
<?=htmlspecialchars($user['name']);?>
</option>
<?php endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
<?php
endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
</select>
<br />
</td>
@ -335,20 +337,21 @@ function presubmit() {
<strong><?=gettext("Members");?></strong><br />
<br />
<select size="10" style="width: 75%" name="members[]" class="formselect" id="members" onchange="clear_selected('notmembers')" multiple="multiple">
<?php
$rowIndex = 0;
foreach ($config['system']['user'] as $user):
if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
continue;
$rowIndex++;
?>
<?php
$rowIndex = 0;
foreach ($config['system']['user'] as $user):
if (!(is_array($pconfig['members']) && in_array($user['uid'],$pconfig['members'])))
continue;
$rowIndex++;
?>
<option value="<?=$user['uid'];?>">
<?=htmlspecialchars($user['name']);?>
</option>
<?php endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
<?php
endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
</select>
<br />
</td>
@ -357,10 +360,10 @@ function presubmit() {
<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
</td>
</tr>
<?php endif; ?>
<?php if($_GET['act'] != "new"): ?>
<?php
endif;
if($_GET['act'] != "new"):
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Assigned Privileges");?></td>
<td width="78%" class="vtable">
@ -370,11 +373,11 @@ function presubmit() {
<td width="60%" class="listhdrr"><?=gettext("Description");?></td>
<td class="list"></td>
</tr>
<?php
if(is_array($pconfig['priv'])):
$i = 0;
foreach ($pconfig['priv'] as $priv):
?>
<?php
if(is_array($pconfig['priv'])):
$i = 0;
foreach ($pconfig['priv'] as $priv):
?>
<tr>
<td class="listr">
<?=htmlspecialchars($priv_list[$priv]['name']);?>
@ -388,11 +391,11 @@ function presubmit() {
</a>
</td>
</tr>
<?php
$i++;
endforeach;
endif;
?>
<?php
$i++;
endforeach;
endif;
?>
<tr>
<td class="list" colspan="2"></td>
<td class="list">
@ -406,10 +409,12 @@ function presubmit() {
</table>
</td>
</tr>
<?php endif; ?>
<tr>
<?php
endif;
?>
<tr>
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<td width="78%">
<input name="save" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
<?php if (isset($id) && $a_group[$id]): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
@ -419,9 +424,9 @@ function presubmit() {
</tr>
</table>
</form>
<?php else: ?>
<?php
else:
?>
<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
<thead>
<tr>
@ -432,7 +437,7 @@ function presubmit() {
</tr>
</thead>
<tfoot>
<tr>
<tr>
<td class="list" colspan="3"></td>
<td class="list">
<a href="system_groupmanager.php?act=new"><img src="./themes/<?=$g['theme'];?>/images/icons/icon_plus.gif" title="<?=gettext("add group");?>" width="17" height="17" border="0" alt="add" />
@ -442,7 +447,7 @@ function presubmit() {
<tr>
<td colspan="3">
<p>
<?=gettext("Additional webConfigurator groups can be added here.
<?=gettext("Additional webConfigurator groups can be added here.
Group permissions can be assigned which are inherited by users who are members of the group.
An icon that appears grey indicates that it is a system defined object.
Some system object properties can be modified but they cannot be deleted.");?>
@ -451,18 +456,17 @@ function presubmit() {
</tr>
</tfoot>
<tbody>
<?php
$i = 0;
foreach($a_group as $group):
if($group['scope'] == "system")
$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
else
$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
$groupcount = count($group['member']);
if ($group["name"] == "all")
$groupcount = count($config['system']['user']);
?>
<?php
$i = 0;
foreach($a_group as $group):
if($group['scope'] == "system")
$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group-grey.png";
else
$grpimg = "/themes/{$g['theme']}/images/icons/icon_system-group.png";
$groupcount = count($group['member']);
if ($group["name"] == "all")
$groupcount = count($config['system']['user']);
?>
<tr ondblclick="document.location='system_groupmanager.php?act=edit&amp;id=<?=$i;?>'">
<td class="listlr">
<table border="0" cellpadding="0" cellspacing="0" summary="">
@ -487,23 +491,27 @@ function presubmit() {
<img src="./themes/<?=$g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit group");?>" width="17" height="17" border="0" alt="edit" />
</a>
&nbsp;
<?php if($group['scope'] != "system"): ?>
<?php
if($group['scope'] != "system"):
?>
<a href="system_groupmanager.php?act=delgroup&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this group?"); ?>')">
<img src="/themes/<?=$g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete group"); ?>" width="17" height="17" border="0" alt="delete" />
</a>
<?php endif; ?>
<?php
endif;
?>
</td>
</tr>
<?php
$i++;
endforeach;
?>
<?php
$i++;
endforeach;
?>
</tbody>
</table>
<?php endif; ?>
</div>
<?php
endif;
?>
</div>
</td>
</tr>
</table>

View File

@ -1,38 +1,38 @@
<?php
/* $Id$ */
/*
system_usermanager.php
part of m0n0wall (http://m0n0.ch/wall)
system_usermanager.php
part of m0n0wall (http://m0n0.ch/wall)
Copyright (C) 2008 Shrew Soft Inc.
All rights reserved.
Copyright (C) 2008 Shrew Soft Inc.
All rights reserved.
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
All rights reserved.
Copyright (C) 2005 Paul Taylor <paultaylor@winn-dixie.com>.
All rights reserved.
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Copyright (C) 2003-2005 Manuel Kasper <mk@neon1.net>.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
pfSense_BUILDER_BINARIES:
@ -252,8 +252,8 @@ if ($_POST) {
if (!empty($_POST['name'])) {
$ca = lookup_ca($_POST['caref']);
if (!$ca)
$input_errors[] = gettext("Invalid internal Certificate Authority") . "\n";
if (!$ca)
$input_errors[] = gettext("Invalid internal Certificate Authority") . "\n";
}
/* if this is an AJAX caller then handle via JSON */
@ -297,19 +297,19 @@ if ($_POST) {
if (!empty($_POST['name'])) {
$cert = array();
$cert['refid'] = uniqid();
$userent['cert'] = array();
$userent['cert'] = array();
$cert['descr'] = $_POST['name'];
$subject = cert_get_subject_array($ca['crt']);
$subject = cert_get_subject_array($ca['crt']);
$dn = array(
'countryName' => $subject[0]['v'],
'stateOrProvinceName' => $subject[1]['v'],
'localityName' => $subject[2]['v'],
'organizationName' => $subject[3]['v'],
'emailAddress' => $subject[4]['v'],
'commonName' => $userent['name']);
$dn = array(
'countryName' => $subject[0]['v'],
'stateOrProvinceName' => $subject[1]['v'],
'localityName' => $subject[2]['v'],
'organizationName' => $subject[3]['v'],
'emailAddress' => $subject[4]['v'],
'commonName' => $userent['name']);
cert_create($cert, $_POST['caref'], $_POST['keylen'],
(int)$_POST['lifetime'], $dn);
@ -431,13 +431,13 @@ function usercertClicked(obj) {
}
function sshkeyClicked(obj) {
if (obj.checked) {
document.getElementById("sshkeychck").style.display="none";
document.getElementById("sshkey").style.display="";
} else {
document.getElementById("sshkey").style.display="none";
document.getElementById("sshkeychck").style.display="";
}
if (obj.checked) {
document.getElementById("sshkeychck").style.display="none";
document.getElementById("sshkey").style.display="";
} else {
document.getElementById("sshkey").style.display="none";
document.getElementById("sshkeychck").style.display="";
}
}
//]]>
</script>
@ -450,36 +450,36 @@ function sshkeyClicked(obj) {
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="user manager">
<tr>
<td>
<?php
<?php
$tab_array = array();
$tab_array[] = array(gettext("Users"), true, "system_usermanager.php");
$tab_array[] = array(gettext("Groups"), false, "system_groupmanager.php");
$tab_array[] = array(gettext("Settings"), false, "system_usermanager_settings.php");
$tab_array[] = array(gettext("Servers"), false, "system_authservers.php");
display_top_tabs($tab_array);
?>
?>
</td>
</tr>
<tr>
<td id="mainarea">
<div class="tabcont">
<?php if ($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors): ?>
<?php
if ($_GET['act'] == "new" || $_GET['act'] == "edit" || $input_errors):
?>
<form action="system_usermanager.php" method="post" name="iform" id="iform" onsubmit="presubmit()">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
<?php
$ro = "";
if ($pconfig['utype'] == "system")
$ro = "readonly=\"readonly\"";
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
<td width="78%" class="vtable">
<strong><?=strtoupper(htmlspecialchars($pconfig['utype']));?></strong>
<?php
$ro = "";
if ($pconfig['utype'] == "system")
$ro = "readonly=\"readonly\"";
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Defined by");?></td>
<td width="78%" class="vtable">
<strong><?=strtoupper(htmlspecialchars($pconfig['utype']));?></strong>
<input name="utype" type="hidden" value="<?=htmlspecialchars($pconfig['utype'])?>" />
</td>
</tr>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Disabled");?></td>
<td width="78%" class="vtable">
@ -528,22 +528,23 @@ function sshkeyClicked(obj) {
<strong><?=gettext("Not Member Of"); ?></strong><br />
<br />
<select size="10" style="width: 75%" name="notgroups[]" class="formselect" id="notgroups" onchange="clear_selected('groups')" multiple="multiple">
<?php
$rowIndex = 0;
foreach ($config['system']['group'] as $group):
if ($group['gid'] == 1998) /* all users group */
continue;
if (is_array($pconfig['groups']) && in_array($group['name'],$pconfig['groups']))
continue;
$rowIndex++;
?>
<?php
$rowIndex = 0;
foreach ($config['system']['group'] as $group):
if ($group['gid'] == 1998) /* all users group */
continue;
if (is_array($pconfig['groups']) && in_array($group['name'],$pconfig['groups']))
continue;
$rowIndex++;
?>
<option value="<?=$group['name'];?>" <?=$selected;?>>
<?=htmlspecialchars($group['name']);?>
</option>
<?php endforeach;
<?php
endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
?>
</select>
<br />
</td>
@ -561,24 +562,25 @@ function sshkeyClicked(obj) {
<strong><?=gettext("Member Of"); ?></strong><br />
<br />
<select size="10" style="width: 75%" name="groups[]" class="formselect" id="groups" onchange="clear_selected('notgroups')" multiple="multiple">
<?php
<?php
$rowIndex = 0;
if (is_array($pconfig['groups'])) {
if (is_array($pconfig['groups'])):
foreach ($config['system']['group'] as $group):
if ($group['gid'] == 1998) /* all users group */
continue;
if (!in_array($group['name'],$pconfig['groups']))
continue;
$rowIndex++;
?>
?>
<option value="<?=$group['name'];?>">
<?=htmlspecialchars($group['name']);?>
</option>
<?php endforeach;
}
<?php
endforeach;
endif;
if ($rowIndex == 0)
echo "<option></option>";
?>
?>
</select>
<br />
</td>
@ -587,9 +589,9 @@ function sshkeyClicked(obj) {
<?=gettext("Hold down CTRL (pc)/COMMAND (mac) key to select multiple items");?>
</td>
</tr>
<?php if (isset($pconfig['uid'])): ?>
<?php
if (isset($pconfig['uid'])):
?>
<tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Effective Privileges");?></td>
<td width="78%" class="vtable">
@ -600,39 +602,42 @@ function sshkeyClicked(obj) {
<td width="40%" class="listhdrr"><?=gettext("Description");?></td>
<td class="list"></td>
</tr>
<?php
$privdesc = get_user_privdesc($a_user[$id]);
if(is_array($privdesc)):
$i = 0;
foreach ($privdesc as $priv):
$group = false;
if ($priv['group'])
$group = $priv['group'];
?>
<?php
$privdesc = get_user_privdesc($a_user[$id]);
if(is_array($privdesc)):
$i = 0;
foreach ($privdesc as $priv):
$group = false;
if ($priv['group'])
$group = $priv['group'];
?>
<tr>
<td class="listlr"><?=$group;?></td>
<td class="listr">
<?=htmlspecialchars($priv['name']);?>
</td>
<td class="listbg">
<?=htmlspecialchars($priv['descr']);?>
<?=htmlspecialchars($priv['descr']);?>
</td>
<td valign="middle" class="list nowrap">
<?php if (!$group): ?>
<?php
if (!$group):
?>
<a href="system_usermanager.php?act=delpriv&amp;id=<?=$id?>&amp;privid=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this privilege?");?>')">
<img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0" alt="delete" />
</a>
<?php endif; ?>
<?php
endif;
?>
</td>
</tr>
<?php
/* can only delete user priv indexes */
if (!$group)
$i++;
endforeach;
endif;
?>
<?php
/* can only delete user priv indexes */
if (!$group)
$i++;
endforeach;
endif;
?>
<tr>
<td class="list" colspan="3"></td>
<td class="list">
@ -653,21 +658,24 @@ function sshkeyClicked(obj) {
<td width="45%" class="listhdrr"><?=gettext("CA");?></td>
<td class="list"></td>
</tr>
<?php
$a_cert = $a_user[$id]['cert'];
if(is_array($a_cert)):
$i = 0;
foreach ($a_cert as $certref):
$cert = lookup_cert($certref);
$ca = lookup_ca($cert['caref']);
?>
<?php
$a_cert = $a_user[$id]['cert'];
if(is_array($a_cert)):
$i = 0;
foreach ($a_cert as $certref):
$cert = lookup_cert($certref);
$ca = lookup_ca($cert['caref']);
?>
<tr>
<td class="listlr">
<?=htmlspecialchars($cert['descr']);?>
<?php if (is_cert_revoked($cert)): ?>
<?php
if (is_cert_revoked($cert)):
?>
(<b>Revoked</b>)
<?php endif; ?>
<?php
endif;
?>
</td>
<td class="listr">
<?=htmlspecialchars($ca['descr']);?>
@ -684,11 +692,11 @@ function sshkeyClicked(obj) {
</a>
</td>
</tr>
<?php
$i++;
endforeach;
endif;
?>
<?php
$i++;
endforeach;
endif;
?>
<tr>
<td class="list" colspan="2"></td>
<td class="list">
@ -701,90 +709,95 @@ function sshkeyClicked(obj) {
</td>
</tr>
<?php else : ?>
<?php if (is_array($config['ca']) && count($config['ca']) > 0): ?>
<?php $i = 0; foreach( $config['ca'] as $ca) {
if (!$ca['prv'])
continue;
$i++;
}
?>
<?php
else:
if (is_array($config['ca']) && count($config['ca']) > 0):
$i = 0;
foreach( $config['ca'] as $ca) {
if (!$ca['prv'])
continue;
$i++;
}
?>
<tr id="usercertchck">
<td width="22%" valign="top" class="vncell"><?=gettext("Certificate");?></td>
<td width="78%" class="vtable">
<td width="78%" class="vtable">
<input type="checkbox" onclick="javascript:usercertClicked(this)" /> <?=gettext("Click to create a user certificate."); ?>
</td>
</tr>
<?php if ($i > 0): ?>
<?php
if ($i > 0):
?>
<tr id="usercert" style="display:none">
<td width="22%" valign="top" class="vncell"><?=gettext("Certificate");?></td>
<td width="78%" class="vtable">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="certificate">
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
<td width="78%" class="vtable">
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate authority");?></td>
<td width="78%" class="vtable">
<select name='caref' id='caref' class="formselect" onchange='internalca_change()'>
<?php
$rowIndex = 0;
foreach( $config['ca'] as $ca):
if (!$ca['prv'])
continue;
$rowIndex++;
?>
<option value="<?=$ca['refid'];?>"><?=$ca['descr'];?></option>
<?php endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Key length");?></td>
<td width="78%" class="vtable">
<select name='keylen' class="formselect">
<?php
$cert_keylens = array( "2048", "512", "1024", "4096");
foreach( $cert_keylens as $len):
?>
<option value="<?=$len;?>"><?=$len;?></option>
<?php
endforeach;
if (!count($cert_keylens))
echo "<option></option>";
?>
</select>
bits
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
<td width="78%" class="vtable">
<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>" />days
</td>
</tr>
</table>
<td width="78%" class="vtable">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="certificate">
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Descriptive name");?></td>
<td width="78%" class="vtable">
<input name="name" type="text" class="formfld unknown" id="name" size="20" value="<?=htmlspecialchars($pconfig['name']);?>" />
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Certificate authority");?></td>
<td width="78%" class="vtable">
<select name='caref' id='caref' class="formselect" onchange='internalca_change()'>
<?php
$rowIndex = 0;
foreach( $config['ca'] as $ca):
if (!$ca['prv'])
continue;
$rowIndex++;
?>
<option value="<?=$ca['refid'];?>"><?=$ca['descr'];?></option>
<?php
endforeach;
if ($rowIndex == 0)
echo "<option></option>";
?>
</select>
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Key length");?></td>
<td width="78%" class="vtable">
<select name='keylen' class="formselect">
<?php
$cert_keylens = array( "2048", "512", "1024", "4096");
foreach( $cert_keylens as $len):
?>
<option value="<?=$len;?>"><?=$len;?></option>
<?php
endforeach;
if (!count($cert_keylens))
echo "<option></option>";
?>
</select>
bits
</td>
</tr>
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Lifetime");?></td>
<td width="78%" class="vtable">
<input name="lifetime" type="text" class="formfld unknown" id="lifetime" size="5" value="<?=htmlspecialchars($pconfig['lifetime']);?>" />days
</td>
</tr>
</table>
</td>
</tr>
<?php endif; endif; ?>
<?php endif; ?>
<?php
endif;
endif;
endif;
?>
<tr id="sshkeychck" <?php if(!empty($pconfig['authorizedkeys'])) echo 'style="display:none"'; ?>>
<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
<td width="78%" class="vtable">
<input type="checkbox" onclick="javascript:sshkeyClicked(this)" /> <?=gettext("Click to paste an authorized key."); ?>
</td>
</tr>
<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
<td width="78%" class="vtable">
<input type="checkbox" onclick="javascript:sshkeyClicked(this)" /> <?=gettext("Click to paste an authorized key."); ?>
</td>
</tr>
<tr id="sshkey" <?php if(empty($pconfig['authorizedkeys'])) echo 'style="display:none"'; ?>>
<td width="22%" valign="top" class="vncell"><?=gettext("Authorized keys");?></td>
<td width="78%" class="vtable">
@ -817,9 +830,9 @@ function sshkeyClicked(obj) {
</tr>
</table>
</form>
<?php else: ?>
<?php
else:
?>
<table class="sortable" width="100%" border="0" cellpadding="0" cellspacing="0" summary="">
<thead>
<tr>
@ -854,21 +867,21 @@ function sshkeyClicked(obj) {
</tr>
</tfoot>
<tbody>
<?php
$i = 0;
foreach($a_user as $userent):
?>
<?php
$i = 0;
foreach($a_user as $userent):
?>
<tr ondblclick="document.location='system_usermanager.php?act=edit&amp;id=<?=$i;?>'">
<td class="listlr">
<table border="0" cellpadding="0" cellspacing="0" summary="icons">
<tr>
<td align="left" valign="middle">
<?php
if($userent['scope'] != "user")
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user-grey.png";
else
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user.png";
?>
<?php
if($userent['scope'] != "user")
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user-grey.png";
else
$usrimg = "/themes/{$g['theme']}/images/icons/icon_system-user.png";
?>
<img src="<?=$usrimg;?>" alt="<?=gettext("User"); ?>" title="<?=gettext("User"); ?>" border="0" height="16" width="16" />
</td>
<td align="left" valign="middle">
@ -880,30 +893,34 @@ function sshkeyClicked(obj) {
<td class="listr"><?=htmlspecialchars($userent['descr']);?>&nbsp;</td>
<td class="listr"><?php if(isset($userent['disabled'])) echo "*"; ?></td>
<td class="listbg">
<?=implode(",",local_user_get_groups($userent));?>
<?=implode(",",local_user_get_groups($userent));?>
&nbsp;
</td>
<td valign="middle" class="list nowrap">
<a href="system_usermanager.php?act=edit&amp;id=<?=$i;?>">
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_e.gif" title="<?=gettext("edit user"); ?>" alt="<?=gettext("edit user"); ?>" width="17" height="17" border="0" />
</a>
<?php if($userent['scope'] != "system"): ?>
<?php
if($userent['scope'] != "system"):
?>
&nbsp;
<a href="system_usermanager.php?act=deluser&amp;id=<?=$i;?>" onclick="return confirm('<?=gettext("Do you really want to delete this User?");?>')">
<img src="/themes/<?= $g['theme'];?>/images/icons/icon_x.gif" title="<?=gettext("delete user"); ?>" alt="<?=gettext("delete user"); ?>" width="17" height="17" border="0" />
</a>
<?php endif; ?>
<?php
endif;
?>
</td>
</tr>
<?php
$i++;
endforeach;
?>
<?php
$i++;
endforeach;
?>
</tbody>
</table>
<?php endif; ?>
<?php
endif;
?>
</div>
</td>
</tr>