mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 21:33:54 -07:00
[TEMP] Removed Http class (#748)
This commit is contained in:
parent
56b518d44e
commit
98d683f98a
3 changed files with 1 additions and 58 deletions
|
@ -27,9 +27,6 @@ if (empty($_SERVER['HTTP_REFERER'])) {
|
||||||
if (empty($_SERVER['SERVER_NAME'])) {
|
if (empty($_SERVER['SERVER_NAME'])) {
|
||||||
$_SERVER['SERVER_NAME'] = '';
|
$_SERVER['SERVER_NAME'] = '';
|
||||||
}
|
}
|
||||||
if (empty($_SERVER['SERVER_PROTOCOL'])) {
|
|
||||||
$_SERVER['SERVER_PROTOCOL'] = getenv('SERVER_PROTOCOL') ?? 'HTTP/1.1';
|
|
||||||
}
|
|
||||||
if (empty($_SERVER['SERVER_ADDR'])) {
|
if (empty($_SERVER['SERVER_ADDR'])) {
|
||||||
$_SERVER['SERVER_ADDR'] = getenv('SERVER_ADDR');
|
$_SERVER['SERVER_ADDR'] = getenv('SERVER_ADDR');
|
||||||
}
|
}
|
||||||
|
|
|
@ -446,7 +446,7 @@ if (
|
||||||
* Exit if board is disabled via trigger
|
* Exit if board is disabled via trigger
|
||||||
*/
|
*/
|
||||||
if (($bb_cfg['board_disable'] || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
|
if (($bb_cfg['board_disable'] || file_exists(BB_DISABLED)) && !defined('IN_ADMIN') && !defined('IN_AJAX') && !defined('IN_LOGIN')) {
|
||||||
\TorrentPier\Common\Http::statusCode(503);
|
header('HTTP/1.0 503 Service Unavailable');
|
||||||
if ($bb_cfg['board_disable']) {
|
if ($bb_cfg['board_disable']) {
|
||||||
// admin lock
|
// admin lock
|
||||||
send_no_cache_headers();
|
send_no_cache_headers();
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* TorrentPier – Bull-powered BitTorrent tracker engine
|
|
||||||
*
|
|
||||||
* @copyright Copyright (c) 2005-2023 TorrentPier (https://torrentpier.com)
|
|
||||||
* @link https://github.com/torrentpier/torrentpier for the canonical source repository
|
|
||||||
* @license https://github.com/torrentpier/torrentpier/blob/master/LICENSE MIT License
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace TorrentPier\Common;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Http
|
|
||||||
* @package TorrentPier\Common
|
|
||||||
*/
|
|
||||||
class Http
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set a HTTP response code
|
|
||||||
*
|
|
||||||
* @param int $statusCode
|
|
||||||
*/
|
|
||||||
public static function statusCode(int $statusCode): void
|
|
||||||
{
|
|
||||||
static $status_codes = null;
|
|
||||||
|
|
||||||
if ($status_codes === null) {
|
|
||||||
$status_codes = [
|
|
||||||
100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing',
|
|
||||||
200 => 'OK', 201 => 'Created', 202 => 'Accepted',
|
|
||||||
203 => 'Non-Authoritative Information', 204 => 'No Content', 205 => 'Reset Content',
|
|
||||||
206 => 'Partial Content', 207 => 'Multi-Status', 300 => 'Multiple Choices',
|
|
||||||
301 => 'Moved Permanently', 302 => 'Found', 303 => 'See Other',
|
|
||||||
304 => 'Not Modified', 305 => 'Use Proxy', 307 => 'Temporary Redirect',
|
|
||||||
400 => 'Bad Request', 401 => 'Unauthorized', 402 => 'Payment Required',
|
|
||||||
403 => 'Forbidden', 404 => 'Not Found', 405 => 'Method Not Allowed',
|
|
||||||
406 => 'Not Acceptable', 407 => 'Proxy Authentication Required', 408 => 'Request Timeout',
|
|
||||||
409 => 'Conflict', 410 => 'Gone', 411 => 'Length Required',
|
|
||||||
412 => 'Precondition Failed', 413 => 'Request Entity Too Large', 414 => 'Request-URI Too Long',
|
|
||||||
415 => 'Unsupported Media Type', 416 => 'Requested Range Not Satisfiable', 417 => 'Expectation Failed',
|
|
||||||
422 => 'Unprocessable Entity', 423 => 'Locked', 424 => 'Failed Dependency',
|
|
||||||
426 => 'Upgrade Required', 500 => 'Internal Server Error', 501 => 'Not Implemented',
|
|
||||||
502 => 'Bad Gateway', 503 => 'Service Unavailable', 504 => 'Gateway Timeout',
|
|
||||||
505 => 'HTTP Version Not Supported', 506 => 'Variant Also Negotiates', 507 => 'Insufficient Storage',
|
|
||||||
509 => 'Bandwidth Limit Exceeded', 510 => 'Not Extended'
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($status_codes[$statusCode] !== null) {
|
|
||||||
$status_string = $statusCode . ' ' . $status_codes[$statusCode];
|
|
||||||
header($_SERVER['SERVER_PROTOCOL'] . ' ' . $status_string, true, $statusCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue