📄 lib.export.php
字号:
<?php
function convert2vcf( $data )
{
$ldap_key = array( "name" => "FN", "email" => "EMAIL;PREF;INTERNET", "street" => "ADR;WORK", "work" => "TITLE" );
$ldapfile = "BEGIN:VCARD\r\nVERSION:2.1\r\n";
foreach ( $data as $key => $value )
{
if ( $key != "city" && $key != "state" )
{
$testo = $key == "street" ? ";;".$data['street'].";".$data['city'].";;;".$data['state'] : $value;
if ( ereg( "[@,\r,\\(,\\),;,:]", $value ) )
{
$testo = urlencode( $testo );
$testo = ereg_replace( "\\+", " ", $testo );
$testo = ereg_replace( "%", "=", $testo );
$testo = chunk_split( $testo, 76, "=\r\n" );
$testo = substr( $testo, 0, strlen( $testo ) - 3 );
$ldapfile .= $ldap_key[$key].";ENCODING=QUOTED-PRINTABLE:{$testo}\r\n";
}
else
{
$ldapfile .= $ldap_key[$key].":{$testo}\r\n";
}
}
}
$ldapfile .= "REV:".date( "Ymd\\This", time( ) )."\r\n";
$ldapfile .= "END:VCARD";
return $ldapfile;
}
function export2ou( $data )
{
$file = convert2vcf( $data );
$filename = empty( $data['name'] ) ? "Address" : $data['name'];
header( "Content-Type: application/outlook\r\r\nContent-Disposition: attachment; filename=\"{$filename}.vcf\"\r\r\nContent-Description: PHP Generated Data\r\r\n" );
print $file;
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -