Location: PHPKode > projects > Private Message System > pmsys-2.3.0/includes/functions_export.php
<?php

/******************************************************************
* $Id: functions_export.php,v 1.2 2003/08/22 19:50:56 allowee Exp $
*
* Copyright (C) 2001-2003 PMS Dev Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA  02111-1307, USA.
*
* The "GNU General Public License" (GPL) is available at
* http://www.gnu.org/copyleft/gpl.html.
******************************************************************/


function dl_file($filestring, $filename, $filetype){
// send file to browser

if ( strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') OR strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') ) {
        $filetype = 'application/octetstream';
    } else {
        $filetype = 'application/octet-stream';
    }

    header('Content-Type: ' . $filetype);
    header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Disposition: attachment; filename="' . $filename . '"');
    header('Content-Length: ' . strlen($filestring));
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');

    echo $filestring;
    exit;
}


function xml_escape_cdata($xhtml){
// prevents nested CDATA tags in XML files
    $xhtml = str_replace('<![CDATA[', '![CDATA[', $xhtml);
    $xhtml = str_replace(']]>', ']]', $xhtml);
    return $xhtml;
}

function unhtmlspecialchars($chars){
    $chars = str_replace('&gt;', '>', $chars);
    $chars = str_replace('&lt;', '<', $chars);
    $chars = str_replace('&quot;', '"', $chars);
    $chars = str_replace('&amp;', '&', $chars);
    return $chars;
}

Return current item: Private Message System