diff options
| author | Oleg Pudeyev <oleg@bsdpower.com> | 2010-05-16 18:24:26 -0400 |
|---|---|---|
| committer | Oleg Pudeyev <oleg@bsdpower.com> | 2010-05-16 18:24:26 -0400 |
| commit | c1a4cb1d01dc19650219566b60671abc767af662 (patch) | |
| tree | 9dbc499120fa373384cad60919ff856bd1abc90c /phpBB/includes/functions.php | |
| parent | 6d7e30ae995fe0791c2bced0974b0445fa769ee9 (diff) | |
| download | forums-c1a4cb1d01dc19650219566b60671abc767af662.tar forums-c1a4cb1d01dc19650219566b60671abc767af662.tar.gz forums-c1a4cb1d01dc19650219566b60671abc767af662.tar.bz2 forums-c1a4cb1d01dc19650219566b60671abc767af662.tar.xz forums-c1a4cb1d01dc19650219566b60671abc767af662.zip | |
[ticket/7782] Send status line using refactored download/file.php logic.
PHPBB3-7782
Diffstat (limited to 'phpBB/includes/functions.php')
| -rw-r--r-- | phpBB/includes/functions.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..bc7c426e44 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,27 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +function send_status_line($code, $message) +{ + if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') + { + // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though + header("Status: $code $message", true, $code); + } + else + { + if (isset($_SERVER['HTTP_VERSION'])) + { + $version = $_SERVER['HTTP_VERSION']; + } + else + { + $version = 'HTTP/1.0'; + } + header("$version $code $message", true, $code); + } +} + //Form validation @@ -3623,7 +3644,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { - header("HTTP/1.x 404 Not Found"); + send_status_line(404, 'Not Found'); } $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; |
