diff options
| author | Nils Adermann <naderman@naderman.de> | 2010-05-30 14:59:06 +0200 |
|---|---|---|
| committer | Nils Adermann <naderman@naderman.de> | 2010-05-30 14:59:06 +0200 |
| commit | 2cf57822bb4607d595affaef2264f064cb984c55 (patch) | |
| tree | 523d050baf573c6dbdc383346cd340e142106d44 /phpBB/includes/functions.php | |
| parent | 904d2049c8f0d528216b4c24941e7dab66ec09ce (diff) | |
| parent | 8f91e6ce8be5e79b58c70dc212c5f83b0d8b7094 (diff) | |
| download | forums-2cf57822bb4607d595affaef2264f064cb984c55.tar forums-2cf57822bb4607d595affaef2264f064cb984c55.tar.gz forums-2cf57822bb4607d595affaef2264f064cb984c55.tar.bz2 forums-2cf57822bb4607d595affaef2264f064cb984c55.tar.xz forums-2cf57822bb4607d595affaef2264f064cb984c55.zip | |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/9094] Hide "Copy permissions" message, when permissions were copied.
[ticket/9135] Fix report-icon for moderators in PM folders.
[ticket/8936] Subsilver2 missing reply-to-all feature.
[ticket/7782] Return 404 HTTP status code for nonexistent attachments.
[ticket/7782] Added spaces.
[ticket/7782] Added phpdoc comment for send_status_line function.
[ticket/7782] Send status line using refactored download/file.php logic.
[ticket/8792] Add LDAP_SEARCH_FAILED string for when ldap_search() fails.
Diffstat (limited to 'phpBB/includes/functions.php')
| -rw-r--r-- | phpBB/includes/functions.php | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..3e80f93114 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,47 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +/** +* Outputs correct status line header. +* +* Depending on php sapi one of the two following forms is used: +* +* Status: 404 Not Found +* +* HTTP/1.x 404 Not Found +* +* HTTP version is taken from HTTP_VERSION environment variable, +* and defaults to 1.0. +* +* Sample usage: +* +* send_status_line(404, 'Not Found'); +* +* @param int $code HTTP status code +* @param string $message Message for the status code +* @return void +*/ +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 @@ -3621,9 +3662,9 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $user->setup(); } - if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') + if ($msg_text == 'ERROR_NO_ATTACHMENT' || $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; |
