示例#1
0
// ** EXPORT FORMATS **
switch ($_GET['format']) {
    // How about this? http://www.oasis-open.org/committees/ciq/ciq.html#6
    default:
        /* SEE: http://vcardmaker.wackomenace.co.uk/, http://tools.ietf.org/html/rfc2426
         * There is still lots of info missing: Occupation -> TITLE:, Company -> ?, Department
         * Please post improvements to: http://sourceforge.net/tracker/?group_id=172286&atid=861164 as attachment!!
         * Or to the developer forums at: http://sourceforge.net/forum/forum.php?forum_id=590644
         */
    /* SEE: http://vcardmaker.wackomenace.co.uk/, http://tools.ietf.org/html/rfc2426
     * There is still lots of info missing: Occupation -> TITLE:, Company -> ?, Department
     * Please post improvements to: http://sourceforge.net/tracker/?group_id=172286&atid=861164 as attachment!!
     * Or to the developer forums at: http://sourceforge.net/forum/forum.php?forum_id=590644
     */
    case "vcard":
        $output = ContactImportExport::vCardExport($contact, 'WORK');
        $fn = mb_convert_encoding($contact->contact['firstname'], 'ASCII') . mb_convert_encoding($contact->contact['lastname'], 'ASCII') . '.vcf';
        header("Content-Type: text/x-vCard; name={$fn}");
        header("Content-Disposition: attachment; filename={$fn}");
        header('Cache-Control: must-revalidate, post-check=0, pre-check=0', true);
        header('Pragma: none', true);
        header("Content-Length: " . strlen($output));
        echo $output;
        break;
        // end vcard
    // end vcard
    case "xml":
        $output = ContactImportExport::xmlExport($contact);
        $fn = mb_convert_encoding($contact->contact['firstname'], 'ASCII') . mb_convert_encoding($contact->contact['lastname'], 'ASCII') . '.xml';
        header("Content-Type: text/xml; name={$fn}");
        //header("Content-Disposition: attachment; filename=$fn"); // download?