Exemple #1
0
/**
 * Set caching headers that will allow or prevent browser caching.
 * @param boolean Allow caching
 */
function http_caching_headers($p_allow_caching = false)
{
    global $g_allow_browser_cache;
    // Headers to prevent caching
    // with option to bypass if running from script
    if (!headers_sent()) {
        if ($p_allow_caching || isset($g_allow_browser_cache) && ON == $g_allow_browser_cache) {
            if (is_browser_internet_explorer()) {
                header('Cache-Control: private, proxy-revalidate');
            } else {
                header('Cache-Control: private, must-revalidate');
            }
        } else {
            header('Cache-Control: no-store, no-cache, must-revalidate');
        }
        header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
    }
}
Exemple #2
0
        break;
}
# throw away output buffer contents (and disable it) to protect download
while (@ob_end_clean()) {
}
if (ini_get('zlib.output_compression') && function_exists('ini_set')) {
    ini_set('zlib.output_compression', false);
}
http_security_headers();
# Make sure that IE can download the attachments under https.
header('Pragma: public');
# To fix an IE bug which causes problems when downloading
# attached files via HTTPS, we disable the "Pragma: no-cache"
# command when IE is used over HTTPS.
global $g_allow_file_cache;
if (isset($_SERVER["HTTPS"]) && "on" == utf8_strtolower($_SERVER["HTTPS"]) && is_browser_internet_explorer()) {
    # Suppress "Pragma: no-cache" header.
} else {
    if (!isset($g_allow_file_cache)) {
        header('Pragma: no-cache');
    }
}
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $v_date_added));
$t_filename = file_get_display_name($v_filename);
# For Internet Explorer 8 as per http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
# Don't let IE second guess our content-type!
header('X-Content-Type-Options: nosniff');
http_content_disposition_header($t_filename, $f_show_inline);
header('Content-Length: ' . $v_filesize);
# If finfo is available (always true for PHP >= 5.3.0) we can use it to determine the MIME type of files
Exemple #3
0
        break;
}
# throw away output buffer contents (and disable it) to protect download
while (@ob_end_clean()) {
}
if (ini_get('zlib.output_compression') && function_exists('ini_set')) {
    ini_set('zlib.output_compression', false);
}
http_security_headers();
# Make sure that IE can download the attachments under https.
header('Pragma: public');
# To fix an IE bug which causes problems when downloading
# attached files via HTTPS, we disable the "Pragma: no-cache"
# command when IE is used over HTTPS.
global $g_allow_file_cache;
if (http_is_protocol_https() && is_browser_internet_explorer()) {
    # Suppress "Pragma: no-cache" header.
} else {
    if (!isset($g_allow_file_cache)) {
        header('Pragma: no-cache');
    }
}
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $v_date_added));
$t_filename = file_get_display_name($v_filename);
# For Internet Explorer 8 as per http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
# Don't let IE second guess our content-type!
header('X-Content-Type-Options: nosniff');
http_content_disposition_header($t_filename, $f_show_inline);
header('Content-Length: ' . $v_filesize);
# If finfo is available (always true for PHP >= 5.3.0) we can use it to determine the MIME type of files
Exemple #4
0
    # Suppress "Pragma: no-cache" header.
} else {
    if (!isset($g_allow_file_cache)) {
        header('Pragma: no-cache');
    }
}
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time()));
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $v_date_added));
$t_filename = file_get_display_name($v_filename);
# For Internet Explorer 8 as per http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
# Don't let IE second guess our content-type!
header('X-Content-Type-Options: nosniff');
//Would be better to use integrated function but it brakes filename of file
//http_content_disposition_header( $t_filename);
$t_disposition = 'attachment;';
if (is_browser_internet_explorer() || is_browser_chrome()) {
    // Internet Explorer does not support RFC2231 however it does
    // incorrectly decode URL encoded filenames and we can use this to
    // get UTF8 filenames to work with the file download dialog. Chrome
    // behaves in the same was as Internet Explorer in this respect.
    // See http://greenbytes.de/tech/tc2231/#attwithfnrawpctenclong
    header('Content-Disposition:' . $t_disposition . ' filename="' . $t_filename . '"');
} else {
    // For most other browsers, we can use this technique:
    // http://greenbytes.de/tech/tc2231/#attfnboth2
    header('Content-Disposition:' . $t_disposition . ' filename*=UTF-8\'\'' . $t_filename . '; filename="' . $t_filename . '"');
}
header('Content-Length: ' . $v_filesize);
header('Content-Type: ' . $v_file_type);
switch (plugin_config_get('upload_method', PLUGINS_RELEASEMGT_UPLOAD_METHOD_DEFAULT)) {
    case DISK: