mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-14 18:48:21 -07:00
Set response code in some cases (#1319)
* Set response code in some cases * Update CHANGELOG.md
This commit is contained in:
parent
ae616f3a74
commit
125cd11c01
9 changed files with 33 additions and 34 deletions
|
@ -1628,10 +1628,14 @@ function obtain_word_list(&$orig_word, &$replacement_word)
|
|||
return true;
|
||||
}
|
||||
|
||||
function bb_die($msg_text)
|
||||
function bb_die($msg_text, $status_code = null)
|
||||
{
|
||||
global $ajax, $bb_cfg, $lang, $template, $theme, $userdata, $user;
|
||||
|
||||
if (isset($status_code)) {
|
||||
http_response_code($status_code);
|
||||
}
|
||||
|
||||
if (defined('IN_AJAX')) {
|
||||
$ajax->ajax_die($msg_text);
|
||||
}
|
||||
|
@ -1682,15 +1686,20 @@ function bb_die($msg_text)
|
|||
exit;
|
||||
}
|
||||
|
||||
function bb_simple_die($txt)
|
||||
function bb_simple_die($txt, $status_code = null)
|
||||
{
|
||||
global $bb_cfg;
|
||||
|
||||
header('Content-Type: text/plain; charset=' . $bb_cfg['charset']);
|
||||
|
||||
if (isset($status_code)) {
|
||||
http_response_code($status_code);
|
||||
}
|
||||
|
||||
if (!empty($_COOKIE['explain'])) {
|
||||
bb_die("bb_simple_die:<br /><br />$txt");
|
||||
}
|
||||
|
||||
header('Content-Type: text/plain; charset=' . $bb_cfg['charset']);
|
||||
die($txt);
|
||||
}
|
||||
|
||||
|
@ -1733,7 +1742,7 @@ function redirect($url)
|
|||
$redirect_url = $server_protocol . $server_name . $server_port . $script_name . preg_replace('#^\/?(.*?)\/?$#', '/\1', $url);
|
||||
|
||||
// Behave as per HTTP/1.1 spec for others
|
||||
header('Location: ' . $redirect_url);
|
||||
header('Location: ' . $redirect_url, response_code: 301);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue