Exemple #1
0
# 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
$finfo = finfo_get_if_available();
$t_content_type = $v_file_type;
$t_content_type_override = file_get_content_type_override($t_filename);
# dump file content to the connection.
switch (config_get('file_upload_method')) {
    case DISK:
        $t_local_disk_file = file_normalize_attachment_path($v_diskfile, $t_project_id);
        if (file_exists($t_local_disk_file)) {
            if ($finfo) {
                $t_file_info_type = $finfo->file($t_local_disk_file);
                if ($t_file_info_type !== false) {
                    $t_content_type = $t_file_info_type;
                }
$f_type_page = gpc_get_string('type_page', 'word');
$f_search = gpc_get_string('search', false);
# @todo need a better default
$f_offset = gpc_get_int('offset', 0);
$f_export = gpc_get_string('export');
$f_show_flag = gpc_get_bool('show_flag');
helper_begin_long_process();
# word or html export
if ($f_type_page != 'html') {
    $t_export_title = helper_get_default_export_filename('');
    $t_export_title = preg_replace('/[\\/:*?"<>|]/', '', $t_export_title);
    $t_export_title .= '.doc';
    # Make sure that IE can download the attachments under https.
    header('Pragma: public');
    header('Content-Type: application/msword');
    http_content_disposition_header($t_export_title);
}
# This is where we used to do the entire actual filter ourselves
$t_page_number = gpc_get_int('page_number', 1);
$t_per_page = -1;
$t_bug_count = null;
$t_page_count = null;
$t_result = filter_get_bug_rows($t_page_number, $t_per_page, $t_page_count, $t_bug_count);
$t_row_count = count($t_result);
# Headers depending on intended output
if ($f_type_page == 'html') {
    html_page_top1();
    html_head_end();
    html_body_begin();
} else {
    echo '<html xmlns:o="urn:schemas-microsoft-com:office:office"