diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-12-17 07:35:31 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-12-17 07:35:31 -0500 |
commit | f224c8a2576866f1a2d1a9574cdc586c4bfbdd35 (patch) | |
tree | 2fac3dd5de7d9ff48b6961d1c8fca94e2112316f /src/usr/local/www/system_certmanager.php | |
parent | 6b8cd448a4a130ea97b8d3214e7b603cd8f79950 (diff) | |
parent | 78863416b2047257c406a105546cd3bde79487ab (diff) | |
download | pfsense-f224c8a2576866f1a2d1a9574cdc586c4bfbdd35.zip pfsense-f224c8a2576866f1a2d1a9574cdc586c4bfbdd35.tar.gz |
Merge pull request #2258 from phil-davis/r015
Diffstat (limited to 'src/usr/local/www/system_certmanager.php')
-rw-r--r-- | src/usr/local/www/system_certmanager.php | 82 |
1 files changed, 40 insertions, 42 deletions
diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php index 4ecd624..9fa7e51 100644 --- a/src/usr/local/www/system_certmanager.php +++ b/src/usr/local/www/system_certmanager.php @@ -248,7 +248,7 @@ if ($act == "csr") { if ($_POST) { // This is just the blank altername name that is added for display purposes. We don't want to validate/save it - if($_POST['altname_value0'] == "") { + if ($_POST['altname_value0'] == "") { unset($_POST['altname_type0']); unset($_POST['altname_value0']); } @@ -317,8 +317,7 @@ if ($_POST) { if (!substr_compare('altname_type', $key, 0, 12)) { $entry = substr($key, 12); $field = 'type'; - } - elseif (!substr_compare('altname_value', $key, 0, 13)) { + } elseif (!substr_compare('altname_value', $key, 0, 13)) { $entry = substr($key, 13); $field = 'value'; } @@ -507,8 +506,8 @@ if ($_POST) { /* input validation */ $reqdfields = explode(" ", "descr cert"); $reqdfieldsn = array( - gettext("Descriptive name"), - gettext("Final Certificate data")); + gettext("Descriptive name"), + gettext("Final Certificate data")); do_input_validation($_POST, $reqdfields, $reqdfieldsn, $input_errors); @@ -562,11 +561,13 @@ 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'); +} $tab_array = array(); $tab_array[] = array(gettext("CAs"), false, "system_camanager.php"); @@ -576,9 +577,9 @@ display_top_tabs($tab_array); // Load valid country codes $dn_cc = array(); -if (file_exists("/etc/ca_countries")){ +if (file_exists("/etc/ca_countries")) { $dn_cc_file=file("/etc/ca_countries"); - foreach($dn_cc_file as $line) { + foreach ($dn_cc_file as $line) { if (preg_match('/^(\S*)\s(.*)$/', $line, $matches)) { $dn_cc[$matches[1]] = $matches[1]; } @@ -588,14 +589,12 @@ if (file_exists("/etc/ca_countries")){ if ($act == "new" || (($_POST['save'] == gettext("Save")) && $input_errors)) { $form = new Form; -if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors)) -{ +if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors)) { $form->setAction('system_certmanager.php?act=csr'); $section = new Form_Section('Complete Signing Request'); - if (isset($id) && $a_cert[$id]) - { + if (isset($id) && $a_cert[$id]) { $form->addGlobal(new Form_Input( 'id', null, @@ -621,7 +620,7 @@ if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors)) $section->addInput(new Form_Textarea( 'cert', 'Final certificate data', - $pconfig["cert"] + $pconfig['cert'] ))->setHelp('Paste the certificate received from your certificate authority here.'); $form->add($section); @@ -633,8 +632,7 @@ if ($act == "csr" || (($_POST['save'] == gettext("Update")) && $input_errors)) $form->setAction('system_certmanager.php?act=edit'); -if (isset($userid) && $a_user) -{ +if (isset($userid) && $a_user) { $form->addGlobal(new Form_Input( 'userid', null, @@ -643,8 +641,7 @@ if (isset($userid) && $a_user) )); } -if (isset($id) && $a_cert[$id]) -{ +if (isset($id) && $a_cert[$id]) { $form->addGlobal(new Form_Input( 'id', null, @@ -655,8 +652,7 @@ if (isset($id) && $a_cert[$id]) $section = new Form_Section('Add a new certificate'); -if (!isset($id)) -{ +if (!isset($id)) { $section->addInput(new Form_Select( 'method', 'Method', @@ -692,22 +688,19 @@ $form->add($section); $section = new Form_Section('Internal Certificate'); $section->addClass('toggle-internal collapse'); -if (!$internal_ca_count) -{ +if (!$internal_ca_count) { $section->addInput(new Form_StaticText( 'Certificate authority', gettext('No internal Certificate Authorities have been defined. You must '). '<a href="system_camanager.php?act=new&method=internal"> '. gettext(" create") .'</a>'. gettext(' an internal CA before creating an internal certificate.') )); -} -else -{ +} else { $allCas = array(); - foreach ($a_ca as $ca) - { - if (!$ca['prv']) - continue; + foreach ($a_ca as $ca) { + if (!$ca['prv']) { + continue; + } $allCas[ $ca['refid'] ] = $ca['descr']; } @@ -797,8 +790,7 @@ $section->addInput(new Form_Input( ['placeholder' => 'e.g. www.example.com'] )); -if (empty($pconfig['altnames']['item'])) -{ +if (empty($pconfig['altnames']['item'])) { $pconfig['altnames']['item'] = array( array('type' => null, 'value' => null) ); @@ -920,19 +912,23 @@ $section->addClass('toggle-existing collapse'); $existCerts = array(); foreach ($config['cert'] as $cert) { - if(is_array($config['system']['user'][$userid]['cert'])) { // Could be MIA! - if (isset($userid) && in_array($cert['refid'], $config['system']['user'][$userid]['cert'])) + if (is_array($config['system']['user'][$userid]['cert'])) { // Could be MIA! + if (isset($userid) && in_array($cert['refid'], $config['system']['user'][$userid]['cert'])) { continue; + } } $ca = lookup_ca($cert['caref']); - if ($ca) + if ($ca) { $cert['descr'] .= " (CA: {$ca['descr']})"; + } - if (cert_in_use($cert['refid'])) + if (cert_in_use($cert['refid'])) { $cert['descr'] .= " <i>In Use</i>"; - if (is_cert_revoked($cert)) + } + if (is_cert_revoked($cert)) { $cert['descr'] .= " <b>Revoked</b>"; + } $existCerts[ $cert['refid'] ] = $cert['descr']; } @@ -1011,7 +1007,7 @@ print $form; </thead> <tbody> <?php -foreach($a_cert as $i => $cert): +foreach ($a_cert as $i => $cert): $name = htmlspecialchars($cert['descr']); if ($cert['crt']) { @@ -1020,10 +1016,11 @@ foreach($a_cert as $i => $cert): $purpose = cert_get_purpose($cert['crt']); list($startdate, $enddate) = cert_get_dates($cert['crt']); - if ($subj==$issuer) + if ($subj == $issuer) { $caname = '<i>'. gettext("self-signed") .'</i>'; - else + } else { $caname = '<i>'. gettext("external").'</i>'; + } $subj = htmlspecialchars($subj); } @@ -1034,8 +1031,9 @@ foreach($a_cert as $i => $cert): } $ca = lookup_ca($cert['caref']); - if ($ca) + if ($ca) { $caname = $ca['descr']; + } ?> <tr> <td> @@ -1050,7 +1048,7 @@ foreach($a_cert as $i => $cert): <td><?=$caname?></td> <td> <?=$subj?> - <?php if (! $cert['csr']): ?> + <?php if (!$cert['csr']): ?> <br /> <small> <?=gettext("Valid From")?>: <b><?=$startdate ?></b><br /><?=gettext("Valid Until")?>: <b><?=$enddate ?></b> @@ -1115,7 +1113,7 @@ foreach($a_cert as $i => $cert): ?> <script type="text/javascript"> //<![CDATA[ -events.push(function(){ +events.push(function() { <?php if ($internal_ca_count): ?> function internalca_change() { |