Formatting tidy

This commit is contained in:
John Crisp
2020-03-06 12:55:50 +01:00
parent dcc5f75e90
commit b4c1219bd5

View File

@@ -32,25 +32,27 @@ if ( !($show_valid.$show_revoked.$show_expired) ) {
$show_expired = 'E'; $show_expired = 'E';
} }
$qstr_filter = 'search='.htvar($search).'&'. $qstr_filter = 'search='.htvar($search) . '&' . "show_valid=$show_valid&" . "show_revoked=$show_revoked&" . "show_expired=$show_expired&";
"show_valid=$show_valid&".
"show_revoked=$show_revoked&".
"show_expired=$show_expired&";
$qstr_sort = "sortfield=$sortfield&ascdec=$ascdec"; $qstr_sort = "sortfield=$sortfield&ascdec=$ascdec";
switch ($stage) { switch ($stage) {
case 'goaway': case 'goaway':
printHeader(false); printHeader(false);
?> <p><center><h1><font color=red>YOU ARE A VERY BAD BOY!</font></h2></center> <?php ?>
<p><center><h1><font color="red">YOU ARE A VERY BAD BOY!</font></h2></center>
<?php
break; break;
case 'display': case 'display':
printHeader(false); printHeader(false);
?> ?>
<center><h2>Certificate Details</h2></center> <center><h2>Certificate Details</h2></center>
<center><font color=#0000AA><h3>(#<?php echo $serial?>)<br><?php echo htvar(CA_cert_cname($serial).' <'.CA_cert_email($serial).'>')?> </h3></font></center> <center><font color="#0000AA"><h3>(#<?php echo $serial?>)<br><?php echo htvar(CA_cert_cname($serial).' <'.CA_cert_email($serial).'>')?> </h3></font></center>
<?php <?php
if ($revoke_date = CAdb_is_revoked($serial)) { if ($revoke_date = CAdb_is_revoked($serial)) {
@@ -67,19 +69,19 @@ case 'dl-confirm':
?> ?>
<h3>You are about to download the <font color=red>PRIVATE</font> certificate key for <?php echo $rec['common_name'].' &lt;'.$rec['email'].'&gt; '?></h3> <h3>You are about to download the <font color=red>PRIVATE</font> certificate key for <?php echo $rec['common_name'].' &lt;'.$rec['email'].'&gt; '?></h3>
<h3><font color=red>DO NOT DISTRIBUTE THIS FILE TO THE PUBLIC!</font></h3> <h3><font color="red">DO NOT DISTRIBUTE THIS FILE TO THE PUBLIC!</font></h3>
<form action="<?php echo $PHP_SELF.'?stage=download&serial='.$serial.'&'.$qstr_sort.'&'.$qstr_filter?>" method=post> <form action="<?php echo $PHP_SELF.'?stage=download&serial='.$serial.'&'.$qstr_sort.'&'.$qstr_filter?>" method="post">
<strong>File type: </strong> <strong>File type: </strong>
<select name=dl_type> <select name="dl_type">
<option value="PKCS#12">PKCS#12 Bundle</option> <option value="PKCS#12">PKCS#12 Bundle</option>
<option value="PEMCERT">PEM Certificate</option> <option value="PEMCERT">PEM Certificate</option>
<option value="PEMKEY">PEM Key</option> <option value="PEMKEY">PEM Key</option>
<option value="PEMBUNDLE">PEM Bundle</option> <option value="PEMBUNDLE">PEM Bundle</option>
<option value="PEMCABUNDLE">PEM Bundle w/Root</option> <option value="PEMCABUNDLE">PEM Bundle w/Root</option>
</select> </select>
<input type=submit name=submit value="Download"> <input type="submit" name="submit" value="Download">
&nbsp; or &nbsp; &nbsp; or &nbsp;
<input type=submit name=submit value="Go Back"> <input type="submit" name="submit" value="Go Back">
</form> </form>
<?php <?php
@@ -118,11 +120,12 @@ case 'revoke-form':
printHeader('ca'); printHeader('ca');
?> ?>
<h4>You are about to <font color=red>REVOKE</font> the following certificate:<hr> <h4>You are about to <font color=red>REVOKE</font> the following certificate:
<table width=500><tr> <hr>
<td width=25% style='white-space: nowrap'> <table width="500px"><tr>
<p align=right> <td width="25%" style="white-space: nowrap">
Serial Number<br> <p align="right">
Serial Number<br>
User's Name<br> User's Name<br>
Email Address<br> Email Address<br>
Organization<br> Organization<br>
@@ -130,7 +133,7 @@ case 'revoke-form':
Locality<br> Locality<br>
State/Province<br> State/Province<br>
Country<br> Country<br>
</p> </p>
</td> </td>
<?php <?php
@@ -145,8 +148,8 @@ case 'revoke-form':
'.htvar($rec[province]).'<br> '.htvar($rec[province]).'<br>
'.htvar($rec[country]).'<br> '.htvar($rec[country]).'<br>
</td> </td>
</tr></table> </tr></table>
<h4>Are you sure?</h4> <h4>Are you sure?</h4>
<form action="'.$PHP_SELF.'?'.$qstr_sort.'&'.$qstr_filter.'" method=post> <form action="'.$PHP_SELF.'?'.$qstr_sort.'&'.$qstr_filter.'" method=post>
<input type=hidden name=stage value=revoke > <input type=hidden name=stage value=revoke >
<input type=hidden name=serial value='.$serial.' > <input type=hidden name=serial value='.$serial.' >
@@ -188,9 +191,9 @@ case 'renew-form':
# need the expiry value, but the old cert values will override # need the expiry value, but the old cert values will override
# the rest. # the rest.
# #
if (! $submit and file_exists("config/user-${PHPki_user}.php")) if (! $submit and file_exists("config/user-${PHPki_user}.php")) {
include("config/user-${PHPki_user}.php"); include("config/user-${PHPki_user}.php");
}
# #
# Get values from the old certificate. # Get values from the old certificate.
# #
@@ -212,44 +215,44 @@ case 'renew-form':
<th colspan="2"><h3>Certificate Renewal Form</h3></th> <th colspan="2"><h3>Certificate Renewal Form</h3></th>
<tr> <tr>
<td colspan="2" style="text-align:center"><h4>This will Revoke the old Certificate and Create a new one<br>You can add a password if required</h4></td> <td colspan="2" style="text-align:center">This will Revoke the old Certificate and Create a new one<br>You can add a password if required</td>
</tr> </tr>
<tr> <tr>
<td width="25%">Common Name </td> <td width="25%">Common Name </td>
<td><input type=text name=common_name value="<?php echo htvar($common_name)?>" size=50 maxlength=60 disabled></td> <td><input type="text"" name="common_name" value="<?php echo htvar($common_name)?>" size="50" maxlength="60" disabled></td>
</tr> </tr>
<tr> <tr>
<td>E-mail Address </td> <td>E-mail Address </td>
<td><input type=text name=email value="<?php echo htvar($email)?>" size=50 maxlength=60 disabled></td> <td><input type="text" name="email" value="<?php echo htvar($email)?>" size="50" maxlength="60" disabled></td>
</tr> </tr>
<tr> <tr>
<td>Organization </td> <td>Organization </td>
<td><input type=text name=organization value="<?php echo htvar($organization)?>" size=60 maxlength=60 disabled></td> <td><input type="text" name="organization" value="<?php echo htvar($organization)?>" size="60" maxlength="60" disabled></td>
</tr> </tr>
<tr> <tr>
<td>Department/Unit </td><td><input type=text name=unit value="<?php echo htvar($unit) ?>" size=40 maxlength=60 disabled></td> <td>Department/Unit </td><td><input type="text" name="unit" value="<?php echo htvar($unit) ?>" size="40" maxlength="60" disabled></td>
</tr> </tr>
<tr> <tr>
<td>Locality</td><td><input type=text name=locality value="<?php echo htvar($locality) ?>" size=30 maxlength=30 disabled></td> <td>Locality</td><td><input type="text" name="locality" value="<?php echo htvar($locality) ?>" size="30" maxlength="30" disabled></td>
</tr> </tr>
<tr> <tr>
<td>State/Province</td><td><input type=text name=province value="<?php echo htvar($province) ?>" size=30 maxlength=30 disabled></td> <td>State/Province</td><td><input type="text" name="province" value="<?php echo htvar($province) ?>" size="30" maxlength="30" disabled></td>
</tr> </tr>
<tr> <tr>
<td>Country</td> <td>Country</td>
<td><input type=text name=country value="<?php echo htvar($country) ?>" size=2 maxlength=2 disabled></td> <td><input type="text" name="country" value="<?php echo htvar($country) ?>" size="2" maxlength="2" disabled></td>
</tr> </tr>
<tr> <tr>
<td>Certificate Password </td> <td>Certificate Password </td>
<td><input type=password name=passwd value="<?php echo htvar($passwd) ?>" size=30></td> <td><input type="password" name="passwd" value="<?php echo htvar($passwd) ?>" size="30"></td>
</tr> </tr>
<tr> <tr>
@@ -272,14 +275,15 @@ case 'renew-form':
<tr> <tr>
<td>&nbsp</td> <td>&nbsp</td>
<td> <td>
<input type=submit name=submit value="Submit Request">&nbsp <input type="submit" name="submit" value="Submit Request">&nbsp
<input type=submit name=submit value="Back"> <input type="submit" name="submit" value="Back">
<input type=hidden name=stage value=renew> <input type="hidden" name="stage" value="renew">
<input type=hidden name=serial value="<?php echo $serial ?>" > <input type="hidden" name="serial" value="<?php echo $serial ?>" >
</td> </td>
</tr> </tr>
</table> </table>
</form> </form>
<?php <?php
printFooter(); printFooter();
@@ -287,8 +291,9 @@ case 'renew-form':
case 'renew': case 'renew':
$ret = true; $ret = true;
if ($submit == "Submit Request") if ($submit == "Submit Request") {
list($ret, $errtxt) = CA_renew_cert($serial, $expiry, $passwd); list($ret, $errtxt) = CA_renew_cert($serial, $expiry, $passwd);
}
if (! $ret) { if (! $ret) {
printHeader('ca'); printHeader('ca');
@@ -303,7 +308,7 @@ case 'renew':
<pre><?php echo $errtxt?></pre> <pre><?php echo $errtxt?></pre>
</blockquote> </blockquote>
<p> <p>
<input type=submit name=submit value=Back> <input type="submit" name="submit" value="Back">
<p> <p>
</form> </form>
<?php <?php
@@ -320,15 +325,19 @@ default:
?> ?>
<body onLoad="self.focus();document.filter.search.focus();"> <body onLoad="self.focus();document.filter.search.focus();">
<table> <table style="margin:0 auto">
<tr><th colspan=9><big>CERTIFICATE MANAGEMENT CONTROL PANEL</big></th></tr> <tr><th colspan=9><big>CERTIFICATE MANAGEMENT CONTROL PANEL</big></th></tr>
<tr><td colspan=9><center> <tr><td colspan=9><center>
<form action="<?php echo "$PHP_SELF?$qstr_sort"?>" method=get name=filter> <form action="<?php echo "$PHP_SELF?$qstr_sort"?>" method="get" name="filter">
Search: <input type=text name=search value="<?php echo htvar($search)?>" style="font-size: 11px;" maxlength=60 size=30> Search: <input type="text" name=search" value="<?php echo htvar($search)?>" style="font-size: 11px;" maxlength="60" size="30">
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type=checkbox name=show_valid value="V" <?php echo ($show_valid?'checked':'')?>>Valid &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
&nbsp&nbsp<input type=checkbox name=show_revoked value="R" <?php echo ($show_revoked?'checked':'')?>>Revoked <input type="checkbox" name="show_valid" value="V" <?php echo ($show_valid?'checked':'')?>>Valid
&nbsp&nbsp<input type=checkbox name=show_expired value="E" <?php echo ($show_expired?'checked':'')?>>Expired &nbsp&nbsp
&nbsp&nbsp&nbsp&nbsp&nbsp<input type=submit name=submit value="Apply Filter" style="font-size: 11px;"> <input type="checkbox" name="show_revoked" value="R" <?php echo ($show_revoked?'checked':'')?>>Revoked
&nbsp&nbsp
<input type="checkbox" name="show_expired" value="E" <?php echo ($show_expired?'checked':'')?>>Expired
&nbsp&nbsp&nbsp&nbsp&nbsp
<input type="submit" name="submit" value="Apply Filter" style="font-size: 11px;">
</form> </form>
</center></td> </center></td>
</tr> </tr>
@@ -349,6 +358,7 @@ default:
} }
print '<tr>'; print '<tr>';
$headings = array( $headings = array(
'status'=>"Status", 'issued'=>"Issued", 'expires'=>"Expires", 'status'=>"Status", 'issued'=>"Issued", 'expires'=>"Expires",
'common_name'=>"User's Name", 'email'=>"E-mail", 'common_name'=>"User's Name", 'email'=>"E-mail",
@@ -385,27 +395,27 @@ default:
foreach($db as $rec) { foreach($db as $rec) {
print '<tr style="font-size: 11px;"> print '<tr style="font-size: 11px;">
<td><font color='.$stcolor[$rec['status']].'><b>' .$rec[status].'</b></font></td> <td><font color='.$stcolor[$rec['status']].'><b>' .$rec[status].'</b></font></td>
<td style="white-space: nowrap">'.$rec[issued].'</td> <td style="white-space: nowrap">'.$rec['issued'].'</td>
<td style="white-space: nowrap">'.$rec[expires].'</td> <td style="white-space: nowrap">'.$rec['expires'].'</td>
<td>'.$rec[common_name].'</td> <td>'.$rec['common_name'].'</td>
<td style="white-space: nowrap"><a href="mailto:' . htvar($rec['common_name']) . ' <' . htvar($rec['email']) . '>" >' . htvar($rec['email']) . '</a></td> <td style="white-space: nowrap"><a href="mailto:' . htvar($rec['common_name']) . ' <' . htvar($rec['email']) . '>" >' . htvar($rec['email']) . '</a></td>
<td>'.htvar($rec[organization]).'</td> <td>'.htvar($rec['organization']).'</td>
<td>'.htvar($rec[unit]).'</td> <td>'.htvar($rec['unit']).'</td>
<td>'.htvar($rec[locality]).'</td> <td>'.htvar($rec['locality']).'</td>
<td><a href="'.$PHP_SELF.'?stage=display&serial='.$rec[serial].'" target=_certdisp>'. <td><a href="'.$PHP_SELF.'?stage=display&serial='.$rec['serial'].'" target=_certdisp>'.
'<img src=../images/display.png alt="Display" title="Display complete certificate details."></a>'; '<img src=../images/display.png alt="Display" title="Display complete certificate details."></a>';
if ($rec['status'] == 'Valid') { if ($rec['status'] == 'Valid') {
print ' print '
<a href="'.$PHP_SELF.'?stage=dl-confirm&serial='.$rec[serial].'&'.$qstr_sort.'&'.$qstr_filter.'">'. <a href="'.$PHP_SELF.'?stage=dl-confirm&serial='.$rec['serial'].'&'.$qstr_sort.'&'.$qstr_filter.'">'.
'<img src=../images/download.png alt="Download" title="Download the PRIVATE certificate. DO NOT DISTRIBUTE THIS TO THE PUBLIC!"></a> '<img src=../images/download.png alt="Download" title="Download the PRIVATE certificate. DO NOT DISTRIBUTE THIS TO THE PUBLIC!"></a>
<a href="'.$PHP_SELF.'?stage=revoke-form&serial='.$rec[serial].'&'.$qstr_sort.'&'.$qstr_filter.'">'. <a href="'.$PHP_SELF.'?stage=revoke-form&serial='.$rec['serial'].'&'.$qstr_sort.'&'.$qstr_filter.'">'.
'<img src=../images/revoke.png alt="Revoke" title="Revoke the certificate when the e-mail address is no longer valid or the certificate password or private key has been compromised."></a>'; '<img src=../images/revoke.png alt="Revoke" title="Revoke the certificate when the e-mail address is no longer valid or the certificate password or private key has been compromised."></a>';
} }
print ' print '
<a href="'.$PHP_SELF.'?stage=renew-form&serial='.$rec[serial].'&'.$qstr_sort.'&'.$qstr_filter.'">'. <a href="'.$PHP_SELF.'?stage=renew-form&serial='.$rec['serial'].'&'.$qstr_sort.'&'.$qstr_filter.'">'.
'<img src=../images/renew.png alt="Renew" title="Renew the certificate by revoking it, if necessary, and creating a replacement with a new expiration date."></a></td></tr>'; '<img src=../images/renew.png alt="Renew" title="Renew the certificate by revoking it, if necessary, and creating a replacement with a new expiration date."></a>
</td></tr>';
} }
print '</table>'; print '</table>';