Project

General

Profile

« Previous | Next » 

Revision 78863416

Added by Phil Davis over 9 years ago

Code style System Certificates

View differences:

src/usr/local/www/system_camanager.php
317 317
						array_push($input_errors, "openssl library returns: " . $ssl_err);
318 318
					}
319 319
				}
320
			}
321
			else if ($pconfig['method'] == "intermediate") {
320
			} else if ($pconfig['method'] == "intermediate") {
322 321
				$dn = array(
323 322
					'countryName' => $pconfig['dn_country'],
324 323
					'stateOrProvinceName' => $pconfig['dn_state'],
......
353 352

  
354 353
include("head.inc");
355 354

  
356
if ($input_errors)
355
if ($input_errors) {
357 356
	print_input_errors($input_errors);
357
}
358 358

  
359
if ($savemsg)
359
if ($savemsg) {
360 360
	print_info_box($savemsg, 'success');
361
}
361 362

  
362 363
// Load valid country codes
363 364
$dn_cc = array();
364
if (file_exists("/etc/ca_countries")){
365
if (file_exists("/etc/ca_countries")) {
365 366
	$dn_cc_file=file("/etc/ca_countries");
366
	foreach($dn_cc_file as $line) {
367
	foreach ($dn_cc_file as $line) {
367 368
		if (preg_match('/^(\S*)\s(.*)$/', $line, $matches)) {
368 369
			$dn_cc[$matches[1]] = $matches[1];
369 370
		}
......
376 377
$tab_array[] = array(gettext("Certificate Revocation"), false, "system_crlmanager.php");
377 378
display_top_tabs($tab_array);
378 379

  
379
if (!($act == "new" || $act == "edit" || $act == gettext("Save") || $input_errors))
380
{
380
if (!($act == "new" || $act == "edit" || $act == gettext("Save") || $input_errors)) {
381 381
?>
382 382
<div class="table-responsive">
383 383
<table class="table table-striped table-hover">
......
398 398
	$subj = cert_get_subject($ca['crt']);
399 399
	$issuer = cert_get_issuer($ca['crt']);
400 400
	list($startdate, $enddate) = cert_get_dates($ca['crt']);
401
	if ($subj == $issuer)
401
	if ($subj == $issuer) {
402 402
		$issuer_name = gettext("self-signed");
403
	else
403
	} else {
404 404
		$issuer_name = gettext("external");
405
	}
405 406
	$subj = htmlspecialchars($subj);
406 407
	$issuer = htmlspecialchars($issuer);
407 408
	$certcount = 0;
408 409

  
409 410
	$issuer_ca = lookup_ca($ca['caref']);
410
	if ($issuer_ca)
411
	if ($issuer_ca) {
411 412
		$issuer_name = $issuer_ca['descr'];
413
	}
412 414

  
413 415
	// TODO : Need gray certificate icon
414 416
	$internal = (!!$ca['prv']);
415 417

  
416
	foreach ($a_cert as $cert)
417
		if ($cert['caref'] == $ca['refid'])
418
	foreach ($a_cert as $cert) {
419
		if ($cert['caref'] == $ca['refid']) {
418 420
			$certcount++;
421
		}
422
	}
419 423

  
420
	foreach ($a_ca as $cert)
421
		if ($cert['caref'] == $ca['refid'])
424
	foreach ($a_ca as $cert) {
425
		if ($cert['caref'] == $ca['refid']) {
422 426
			$certcount++;
427
		}
428
	}
423 429
?>
424 430
		<tr>
425 431
			<td><?=$name?></td>
......
459 465

  
460 466
$form = new Form;
461 467
//$form->setAction('system_camanager.php?act=edit');
462
if (isset($id) && $a_ca[$id])
463
{
468
if (isset($id) && $a_ca[$id]) {
464 469
	$form->addGlobal(new Form_Input(
465 470
		'id',
466 471
		null,
......
469 474
	));
470 475
}
471 476

  
472
if ($act == "edit")
473
{
477
if ($act == "edit") {
474 478
	$form->addGlobal(new Form_Input(
475 479
		'refid',
476 480
		null,
......
488 492
	$pconfig['descr']
489 493
));
490 494

  
491
if (!isset($id) || $act == "edit")
492
{
495
if (!isset($id) || $act == "edit") {
493 496
	$section->addInput(new Form_Select(
494 497
		'method',
495 498
		'Method',
......
531 534
$section->addClass('toggle-internal', 'toggle-intermediate', 'collapse');
532 535

  
533 536
$allCas = array();
534
foreach ($a_ca as $ca)
535
{
536
	if (!$ca['prv'])
537
foreach ($a_ca as $ca) {
538
	if (!$ca['prv']) {
537 539
			continue;
540
	}
538 541

  
539 542
	$allCas[ $ca['refid'] ] = $ca['descr'];
540 543
}

Also available in: Unified diff