Changeset 1035


Ignore:
Timestamp:
06/20/09 01:07:18 (15 years ago)
Author:
rafaelraymundo
Message:

Ticket #558 - Adicionada funcionalidade de assinatura e criptografia de e-mails.

Location:
trunk
Files:
104 added
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/inc/hook_admin.inc.php

    r357 r1035  
    7676                $file['phpInfo']         = $GLOBALS['phpgw']->link('/admin/phpinfo.php'); 
    7777        } 
    78   
     78 
     79        if (! $GLOBALS['phpgw']->acl->check('asyncservice_access',1,'admin')) 
     80        { 
     81                if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']  ||  $GLOBALS['phpgw_info']['server']['certificado']) 
     82                { 
     83                        $file['CASCRLS']    = $GLOBALS['phpgw']->link('../seguranca/security_admin.php'); 
     84                } 
     85        } 
     86 
     87 
     88        if (! $GLOBALS['phpgw']->acl->check('asyncservice_access',1,'admin')) 
     89        { 
     90                $file['subversion']    = $GLOBALS['phpgw']->link('subversion.php'); 
     91        } 
     92 
    7993        if (! $GLOBALS['phpgw']->acl->check('site_config_access',1,'admin')) 
    8094        { 
  • trunk/admin/templates/default/config.tpl

    r32 r1035  
    118118   <tr class="th"> 
    119119    <td colspan="2">&nbsp;<b>{lang_security}</b></td> 
     120   </tr> 
     121 
     122   <tr class="row_off"> 
     123   <td valign="top"><pre> 
     124Nome, um ponto-e-virgula como separador, e o caminho completo para os drivers dos tokens 
     125que ser&atilde;o suportados (At&eacute; 10):<br/> 
     126 
     127   Ex:  ePass2000Lx;/usr/lib/libepsng_p11.so 
     128        ePass2000Win;c:/windows/system32/ngp11v211.dll 
     129 
     130        Estes s&atilde;o os drivers para o token ePass2000, utilizado no Serpro, 
     131        nos ambientes Linux e Windows respectivamente. 
     132 
     133        <b>Aten&ccedil;&atilde;o</b>: O caminho no ambiente Windows n&atilde;o deve usar contra barra. 
     134         </pre> </td> 
     135    <td> 
     136        <input name="newsettings[test_token11]" value="{value_test_token11}"><br/> 
     137        <input name="newsettings[test_token21]" value="{value_test_token21}"><br/> 
     138        <input name="newsettings[test_token31]" value="{value_test_token31}"><br/> 
     139        <input name="newsettings[test_token41]" value="{value_test_token41}"><br/> 
     140        <input name="newsettings[test_token51]" value="{value_test_token51}"><br/> 
     141        <input name="newsettings[test_token61]" value="{value_test_token61}"><br/> 
     142        <input name="newsettings[test_token71]" value="{value_test_token71}"><br/> 
     143        <input name="newsettings[test_token81]" value="{value_test_token81}"><br/> 
     144        <input name="newsettings[test_token91]" value="{value_test_token91}"><br/> 
     145        <input name="newsettings[test_token101]" value="{value_test_token101}"><br/> 
     146    </td> 
    120147   </tr> 
    121148 
  • trunk/expressoMail1_2/inc/class.db_functions.inc.php

    r906 r1035  
    407407                return $uiicalendar = $uiicalendar->import_from_mail($calendar); 
    408408        } 
    409          
     409 
     410    function insert_certificate($email,$certificate,$serialnumber,$authoritykeyidentifier=null) 
     411        { 
     412                if(!$email || !$certificate || !$serialnumber || !$authoritykeyidentifier) 
     413                        return false; 
     414                // Insere uma chave publica na tabela phpgw_certificados. 
     415                $data = array   ('email' => $email, 
     416                                                 'chave_publica' => $certificate, 
     417                                                 'serialnumber' => $serialnumber, 
     418                                                 'authoritykeyidentifier' => $authoritykeyidentifier); 
     419 
     420                if(!$this->db->insert('phpgw_certificados',$data,array(),__LINE__,__FILE__)){ 
     421                return $this->db->Error; 
     422        } 
     423        return true; 
     424        } 
     425 
     426        function get_certificate($email=null) 
     427        { 
     428                if(!$email) return false; 
     429                $result = array(); 
     430 
     431                $where = array ('email' => $email, 
     432                                                'revogado' => 0, 
     433                                                'expirado' => 0); 
     434 
     435                if(!$this->db->select('phpgw_certificados','chave_publica', $where, __LINE__,__FILE__)) 
     436        { 
     437            $result['dberr1'] = $this->db->Error; 
     438            return $result; 
     439        } 
     440                $regs = array(); 
     441                while($this->db->next_record()) 
     442        { 
     443            $regs[] = $this->db->row(); 
     444        } 
     445                if (count($regs) == 0) 
     446        { 
     447            $result['dberr2'] = ' Certificado nao localizado.'; 
     448            return $result; 
     449        } 
     450                $result['certs'] = $regs; 
     451                return $result; 
     452        } 
     453 
     454        function update_certificate($serialnumber=null,$email=null,$authoritykeyidentifier,$expirado,$revogado) 
     455        { 
     456                if(!$email || !$serialnumber) return false; 
     457                if(!$expirado) 
     458                        $expirado = 0; 
     459                if(!$revogado) 
     460                        $revogado = 0; 
     461 
     462                $data = array   ('expirado' => $expirado, 
     463                                                 'revogado' => $revogado); 
     464 
     465                $where = array  ('email' => $email, 
     466                                                 'serialnumber' => $serialnumber, 
     467                                                 'authoritykeyidentifier' => $authoritykeyidentifier); 
     468 
     469                if(!$this->db->update('phpgw_certificados',$data,$where,__LINE__,__FILE__)) 
     470                { 
     471                        return $this->db->Error; 
     472                } 
     473                return true; 
     474        } 
     475 
    410476} 
    411477?> 
  • trunk/expressoMail1_2/inc/class.exporteml.inc.php

    r1000 r1035  
    242242                imap_close($this->mbox_stream); 
    243243                return $tempDir.'/'.$file; 
     244        } 
     245 
     246    function export_msg_data($id_msg,$folder) { 
     247                $this->folder = $folder; 
     248                $this->folder = mb_convert_encoding($this->folder, "UTF7-IMAP","UTF-8"); 
     249 
     250                $this->connectImap(); 
     251                $header         = $this-> getHeader($id_msg); 
     252                $body           = $this-> getBody($id_msg); 
     253 
     254                $msg_data = $header ."\r\n\r\n". $body; 
     255 
     256                imap_close($this->mbox_stream); 
     257                return $msg_data; 
    244258        } 
    245259 
  • trunk/expressoMail1_2/inc/class.imap_functions.inc.php

    r1012 r1035  
    404404                $body = ereg_replace("<a[^>]*href=[\'\"]mailto:([^\"\']+)[\'\"]>([^<]+)</a>","<a href=\"javascript:new_message_to('\\1')\">\\2</a>",$return_get_body['body']); 
    405405 
    406                 $return['body']                 = $body; 
    407                 $return['attachments']  = $return_get_body['attachments']; 
    408                 $return['thumbs']               = $return_get_body['thumbs']; 
    409                 $return['signature']    = $return_get_body['signature']; 
    410  
     406                if($return_get_body['body']=='isCripted'){ 
     407                        $exporteml = new ExportEml(); 
     408                        $return['source']=$exporteml->export_msg_data($msg_number,$msg_folder); 
     409                        $return['body']                 = ""; 
     410                        $return['attachments']  =  ""; 
     411                        $return['thumbs']               =  ""; 
     412                        $return['signature']    =  ""; 
     413                        //return $return; 
     414                }else{ 
     415            $return['body']             = $body; 
     416            $return['attachments']      = $return_get_body['attachments']; 
     417            $return['thumbs']           = $return_get_body['thumbs']; 
     418            $return['signature']        = $return_get_body['signature']; 
     419        } 
    411420                $pattern = '/^[ \t]*Disposition-Notification-To(^:)*:(.+)*@(.+)*$/isUm'; 
    412421                if (preg_match($pattern, $header_, $fields)) 
     
    661670                if(!$msg->structure[$msg_number]->parts) //Simple message, only 1 piece 
    662671                { 
     672            if(strtolower($msg->structure[$msg_number]->subtype) == 'x-pkcs7-mime'){ 
     673                $return['body']='isCripted'; 
     674                return $return; 
     675            } 
     676 
    663677                        $attachment = array(); //No attachments 
    664                          
     678 
     679            if(strtolower($msg->structure[$msg_number]->subtype) == 'x-pkcs7-mime'){ 
     680                                        $return['body']='isCripted'; 
     681                                        return $return; 
     682                        } 
     683 
    665684                        $content = ''; 
    666685                        if (strtolower($msg->structure[$msg_number]->subtype) == "plain") 
     
    10071026 
    10081027        function get_signature($msg, $msg_number, $msg_folder) 
    1009         {  
     1028        { 
     1029        include_once("../seguranca/classes/CertificadoB.php"); 
     1030                include_once("class.db_functions.inc.php"); 
    10101031                foreach ($msg->file_type[$msg_number] as $index => $file_type) 
    10111032                { 
     1033            $sign = array(); 
     1034                        $temp = $this->get_info_head_msg($msg_number); 
     1035                        if($temp['ContentType'] =='normal') return $sign; 
    10121036                        $file_type = strtolower($file_type); 
    10131037                        if(strtolower($msg->encoding[$msg_number][$index]) == 'base64')  
     
    10151039                                if ($file_type == 'application/x-pkcs7-signature' || $file_type == 'application/pkcs7-signature')  
    10161040                                { 
    1017                                         $export_mail = new ExportEml(); 
    1018                                         $params['folder'] = $msg_folder; 
    1019                                         $params['msgs_to_export'] = $msg_number; 
    1020                                     $tempDir = ini_get("session.save_path"); 
    1021                                         $cert_file = $tempDir."/certificate_".base_convert(microtime(), 10, 36).".crt";                                  
    1022                                         $result = openssl_pkcs7_verify($export_mail->export_msg($params),PKCS7_NOVERIFY,$cert_file); 
    1023                                         if (file_exists($cert_file)) 
     1041                                        if(!$this->mbox || !is_resource($this->mbox)) 
     1042                                        $this->mbox = $this->open_mbox($msg_folder); 
     1043 
     1044                                        $header = @imap_headerinfo($this->mbox, imap_msgno($this->mbox, $msg_number), 80, 255); 
     1045 
     1046                                        $imap_msg               = @imap_fetchheader($this->mbox, $msg_number, FT_UID); 
     1047                                        $imap_msg               .= @imap_body($this->mbox, $msg_number, FT_UID); 
     1048 
     1049                                        $certificado = new certificadoB(); 
     1050                                        $validade = $certificado->verificar($imap_msg); 
     1051 
     1052                                        if ($certificado->apresentado) 
    10241053                                        { 
    1025                                                 $handle = fopen ($cert_file,"r"); 
    1026                                                 $pemout = fread($handle,filesize($cert_file)); 
    1027                                                 fclose($handle); 
    1028                                                 $cert=openssl_x509_parse($pemout); 
    1029                                                 $temp = "\\nSigned by: ".$cert[subject][CN]; 
    1030                                                 $temp .= "\\nEmail Address: ".$cert[subject][emailAddress]; 
    1031                                                 $temp .= "\\nCertificate issued by: ".$cert[issuer][CN]."\\n"; 
     1054                                                $from = $header->from; 
     1055                                                foreach ($from as $id => $object) { 
     1056                                                        $fromname = $object->personal; 
     1057                                                    $fromaddress = $object->mailbox . "@" . $object->host; 
    10321058                                        } 
    1033                                     /* Message verified */ 
    1034                                     if ($result === true) 
    1035                                             $sign = $temp; 
     1059                                                $sign_alert = ''; 
     1060                                                foreach ($certificado->erros_ssl as $item) 
     1061                                                { 
     1062                                                        $check_error_msg = $this->functions->getLang($item); 
     1063                                                        /* 
     1064                                                         * Desabilite o teste abaixo para mostrar todas as mensagem 
     1065                                                         * de erro. 
     1066                                                         */ 
     1067                                                        //if (!strpos($check_error_msg,'*',strlen($check_error_msg-1))) 
     1068                                                        //{ 
     1069                                                        $sign[] = "<span style=color:red>" . $check_error_msg . " </span>"; 
     1070                                                        //} 
     1071                                                } 
     1072                                                if (count($certificado->erros_ssl) < 1) 
     1073                                                { 
     1074                                                        $check_msg = $this->functions->getLang('Message untouched') . " "; 
     1075                                                        if($fromaddress == $certificado->dados['EMAIL']) 
     1076                                                        { 
     1077                                                                $check_msg .= $this->functions->getLang('and') . " "; 
     1078                                                                $check_msg .= $this->functions->getLang('authentic'); 
     1079                                                        } 
     1080                                                        $sign[] = "<strong>".$check_msg."</strong>"; 
     1081                                                } 
     1082                                                if($fromaddress != $certificado->dados['EMAIL']) 
     1083                                                { 
     1084                                                        $sign[] =       "<span style=color:red>" . 
     1085                                                                                $this->functions->getLang('message') . " " . 
     1086                                                                        $this->functions->getLang('with signer different from sender') . 
     1087                                                                        " </span>"; 
     1088                                                } 
     1089                                                $sign[] = "<strong>" . $this->functions->getLang('Message signed by: ') . "</strong>" . $certificado->dados['NOME']; 
     1090                                                $sign[] = "<strong>" . $this->functions->getLang('Certificate email: ') . "</strong>" . $certificado->dados['EMAIL']; 
     1091                                                $sign[] = "<strong>" . $this->functions->getLang('Mail from: ') . "</strong>" . $fromaddress; 
     1092                                                $sign[] = "<strong>" . $this->functions->getLang('Certificate Authority: ') . "</strong>" . $certificado->dados['EMISSOR']; 
     1093                                                $sign[] = "<strong>" . $this->functions->getLang('Validity of certificate: ') . "</strong>" . gmdate('r',openssl_to_timestamp($certificado->dados['FIM_VALIDADE'])); 
     1094                                                $sign[] = "<strong>" . $this->functions->getLang('Message date: ') . "</strong>" . $header->Date; 
     1095 
     1096                                            $cert = openssl_x509_parse($certificado->cert_assinante); 
     1097                                                /* 
     1098                                                $sign[] = '<table>'; 
     1099                                                $sign[] = '<tr><td colspan=1><b>Expedido para:</b></td></tr>'; 
     1100                                                $sign[] = '<tr><td>Nome Comum (CN) </td><td>' . $cert[subject]['CN'] .  '</td></tr>'; 
     1101                                                $X = substr($certificado->dados['NASCIMENTO'] ,0,2) . '-' . substr($certificado->dados['NASCIMENTO'] ,2,2) . '-'  . substr($certificado->dados['NASCIMENTO'] ,4,4); 
     1102                                                $sign[] = '<tr><td>Data de nascimento </td><td>' . $certificado->dados['NASCIMENTO'] .  '</td></tr>'; 
     1103                                                $sign[] = '<tr><td>CPF </td><td>' . $certificado->dados['CPF'] .  '</td></tr>'; 
     1104                                                $sign[] = '<tr><td>Documento identidade </td><td>' . $certificado->dados['RG'] .  '</td></tr>'; 
     1105                                                $sign[] = '<tr><td>Empresa (O) </td><td>' . $cert[subject]['O'] .  '</td></tr>'; 
     1106                                                $sign[] = '<tr><td>Unidade Organizacional (OU) </td><td>' . $cert[subject]['OU'][0] .  '</td></tr>'; 
     1107                                                //$sign[] = '<tr><td>Numero de serie </td><td>' . $cert['serialNumber'] .  '</td></tr>'; 
     1108                                                $sign[] = '<tr><td colspan=1> </td></tr>'; 
     1109                                                $sign[] = '<tr><td colspan=1><b>Expedido por:</b></td></tr>'; 
     1110                                                $sign[] = '<tr><td>Nome Comum (CN) </td><td>' . $cert[issuer]['CN'] .  '</td></tr>'; 
     1111                                                $sign[] = '<tr><td>Empresa (O) </td><td>' . $cert[issuer]['O'] .  '</td></tr>'; 
     1112                                                $sign[] = '<tr><td>Unidade Organizacional (OU) </td><td>' . $cert[issuer]['OU'][0] .  '</td></tr>'; 
     1113                                                $sign[] = '<tr><td colspan=1> </td></tr>'; 
     1114                                                $sign[] = '<tr><td colspan=1><b>Validade:</b></td></tr>'; 
     1115                                                $H = data_hora($cert[validFrom]); 
     1116                                                $X = substr($H,6,2) . '-' . substr($H,4,2) . '-'  . substr($H,0,4); 
     1117                                                $sign[] = '<tr><td>Expedido em </td><td>' . $X .  '</td></tr>'; 
     1118                                                $H = data_hora($cert[validTo]); 
     1119                                                $X = substr($H,6,2) . '-' . substr($H,4,2) . '-'  . substr($H,0,4); 
     1120                                                $sign[] = '<tr><td>Valido ate </td><td>' . $X .  '</td></tr>'; 
     1121                                                $sign[] = '<tr><td colspan=1> </td></tr>'; 
     1122                                                $sign[] = '</table>'; 
     1123                                                */ 
     1124                                                $sign_alert .= 'Expedido para:\n'; 
     1125                                                $sign_alert .= 'Nome Comum (CN)  ' . $cert[subject]['CN'] .  '\n'; 
     1126                                                $X = substr($certificado->dados['NASCIMENTO'] ,0,2) . '-' . substr($certificado->dados['NASCIMENTO'] ,2,2) . '-'  . substr($certificado->dados['NASCIMENTO'] ,4,4); 
     1127                                                $sign_alert .= 'Data de nascimento ' . $X .  '\n'; 
     1128                                                $sign_alert .= 'CPF ' . $certificado->dados['CPF'] .  '\n'; 
     1129                                                $sign_alert .= 'Documento identidade ' . $certificado->dados['RG'] .  '\n'; 
     1130                                                $sign_alert .= 'Empresa (O)  ' . $cert[subject]['O'] .  '\n'; 
     1131                                                $sign_alert .= 'Unidade Organizacional (OU) ' . $cert[subject]['OU'][0] .  '\n'; 
     1132                                                //$sign_alert[] = '<tr><td>Numero de serie </td><td>' . $cert['serialNumber'] .  '</td></tr>'; 
     1133                                                $sign_alert .= '\n'; 
     1134                                                $sign_alert .= 'Expedido por:\n'; 
     1135                                                $sign_alert .= 'Nome Comum (CN) ' . $cert[issuer]['CN'] . '\n'; 
     1136                                                $sign_alert .= 'Empresa (O)  ' . $cert[issuer]['O'] .  '\n'; 
     1137                                                $sign_alert .= 'Unidade Organizacional (OU) ' . $cert[issuer]['OU'][0] .  '\n'; 
     1138                                                $sign_alert .= '\n'; 
     1139                                                $sign_alert .= 'Validade:\n'; 
     1140                                                $H = data_hora($cert[validFrom]); 
     1141                                                $X = substr($H,6,2) . '-' . substr($H,4,2) . '-'  . substr($H,0,4); 
     1142                                                $sign_alert .= 'Expedido em ' . $X .  '\n'; 
     1143                                                $H = data_hora($cert[validTo]); 
     1144                                                $X = substr($H,6,2) . '-' . substr($H,4,2) . '-'  . substr($H,0,4); 
     1145                                                $sign_alert .= 'Valido ate ' . $X .  '\n'; 
     1146 
     1147                                                $sign[] = "<a onclick=\"javascript:alert('" . $sign_alert . "')\"><b><font color=\"#0000FF\">".$this->functions->getLang("More")."...</font></b></a>"; 
     1148                                                $this->db = new db_functions(); 
     1149 
     1150                                                // TODO: testar se existe um certificado no banco e verificar qual ï¿œ o mais atual. 
     1151                        if(!$certificado->dados['EXPIRADO'] && !$certificado->dados['REVOGADO'] && count($certificado->erros_ssl) < 1) 
     1152                            $this->db->insert_certificate(strtolower($certificado->dados['EMAIL']), $certificado->cert_assinante, $certificado->dados['SERIALNUMBER'], $certificado->dados['AUTHORITYKEYIDENTIFIER']); 
     1153                                        } 
    10361154                                     else 
    1037                                             $sign = "void"; 
     1155                                    { 
     1156                                        $sign[] = "<span style=color:red>" . $this->functions->getLang('Invalid signature') . "</span>"; 
     1157                                        foreach($certificado->erros_ssl as $item) 
     1158                                        $sign[] = "<span style=color:red>" . $this->functions->getLang($item) . "</span>"; 
     1159                    } 
    10381160                                } 
    10391161                        } 
     
    11731295                        * a perda em performance é insignificante. 
    11741296                        */ 
    1175                         $flag = preg_match('/importance *: *(.*)\r/i', 
    1176                                         @imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)) 
    1177                                         ,$importance);           
     1297            $tempHeader = @imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)); 
     1298                        $flag = preg_match('/importance *: *(.*)\r/i', $tempHeader, $importance); 
    11781299                        $return[$i]['Importance'] = $flag==0?"Normal":$importance[1]; 
    11791300                         
     
    11861307                         
    11871308                        $return[$i]['msg_folder']       = $folder; 
     1309            // Atribui o tipo (normal, signature ou cipher) ao campo Content-Type 
     1310            $return[$i]['ContentType']  = $this->getMessageType($msg_number, $tempHeader); 
    11881311                        $return[$i]['Recent']           = $header->Recent; 
    11891312                        $return[$i]['Unseen']           = $header->Unseen; 
     
    12361359        } 
    12371360 
     1361     /** 
     1362     * Método que faz a verificação do Content-Type do e-mail e verifica se é um e-mail normal, 
     1363     * assinado ou cifrado. 
     1364     * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
     1365     * @param $headers Uma String contendo os Headers do e-mail retornados pela função imap_imap_fetchheader 
     1366     * @param $msg_number O número da mesagem 
     1367     * @return Retorna o tipo da mensagem (normal, signature, cipher). 
     1368     */ 
     1369    function getMessageType($msg_number, $headers = false){ 
     1370 
     1371            $contentType = "normal"; 
     1372            if (!$headers){ 
     1373                $headers = imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)); 
     1374            } 
     1375            //$header2 = imap_fetchheader($this->mbox, imap_msgno($this->mbox, $msg_number)); 
     1376            if (preg_match("/Content-Type:.*pkcs7-signature/i", $headers) == 1){ 
     1377                $contentType = "signature"; 
     1378            } else if (preg_match("/Content-Type:.*x-pkcs7-mime/i", $headers) == 1){ 
     1379                $contentType = "cipher"; 
     1380            } 
     1381 
     1382            return $contentType; 
     1383    } 
     1384 
    12381385        function get_folders_list($params = null) 
    12391386        { 
     
    12481395                if (is_array($folders_list)) { 
    12491396                        reset($folders_list); 
     1397            $this->ldap = new ldap_functions(); 
    12501398                         
    12511399                        $i = 0; 
    12521400                        while (list($key, $val) = each($folders_list)) { 
    12531401                                $status = imap_status($mbox_stream, $val->name, SA_UNSEEN); 
    1254                                 $result[$i]['folder_unseen'] = $status->unseen; 
    1255                          
     1402 
    12561403                                //$tmp_folder_id = explode("}", imap_utf7_decode($val->name)); 
    12571404                                $tmp_folder_id = explode("}", mb_convert_encoding($val->name, "ISO_8859-1", "UTF7-IMAP" )); 
     1405                if($tmp_folder_id[1]=='INBOX'.$this->imap_delimiter.'decifradas'){ 
     1406                    //error_log('passou', 3,'/tmp/imap_get_list.log'); 
     1407                    //imap_deletemailbox($mbox_stream,imap_utf7_encode("{".$this->imap_server."}".'INBOX/decifradas')); 
     1408                    continue; 
     1409                } 
     1410                $result[$i]['folder_unseen'] = $status->unseen; 
    12581411                                $folder_id = $tmp_folder_id[1]; 
    12591412                                $result[$i]['folder_id'] = $folder_id; 
     
    12631416                                $result[$i]['folder_name'] = $result[$i]['folder_name'] == 'INBOX' ? 'Inbox' : $result[$i]['folder_name']; 
    12641417                                if (is_numeric($result[$i]['folder_name']))     { 
    1265                                         $this->ldap = new ldap_functions(); 
     1418                                        //$this->ldap = new ldap_functions(); 
    12661419                                        if ($cn = $this->ldap->uid2cn($result[$i]['folder_name'])){ 
    12671420                                                $result[$i]['folder_name'] = $cn; 
     
    14281581                $return_receipt = $params['input_return_receipt']; 
    14291582                $is_important = $params['input_important_message']; 
    1430                 $body = $params['body']; 
     1583        $encrypt = $params['input_return_cripto']; 
     1584                $signed = $params['input_return_digital']; 
     1585 
     1586                if($params['smime']) 
     1587        { 
     1588            $body = $params['smime']; 
     1589            $mail->SMIME = true; 
     1590            // A MSG assinada deve ser testada neste ponto. 
     1591            // Testar o certificado e a integridade da msg.... 
     1592            include_once("../seguranca/classes/CertificadoB.php"); 
     1593            $erros_acumulados = ''; 
     1594            $certificado = new certificadoB(); 
     1595            $validade = $certificado->verificar($body); 
     1596            if(!$validade) 
     1597            { 
     1598                foreach($certificado->erros_ssl as $linha_erro) 
     1599                { 
     1600                    $erros_acumulados .= $linha_erro; 
     1601                } 
     1602            } 
     1603            else 
     1604            { 
     1605                // Testa o CERTIFICADO: se o CPF  he o do usuario logado, se  pode assinar msgs e se  nao esta expirado... 
     1606                if ($certificado->apresentado) 
     1607                { 
     1608                    if($certificado->dados['EXPIRADO']) $erros_acumulados .='Certificado expirado.'; 
     1609                    if($certificado->dados['CPF'] != $this->username) $erros_acumulados .=' CPF no certificado diferente do logado no expresso.'; 
     1610                    if(!($certificado->dados['KEYUSAGE']['digitalSignature'] && $certificado->dados['EXTKEYUSAGE']['emailProtection'])) $erros_acumulados .=' Certificado nao permite assinar mensagens.'; 
     1611                } 
     1612                else 
     1613                { 
     1614                    $$erros_acumulados .= 'Nao foi possivel usar o certificado para assinar a msg'; 
     1615                } 
     1616            } 
     1617            if(!$erros_acumulados =='') 
     1618            { 
     1619                return $erros_acumulados; 
     1620            } 
     1621        } 
     1622        else 
     1623        { 
     1624            $body = $params['body']; 
     1625        } 
    14311626                //echo "<script language=\"javascript\">javascript:alert('".$body."');</script>"; 
    14321627                $attachments = $params['FILES']; 
     
    14471642//////////////////////////////////////////////////////////////////////////////////////////////////// 
    14481643                $mail->SMTPDebug = false; 
    1449                                  
    1450                 $mail->IsSMTP(); 
     1644 
     1645                if($signed && !$params['smime']) 
     1646                { 
     1647            $mail->Mailer = "smime"; 
     1648                        $mail->SignedBody = true; 
     1649                } 
     1650                else 
     1651            $mail->IsSMTP(); 
     1652             
    14511653                $mail->Host = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpServer']; 
    14521654                $mail->Port = $_SESSION['phpgw_info']['expressomail']['email_server']['smtpPort']; 
     
    14651667                $mail->Subject = $subject; 
    14661668                $mail->IsHTML(true); 
    1467                 $mail->Body = $params['body']; 
     1669                $mail->Body = $body; 
     1670 
     1671        if (($encrypt && $signed && $params['smime']) || ($encrypt && !$signed))        // a msg deve ser enviada cifrada... 
     1672                { 
     1673                        $email = $this->add_recipients_cert($toaddress . ',' . $ccaddress. ',' .$ccoaddress); 
     1674            $email = explode(",",$email); 
     1675            // Deve ser testado se foram obtidos os certificados de todos os destinatarios. 
     1676            // Deve ser verificado um numero limite de destinatarios. 
     1677            // Deve ser verificado se os certificados sao validos. 
     1678            // Se uma das verificacoes falhar, nao enviar o e-mail e avisar o usuario. 
     1679            // O array $mail->Certs_crypt soh deve ser preenchido se os certificados passarem nas verificacoes. 
     1680            $numero_maximo = $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['num_max_certs_to_cipher'];  // Este valor dever ser configurado pelo administrador do site .... 
     1681            $erros_acumulados = ""; 
     1682            $aux_mails = array(); 
     1683            $mail_list = array(); 
     1684            if(count($email) > $numero_maximo) 
     1685            { 
     1686                $erros_acumulados .= "Excedido o numero maximo (" . $numero_maximo . ") de destinatarios para uma msg cifrada...." . chr(0x0A); 
     1687                return $erros_acumulados; 
     1688            } 
     1689            // adiciona o email do remetente. eh para cifrar a msg para ele tambem. Assim vai poder visualizar a msg na pasta enviados.. 
     1690            $email[] = $_SESSION['phpgw_info']['expressomail']['user']['email']; 
     1691            foreach($email as $item) 
     1692            { 
     1693                $certificate = $db->get_certificate(strtolower($item)); 
     1694                if(!$certificate) 
     1695                { 
     1696                    $erros_acumulados .= "Chamada com parametro invalido.  e-Mail nao pode ser vazio." . chr(0x0A); 
     1697                    return $erros_acumulados; 
     1698                } 
     1699 
     1700                if (array_key_exists("dberr1", $certificate)) 
     1701                { 
     1702 
     1703                    $erros_acumulados .= "Ocorreu um erro quando pesquisava certificados dos destinatarios para cifrar a msg." . chr(0x0A); 
     1704                    return $erros_acumulados; 
     1705                                } 
     1706                if (array_key_exists("dberr2", $certificate)) 
     1707                { 
     1708                    $erros_acumulados .=  $item . ' : Nao  pode cifrar a msg. Certificado nao localizado.' . chr(0x0A); 
     1709                    //continue; 
     1710                } 
     1711                        /*  Retirado este teste para evitar mensagem de erro duplicada. 
     1712                if (!array_key_exists("certs", $certificate)) 
     1713                { 
     1714                        $erros_acumulados .=  $item . ' : Nao  pode cifrar a msg. Certificado nao localizado.' . chr(0x0A); 
     1715                    continue; 
     1716                } 
     1717            */ 
     1718                include_once("../seguranca/classes/CertificadoB.php"); 
     1719 
     1720                foreach ($certificate['certs'] as $registro) 
     1721                { 
     1722                    $c1 = new certificadoB(); 
     1723                    $c1->certificado($registro['chave_publica']); 
     1724                    if ($c1->apresentado) 
     1725                    { 
     1726                        $c2 = new Verifica_Certificado($c1->dados,$registro['chave_publica']); 
     1727                        if (!$c1->dados['EXPIRADO'] && !$c2->revogado && $c2->status) 
     1728                        { 
     1729                            $aux_mails[] = $registro['chave_publica']; 
     1730                            $mail_list[] = strtolower($item); 
     1731                        } 
     1732                        else 
     1733                        { 
     1734                            if ($c1->dados['EXPIRADO'] || $c2->revogado) 
     1735                            { 
     1736                                $db->update_certificate($c1->dados['SERIALNUMBER'],$c1->dados['EMAIL'],$c1->dados['AUTHORITYKEYIDENTIFIER'], 
     1737                                    $c1->dados['EXPIRADO'],$c2->revogado); 
     1738                            } 
     1739 
     1740                            $erros_acumulados .= $item . ':  ' . $c2->msgerro . chr(0x0A); 
     1741                            foreach($c2->erros_ssl as $linha) 
     1742                            { 
     1743                                $erros_acumulados .=  $linha . chr(0x0A); 
     1744                            } 
     1745                            $erros_acumulados .=  'Emissor: ' . $c1->dados['EMISSOR'] . chr(0x0A); 
     1746                            $erros_acumulados .=  $c1->dados['CRLDISTRIBUTIONPOINTS'] . chr(0x0A); 
     1747                        } 
     1748                    } 
     1749                    else 
     1750                    { 
     1751                        $erros_acumulados .= $item . ' : Nao  pode cifrar a msg. Certificado invalido.' . chr(0x0A); 
     1752                    } 
     1753                } 
     1754                if(!(in_array(strtolower($item),$mail_list)) && !empty($erros_acumulados)) 
     1755                                { 
     1756                                        return $erros_acumulados; 
     1757                        } 
     1758            } 
     1759 
     1760            $mail->Certs_crypt = $aux_mails; 
     1761        } 
    14681762 
    14691763//////////////////////////////////////////////////////////////////////////////////////////////////// 
     
    15891883                else 
    15901884                { 
     1885            if ($signed && !$params['smime']) 
     1886                        { 
     1887                                return $sent; 
     1888                        } 
    15911889                        if($_SESSION['phpgw_info']['server']['expressomail']['expressoMail_enable_log_messages'] == "True")  
    15921890                        { 
     
    16061904                        return array("success" => true); 
    16071905                } 
     1906        } 
     1907 
     1908    function add_recipients_cert($full_address) 
     1909        { 
     1910                $result = ""; 
     1911                $parse_address = imap_rfc822_parse_adrlist($full_address, ""); 
     1912                foreach ($parse_address as $val) 
     1913                { 
     1914                        //echo "<script language=\"javascript\">javascript:alert('".$val->mailbox."@".$val->host."');</script>"; 
     1915                        if ($val->mailbox == "INVALID_ADDRESS") 
     1916                                continue; 
     1917                        if ($val->mailbox == "UNEXPECTED_DATA_AFTER_ADDRESS") 
     1918                                continue; 
     1919                        if (empty($val->personal)) 
     1920                                $result .= $val->mailbox."@".$val->host . ","; 
     1921                        else 
     1922                                $result .= $val->mailbox."@".$val->host . ","; 
     1923                } 
     1924 
     1925                return substr($result,0,-1); 
    16081926        } 
    16091927 
     
    23672685                        $folder_id = "INBOX"; 
    23682686                 
    2369                 if(!$this->mbox) 
     2687                if(!$this->mbox || !is_resource($this->mbox)) 
    23702688                        $this->mbox = $this->open_mbox(); 
    23712689 
     
    29583276    } 
    29593277 
     3278    function show_decript($params){ 
     3279        $source = $params['source']; 
     3280        //error_log("source: $source\nversao: " . PHP_VERSION, 3, '/tmp/teste.log'); 
     3281        $source = str_replace(" ", "+", $source,$i); 
     3282         
     3283        if (version_compare(PHP_VERSION, '5.2.0', '>=')){ 
     3284            if(!$source = base64_decode($source,true)) 
     3285                return "error ".$source."Espaços ".$i; 
     3286 
     3287        } 
     3288        else { 
     3289            if(!$source = base64_decode($source)) 
     3290                return "error ".$source."Espaços ".$i; 
     3291        } 
     3292 
     3293        $insert = $this->insert_email($source,'INBOX'.$this->imap_delimiter.'decifradas'); 
     3294 
     3295                $get['msg_number'] = $insert['msg_no']; 
     3296                $get['msg_folder'] = 'INBOX'.$this->imap_delimiter.'decifradas'; 
     3297                $return = $this->get_info_msg($get); 
     3298                $get['msg_number'] = $params['ID']; 
     3299                $get['msg_folder'] = $params['folder']; 
     3300                $tmp = $this->get_info_msg($get); 
     3301                if(!$tmp['status_get_msg_info']) 
     3302                { 
     3303                        $return['msg_day']=$tmp['msg_day']; 
     3304                        $return['msg_hour']=$tmp['msg_hour']; 
     3305                        $return['fulldate']=$tmp['fulldate']; 
     3306                        $return['smalldate']=$tmp['smalldate']; 
     3307                } 
     3308                else 
     3309                { 
     3310                        $return['msg_day']=''; 
     3311                        $return['msg_hour']=''; 
     3312                        $return['fulldate']=''; 
     3313                        $return['smalldate']=''; 
     3314                } 
     3315        $return['msg_no'] =$insert['msg_no']; 
     3316        $return['error'] = $insert['error']; 
     3317        $return['folder'] = $params['folder']; 
     3318        //$return['acls'] = $insert['acls']; 
     3319        $return['original_ID'] =  $params['ID']; 
     3320 
     3321        return $return; 
     3322 
     3323    } 
     3324     
    29603325//Por Bruno Costa(bruno.vieira-costa@serpro.gov.br - Trata fontes de emails enviados via POST para o servidor por um xmlhttprequest, as partes codificados com 
    29613326//Base64 os "+" são substituidos por " " no envio e essa função arruma esse efeito. 
  • trunk/expressoMail1_2/inc/class.phpmailer.php

    r614 r1035  
    101101 
    102102    /** 
     103     * Sets the signed body of the message.  This automatically sets the 
     104     * email to multipart/signed. 
     105     * @var string 
     106     */ 
     107    var $SignedBody           = false; 
     108    var $SMIME                  = false; 
     109    var $Certs_crypt            = array(); 
     110    /** 
     111     * Sets the encrypted body of the message.  This automatically sets the 
     112     * email to multipart/encript. 
     113     * @var string 
     114     */ 
     115    var $CryptedBody           = ""; 
     116 
     117    /** 
    103118     * Sets word wrapping on the body of the message to a given number of  
    104119     * characters. 
     
    148163        var $SaveMessageInFolder = ""; 
    149164        var $SaveMessageAsDraft = ""; 
     165 
     166    var $xMailer           = ""; 
    150167 
    151168    ///////////////////////////////////////////////// 
     
    372389        $this->SetMessageType(); 
    373390        $header .= $this->CreateHeader(); 
    374         $body = $this->CreateBody(); 
    375                  
    376         if($body == "") { return false; } 
     391 
     392        if ($this->SMIME == false) 
     393        { 
     394            $body = $this->CreateBody(); 
     395            if($body == "") 
     396            { 
     397                return false; 
     398            } 
     399        } 
    377400                 
    378401        // Choose the mailer 
    379402        switch($this->Mailer) 
    380403        { 
     404            // Usado para processar o email e retornar para a applet 
     405                case "smime": 
     406                $retorno['body'] = $header.$this->LE.$body; 
     407                $retorno['type'] =  $this->write_message_type(); 
     408                        return $retorno; 
    381409            case "sendmail": 
    382410                $result = $this->SendmailSend($header, $body); 
     
    473501        include_once($this->PluginDir . "class.smtp.php"); 
    474502        $error = ""; 
     503 
    475504        $bad_rcpt = array(); 
    476  
     505        $errorx = ''; 
    477506        if(!$this->SmtpConnect()) 
    478507            return false; 
     508 
     509        if($this->SMIME) 
     510        { 
     511            $header=''; 
     512            $body = $this->Body; 
     513        } 
    479514 
    480515        $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender; 
     
    490525        for($i = 0; $i < count($this->to); $i++) 
    491526        { 
    492             if(!$this->smtp->Recipient($this->to[$i][0])) 
    493                 $bad_rcpt[] = $this->to[$i][0]; 
     527            if($this->valEm($this->to[$i][0])) 
     528            { 
     529                if(!$this->smtp->Recipient($this->to[$i][0]))  $bad_rcpt[] = $this->to[$i][0]; 
     530            } 
     531            else 
     532            { 
     533                $errorx .= $this->to[$i][0] . ', '; 
     534            } 
    494535        } 
    495536        for($i = 0; $i < count($this->cc); $i++) 
    496537        { 
    497             if(!$this->smtp->Recipient($this->cc[$i][0])) 
    498                 $bad_rcpt[] = $this->cc[$i][0]; 
     538            if($this->valEm($this->cc[$i][0])) 
     539            { 
     540                if(!$this->smtp->Recipient($this->cc[$i][0])) $bad_rcpt[] = $this->cc[$i][0]; 
     541            } 
     542                        else 
     543            { 
     544                $errorx .= $this->cc[$i][0] . ', '; 
     545            } 
    499546        } 
    500547        for($i = 0; $i < count($this->bcc); $i++) 
    501548        { 
    502             if(!$this->smtp->Recipient($this->bcc[$i][0])) 
    503                 $bad_rcpt[] = $this->bcc[$i][0]; 
    504         } 
     549            if($this->valEm($this->bcc[$i][0])) 
     550            { 
     551                if(!$this->smtp->Recipient($this->bcc[$i][0])) $bad_rcpt[] = $this->bcc[$i][0]; 
     552            } 
     553                        else 
     554            { 
     555                $errorx .= $this->bcc[$i][0] . ', '; 
     556            } 
     557        } 
     558        if($errorx != '') 
     559                { 
     560                        $error = $errorx; 
     561                        $error = $this->Lang("recipients_failed")  . '  ' . $errorx; 
     562                        $this->SetError($error); 
     563                        $this->smtp->Reset(); 
     564                        return false; 
     565                } 
    505566 
    506567        if(count($bad_rcpt) > 0) // Create error message 
     
    524585            return false; 
    525586        } 
     587 
     588        // Vai verificar se deve cifrar a msg ...... 
     589        if(count($this->Certs_crypt) > 0) 
     590                { 
     591            // Vai cifrar a msg antes de enviar ...... 
     592                        include_once("../seguranca/classes/CertificadoB.php"); 
     593 
     594            $teste1 = array(); 
     595            $aux_cifra1 = $header . $body; 
     596 
     597            // Início relocação dos headers 
     598            // Esta relocação dos headers podem causar problemas. 
     599 
     600            $match = 0; 
     601            $pattern = '/^Disposition\-Notification\-To:.*\n/m'; 
     602            $match = preg_match($pattern, $aux_cifra1, $teste1); 
     603 
     604            if (!empty($match)){ 
     605                $aux_cifra1 = preg_replace($pattern, '', $aux_cifra1, 1); // retira o Disposition-Notification-To 
     606 
     607                $match = 0; 
     608                $teste2 = array(); 
     609                $pattern = '/^MIME\-Version:.*\n/m'; 
     610                $match = preg_match($pattern, $aux_cifra1, $teste2); 
     611                $aux_cifra1 = preg_replace($pattern, $teste1[0].$teste2[0], $aux_cifra1, 1); // Adiciona Disposition-Notification-To logo acima de MIME-Version 
     612 
     613            } 
     614            // Fim relocação dos headers 
     615 
     616           // Vai partir em duas partes a msg.  A primeira parte he a dos headers, e a segunda vai ser criptografada ... 
     617            $pos_content_type = strpos($aux_cifra1,'Content-Type:'); 
     618            $pos_MIME_Version = strpos($aux_cifra1,'MIME-Version: 1.0' . chr(0x0D) . chr(0x0A)); 
     619            $valx_len = 19; 
     620            if($pos_MIME_Version === False) 
     621                    { 
     622                $pos_MIME_Version = strpos($aux_cifra1,'MIME-Version: 1.0' . chr(0x0A)); 
     623                $valx_len = 18; 
     624                    } 
     625 
     626            if($pos_MIME_Version >= $pos_content_type) 
     627            { 
     628                // nao deve enviar a msg..... O header MIME-Version com posicao invalida ...... 
     629                $this->SetError('Formato dos headers da msg estao invalidos.(CD-17) - A'); 
     630                $this->smtp->Reset(); 
     631                return false; 
     632            } 
     633 
     634            $aux_cifra2 = array(); 
     635            $aux_cifra2[] = substr($aux_cifra1,0,$pos_MIME_Version - 1); 
     636            $aux_cifra2[] = substr($aux_cifra1,$pos_MIME_Version + $valx_len); 
     637 
     638               /* 
     639                        // este explode pode ser fonte de problemas ....... 
     640                        $aux_cifra2 = explode('MIME-Version: 1.0' . chr(0x0A), $aux_cifra1); 
     641                        // Pode ocorrer um erro se nao tiver o header MIME-Version ..... 
     642                        if(count($aux_cifra2)  != 2 ) 
     643                                { 
     644                                        $aux_cifra2 = explode('MIME-Version: 1.0' . chr(0x0D) . chr(0x0A), $aux_cifra1); 
     645                                        if(count($aux_cifra2)  != 2 ) 
     646                                                { 
     647                                                        // nao deve enviar a msg..... nao tem o header MIME-Version ...... 
     648                                                        $this->SetError('Formato dos headers da msg estao invalidos.(CD-17) - ' . count($aux_cifra2)); 
     649                                                        $this->smtp->Reset(); 
     650                                                        return false; 
     651                                                } 
     652                                } 
     653                */ 
     654                        $certificado = new certificadoB(); 
     655                        $h = array(); 
     656                        $aux_body = $certificado->encriptar($aux_cifra2[1], $this->Certs_crypt, $h); 
     657                        if(!$aux_body) 
     658            { 
     659                $this->SetError('Ocorreu um erro. A msg nao foi enviada. (CD-18)'); 
     660                $this->smtp->Reset(); 
     661                return false; 
     662            } 
     663                        // salvar sem cifra...... 
     664                        //$smtpSent = $this->smtp->Data($aux_cifra2[0] . $aux_body); 
     665 
     666                        // salva a msg sifrada. neste caso deve ter sido adicionado o certificado do autor da msg...... 
     667                        $header = $aux_cifra2[0]; 
     668                        $body = $aux_body; 
    526669        $smtpSent = $this->smtp->Data($header . $body); 
     670        } 
     671        else 
     672                { 
     673                        $smtpSent = $this->smtp->Data($header . $body); 
     674                } 
     675 
    527676        if(!$smtpSent) 
    528677        { 
     
    563712                                $header = substr($header, 0, $target) . $this->AddrAppend("Bcc", $this->bcc) . substr($header, $target); 
    564713                        } 
    565                  
    566                         $new_header = str_replace("\n", "\r\n", $header); 
    567                         $new_body = str_replace("\n", "\r\n", $body); 
     714            $new_headerx = str_replace(chr(0x0A),chr(0x0D).chr(0x0A), $header); 
     715                        $new_bodyx = str_replace(chr(0x0A),chr(0x0D).chr(0x0A), $body); 
     716                        $new_header = str_replace(chr(0x0D).chr(0x0D).chr(0x0A), chr(0x0D).chr(0x0A),$new_headerx); 
     717                        $new_body = str_replace(chr(0x0D).chr(0x0D).chr(0x0A), chr(0x0D).chr(0x0A), $new_bodyx); 
    568718                         
    569719                        if ($this->SaveMessageAsDraft){ 
     
    576726         
    577727        return $smtpSent; 
     728    } 
     729 
     730    function valEm($email) 
     731    { 
     732        $mail_retorno = FALSE; 
     733        if ((strlen($email) >= 6) && (substr_count($email,"@") == 1) && (substr($email,0,1) != "@") && (substr($email,strlen($email)-1,1) != "@")) 
     734        { 
     735            if ((!strstr($email,"'")) && (!strstr($email,"\"")) && (!strstr($email,"\\")) && (!strstr($email,"\$")) && (!strstr($email," "))) 
     736            { 
     737                //testa se tem caracter . 
     738                if (substr_count($email,".")>= 1) 
     739                { 
     740                    //obtem a terminação do dominio 
     741                    $term_dom = substr(strrchr ($email, '.'),1); 
     742                    //verifica se terminação do dominio esta correcta 
     743                    if (strlen($term_dom)>1 && strlen($term_dom)<5 && (!strstr($term_dom,"@")) ) 
     744                    { 
     745                        $antes_dom = substr($email,0,strlen($email) - strlen($term_dom) - 1); 
     746                        $caracter_ult = substr($antes_dom,strlen($antes_dom)-1,1); 
     747                        if ($caracter_ult != "@" && $caracter_ult != ".") 
     748                        { 
     749                            $mail_retorno = TRUE; 
     750                        } 
     751                    } 
     752                } 
     753            } 
     754        } 
     755        return $mail_retorno; 
    578756    } 
    579757 
     
    8851063        $result .= $this->HeaderLine("MIME-Version", "1.0"); 
    8861064 
     1065        $result .= $this->write_message_type(); 
     1066 
     1067        if($this->Mailer != "mail") 
     1068            $result .= $this->LE.$this->LE; 
     1069 
     1070        return $result; 
     1071    } 
     1072 
     1073 
     1074    function write_message_type() 
     1075        { 
     1076                $result = ""; 
    8871077        switch($this->message_type) 
    8881078        { 
     
    8911081                $result .= sprintf("Content-Type: %s; charset=\"%s\"", 
    8921082                                    $this->ContentType, $this->CharSet); 
    893                 break; 
     1083                return $result; 
    8941084            case "attachments": 
    8951085                // fall through 
     
    9061096                    $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); 
    9071097                } 
    908                 break; 
     1098                return $result; 
    9091099            case "alt": 
    9101100                $result .= $this->HeaderLine("Content-Type", "multipart/alternative;"); 
    9111101                $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"'); 
    912                 break; 
     1102                return $result; 
    9131103        } 
    9141104 
  • trunk/expressoMail1_2/inc/hook_settings.inc.php

    r1005 r1035  
    1313$type = $_GET['type']; // FIX ME 
    1414 
     15//if ($type == 'user' || $type == ''){ 
     16create_html_code('<script language="JavaScript" type="text/javascript"> 
     17function exibir_ocultar() 
     18{ 
     19    var type = ("'.$type.'" == "") ? "user" : "'.$type.'"; 
     20    var use_signature_digital_cripto = document.getElementsByName(type+"[use_signature_digital_cripto]")[0]; 
     21    var default_signature_digital_cripto = "'.$GLOBALS['phpgw_info']['default']['preferences']['expressoMail']['use_signature_digital_cripto'].'"; 
     22 
     23    if (use_signature_digital_cripto) 
     24    { 
     25        var element_signature_digital = document.getElementById(type+"[use_signature_digital]"); 
     26        var element_signature_cripto = document.getElementById(type+"[use_signature_cripto]"); 
     27 
     28        switch (use_signature_digital_cripto[use_signature_digital_cripto.selectedIndex].value){ 
     29 
     30            case "1": 
     31                element_signature_digital.style.display=""; 
     32                element_signature_cripto.style.display=""; 
     33                break; 
     34            case "0": 
     35                element_signature_digital.style.display="none"; 
     36                element_signature_cripto.style.display="none"; 
     37                break; 
     38            case "": 
     39                if (default_signature_digital_cripto){ 
     40                    element_signature_digital.style.display=""; 
     41                    element_signature_cripto.style.display=""; 
     42                 } 
     43                 else 
     44                 { 
     45                    element_signature_digital.style.display="none"; 
     46                    element_signature_cripto.style.display="none"; 
     47                 } 
     48 
     49        } 
     50 
     51    } 
     52 
     53} 
     54 
     55</script>'); 
     56//} 
     57 
    1558$default = array( 
    1659        '25'    => '25', 
     
    2063); 
    2164 
    22 create_select_box(lang('What is the maximum number of messages per page?'),'max_email_per_page',$default, 
     65create_select_box('What is the maximum number of messages per page?','max_email_per_page',$default, 
    2366        'What is the maximum number of messages per page?'); 
    24 create_check_box(lang('Save deleted messages in trash folder?'),'save_deleted_msg','Save deleted messages in trash folder?'); 
     67create_check_box('Save deleted messages in trash folder?','save_deleted_msg','Save deleted messages in trash folder?'); 
    2568$default = array( 
    2669        '1'    => lang('1 day'), 
     
    3174); 
    3275 
    33 create_select_box(lang('Delete trash messages after how many days?'),'delete_trash_messages_after_n_days',$default,lang('Delete trash messages after how many days?')); 
    34 create_check_box(lang('Would you like to use local messages?'),'use_local_messages',''); 
    35 create_check_box(lang('Would you like to keep archived messages?'),'keep_archived_messages',''); 
    36 create_check_box(lang('Show previous message, after delete actual message?'),'delete_and_show_previous_message',''); 
    37 create_check_box(lang('Do you wanna receive an alert for new messages?'),'alert_new_msg',''); 
    38 create_check_box(lang('Show default view on main screen?'),'mainscreen_showmail',''); 
    39 create_check_box(lang('Do you want to use remove attachments function?'),'remove_attachments_function',''); 
    40 create_check_box(lang('Do you want to use important flag in email editor?'),'enable_important_flag',''); 
     76create_select_box('Delete trash messages after how many days?','delete_trash_messages_after_n_days',$default,lang('Delete trash messages after how many days?')); 
     77create_check_box('Would you like to use local messages?','use_local_messages',''); 
     78create_check_box('Would you like to keep archived messages?','keep_archived_messages',''); 
     79create_check_box('Show previous message, after delete actual message?','delete_and_show_previous_message',''); 
     80create_check_box('Do you wanna receive an alert for new messages?','alert_new_msg',''); 
     81create_check_box('Show default view on main screen?','mainscreen_showmail',''); 
     82create_check_box('Do you want to use remove attachments function?','remove_attachments_function',''); 
     83create_check_box('Do you want to use important flag in email editor?','enable_important_flag',''); 
    4184 
    4285//TODO use default folders from email admin 
     
    4790        'INBOX/'.lang('Trash')  => lang('Trash') 
    4891); 
    49 create_select_box(lang('Save sent messages in folder'),'save_in_folder',$default,''); 
    50 create_check_box(lang('Hide menu folders?'),'check_menu',''); 
     92create_select_box('Save sent messages in folder','save_in_folder',$default,''); 
     93create_check_box('Hide menu folders?','check_menu',''); 
    5194 
    5295$default = array( 
     
    5699); 
    57100 
    58 create_select_box(lang('What is the height of the lines in the list of messages?'),'line_height',$default,''); 
     101create_select_box('What is the height of the lines in the list of messages?','line_height',$default,''); 
    59102$default = array( 
    60103        '10' => lang('small'), 
     
    63106); 
    64107 
    65 create_select_box(lang('What the font size in the list of messages?'),'font_size',$default,''); 
    66 create_check_box(lang('Use dynamic contacts?'),'use_dynamic_contacts',''); 
    67 create_check_box(lang('Use shortcuts?'),'use_shotcuts',''); 
    68 create_check_box(lang('Auto save draft'),'auto_save_draft',''); 
     108create_select_box('What the font size in the list of messages?','font_size',$default,''); 
     109create_check_box('Use dynamic contacts?','use_dynamic_contacts',''); 
     110create_check_box('Use shortcuts?','use_shotcuts',''); 
     111create_check_box('Auto save draft','auto_save_draft',''); 
    69112$default = array( 
    70113        '65536' => lang('unlimited'), 
     
    76119); 
    77120 
    78 create_select_box(lang('What is the maximum size of embedded images')."?",'image_size',$default,''); 
     121create_select_box('What is the maximum size of embedded images'."?",'image_size',$default,''); 
     122 
     123if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) 
     124{ 
     125    create_check_box('Enable digitally sign/cipher the message?','use_signature_digital_cripto','','',True,'onchange="javascript:exibir_ocultar();"'); 
     126    if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto']) 
     127    { 
     128        create_check_box('Always sign message digitally?','use_signature_digital',''); 
     129        create_check_box('Always cipher message digitally?','use_signature_cripto',''); 
     130    } 
     131    else 
     132    { 
     133        create_check_box('Always sign message digitally?','use_signature_digital','','',True,'',False); 
     134        create_check_box('Always cipher message digitally?','use_signature_cripto','','',True,'',False); 
     135    } 
     136} 
    79137 
    80138$default = array( 
     
    83141); 
    84142 
    85 create_select_box(lang('Signature Type'),'type_signature',$default,'','','','onchange="javascript:changeType(this.value);" onload="javascript:alert(this.value);"'); 
     143create_select_box('Signature Type','type_signature',$default,'','','','onchange="javascript:changeType(this.value);" onload="javascript:alert(this.value);"'); 
    86144 
    87145if ($type == 'user' || $type == ''){ 
  • trunk/expressoMail1_2/index.php

    r905 r1035  
    2828                'nonavbar' => False, 
    2929                'currentapp' => 'expressoMail1_2', 
    30                 'update_version'        => '1.234', 
     30                'update_version'        => '1.334', 
    3131                'enable_nextmatchs_class' => True 
    3232        ); 
     
    9090        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_important_flag'] = $current_config['expressoMail_enable_important_flag']; 
    9191        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_local_messages'] : "0"; 
    92         $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] : "0";  
     92        $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['keep_archived_messages'] : "0"; 
     93    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_assinar_criptografar'] = $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] ?  $GLOBALS['phpgw_info']['server']['use_assinar_criptografar'] : "0"; 
     94    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto'] : "0"; 
     95    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital'] : "0"; 
     96    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['num_max_certs_to_cipher'] = $GLOBALS['phpgw_info']['server']['num_max_certs_to_cipher'] ?  $GLOBALS['phpgw_info']['server']['num_max_certs_to_cipher'] : "10"; 
     97    $_SESSION['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'] = $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'] ? $GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto'] : "0"; 
    9398 
    9499        $template = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 
     
    135140    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder']              : lang("Spam"); 
    136141    $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']    = $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']      ? $_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder']              : lang("Sent"); 
    137      
     142 
     143    // gera paramero com tokens suportados .... 
     144    $var_tokens = ''; 
     145    for($ii = 1; $ii < 11; $ii++) 
     146    { 
     147        if($GLOBALS['phpgw_info']['server']['test_token' . $ii . '1']) 
     148            $var_tokens .= $GLOBALS['phpgw_info']['server']['test_token' . $ii . '1'] . ','; 
     149    } 
     150 
     151    if(!$var_tokens) 
     152    { 
     153        $var_tokens = 'ePass2000Lx;/usr/lib/libepsng_p11.so,ePass2000Win;c:/windows/system32/ngp11v211.dll'; 
     154    } 
     155 
    138156    echo '<script> var special_folders = new Array(4); 
    139157        special_folders["'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultTrashFolder'].'"] = \'Trash\'; 
     
    144162    var draftsfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultDraftsFolder'].'"; 
    145163    var sentfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSentFolder'].'"; 
    146     var spamfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'";                  
     164    var spamfolder = "'.$_SESSION['phpgw_info']['expressomail']['email_server']['imapDefaultSpamFolder'].'"; 
     165    var token_param = "'.$var_tokens.'"; 
     166    var locale = "'.$GLOBALS['phpgw']->common->getPreferredLanguage().'"; 
    147167    </script>'; 
    148168 
  • trunk/expressoMail1_2/js/draw_api.js

    r1000 r1035  
    514514                 
    515515                td_element2 = document.createElement("TD"); 
    516                 td_element2.setAttribute("width", "2%");                 
     516                td_element2.setAttribute("width", "7%"); 
    517517                td_element3 = document.createElement("TD"); 
    518                 td_element3.setAttribute("width", "31%"); 
     518                td_element3.setAttribute("width", "29%"); 
    519519                td_element3.onclick = function () {sort_box(search_box_type,'SORTFROM');}; 
    520520                td_element3.id = "message_header_SORTFROM_"+numBox; 
     
    523523                 
    524524                td_element4 = document.createElement("TD"); 
    525                 td_element4.setAttribute("width", "41%"); 
     525                td_element4.setAttribute("width", "38%"); 
    526526                td_element4.onclick = function () {sort_box(search_box_type,'SORTSUBJECT');}; 
    527527                td_element4.id = "message_header_SORTSUBJECT_"+numBox; 
     
    752752                td_element21.id = "td_message_answered_"+headers_msgs.msg_number; 
    753753 
     754                if (headers_msgs.attachment && headers_msgs.attachment.number_attachments > 0) { 
     755                        attach_name = headers_msgs.attachment.names.split(", "); 
     756                        for(var item in attach_name) 
     757                        { 
     758                                if (url_decode(attach_name[item]) != 'smime.p7s' && url_decode(attach_name[item]) != 'smime.p7m'){ 
     759                                        td_element21.innerHTML = "<img src ='templates/"+template+"/images/clip.gif' title='" + url_decode(attach_name[item]) + "'>"; 
     760                                        break; 
     761                                } 
     762                        } 
     763                } 
     764 
    754765                if ((headers_msgs.Forwarded == 'F')  || (headers_msgs.Draft == 'X' && headers_msgs.Answered == 'A')){ 
    755766                        td_element21.innerHTML = "<img src ='templates/"+template+"/images/forwarded.gif' title='"+get_lang('Forwarded')+"'>"; 
    756767                        headers_msgs.Draft = ''  
    757768                        headers_msgs.Answered = ''; 
    758                         headers_msgs.Forwarded == 'F'; 
     769                        headers_msgs.Forwarded = 'F'; 
    759770                } 
    760771                else if (headers_msgs.Draft == 'X') 
     
    768779                td_element22.className = "td_msg"; 
    769780                td_element22.setAttribute("width", "1%"); 
    770                 td_element22.id = "td_message_important_"+headers_msgs.msg_number; 
     781                td_element22.id = "td_message_signed_"+headers_msgs.msg_number; 
     782 
     783        //td_element23 = document.createElement("TD"); 
     784                //td_element23.setAttribute("width", "1%"); 
     785                //td_element23.id = "td_message_signed_"+headers_msgs.msg_number; 
     786        switch(headers_msgs.ContentType) 
     787                { 
     788            case "signature": 
     789                        { 
     790                                td_element22.innerHTML = "<img src ='templates/"+template+"/images/signed_msg.gif' title='" + get_lang('Signed message') + "'>"; 
     791                                break; 
     792                        } 
     793            case "cipher": 
     794                        { 
     795                                td_element22.innerHTML = "<img src ='templates/"+template+"/images/lock.gif' title='" + get_lang('Crypted message') + "'>"; 
     796                                break; 
     797                        } 
     798            default: 
     799                        { 
     800                                break; 
     801                        } 
     802                } 
     803 
     804        td_element23 = document.createElement("TD"); 
     805                td_element23.className = "td_msg" 
     806                td_element23.setAttribute("width", "1%"); 
     807                td_element23.id = "td_message_important_"+headers_msgs.msg_number; 
    771808 
    772809                if (headers_msgs.Flagged == 'F' || (headers_msgs.Importance.toLowerCase().indexOf("high") != -1 && preferences.use_important_flag == 'True')) 
    773810                { 
    774                         td_element22.innerHTML = "<img src ='templates/"+template+"/images/important.gif' title='"+get_lang('Important')+"'>"; 
     811                        td_element23.innerHTML = "<img src ='templates/"+template+"/images/important.gif' title='"+get_lang('Important')+"'>"; 
    775812                } 
    776813                else 
    777                         td_element22.innerHTML = "&nbsp;&nbsp;&nbsp;"; 
    778  
    779                 td_element23 = document.createElement("TD"); 
    780                 td_element23.className = "td_msg"; 
    781                 td_element23.setAttribute("width", "1%"); 
    782                 td_element23.id = "td_message_sent_"+headers_msgs.msg_number; 
    783                 td_element23.innerHTML = "&nbsp;&nbsp;&nbsp;"; 
     814                        td_element23.innerHTML = "&nbsp;&nbsp;&nbsp;"; 
     815 
     816                td_element24 = document.createElement("TD"); 
     817                td_element24.className = "td_msg"; 
     818                td_element24.setAttribute("width", "1%"); 
     819                td_element24.id = "td_message_sent_"+headers_msgs.msg_number; 
     820                td_element24.innerHTML = "&nbsp;&nbsp;&nbsp;"; 
    784821                // preload image 
    785822                var _img_sent = new Image(); 
     
    803840                        else{                            
    804841                                if(headers_msgs.to.email.toLowerCase() != Element("user_email").value) 
    805                                         td_element23.innerHTML = "<img valign='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; 
     842                                        td_element24.innerHTML = "<img valign='center' src ='templates/"+template+"/images/sent.gif' title='"+get_lang('Sent')+"'>"; 
    806843                         
    807844                                if ((headers_msgs.to)&&(headers_msgs.to.name != null)) 
     
    880917                tr_element.appendChild(td_element22); 
    881918                tr_element.appendChild(td_element23); 
     919        tr_element.appendChild(td_element24); 
    882920                tr_element.appendChild(td_element3); 
    883921                tr_element.appendChild(td_element4); 
     
    9661004        // Old 
    9671005        //img_next_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_next_msg&msg_number="+ info_msg.msg_number + "&msg_folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type +  "&search_box_type="+ search_box_type +"&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)}; 
    968         var folder = document.getElementById(ID.substr(0, ID.indexOf('_'))); 
     1006    var folder_id = 0; 
     1007    folder_id = info_msg.original_ID ? info_msg.original_ID: info_msg.msg_number; 
     1008        var folder = document.getElementById(folder_id); 
    9691009        if (!folder){ 
    9701010                delete_border(ID); 
    9711011                return; 
    9721012                } 
    973         if (folder.nextSibling){ 
    974                 var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; 
    975                 img_next_msg.onclick = function() 
     1013    if (folder){ // mensagem local criptografada nao tem ID da pasta local 
     1014        if (folder.nextSibling){ 
     1015            var nextMsgBox = folder.nextSibling.name?folder.nextSibling.name:info_msg.msg_folder; 
     1016 
     1017            if (nextMsgBox == "INBOX/decifradas")// teste para ver se a mensagem vem da pasta oculta decifradas 
     1018                    nextMsgBox = get_current_folder(); 
     1019 
     1020            img_next_msg.onclick = function() 
     1021            { 
     1022                currentTab = ID; 
     1023                openTab.type[ID] = 2; 
     1024                            proxy_mensagens.get_msg(parseInt(folder.nextSibling.id),nextMsgBox,true,show_msg); 
     1025                //cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.nextSibling.id+"&msg_folder="+nextMsgBox, show_msg); 
     1026            }; 
     1027        } 
     1028        else 
     1029        { 
     1030            img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; 
     1031            img_next_msg.style.cursor = 'default'; 
     1032 
     1033        } 
     1034    } 
     1035    else 
     1036    { 
     1037        img_next_msg.src = "./templates/"+template+"/images/down.gray.button.png"; 
     1038                img_next_msg.style.cursor = 'default'; 
     1039                if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX/decifradas")) // testa se a mensagem e local 
    9761040                { 
    977                         currentTab = ID; 
    978                         openTab.type[ID] = 2; 
    979                         proxy_mensagens.get_msg(parseInt(folder.nextSibling.id),nextMsgBox,true,show_msg); 
    980                         //cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.nextSibling.id+"&msg_folder="+nextMsgBox, show_msg); 
    981                 }; 
    982         } 
    983         else 
    984                 img_next_msg.onclick = function() 
    985                         { 
    986                                 /*current_page++; 
    987                                 msg_range_end = (current_page*preferences.max_email_per_page); 
    988                                 msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); 
    989                                 kill_current_box(); 
    990                                 cExecute ('$this.imap_functions.get_range_msgs2&folder='+current_folder+'&msg_range_begin='+msg_range_begin+'&msg_range_end='+msg_range_end+'&sort_box_reverse=1', function handler(data){draw_box(data, current_folder);}) */ 
    991                                         delete_border(ID); 
    992                         }; 
    993  
     1041            img_next_msg.onclick = function() 
     1042                { 
     1043                    /*current_page++; 
     1044                    msg_range_end = (current_page*preferences.max_email_per_page); 
     1045                    msg_range_begin = (msg_range_end-(preferences.max_email_per_page)+1); 
     1046                    kill_current_box(); 
     1047                    cExecute ('$this.imap_functions.get_range_msgs2&folder='+current_folder+'&msg_range_begin='+msg_range_begin+'&msg_range_end='+msg_range_end+'&sort_box_reverse=1', function handler(data){draw_box(data, current_folder);}) */ 
     1048                        delete_border(ID); 
     1049                }; 
     1050        } 
     1051    } 
    9941052        var img_space = document.createElement("SPAN"); 
    9951053        img_space.innerHTML = "&nbsp;"; 
     
    10021060        //Old 
    10031061        //img_previous_msg.onclick = function () {cExecute ("$this.imap_functions.get_info_previous_msg&msgs_number="+ info_msg.msg_number + "&folder="+ info_msg.msg_folder + "&sort_box_type="+ sort_box_type+ "&search_box_type="+ search_box_type + "&sort_box_reverse="+ sort_box_reverse +"&reuse_border="+ID, show_msg)} 
    1004         folder = document.getElementById(ID.substr(0, ID.indexOf('_'))); 
     1062        //folder = document.getElementById(ID.substr(0, ID.indexOf('_'))); 
    10051063        if (!folder){ 
    10061064                delete_border(ID); 
    10071065                return; 
    10081066                } 
    1009         if (folder.previousSibling) 
     1067    if (folder){ // mensagem local criptografada nao tem ID da pasta local 
     1068        if (folder.previousSibling) 
     1069        { 
     1070            var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; 
     1071 
     1072            if (previousMsgBox == "INBOX/decifradas") // teste para ver se a mensagem vem da pasta oculta decifradas 
     1073                    previousMsgBox = get_current_folder(); 
     1074 
     1075            img_previous_msg.onclick = function() 
     1076            { 
     1077                currentTab = ID; 
     1078                openTab.type[ID] = 2; 
     1079                //cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.previousSibling.id+"&msg_folder=" + previousMsgBox, show_msg); 
     1080                            proxy_mensagens.get_msg(parseInt(folder.previousSibling.id),previousMsgBox,true,show_msg); 
     1081            }; 
     1082        } 
     1083        else 
     1084        { 
     1085            img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; 
     1086            img_previous_msg.style.cursor = 'default'; 
     1087        } 
     1088        } 
     1089        else 
    10101090        { 
    1011                 var previousMsgBox = folder.previousSibling.name?folder.previousSibling.name:info_msg.msg_folder; 
    1012                 img_previous_msg.onclick = function() 
    1013                 { 
    1014                         currentTab = ID; 
    1015                         openTab.type[ID] = 2; 
    1016                         //cExecute("$this.imap_functions.get_info_msg&msg_number="+folder.previousSibling.id+"&msg_folder=" + previousMsgBox, show_msg); 
    1017                         proxy_mensagens.get_msg(parseInt(folder.previousSibling.id),previousMsgBox,true,show_msg); 
    1018                 }; 
    1019         } 
    1020         else 
    1021                 img_previous_msg.onclick = function() 
    1022                 { 
    1023                         delete_border(ID); 
    1024                 }; 
    1025  
     1091                img_previous_msg.src = "./templates/"+template+"/images/up.gray.button.png"; 
     1092                img_previous_msg.style.cursor = 'default'; 
     1093                if (!proxy_mensagens.is_local_folder(get_current_folder()) && !(info_msg.msg_folder == "INBOX/decifradas")) // testa se a mensagem e local 
     1094        { 
     1095            img_previous_msg.onclick = function() 
     1096            { 
     1097                delete_border(ID); 
     1098            }; 
     1099        } 
     1100    } 
    10261101        next_previous_msg_td.appendChild(img_previous_msg); 
    10271102        next_previous_msg_td.appendChild(img_space); 
     
    11071182        option_mark.align = "left"; 
    11081183        option_mark.width = "50%"; 
    1109         var option_mark_as_unseen = '<span class="message_options" onclick="set_messages_flag(\'unseen\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, '; 
    1110         var option_mark_as_important = '<span class="message_options" onclick="set_messages_flag(\'flagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, '; 
    1111         var option_mark_as_normal = '<span class="message_options" onclick="set_messages_flag(\'unflagged\','+info_msg.msg_number+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span>'; 
     1184        var option_mark_as_unseen = '<span class="message_options" onclick="set_messages_flag(\'unseen\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Unseen")+'.\');">'+get_lang("Unseen")+'</span>, '; 
     1185        var option_mark_as_important = '<span class="message_options" onclick="set_messages_flag(\'flagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Important")+'.\');">'+get_lang("Important")+'</span>, '; 
     1186        var option_mark_as_normal = '<span class="message_options" onclick="set_messages_flag(\'unflagged\','+folder_id+');write_msg(\''+get_lang('Message marked as ')+get_lang("Normal")+'.\');">'+get_lang("Normal")+'</span>'; 
    11121187        option_mark.innerHTML = option_mark_as_unseen+option_mark_as_important+option_mark_as_normal; 
    11131188        option_hide_more.innerHTML = get_lang('Options'); 
     
    11921267        tbody_message_options.appendChild(tr_other_options); 
    11931268        ////////// END OTHER OPTIONS //////////////// 
     1269 
     1270        ////////// BEGIN SIGNATURE ////////////////// 
     1271        if (info_msg.signature && info_msg.signature.length > 0) 
     1272        { 
     1273                var tr_signature = document.createElement("TR"); 
     1274                var td_signature = document.createElement("TD"); 
     1275                td_signature.className = 'tr_message_header'; 
     1276                tr_signature.id = 'tr_signature_'+ID; 
     1277                td_signature.colSpan = "5"; 
     1278                tr_signature.style.display = 'none'; 
     1279 
     1280                for (i in info_msg.signature) 
     1281                        td_signature.innerHTML += '<span>'+info_msg.signature[i]+'</span> <br /> '; 
     1282                var signature_status_pos = info_msg.signature[0].indexOf(get_lang('Message untouched')); 
     1283                td_signature.id = "td_signature_"+ID; 
     1284                if(signature_status_pos < 0 ) 
     1285                { 
     1286                td.innerHTML += '&nbsp;<img style="cursor:pointer" src="templates/'+template+'/images/signed_error.gif" title="'+get_lang("Details")+'">'; 
     1287                tr_signature.style.display = ''; 
     1288                } 
     1289                else 
     1290                { 
     1291                td.innerHTML += '&nbsp;<img style="cursor:pointer" src="templates/'+template+'/images/signed_table.gif" title="'+get_lang("Details")+'">'; 
     1292                } 
     1293                td.onclick = function(){ 
     1294                var _height = Element("div_message_scroll_"+ID).style.height; 
     1295                _height = parseInt(_height.replace("px","")); 
     1296                var _offset = 130; 
     1297                if (this.value == 'more_cert'){ 
     1298                        //this.innerHTML += "<b><u>Mais Informaᅵᅵes</u></b>"; 
     1299                        this.value = 'hide_cert'; 
     1300                        Element("div_message_scroll_"+ID).style.height = (_height + _offset)+"px"; 
     1301                        Element('tr_signature_'+ID).style.display = 'none'; 
     1302                        Element('td_signature_'+ID).style.display = 'none'; 
     1303 
     1304                } 
     1305                else{ 
     1306                        //this.innerHTML += "Mais Informaᅵᅵes"; 
     1307                        this.value = 'more_cert'; 
     1308                        Element("div_message_scroll_"+ID).style.height = (_height - _offset)+"px"; 
     1309                        Element('tr_signature_'+ID).style.display = ''; 
     1310                        Element('td_signature_'+ID).style.display = ''; 
     1311                } 
     1312        }; 
     1313 
     1314                tr_signature.appendChild(td_signature); 
     1315                tbody_message_options.appendChild(tr_signature); 
     1316        /******************************************* Old signature   ***********************************************/ 
     1317                //if (info_msg.signature != "void") 
     1318                //      td.innerHTML += '&nbsp;<img style="cursor:pointer" onclick="alert(\''+ get_lang("This message is signed, and you can trust.") + info_msg.signature +'\');" src="'+tpl_img_path+'/signed.gif">'; 
     1319                //else 
     1320                //      td.innerHTML += "&nbsp;<img style='cursor:pointer' onclick='alert(\""+get_lang("This message is signed, but it is invalid. You should not trust on it.")+"\");' title='"+get_lang("Voided message")+"' src='"+tpl_img_path+"/invalid.gif'>"; 
     1321        /*****************************************                                                                                                                      ********/ 
     1322        } 
     1323        //////////// END SIGNATURE //////////////// 
     1324 
    11941325        table_message_options.appendChild(tbody_message_options); 
    11951326        td0.appendChild(table_message_options); 
     
    20722203        input_return_receipt.name = "input_return_receipt"; 
    20732204        input_return_receipt.setAttribute("tabIndex","-1"); 
    2074         td_return_receipt.appendChild(input_return_receipt);     
     2205        td_return_receipt.appendChild(input_return_receipt); 
     2206 
     2207 
     2208//alert("preferences.use_assinar_criptografar " + preferences.use_assinar_criptografar); 
     2209//alert("preferences.use_signature_digital_cripto " + preferences.use_signature_digital_cripto); 
     2210//alert("preferences.use_signature_digital " + preferences.use_signature_digital); 
     2211//alert("preferences.use_signature_cripto " + preferences.use_signature_cripto); 
     2212 
     2213    if(preferences.use_assinar_criptografar==1) 
     2214        { 
     2215                if(preferences.use_signature_digital_cripto==1) 
     2216                { 
     2217                        td_return_receipt.innerHTML +=  "&nbsp;&nbsp;" + get_lang("Digitally sign message?")+""; 
     2218                        var input_return_digital = document.createElement('input'); 
     2219                        input_return_digital.type = "checkbox"; 
     2220                        input_return_digital.className = "checkbox"; 
     2221                        input_return_digital.id = "return_digital_"+ID; 
     2222                        input_return_digital.name = "input_return_digital"; 
     2223                        input_return_digital.setAttribute("tabIndex","-1"); 
     2224                        if(preferences.use_signature_digital==1) 
     2225                        { 
     2226                                input_return_digital.defaultChecked=true; 
     2227                        } 
     2228                        td_return_receipt.appendChild(input_return_digital); 
     2229                        //descomentariar a linha abaixo para criptografia 
     2230                        td_return_receipt.innerHTML +=  "&nbsp;&nbsp;" + get_lang("Digitally crypt message?")+""; 
     2231                        var input_return_cripto = document.createElement('input'); 
     2232                        input_return_cripto.type = "checkbox"; 
     2233                        input_return_cripto.className = "checkbox"; 
     2234                        input_return_cripto.id = "return_cripto_"+ID; 
     2235                        input_return_cripto.name = "input_return_cripto"; 
     2236                        input_return_cripto.setAttribute("tabIndex","-1"); 
     2237                        //input_return_cripto.style.display = "none"; 
     2238                        input_return_cripto.defaultChecked=false; 
     2239                        //Descomentariar o bloco abaixo para criptografia 
     2240 
     2241                        if(preferences.use_signature_cripto==1) 
     2242                        { 
     2243                                input_return_cripto.defaultChecked=true; 
     2244                        } 
     2245 
     2246                        td_return_receipt.appendChild(input_return_cripto); 
     2247 
     2248                } 
     2249        } 
     2250 
    20752251        tr5.appendChild(td5); 
    20762252        tr5.appendChild(td_return_receipt); 
  • trunk/expressoMail1_2/js/local_messages.js

    r1000 r1035  
    135135        local_messages.prototype.get_local_mail = function(id_mail) { 
    136136                this.init_local_messages(); 
    137                 var rs = this.dbGears.execute("select mail.rowid,mail.mail,mail.ffrom,mail.subject,mail.body,mail.fto,mail.cc,folder.folder from mail inner join folder on mail.id_folder=folder.rowid  where mail.rowid="+id_mail); 
     137                var rs = this.dbGears.execute("select mail.rowid,mail.mail,mail.ffrom,mail.subject,mail.body,mail.fto,mail.cc,folder.folder,mail.original_id from mail inner join folder on mail.id_folder=folder.rowid  where mail.rowid="+id_mail); 
    138138                var retorno = null; 
    139139                if(rs.isValidRow()) { 
     
    141141                } 
    142142                retorno = connector.unserialize(retorno); 
    143                  
    144                 retorno['from'] = connector.unserialize(rs.field(2)); 
    145                 retorno['subject'] = rs.field(3); 
    146                 retorno['body'] = rs.field(4); 
    147                 //Codigo que as imagens embutidas em emails (com multipart/related ou multipart/mixed) sejam corretamente mostradas em emails arquivados. Os links do 
    148                 //tipo "./inc/show_embedded_attach.php?msg_folder=[folder]&msg_num=[msg_num]&msg_part=[part]" 
    149                 //são substituidos pelos links dos anexos capturados pelo gears. 
    150  
    151                 var thumbs= retorno.thumbs; 
    152                 var anexos= retorno.array_attach; 
    153                 for (i in anexos) 
    154                 { 
    155                     nomeArquivo = anexos[i]['name'].substring(0,anexos[i]['name'].length - 4); 
    156                     if(nomeArquivo.match('jpg')||anexos[i]['name'].match('gif')||anexos[i]['name'].match('png')) 
    157                         { 
    158                             var er_imagens = new RegExp("\\.\\/inc\\/show_embedded_attach.php\\?msg_folder=[\\w/]+\\&msg_num=[0-9]+\\&msg_part="+anexos[i]['pid']); 
    159                             var Result_imagens = er_imagens.exec(retorno['body']); 
    160                             retorno['body'] = retorno['body'].replace(Result_imagens,anexos[i]['url']); 
    161                             if(thumbs && thumbs[i]){ 
    162                                 er_imagens = new RegExp("\\.\\/inc\\/show_thumbs.php\\?file_type=image\\/[\\w]+\\&msg_num=[0-9]+\\&msg_folder=[\\w/%]+\\&msg_part="+anexos[i]['pid']); 
    163                                 Result_imagens = er_imagens.exec(thumbs[i]); 
    164                                 thumbs[i] = thumbs[i].replace(Result_imagens,"'"+anexos[i]['url']+"'"); 
    165                                 er_imagens = new RegExp("\\.\\/inc\\/show_img.php\\?msg_num=[0-9]+\\&msg_folder=[\\w/%]+\\&msg_part="+anexos[i]['pid']); 
    166                                 Result_imagens = er_imagens.exec(thumbs[i]); 
    167                                 thumbs[i] = thumbs[i].replace(Result_imagens,"'"+anexos[i]['url']+"'"); 
    168                                 thumbs[i] = thumbs[i].replace(/<IMG/i,'<img width="120"'); 
    169                             } 
     143 
     144        //alert('tipo retorno.source: ' + typeof(retorno.source)); 
     145 
     146        if (typeof(retorno.source) == 'string') 
     147        { 
     148            retorno.msg_number=rs.field(0); 
     149            retorno.original_ID=rs.field(8); 
     150            retorno.msg_folder=rs.field(7); 
     151 
     152            //alert('tipo retorno: '+typeof(retorno)) 
     153            //show_msg(retorno); 
     154        } 
     155                else 
     156        { 
     157            retorno['from'] = connector.unserialize(rs.field(2)); 
     158            retorno['subject'] = rs.field(3); 
     159            retorno['body'] = rs.field(4); 
     160            //Codigo que as imagens embutidas em emails (com multipart/related ou multipart/mixed) sejam corretamente mostradas em emails arquivados. Os links do 
     161            //tipo "./inc/show_embedded_attach.php?msg_folder=[folder]&msg_num=[msg_num]&msg_part=[part]" 
     162            //são substituidos pelos links dos anexos capturados pelo gears. 
     163 
     164            var thumbs= retorno.thumbs; 
     165            var anexos= retorno.array_attach; 
     166            for (i in anexos) 
     167            { 
     168                nomeArquivo = anexos[i]['name'].substring(0,anexos[i]['name'].length - 4); 
     169                if(nomeArquivo.match('jpg')||anexos[i]['name'].match('gif')||anexos[i]['name'].match('png')) 
     170                    { 
     171                        var er_imagens = new RegExp("\\.\\/inc\\/show_embedded_attach.php\\?msg_folder=[\\w/]+\\&msg_num=[0-9]+\\&msg_part="+anexos[i]['pid']); 
     172                        var Result_imagens = er_imagens.exec(retorno['body']); 
     173                        retorno['body'] = retorno['body'].replace(Result_imagens,anexos[i]['url']); 
     174                        if(thumbs && thumbs[i]){ 
     175                            er_imagens = new RegExp("\\.\\/inc\\/show_thumbs.php\\?file_type=image\\/[\\w]+\\&msg_num=[0-9]+\\&msg_folder=[\\w/%]+\\&msg_part="+anexos[i]['pid']); 
     176                            Result_imagens = er_imagens.exec(thumbs[i]); 
     177                            thumbs[i] = thumbs[i].replace(Result_imagens,"'"+anexos[i]['url']+"'"); 
     178                            er_imagens = new RegExp("\\.\\/inc\\/show_img.php\\?msg_num=[0-9]+\\&msg_folder=[\\w/%]+\\&msg_part="+anexos[i]['pid']); 
     179                            Result_imagens = er_imagens.exec(thumbs[i]); 
     180                            thumbs[i] = thumbs[i].replace(Result_imagens,"'"+anexos[i]['url']+"'"); 
     181                            thumbs[i] = thumbs[i].replace(/<IMG/i,'<img width="120"'); 
    170182                        } 
    171                 } 
    172  
    173                 retorno['to'] = connector.unserialize(rs.field(5)); 
    174                 retorno['cc'] = connector.unserialize(rs.field(6)); 
    175                  
    176                 retorno['local_message'] = true; 
    177                 retorno['msg_folder'] = "local_"+rs.field(7); //Now it's a local folder  
    178                 retorno['msg_number'] = rs.field(0); //the message number is the rowid 
     183                    } 
     184            } 
     185 
     186            retorno['to'] = connector.unserialize(rs.field(5)); 
     187            retorno['cc'] = connector.unserialize(rs.field(6)); 
     188 
     189            retorno['local_message'] = true; 
     190            retorno['msg_folder'] = "local_"+rs.field(7); //Now it's a local folder 
     191            retorno['msg_number'] = rs.field(0); //the message number is the rowid 
     192 
     193        } 
     194 
     195        rs.close(); 
    179196                this.finalize(); 
    180197                return retorno; 
     
    671688    } 
    672689 
     690    local_messages.prototype.get_msg_date = function (original_id, is_local){ 
     691 
     692        this.init_local_messages(); 
     693 
     694        if (typeof(is_local) == 'undefined') 
     695        { 
     696            is_local = false; 
     697        } 
     698 
     699        var rs; 
     700 
     701        if (is_local) 
     702        { 
     703            rs = this.dbGears.execute("select mail from mail where rowid="+original_id); 
     704        } 
     705        else 
     706        { 
     707            rs = this.dbGears.execute("select mail from mail where original_id="+original_id); 
     708        } 
     709        var tmp = connector.unserialize(rs.field(0)); 
     710        var ret = new Array(); 
     711        ret.fulldate = tmp.fulldate.substr(0,16); 
     712        ret.smalldate = tmp.msg_day; 
     713        ret.msg_day = tmp.msg_day; 
     714        ret.msg_hour = tmp.msg_day; 
     715 
     716        rs.close(); 
     717        this.finalize(); 
     718        return ret; 
     719    } 
     720 
    673721 
    674722    local_messages.prototype.download_all_local_attachments = function(folder,id){ 
  • trunk/expressoMail1_2/js/main.js

    r1005 r1035  
    2323                        write_msg(get_lang("Attention, you are in out of office mode."), true); 
    2424                ConstructMenuTools(); 
     25 
     26        // Insere a applet de criptografia 
     27        if (preferences.use_signature_digital_cripto == '1'){ 
     28            loadApplet(); 
     29        } 
     30        // Fim da inserção da applet 
     31 
    2532                cExecute ("$this.imap_functions.get_folders_list", update_menu); 
    2633        } 
     
    3643        // Get cyrus delimiter 
    3744        cyrus_delimiter = Element('cyrus_delimiter').value; 
    38          
     45    var del_return = function(data){ 
     46                //alert(data); 
     47        } 
     48 
     49        cExecute ("$this.imap_functions.delete_mailbox&del_past=INBOX/decifradas", del_return); 
    3950        cExecute ("$this.db_functions.get_dropdown_contacts", save_contacts); 
    4051        cExecute ("$this.functions.get_preferences", save_preferences); 
    4152        setTimeout('auto_refresh()', time_refresh); 
    4253} 
     54 
     55/** 
     56 * Carrega a applet java no objeto search_div 
     57 * @author Mário César Kolling <mario.kolling@serpro.gov.br> 
     58 */ 
     59 
     60function loadApplet(){ 
     61 
     62    var search_div = Element('search_div'); 
     63    var applet = null; 
     64    if (navigator.userAgent.match('MSIE')){ 
     65        applet = document.createElement('<object style="display:yes;width:0;height:0;vertical-align:bottom;" id="cert_applet" ' + 
     66            'classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"></object>'); 
     67 
     68        //applet = document.createElement('object'); 
     69        //var attributes = { 
     70        //    style:'display:yes;width:0;height:0;vertical-align:bottom;', 
     71        //    id:'cert_applet', 
     72        //    classid:'clsid:8AD9C840-044E-11D1-B3E9-00805F499D93' 
     73        //} 
     74 
     75        var parameters = { 
     76            type:'application/x-java-applet;version=1.5', 
     77            code:'ExpressoSmimeApplet', 
     78            codebase:'../', 
     79            mayscript:'true', 
     80            token: token_param, 
     81            locale: locale, 
     82            archive:'ExpressoCertMail.jar,' + 
     83                'ExpressoCert.jar,' + 
     84                'bcmail-jdk15-142.jar,' + 
     85                'mail.jar,' + 
     86                'activation.jar,' + 
     87                'bcprov-jdk15-142.jar,' + 
     88                'commons-codec-1.3.jar,' + 
     89                'commons-httpclient-3.1.jar,' + 
     90                'commons-logging-1.1.1.jar' 
     91            //debug:'true' 
     92        } 
     93 
     94        //for (var attribute in attributes){ 
     95        //    applet.setAttribute(attribute, attributes[attribute]); 
     96        //} 
     97 
     98        if (parameters != 'undefined' && parameters != null){ 
     99            for (var parameter in parameters) { 
     100                var param = document.createElement("PARAM"); 
     101                param.setAttribute("name",parameter); 
     102                param.setAttribute("value",parameters[parameter]); 
     103                applet.appendChild(param); 
     104            } 
     105        } 
     106        search_div.appendChild(applet); 
     107        //alert(search_div.innerHTML); 
     108        //alert(window.); 
     109    } 
     110    else { 
     111        applet = document.createElement('embed'); 
     112        applet.innerHTML = '<embed style="display:yes;width:0;height:0;vertical-align:bottom;" id="cert_applet" code="ExpressoSmimeApplet.class" ' + 
     113            'codebase="../" locale="'+locale+'"'+ 
     114            'archive="ExpressoCertMail.jar,ExpressoCert.jar,bcmail-jdk15-142.jar,mail.jar,activation.jar,bcprov-jdk15-142.jar,commons-codec-1.3.jar,commons-httpclient-3.1.jar,commons-logging-1.1.1.jar" ' + 
     115            'token="' + token_param + '" ' + 
     116            'type="application/x-java-applet;version=1.5" mayscript > ' + 
     117            //'type="application/x-java-applet;version=1.5" debug="true" mayscript > ' + 
     118            '<noembed> ' + 
     119            'No Java Support. ' + 
     120            '</noembed> ' + 
     121            '</embed> '; 
     122        search_div.appendChild(applet); 
     123    } 
     124} 
     125 
    43126function disable_field(field,condition) { 
    44127        var comando = "if ("+condition+") { document.getElementById('"+field.id+"').disabled=true;} else { document.getElementById('"+field.id+"').disabled=false; }"; 
     
    137220                        write_msg(get_lang("Error in SMTP sending read confirmation.")); 
    138221        } 
     222     
     223        if(msg_info.source) 
     224        { 
     225        // Abrindo um e-mail criptografado 
     226        // Verifica se existe o objeto applet 
     227        if (!Element('cert_applet')){ 
     228            // se não existir, mostra mensagem de erro. 
     229            write_msg(get_lang('The preference "%1" isn\'t enabled.', get_lang('Enable digitally sign/cipher the message?'))); 
     230        } else { 
     231            // se existir prepara os dados para serem enviados e chama a 
     232            // operação na applet 
     233 
     234            connector.showProgressBar(); 
     235 
     236           // if ((msg_info.DispositionNotificationTo) && ((msg_info.Unseen == 'U') || (msg_info.Recent == 'N'))){ 
     237            /*  var confNotification = confirm(get_lang("The sender waits your notification of reading. Do you want to confirm this?"), ""); 
     238                if (confNotification)*/ 
     239            //        cExecute ("$this.imap_functions.send_notification&notificationto="+msg_info.DispositionNotificationTo+"&subject="+url_encode(msg_info.subject), handler_sendNotification); 
     240           // } 
     241 
     242            Element('cert_applet').doButtonClickAction('decript', 
     243                                                        msg_info.msg_number, 
     244                                                        msg_info.source, 
     245                                                        msg_info.msg_folder); // Passa os dados para a applet 
     246        } 
     247                return; 
     248 
     249        } 
     250 
     251 
     252        if (msg_info.status_get_msg_info == 'false') 
     253        { 
     254                write_msg(get_lang("Problems reading your message")+ "."); 
     255                return; 
     256        } 
    139257 
    140258        if (msg_info.status == 'false'){ 
     
    142260        } 
    143261        else{ 
     262        var ID = msg_info.original_ID ? msg_info.original_ID : msg_info.msg_number; 
     263        var id_msg_read = ID+"_r"; 
     264 
    144265                if (preferences.use_shortcuts == '1') 
    145                         select_msg(msg_info.msg_number, 'null'); 
     266                        select_msg(ID, 'null'); 
    146267                // Call function to draw message 
    147                 var id_msg_read = msg_info.msg_number +"_r"; 
    148268                // If needed, delete old border 
    149269                if (openTab.type[currentTab] == 2 || openTab.type[currentTab] == 3) 
     
    173293 
    174294                var domains = ""; 
    175                 if ((msg_info.DispositionNotificationTo) && (!msg_is_read(msg_info.msg_number) || (msg_info.Recent == 'N'))) 
     295                if ((msg_info.DispositionNotificationTo) && (!msg_is_read(ID) || (msg_info.Recent == 'N'))) 
    176296                {                        
    177297                        if (preferences.notification_domains != undefined && preferences.notification_domains != "") 
     298            { 
    178299                                domains = preferences.notification_domains.split(','); 
     300            } 
    179301                        else 
    180302                        {                                
     
    194316                } 
    195317                //Change msg class to read. 
    196                 if (!msg_is_read(msg_info.msg_number)) 
     318                if (!msg_is_read(ID)) 
    197319                { 
    198                         set_msg_as_read(msg_info['msg_number'], true); 
    199                         if (msg_info.cacheHit) 
    200                                 set_message_flag(msg_info.msg_number, "seen"); // avoid caducous (lazy) data 
    201                 } 
    202  
     320            set_msg_as_read(ID, true); 
     321                        if (msg_info.cacheHit || (!proxy_mensagens.is_local_folder(get_current_folder()) && msg_info.original_ID)) 
     322            { 
     323                                set_message_flag(ID, "seen"); // avoid caducous (lazy) data 
     324            } 
     325        } 
    203326        } 
    204327} 
     
    12141337 
    12151338function send_message_return(data, ID){ 
     1339 
     1340    var sign = false; 
     1341        var crypt = false; 
     1342 
     1343    if ((preferences.use_assinar_criptografar != '0') && (preferences.use_signature_digital_cripto != '0')){ 
     1344                var checkSign = document.getElementById('return_digital_'+ID) 
     1345                if (checkSign.checked){ 
     1346                        sign = true; 
     1347                } 
     1348 
     1349                var checkCript = document.getElementById('return_cripto_'+ID); 
     1350                if (checkCript.checked){ 
     1351                        crypt = true; 
     1352                } 
     1353        } 
     1354 
     1355    if (typeof(data) == 'object' && !data.success) 
     1356        { 
     1357        connector = new  cConnector(); 
     1358        connector.showProgressBar(); 
     1359 
     1360        if (sign || crypt){ 
     1361            var operation = ''; 
     1362                        if (sign){ 
     1363                                operation = 'sign'; 
     1364                        } 
     1365                        else { // crypt 
     1366                //TODO: Colocar mensagem de erro, e finalizar o método. 
     1367                                operation = 'nop'; 
     1368                        } 
     1369        } 
     1370 
     1371        if (data.body){ 
     1372            Element('cert_applet').doButtonClickAction(operation, ID, data.body); 
     1373        } 
     1374        else { 
     1375                        alert(data.error); 
     1376                } 
     1377 
     1378                return; 
     1379    } 
     1380 
    12161381        if(data && data.success == true ){ 
    12171382                // if send ok, set a flag as answered or forwarded 
     
    12521417                        write_msg(get_lang("Connection failed with %1 Server. Try later.", "Web")); 
    12531418        } 
     1419} 
     1420 
     1421function appletReturn(smime, ID, operation, folder){ 
     1422        //alert('os dados chegaram!'); 
     1423    //alert("ID: " + ID + "\n" + smime); 
     1424        if(operation=='decript') 
     1425        { 
     1426                var handler = function(data){ 
     1427 
     1428                        if(data.msg_day == '') 
     1429                        { 
     1430                header=expresso_local_messages.get_msg_date(data.original_ID, proxy_mensagens.is_local_folder(get_current_folder())); 
     1431 
     1432                                data.fulldate=header.fulldate; 
     1433                                data.smalldate=header.smalldate; 
     1434                                data.msg_day = header.msg_day; 
     1435                                data.msg_hour = header.msg_hour; 
     1436 
     1437                        } 
     1438                        this.show_msg(data); 
     1439                } 
     1440                para="&source="+smime+"&ID="+ID+"&folder="+folder; 
     1441                cExecute ("$this.imap_functions.show_decript&", handler, para); 
     1442        }else 
     1443        { 
     1444        ID_tmp = ID; 
     1445        // Lê a variável e chama a nova função cExecuteForm 
     1446        // Processa e envia para o servidor web 
     1447        // Faz o request do connector novamente. Talvez implementar no connector 
     1448        // para manter coerência. 
     1449 
     1450        var handler_send_smime = function(data){ 
     1451            send_message_return(data, this.ID_tmp); // this is a hack to escape quotation form connector bug 
     1452        }; 
     1453 
     1454        var textArea = document.createElement("TEXTAREA"); 
     1455        textArea.style.display='none'; 
     1456        textArea.name = "smime"; 
     1457        textArea.value += smime; 
     1458 
     1459        // Lê a variável e chama a nova função cExecuteForm 
     1460        // Processa e envia para o servidor web 
     1461        // Faz o request do connector novamente. Talvez implementar no connector 
     1462        // para manter coerência. 
     1463        if (is_ie){ 
     1464            var i = 0; 
     1465            while (document.forms(i).name != "form_message_"+ID){i++} 
     1466            form = document.forms(i); 
     1467        } 
     1468        else 
     1469            form = document.forms["form_message_"+ID]; 
     1470 
     1471        form.appendChild(textArea); 
     1472 
     1473        cExecuteForm ("$this.imap_functions.send_mail", form, handler_send_smime, ID); 
     1474    } 
    12541475} 
    12551476 
  • trunk/expressoMail1_2/preferences.php

    r689 r1035  
    7777                else 
    7878                        $GLOBALS['phpgw']->template->set_var('checked_auto_save_draft',''); 
     79 
     80 
     81        if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) 
     82                { 
     83                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto']) 
     84                        { 
     85                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital_cripto','checked'); 
     86                        $GLOBALS['phpgw']->template->set_var('display_digital',''); 
     87                        $GLOBALS['phpgw']->template->set_var('display_cripto',''); 
     88                        } 
     89                else 
     90                        { 
     91                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital',''); 
     92                        $GLOBALS['phpgw']->template->set_var('display_digital','style="display: none;"'); 
     93                        $GLOBALS['phpgw']->template->set_var('display_cripto','style="display: none;"'); 
     94                        } 
     95 
     96                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital']) 
     97                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital','checked'); 
     98                else 
     99                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_digital',''); 
     100                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto']) 
     101                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_cripto','checked'); 
     102                else 
     103                        $GLOBALS['phpgw']->template->set_var('checked_use_signature_cripto',''); 
     104                } 
     105                else 
     106                { 
     107                        $GLOBALS['phpgw']->template->set_var('display_digital','style="display: none;"'); 
     108                        $GLOBALS['phpgw']->template->set_var('display_cripto','style="display: none;"'); 
     109                        $GLOBALS['phpgw']->template->set_var('display_digital_cripto','style="display: none;"'); 
     110                } 
     111 
    79112 
    80113                // Insert new expressoMail preference use_signature: defines if the signature will be automatically inserted 
     
    223256                        $GLOBALS['phpgw']->preferences->add('expressoMail','auto_save_draft',$_POST['auto_save_draft']);         
    224257 
     258        if($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) 
     259                { 
     260                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital_cripto']) 
     261                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature_digital_cripto',$_POST['use_signature_digital_cripto']); 
     262                else 
     263                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature_digital_cripto',$_POST['use_signature_digital_cripto']); 
     264                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_digital']) 
     265                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature_digital',$_POST['use_signature_digital']); 
     266                else 
     267                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature_digital',$_POST['use_signature_digital']); 
     268                if ($GLOBALS['phpgw_info']['user']['preferences']['expressoMail']['use_signature_cripto']) 
     269                        $GLOBALS['phpgw']->preferences->change('expressoMail','use_signature_cripto',$_POST['use_signature_cripto']); 
     270                else 
     271                        $GLOBALS['phpgw']->preferences->add('expressoMail','use_signature_cripto',$_POST['use_signature_cripto']); 
     272                } 
    225273                // Insert new expressoMail preference use_signature: defines if the signature will be automatically inserted 
    226274                // at the e-mail body 
     
    312360        $GLOBALS['phpgw']->template->set_var('lang_type_signature',lang('Signature type')); 
    313361        $GLOBALS['phpgw']->template->set_var('big',lang('Big')); 
     362    //$GLOBALS['phpgw']->template->set_var('lang_use_signature_digital_cripto',lang('Possibilitar <b>assinar/criptografar</b> digitalmente a mensagem?')); 
     363        $GLOBALS['phpgw']->template->set_var('lang_use_signature_digital_cripto',lang('Enable digitally sign/cipher the message?')); 
     364        $GLOBALS['phpgw']->template->set_var('lang_use_signature_digital',lang('Always sign message digitally?')); 
     365        $GLOBALS['phpgw']->template->set_var('lang_use_signature_cripto',lang('Always cipher message digitally?')); 
     366        $GLOBALS['phpgw']->template->set_var('lang_use_signature',lang('Insert signature automatically in new messages?')); 
     367        $GLOBALS['phpgw']->template->set_var('lang_signature',lang('Signature')); 
    314368        $GLOBALS['phpgw']->template->set_var('lang_Would_you_like_to_keep_archived_messages_?',lang('Would you like to keep archived messages?')); 
    315369        $GLOBALS['phpgw']->template->set_var('lang_Yes',lang('Yes')); 
    316370        $GLOBALS['phpgw']->template->set_var('lang_No',lang('No')); 
    317371        $GLOBALS['phpgw']->template->set_var('lang_Would_you_like_to_use_local_messages_?',lang('Would you like to use local messages?')); 
    318         $GLOBALS['phpgw']->template->set_var('lang_use_signature',lang('Insert signature automatically in new messages?')); 
    319372 
    320373        $boemailadmin   = CreateObject('emailadmin.bo'); 
  • trunk/expressoMail1_2/setup/phpgw_en.lang

    r799 r1035  
    1414all     expressoMail1_2 en      all 
    1515Also check message against next rule    expressoMail1_2 en      Also check message against next rule 
     16Always sign message digitally?  expressoMail1_2 en      Always sign message digitally? 
     17Always cipher message digitally?        expressoMail1_2 en      Always cipher message digitally? 
     18and     expressoMail1_2 en      and 
    1619and save in     expressoMail1_2 en      and save in 
    1720Answered        expressoMail1_2 en      Answered 
     
    2124At %1, %2 hours, %3 wrote:      expressoMail1_2 en      At %1, %2 hours, %3 wrote: 
    2225Auto save draft expressoMail1_2 en      Auto save draft 
     26authentic       expressoMail1_2 en      authentic 
    2327Back    expressoMail1_2 en      Back 
    2428BCC     expressoMail1_2 en      BCC 
     
    3337CC      expressoMail1_2 en      CC 
    3438CCo     expressoMail1_2 en      CCo 
     39REVOKED Certificate.    expressoMail1_2 en      REVOKED Certificate. 
     40Certificate Authority:  expressoMail1_2 en      Certificate Authority: 
     41Certificate email:      expressoMail1_2 en      Certificate email: 
     42certificate has expired expressoMail1_2 en      certificate has expired 
    3543Change folder   expressoMail1_2 en      Change folder 
    3644Choose a name   expressoMail1_2 en      Choose a name 
     
    4452Command for unmark spam admin   en      Command for unmark spam 
    4553Config for ExpressoMail expressoMail1_2 en      Config for ExpressoMail 
     54Couldn't verify if certificate was revoked.(CD-01)      expressoMail1_2 en      Couldn't verify if certificate was revoked.(CD-01) 
     55Couldn't verify if certificate was revoked.(CD-02)      expressoMail1_2 en      Couldn't verify if certificate was revoked.(CD-02) 
     56Couldn't verify if certificate was revoked.(CD-03)      expressoMail1_2 en      Couldn't verify if certificate was revoked.(CD-03) 
     57Crypted message expressoMail1_2 en      Crypted message 
    4658Cyrus IMAP Server       expressoMail1_2 en      Cyrus IMAP Server 
    4759attachment      expressoMail1_2 en      attachment 
     
    5971DISABLED        expressoMail1_2 en      DISABLED 
    6072Disable expressoMail1_2 en      Disable 
     73Details expressoMail1_2 pt-br   Details 
     74Digitally sign message? expressoMail1_2 en      Digitally sign message? 
     75Digitally crypt message?        expressoMail1_2 en      Digitally crypt message? 
    6176Download all atachments expressoMail1_2 en      Download all atachments 
    6277Download manual expressoMail1_2 en      Download manual 
     
    7994ENABLED expressoMail1_2 en      ENABLED 
    8095Enable  expressoMail1_2 en      Enable 
     96Enable digitally sign/cipher the message?       expressoMail1_2 en      Enable digitally sign/cipher the message? 
    8197Enable Quick Reply      expressoMail1_2 en      Enable Quick Reply 
    8298Enter a name for the box        expressoMail1_2 en      Enter a name for the box 
     
    88104Error in SMTP sending read confirmation.        expressoMail1_2 en      Error in SMTP sending read confirmation. 
    89105Error moving message.   expressoMail1_2 en      Error moving message. 
     106Enable digitally sign/cipher the message?       expressoMail1_2 en      Enable digitally sign/cipher the message? 
     107#error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error    expressoMail1_2 en      #error:21075075:PKCS7 routines:PKCS7_verify:certificate verify error 
     108error:21075069:PKCS7 routines:PKCS7_verify:signature failure    expressoMail1_2 en      error:21075069:PKCS7 routines:PKCS7_verify:signature failure 
     109error:21071065:PKCS7 routines:PKCS7_signatureVerify:digest failure      expressoMail1_2 en      error:21071065:PKCS7 routines:PKCS7_signatureVerify:digest failure 
     110error:21071065:PKCS7 routines:func(113):reason(101)     expressoMail1_2 en      error:21071065:PKCS7 routines:func(113):reason(101) 
     111error:21075069:PKCS7 routines:func(117):reason(105)     expressoMail1_2 en      error:21075069:PKCS7 routines:func(117):reason(105) 
    90112Exclusion       expressoMail1_2 en      Exclusion 
    91113Export  expressoMail1_2 en      Export 
     
    145167Insert signature automatically in new messages? expressoMail1_2 en      Insert signature automatically in new messages? 
    146168insertunorderedlist     expressoMail1_2 en      Insert unordered list 
     169Invalid signature       expressoMail1_2 en      Invalid signature 
    147170in this message expressoMail1_2 en      in this message 
    148171italic  expressoMail1_2 en      italic 
     
    169192Loading expressoMail1_2 en      Loading 
    170193Mailbox Sharing expressoMail1_2 en      Mailbox Sharing 
     194Mail from:      expressoMail1_2 pt-br   Mail from: 
    171195Manager your folders and export messages        expressoMail1_2 en      Manager your folders and export messages 
    172196Mark as expressoMail1_2 en      Mark as 
     
    176200Medium  expressoMail1_2 en      Medium 
    177201Message body    expressoMail1_2 en      Message body 
     202Message date:   expressoMail1_2 pt-br   Message date: 
    178203message expressoMail1_2 en      message 
    179204minute ago      expressoMail1_2 en      minute ago 
     
    183208Message Header  expressoMail1_2 en      Message Header 
    184209Message marked as       expressoMail1_2 en      Message marked as  
     210Message signed by:      expressoMail1_2 pt-br   Message signed by: 
     211Message untouched       expressoMail1_2 pt-br   Message untouched 
    185212message(s) deleted from your trash folder.      expressoMail1_2 en      message(s) deleted from your trash folder. 
    186213messages        expressoMail1_2 en      messages 
    187214messages found in folder:       expressoMail1_2 en      messages found in folder: 
    188215Messages saved in %1 folder.    expressoMail1_2 en      Messages saved in %1 folder. 
     216#MSG010- Erro verificando Expiracao/CAs do certificado. expressoMail1_2 en      #MSG010- Erro verificando Expiracao/CAs do certificado. 
     217#MSG011- Ocorreu erro validando o certificado.  expressoMail1_2 en      #MSG011- Ocorreu erro validando o certificado. 
    189218More actions    expressoMail1_2 en      More actions 
    190219More    expressoMail1_2 en      More 
     
    316345The message was moved to folder         expressoMail1_2 en      The message was moved to folder  
    317346The origin folder and the destination folder are the same.      expressoMail1_2 en      The origin folder and the destination folder are the same. 
     347The preference "%1" isn't enabled.      expressoMail1_2 en      The preference "%1" isn't enabled. 
    318348There's an action processing. Do you want abort it?     expressoMail1_2 en      There's an action processing. Do you want abort it? 
    319349The results were found in the Global Catalog    expressoMail1_2 en      The results were found in the Global Catalog 
     
    345375User not registered     instant_messenger       en      User not registered 
    346376Users   expressoMail1_2 en      Users 
     377Validity of certificate:        expressoMail1_2 en      Validity of certificate: 
    347378View HTML source        expressoMail1_2 en      View HTML source 
    348379View tips       expressoMail1_2 en      View tips 
     
    353384Who     expressoMail1_2 en      Who 
    354385With all        expressoMail1_2 en      With all 
     386with signer different from sender       expressoMail1_2 en      with signer different from sender 
    355387Without Quota   expressoMail1_2 en      Without Quota 
    356388without save    expressoMail1_2 en      without save 
  • trunk/expressoMail1_2/setup/setup.inc.php

    r1034 r1035  
    1212        $setup_info['expressoMail1_2']['name']          = 'expressoMail1_2'; 
    1313        $setup_info['expressoMail1_2']['title']         = 'ExpressoMail 1.2'; 
    14         $setup_info['expressoMail1_2']['version']       = '1.234'; 
     14        $setup_info['expressoMail1_2']['version']       = '1.334'; 
    1515        $setup_info['expressoMail1_2']['app_order']     = 2; 
    1616        $setup_info['expressoMail1_2']['tables'][]              = 'phpgw_expressomail_contacts'; 
     17    $setup_info['expressoMail1_2']['tables'][]          = 'phpgw_certificados'; 
    1718        $setup_info['expressoMail1_2']['enable']        = 1; 
    1819 
  • trunk/expressoMail1_2/setup/tables_current.inc.php

    r468 r1035  
    1919                        'ix' => array(), 
    2020                        'uc' => array() 
     21                ), 
     22        'phpgw_certificados' => array( 
     23            'fd' => array( 
     24                'email' => array( 'type' => 'varchar', 'precision' => 60, 'nullable' => false), 
     25                'chave_publica' => array( 'type' => 'text'), 
     26                'expirado' => array('type' => 'bool', 'default' => 'false'), 
     27                'revogado' => array('type' => 'bool', 'default' => 'false'), 
     28                'serialnumber' => array('type' => 'int', 'precision' => 8, 'nullable' => false), 
     29                'authoritykeyidentifier' => array( 'type' => 'text', 'nullable' => false), 
     30            ), 
     31            'pk' => array('email','serialnumber','authoritykeyidentifier'), 
     32            'fk' => array(), 
     33            'ix' => array(), 
     34            'uc' => array() 
    2135                ) 
    2236        ); 
  • trunk/expressoMail1_2/setup/tables_update.inc.php

    r1034 r1035  
    1212                $test[] = '1.233'; 
    1313                function expressoMail1_2_upgrade1_233() { 
    14                         $setup_info['expressoMail1_2']['currentver'] = '1.234'; 
    15                         return $setup_info['expressoMail1_2']['currentver']; 
     14            $oProc = $GLOBALS['phpgw_setup']->oProc; 
     15            $oProc->CreateTable('phpgw_expressomail_contacts',array( 
     16                                'fd' => array( 
     17                                        'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false), 
     18                                        'data' => array( 'type' => 'text') 
     19                                ), 
     20                                'pk' => array('id_owner'), 
     21                                'fk' => array(), 
     22                                'ix' => array(), 
     23                                'uc' => array() 
     24                                ) 
     25                        ); 
     26 
     27            $oProc->CreateTable('phpgw_certificados',array( 
     28                                'fd' => array( 
     29                                        'email' => array( 'type' => 'varchar', 'precision' => 60, 'nullable' => false), 
     30                                        'chave_publica' => array( 'type' => 'text'), 
     31                                        'expirado' => array('type' => 'bool', 'default' => 'false'), 
     32                                        'revogado' => array('type' => 'bool', 'default' => 'false'), 
     33                                        'serialnumber' => array('type' => 'int', 'precision' => 8, 'nullable' => false), 
     34                                        'authoritykeyidentifier' => array( 'type' => 'text', 'nullable' => false), 
     35                                ), 
     36                                'pk' => array('email','serialnumber','authoritykeyidentifier'), 
     37                                'fk' => array(), 
     38                                'ix' => array(), 
     39                                'uc' => array() 
     40                                ) 
     41                        ); 
     42 
     43            $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.334'; 
     44            return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 
    1645                } 
    1746        }        
     
    5382        if ($GLOBALS['setup_info']['expressoMail1_2']['currentver'] == '1.222'){ 
    5483                $test[] = '1.222'; 
    55                 function expressoMail1_2_upgrade1_222() {return expressoMail1_2_upgrade1_230(); } 
     84                function expressoMail1_2_upgrade1_222() { 
     85                        $oProc = $GLOBALS['phpgw_setup']->oProc; 
     86                        $oProc->CreateTable('phpgw_expressomail_contacts',array( 
     87                                'fd' => array( 
     88                                        'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false), 
     89                                        'data' => array( 'type' => 'text') 
     90                                ), 
     91                                'pk' => array('id_owner'), 
     92                                'fk' => array(), 
     93                                'ix' => array(), 
     94                                'uc' => array() 
     95                                ) 
     96                        ); 
     97                        $oProc->CreateTable('phpgw_certificados',array( 
     98                                'fd' => array( 
     99                                        'email' => array( 'type' => 'varchar', 'precision' => 60, 'nullable' => false), 
     100                                        'chave_publica' => array( 'type' => 'text'), 
     101                                        'expirado' => array('type' => 'bool', 'default' => 'false') 
     102                                ), 
     103                                'pk' => array('email'), 
     104                                'fk' => array(), 
     105                                'ix' => array(), 
     106                                'uc' => array() 
     107                                ) 
     108                        ); 
     109                        $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.223'; 
     110                        return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 
     111        } 
    56112        } 
    57113        if ($GLOBALS['setup_info']['expressoMail1_2']['currentver'] == '1.2211'){ 
    58114                $test[] = '1.2211'; 
    59                 function expressoMail1_2_upgrade1_2211() {return expressoMail1_2_upgrade1_230();} 
     115                function expressoMail1_2_upgrade1_2211() { 
     116                        $oProc = $GLOBALS['phpgw_setup']->oProc; 
     117                        $oProc->CreateTable('phpgw_expressomail_contacts',array( 
     118                                'fd' => array( 
     119                                        'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false), 
     120                                        'data' => array( 'type' => 'text') 
     121                                ), 
     122                                'pk' => array('id_owner'), 
     123                                'fk' => array(), 
     124                                'ix' => array(), 
     125                                'uc' => array() 
     126                                ) 
     127                        ); 
     128                        $oProc->CreateTable('phpgw_certificados',array( 
     129                                'fd' => array( 
     130                                        'email' => array( 'type' => 'varchar', 'precision' => 60, 'nullable' => false), 
     131                                        'chave_publica' => array( 'type' => 'text'), 
     132                                        'expirado' => array('type' => 'bool', 'default' => 'false') 
     133                                ), 
     134                                'pk' => array('email'), 
     135                                'fk' => array(), 
     136                                'ix' => array(), 
     137                                'uc' => array() 
     138                                ) 
     139                        ); 
     140                        $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.223'; 
     141                        return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 
     142        } 
    60143        } 
    61144        if ($GLOBALS['setup_info']['expressoMail1_2']['currentver'] == '1.2201'){ 
     
    66149        if ($GLOBALS['setup_info']['expressoMail1_2']['currentver'] == '1.2031'){ 
    67150                $test[] = '1.2031'; 
    68                 function expressoMail1_2_upgrade1_2031() {return expressoMail1_2_upgrade1_230();} 
     151                function expressoMail1_2_upgrade1_2031() { 
     152                        $oProc = $GLOBALS['phpgw_setup']->oProc; 
     153                        $oProc->CreateTable('phpgw_expressomail_contacts',array( 
     154                                'fd' => array( 
     155                                        'id_owner' => array( 'type' => 'int', 'precision' => 8, 'nullable' => false), 
     156                                        'data' => array( 'type' => 'text') 
     157                                ), 
     158                                'pk' => array('id_owner'), 
     159                                'fk' => array(), 
     160                                'ix' => array(), 
     161                                'uc' => array() 
     162                                ) 
     163                        ); 
     164                        $oProc->CreateTable('phpgw_certificados',array( 
     165                                'fd' => array( 
     166                                        'email' => array( 'type' => 'varchar', 'precision' => 60, 'nullable' => false), 
     167                                        'chave_publica' => array( 'type' => 'text'), 
     168                                        'expirado' => array('type' => 'bool', 'default' => 'false') 
     169                                ), 
     170                                'pk' => array('email'), 
     171                                'fk' => array(), 
     172                                'ix' => array(), 
     173                                'uc' => array() 
     174                                ) 
     175                        ); 
     176                        $GLOBALS['setup_info']['expressoMail1_2']['currentver'] = '1.223'; 
     177                        return $GLOBALS['setup_info']['expressoMail1_2']['currentver']; 
     178        } 
    69179        }        
    70180?> 
  • trunk/expressoMail1_2/templates/azul/index.tpl

    r1023 r1035  
    1515                                                <tr><td class='content-menu'> 
    1616                                                        <table border="0" cellspacing="0" cellpadding="0" border="0"><tbody> 
    17                                                                 <tr><td><div align="center" style="white-space:nowrap"> 
     17                                                                <tr><td><div id="search_div" align="center" style="white-space:nowrap"> 
    1818                                        <input type="text" id="em_message_search" size="16" maxlength="22" onfocus="javascript:onFocusQuickSearchEmail(this); return false;"/> 
    1919                                        <a class='' onMouseOut="window.status='';return true;" title='{lang_Open_Search_Window}' onMouseOver="window.status='{lang_Open_Search_Window}';return true;" href="javascript:void(0);"  onClick="javascript:search_emails(Element('em_message_search').value)"> 
  • trunk/expressoMail1_2/templates/default/index.tpl

    r955 r1035  
    2828                                </table> 
    2929                                <div style="height:4px"></div> 
    30                                 <div align="center" style="white-space:nowrap"> 
     30                                <div id="search_div" align="center" style="white-space:nowrap"> 
    3131                                        <input type="text" id="em_message_search" size="16" maxlength="22" onfocus="javascript:onFocusQuickSearchEmail(this); return false;"/> 
    3232                                        <a class='' onMouseOut="window.status='';return true;" title='{lang_Open_Search_Window}' onMouseOver="window.status='{lang_Open_Search_Window}';return true;" href="javascript:void(0);"  onClick="javascript:search_emails(Element('em_message_search').value)"> 
  • trunk/expressoMail1_2/templates/default/preferences.tpl

    r695 r1035  
    22<script src="js/main.js"></script> 
    33<center> 
    4  
     4<script language="JavaScript" type="text/javascript"> 
     5<!-- 
     6  function exibir_ocultar(situacao) 
     7  { 
     8     var xtr1 = document.getElementById('tr01'); 
     9     var xtr2 = document.getElementById('tr02'); 
     10     var xc1 = document.getElementById('c01'); 
     11     var xc2 = document.getElementById('c02'); 
     12     if(situacao==true) 
     13       { 
     14    xtr1.style.display=''; 
     15    xtr2.style.display=''; 
     16    xc1.checked=false; 
     17    xc2.checked=false; 
     18       } 
     19      else 
     20       { 
     21    xtr1.style.display='none'; 
     22    xtr2.style.display='none'; 
     23    xc1.checked=false; 
     24    xc2.checked=false; 
     25       } 
     26  } 
     27 --> 
     28</script>  
    529<table width="65%" border="0" cellspacing="2" cellpadding="2"> 
    630 
     
    136160        <td colspan="2" align="center">{lang_config_signature}</td> 
    137161    </tr> 
     162    <tr bgcolor="{tr_color2}"  {display_digital_cripto}> 
     163        <td> 
     164                        {lang_use_signature_digital_cripto} 
     165                </td> 
     166                <td align="center"> 
     167                        <input type="checkbox" name="use_signature_digital_cripto" value=1 {checked_use_signature_digital_cripto} onClick="javascript:exibir_ocultar(this.checked)"> 
     168                </td> 
     169    </tr> 
     170 
     171    <tr  bgcolor="{tr_color1}" id="tr01" {display_digital}> 
     172        <td> 
     173                        {lang_use_signature_digital} 
     174                </td> 
     175                <td  align="center" > 
     176                         <input id="c01" type="checkbox" name="use_signature_digital" value=1 {checked_use_signature_digital}> 
     177                </td> 
     178    </tr> 
     179 
     180    <tr bgcolor="{tr_color2}" id="tr02" {display_cripto} > 
     181        <td> 
     182                        {lang_use_signature_cripto} 
     183                </td> 
     184                <td  align="center"> 
     185                         <input id="c02" type="checkbox" name="use_signature_cripto" value=1 {checked_use_signature_cripto}> 
     186                </td> 
     187    </tr> 
     188 
    138189     <tr bgcolor="{tr_color1}"> 
    139190        <td> 
  • trunk/preferences/preferences.php

    r1002 r1035  
    122122                        $def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').':&nbsp;'.$def_text.'</font></i>' : ''; 
    123123                } 
     124        $t->set_var('row_id', "${GLOBALS[type]}[$name]"); 
    124125                $t->set_var('row_value',"<input name=\"${GLOBALS[type]}[$name]\"value=\"". 
    125126                        @htmlentities($default,ENT_COMPAT,$charSet)."\"$options>$def_text"); 
     
    148149        } 
    149150 
    150         function create_check_box($label,$name,$help='',$default='',$run_lang=True) 
     151        function create_check_box($label,$name,$help='',$default='',$run_lang=True,$checkbox_prop='',$visible=True) 
    151152        { 
    152153                // checkboxes itself can't be use as they return nothing if uncheckt !!! 
     
    165166                        '0' => lang('No'), 
    166167                        '1' => lang('Yes') 
    167                 ),$help,$default,$run_lang); 
     168                ),$help,$default,$run_lang,$checkbox_prop,$visible); 
    168169        } 
    169170 
     
    196197        { 
    197198                global $t,$prefs; 
     199        $t->set_var('row_id', "${GLOBALS[type]}[$name]"); 
    198200                $t->set_var('row_value',$code.$prefs[$name].$appendcode); 
    199201                $t->set_var('row_name',lang("signature")); 
     
    202204        } 
    203205 
    204         function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True,$select_prop = '') 
     206        function create_select_box($label,$name,$values,$help='',$default='',$run_lang=True,$select_prop = '',$visible=True) 
    205207        { 
    206208                global $t,$prefs; 
     
    235237                        $def_text = $def_text != '' ? ' <i><font size="-1">'.lang('default').':&nbsp;'.$values[$def_text].'</font></i>' : ''; 
    236238                } 
     239        $t->set_var('row_id', "${GLOBALS[type]}[$name]"); 
    237240                $t->set_var('row_value',"<select name=\"${GLOBALS[type]}[$name]\" $select_prop>$s</select>$def_text"); 
    238241                $t->set_var('row_name',lang($label)); 
     242        if ($visible) 
     243        { 
     244            $t->set_var('row_visibility', ''); 
     245        } 
     246        else 
     247        { 
     248            $t->set_var('row_visibility', 'style="display: none;"'); 
     249        } 
     250         
    239251                $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t); 
    240  
     252         
    241253                $t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 'row',True); 
    242254        } 
     
    314326                        $def_text = $def_text != '' ? '<br><i><font size="-1"><b>'.lang('default').'</b>:<br>'.nl2br($def_text).'</font></i>' : ''; 
    315327                } 
     328        $t->set_var('row_id', "${GLOBALS[type]}[$name]"); 
    316329                $t->set_var('row_value',"<textarea rows=\"$rows\" cols=\"$cols\" name=\"${GLOBALS[type]}[$name]\">". 
    317330                        htmlentities($default,ENT_COMPAT,$charSet)."</textarea>$def_text"); 
  • trunk/preferences/templates/azul/preferences.tpl

    r1026 r1035  
    2323 
    2424<!-- BEGIN row --> 
    25  <tr bgcolor="{tr_color}"> 
     25 <tr id="{row_id}" bgcolor="{tr_color}" {row_visibility}> 
    2626  <td>{row_name}</td> 
    2727  <td>{row_value}</td> 
  • trunk/preferences/templates/default/preferences.tpl

    r2 r1035  
    3030 
    3131<!-- BEGIN row --> 
    32  <tr bgcolor="{tr_color}"> 
     32 <tr id="{row_id}" bgcolor="{tr_color}" {row_visibility}> 
    3333  <td>{row_name}</td> 
    3434  <td>{row_value}</td> 
  • trunk/setup/manageheader.php

    r2 r1035  
    599599                                        break; 
    600600                        } 
     601 
     602            switch($GLOBALS['phpgw_info']['server']['use_assinar_criptografar']) 
     603                        { 
     604                                case '0': 
     605                                        $setup_tpl->set_var('use_assinar_criptografar_0',' checked'); 
     606                                        break; 
     607                                case '1': 
     608                                        $setup_tpl->set_var('use_assinar_criptografar_1',' checked'); 
     609                                        break; 
     610                                default: 
     611                                        $setup_tpl->set_var('use_assinar_criptografar_0',' checked'); 
     612                        } 
     613 
     614                        if($GLOBALS['phpgw_info']['server']['num_max_certs_to_cipher']) 
     615                        { 
     616                                $setup_tpl->set_var('num_max_certs_to_cipher',$GLOBALS['phpgw_info']['server']['num_max_certs_to_cipher']); 
     617                        } 
     618                        else 
     619                        { 
     620                                $setup_tpl->set_var('num_max_certs_to_cipher','10'); 
     621                        } 
     622 
    601623                        if(@$GLOBALS['phpgw_info']['server']['sugestoes_email_to']) 
    602624                        { 
  • trunk/setup/templates/default/manageheader.tpl

    r2 r1035  
    102102                <INPUT type="radio"{use_https_2} name="setting[use_https]" value="2">Usar HTTPS no Site inteiro.<BR>     
    103103        </td></tr> 
    104                  
     104 
     105    <tr><td colspan="2"> 
     106        <fieldset><legend>Segurança</legend> 
     107        <table> 
     108        <tr><td colspan="2"><b>Habilitar Assinar/Cifrar digitalmente?</b></td></tr> 
     109                <tr><td colspan="2"> 
     110                <INPUT type="radio" {use_assinar_criptografar_0} name="setting[use_assinar_criptografar]" value="0"  />NAO habilitar.<BR> 
     111                <INPUT type="radio" {use_assinar_criptografar_1} name="setting[use_assinar_criptografar]" value="1" />Habilitar.<BR> 
     112        </td></tr> 
     113        <tr><td colspan="2"><b>Numero maximo de destinatários para uma mensagem cifrada:</b><br>Este valor e utilizado se Assinar/Criptografar for habilitado.</td></tr> 
     114        <tr><td colspan="2"> 
     115                <INPUT type="text" maxlength="2" size="3" name="setting[num_max_certs_to_cipher]" id="maxcerttxt" value="{num_max_certs_to_cipher}" onkeypress="return soNumero(this, event);"> 
     116        </td></tr> 
     117        <!-- 
     118        <tr><td colspan="2"><b>Aponta um certificado corporativo:</b><br> Este certificado sera incluido como destinatario adicional, quando cifrar uma msg.</td></tr> 
     119        <tr><td colspan="2"> 
     120                <INPUT type="text"  size="40" name="setting[corporative_certificate]" id="corpcerttxt" value="{corporative_certificate}" > 
     121        </td></tr> 
     122        --> 
     123        </fieldset> 
     124           </table> 
     125           <br> 
     126 
    105127        <tr><td colspan="2"><b>Digite os endereços de emails, separados por vírgula, que devem receber as sugestões enviados pelos usuários.</b></td></tr> 
    106128        <tr><td colspan="2"><INPUT size="50" name="setting[sugestoes_email_to]" value="{sugestoes_email_to}"></td></tr> 
Note: See TracChangeset for help on using the changeset viewer.