Changeset 1035 for trunk/expressoMail1_2/inc/class.db_functions.inc.php
- Timestamp:
- 06/20/09 01:07:18 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.db_functions.inc.php
r906 r1035 407 407 return $uiicalendar = $uiicalendar->import_from_mail($calendar); 408 408 } 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 410 476 } 411 477 ?>
Note: See TracChangeset
for help on using the changeset viewer.