[3232] | 1 | <?php |
---|
| 2 | $GLOBALS['phpgw_info'] = array(); |
---|
| 3 | $GLOBALS['phpgw_info']['flags']['currentapp'] = 'admin'; |
---|
| 4 | include('../header.inc.php'); |
---|
| 5 | require_once('classes/CertificadoB.php'); |
---|
| 6 | |
---|
| 7 | if($GLOBALS['CRLs'] == '') |
---|
| 8 | { |
---|
[3377] | 9 | echo '<br/><br/><br/><div align="center"><h3><b>' . lang('CRLs use is disable') . '.<b><h3><br/><br/>'; |
---|
| 10 | echo '<a href="security_admin.php" style="text-decoration:none"><input type="button" value="' . lang('Back') . '"/></a></div>'; |
---|
[3232] | 11 | exit(); |
---|
| 12 | } |
---|
| 13 | |
---|
| 14 | if($_POST) |
---|
| 15 | { |
---|
| 16 | if($_POST['atualizar']) |
---|
| 17 | { |
---|
| 18 | $saida = array(); |
---|
| 19 | $aa = pathinfo($GLOBALS['arquivos_crls']); |
---|
| 20 | $a = $aa['dirname'] . '/crl_admin.py'; |
---|
| 21 | $w = exec($a,$saida); |
---|
| 22 | } |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | $path1 = $GLOBALS['arquivos_crls']; |
---|
| 26 | $arq = file_get_contents($path1); |
---|
| 27 | echo '<script type="text/javascript" src="certificados.js" ></script>'; |
---|
| 28 | echo '<div style="padding-left:90px" >'; |
---|
[3377] | 29 | echo '<a href="../security/security_admin.php" style="text-decoration:none"><input type="button" value="' . lang('Back') . '"/></a>'; |
---|
[3232] | 30 | echo '<input type="hidden" name="adicionar" value="adicionar" />'; |
---|
| 31 | $Linhas = explode(chr(0x0A),$arq); |
---|
| 32 | if($path1) |
---|
| 33 | { |
---|
| 34 | |
---|
[3377] | 35 | echo '<h2 style="color: #000066">' . lang('RCLs configurated') . ':</h2>'; |
---|
[3232] | 36 | echo '<div id="xdiv2" style="border: #000000 1px solid; overflow: auto; width: 870px; height: 190px; white-space: pre; padding: 3px; " >'; |
---|
| 37 | echo '<table border ="1" style="margin-top: 8px; width: 770px">'; |
---|
[3377] | 38 | echo '<th nowrap align="left" style=" padding: 5px">' . lang('RCLs get in') . ':</th><th nowrap align="left" style=" padding: 5px">' . lang('Where save RCLs') . ':</th>'; |
---|
[3232] | 39 | foreach($Linhas as $linhaz) |
---|
| 40 | { |
---|
| 41 | $linha = trim($linhaz); |
---|
| 42 | if($linha[0] != '#' && $linha != '') |
---|
| 43 | { |
---|
| 44 | $n = explode('/',$linha); |
---|
| 45 | $f = $GLOBALS['CRLs'] . $n[count($n)-1]; |
---|
| 46 | echo '<tr><td nowrap valign="top" style=" padding: 5px">' . $linha . '</td><td nowrap style=" padding: 5px">'; |
---|
| 47 | echo $f; |
---|
| 48 | if(!is_file($f)) |
---|
| 49 | { |
---|
[3377] | 50 | echo '<p style="margin-bottom: 5px"><b style="color: #FF0000">' . lang('File not found') . '.</b></p>'; |
---|
[3232] | 51 | } |
---|
| 52 | else |
---|
| 53 | { |
---|
| 54 | $data = file_get_contents($f); |
---|
| 55 | $dados = Crl_parseASN($data); |
---|
[3377] | 56 | echo '<br/><br/>' . lang ('Issuer') . ': '; |
---|
[3232] | 57 | $aux = $dados[1][0][1][2][1]; // pega dados do emissor. |
---|
| 58 | $aux = $aux[count($aux)-1]; // ultimo item he o do CN..... |
---|
| 59 | echo $aux[1][1][1][1]; |
---|
[3377] | 60 | echo '<br/>' . lang('Num. Certificates') . ': '; |
---|
[3232] | 61 | $num = 0; |
---|
| 62 | if(count($dados[1][0][1]) > 6) // qtd de itens esperado he 7. o 6 contem os certificados revogados. |
---|
| 63 | { |
---|
| 64 | $num = count($dados[1][0][1][5][1]); // pega o numero de certificados revogados na LCR. |
---|
| 65 | } |
---|
| 66 | echo $num; |
---|
[3377] | 67 | echo '<br/>' . lang('Num. RCL') . ': '; |
---|
[3232] | 68 | $oid_Num_crl = recupera_dados_oid($data,'2.5.29.20'); // oid que informa o numero de geracao da LCR. |
---|
| 69 | $num = $oid_Num_crl[0][1][1][1]; |
---|
| 70 | if($num) |
---|
| 71 | { |
---|
| 72 | echo $num; |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
| 76 | echo '0'; |
---|
| 77 | } |
---|
| 78 | echo '<br/>'; |
---|
| 79 | $di = data_hora($dados[1][0][1][3][1]); // data, hora em que foi gerada a LCR. |
---|
| 80 | $df = data_hora($dados[1][0][1][4][1]); // data, hora em que expira a LCR. |
---|
| 81 | if(gmdate("YmdHis") < $di) |
---|
| 82 | { |
---|
| 83 | $cor = 'style="color: #FF0000"'; |
---|
| 84 | } |
---|
| 85 | else |
---|
| 86 | { |
---|
| 87 | $cor = 'style="color: #000066"'; |
---|
| 88 | } |
---|
[3377] | 89 | echo '<p><b ' . $cor . '>' . lang('Create in') . ' : </b>' . substr($di,0,4) . '/' . substr($di,4,2) . '/' . substr($di,6,2) . ' - ' . substr($di,8,2) . ':' . substr($di,10,2) . ':' . substr($di,12,2) . ' GMT</p>'; |
---|
[3232] | 90 | if(gmdate("YmdHis") > $df) |
---|
| 91 | { |
---|
[3377] | 92 | $cor = 'style="color: #FF0000" >' . lang('Expired on') . ': '; |
---|
[3232] | 93 | } |
---|
| 94 | else |
---|
| 95 | { |
---|
[3377] | 96 | $cor = 'style="color: #000066" >' . lang('Expire on') . ': '; |
---|
[3232] | 97 | } |
---|
| 98 | echo '<p><b ' . $cor . ' </b>' . substr($df,0,4) . '/' . substr($df,4,2) . '/' . substr($df,6,2) . ' - ' . substr($df,8,2) . ':' . substr($df,10,2) . ':' . substr($df,12,2) . ' GMT</p>'; |
---|
| 99 | } |
---|
| 100 | echo '</td></tr>'; |
---|
| 101 | } |
---|
| 102 | } |
---|
| 103 | echo '</table>'; |
---|
| 104 | echo '</div>'; |
---|
| 105 | echo '<form id="frm2" enctype="multipart/form-data" method="post" action="' . $_SERVER["PHP_SELF"] . '">'; |
---|
| 106 | echo '<input type="hidden" name="atualizar" value="atualizar" />'; |
---|
| 107 | echo '<br/>'; |
---|
[3377] | 108 | echo '<input type="button" name="atualiz" value="' . lang('Execute RCLs update') . '" onclick="javascript:Salvar_arq(\'frm2\',\'' . lang('Confirm RCLs update') . ' ?\')"/>'; |
---|
[3232] | 109 | echo '<br/>'; |
---|
| 110 | echo '</form>'; |
---|
| 111 | } |
---|
| 112 | |
---|
| 113 | $path2 = $GLOBALS['log']; |
---|
| 114 | if($path2) |
---|
| 115 | { |
---|
[3377] | 116 | echo '<h2 style="color: #000066">' . lang('Log of RCLs update') . ':</h2>'; |
---|
[3232] | 117 | echo '<div style="border: #000000 1px solid; overflow: auto; width: 770px; height:180px; white-space: pre; padding: 5px" >'; |
---|
| 118 | echo '<pre>'; |
---|
| 119 | if(is_file($path2)) |
---|
| 120 | { |
---|
| 121 | $saida = array(); |
---|
| 122 | $ret = exec('cat ' . $path2 . ' | grep -a --text ' . date('Y-m-d') ,$saida); |
---|
| 123 | //$ret = exec('cat ' . $path2); |
---|
| 124 | foreach($saida as $linha) |
---|
| 125 | { |
---|
| 126 | echo str_replace(chr(0x00),'',$linha) . chr(0x0A); |
---|
| 127 | } |
---|
| 128 | } |
---|
| 129 | else |
---|
| 130 | { |
---|
| 131 | //$ret = exec('cat ' . $path2 ,$saida); |
---|
[3377] | 132 | echo '<p style="margin-bottom: 5px"><b style="color: #FF0000">' . lang('File') . ' ' . $path2 . ' ' . lang('not found') . '</b></p>'; |
---|
[3232] | 133 | } |
---|
| 134 | echo '</pre>'; |
---|
| 135 | echo '</div><br/><br/>'; |
---|
[3377] | 136 | echo '<a href="../security/security_admin.php" style="text-decoration:none"><input type="button" value="' . lang('Back') . '"/></a>'; |
---|
[3232] | 137 | echo '<div>'; |
---|
| 138 | } |
---|
| 139 | ?> |
---|