$caname = ""; $inuse = ""; $revoked = ""; if (isset($cert['caref'])) { $ca = lookup_ca($cert['caref']); if (!empty($ca)) { $caname = " (CA: {$ca['descr']})"; } } if ($pconfig['certref'] == $cert['refid']) { $selected = "selected=\"selected\""; } if (cert_in_use($cert['refid'])) { $inuse = " *In Use"; } if (is_cert_revoked($cert)) { $revoked = " *Revoked"; } ?> <option value="<?php echo htmlspecialchars($cert['refid']); ?> " <?php echo $selected; ?> ><?php echo htmlspecialchars($cert['descr'] . $caname . $inuse . $revoked); ?> </option> <?php }
function build_cert_table() { global $a_user, $id; $certhtml = '<div class="table-responsive">'; $certhtml .= '<table class="table table-striped table-hover table-condensed">'; $certhtml .= '<thead>'; $certhtml .= '<tr>'; $certhtml .= '<th>' . gettext('Name') . '</th>'; $certhtml .= '<th>' . gettext('CA') . '</th>'; $certhtml .= '<th></th>'; $certhtml .= '</tr>'; $certhtml .= '</thead>'; $certhtml .= '<tbody>'; $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']); $revokedstr = is_cert_revoked($cert) ? '<b> Revoked</b>' : ''; $certhtml .= '<tr>'; $certhtml .= '<td>' . htmlspecialchars($cert['descr']) . $revokedstr . '</td>'; $certhtml .= '<td>' . htmlspecialchars($ca['descr']) . '</td>'; $certhtml .= '<td>'; $certhtml .= '<a id="delcert' . $i . '" class="fa fa-trash no-confirm icon-pointer" title="'; $certhtml .= gettext('Remove this certificate association? (Certificate will not be deleted)') . '"></a>'; $certhtml .= '</td>'; $certhtml .= '</tr>'; $i++; } } $certhtml .= '</tbody>'; $certhtml .= '</table>'; $certhtml .= '</div>'; $certhtml .= '<nav class="action-buttons">'; $certhtml .= '<a href="system_certmanager.php?act=new&userid=' . $id . '" class="btn btn-success">' . gettext("Add") . '</a>'; $certhtml .= '</nav>'; return $certhtml; }
</td> <td></td> </tr> <?php if (isset($a_user[$id]['cert']) && is_array($a_user[$id]['cert'])) { $i = 0; foreach ($a_user[$id]['cert'] as $certref) { $cert = lookup_cert($certref); $ca = lookup_ca($cert['caref']); ?> <tr> <td><?php echo htmlspecialchars($cert['descr']); ?> <?php echo is_cert_revoked($cert) ? "(<b>" . gettext('Revoked') . "</b>)" : ""; ?> </td> <td> <?php echo htmlspecialchars($ca['descr']); ?> </td> <td> <a href="system_usermanager.php?act=expckey&certid=<?php echo $i; ?> &userid=<?php echo $id; ?> "
function build_cert_list() { global $a_cert; $list = array('' => 'None (Username and/or Password required)'); foreach ($a_cert as $cert) { $caname = ""; $inuse = ""; $revoked = ""; $ca = lookup_ca($cert['caref']); if ($ca) { $caname = " (CA: {$ca['descr']})"; } if ($pconfig['certref'] == $cert['refid']) { $selected = "selected=\"selected\""; } if (cert_in_use($cert['refid'])) { $inuse = " *In Use"; } if (is_cert_revoked($cert)) { $revoked = " *Revoked"; } $list[$cert['refid']] = $cert['descr'] . $caname . $inuse . $revoked; } return $list; }
</td> </tr> <?php } ?> </tbody> </table> <?php } ?> </div> </div> <?php $ca_certs = array(); foreach ($a_cert as $cert) { if ($cert['caref'] == $crl['caref'] && !is_cert_revoked($cert, $id)) { $ca_certs[] = $cert; } } if (count($ca_certs) == 0) { print_info_box(gettext("No certificates found for this CA."), 'danger'); } else { $section = new Form_Section('Choose a Certificate to Revoke'); $group = new Form_Group(null); $group->add(new Form_Select('certref', null, $pconfig['certref'], build_cacert_list()))->setWidth(4)->setHelp('Certificate'); $group->add(new Form_Select('crlreason', null, -1, $openssl_crl_status))->setHelp('Reason'); $group->add(new Form_Button('submit', 'Add', null, 'fa-plus'))->addClass('btn-success btn-sm'); $section->add($group); $section->addInput(new Form_Input('id', null, 'hidden', $crl['refid'])); $section->addInput(new Form_Input('act', null, 'hidden', 'addcert')); $section->addInput(new Form_Input('crlref', null, 'hidden', $crl['refid']));