diff --git a/README.md b/README.md index ce8155d43..3aaee0715 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ and go from there. The documentation will be translated to english in the near f * High-load capable, heavily configurable announcer * Scrape support * FreeLeech +* [IndexNow](https://www.indexnow.org) support * [TorrServer integration](https://github.com/YouROK/TorrServer) support * BitTorrent v2 support * Event-based invite system diff --git a/bt/announce.php b/bt/announce.php index 6f4d900de..67ade667b 100644 --- a/bt/announce.php +++ b/bt/announce.php @@ -13,7 +13,9 @@ require dirname(__DIR__) . '/common.php'; global $bb_cfg; -if (empty($_SERVER['HTTP_USER_AGENT'])) { +// Check User-Agent for existence +$userAgent = (string)$_SERVER['HTTP_USER_AGENT']; +if (empty($userAgent)) { header('Location: http://127.0.0.1', true, 301); die; } @@ -151,7 +153,6 @@ if (!isset($left) || !is_numeric($left) || $left < 0) { * * @see https://github.com/HDInnovations/UNIT3D-Community-Edition/blob/c64275f0b5dcb3c4c845d5204871adfe24f359d6/app/Http/Controllers/AnnounceController.php#L177 */ -$userAgent = (string)$_SERVER['HTTP_USER_AGENT']; if (strlen($userAgent) > 64) { msg_die('User-Agent must be less than 64 characters long'); } diff --git a/src/Legacy/Post.php b/src/Legacy/Post.php index 4c0736e86..b82a03d86 100644 --- a/src/Legacy/Post.php +++ b/src/Legacy/Post.php @@ -159,7 +159,7 @@ class Post topic_id = $topic_id "; - $sql = ($mode != "editpost") ? $sql_insert : $sql_update; + $sql = ($mode != 'editpost') ? $sql_insert : $sql_update; if (!DB()->sql_query($sql)) { bb_die('Error in posting #1'); @@ -178,7 +178,7 @@ class Post DB()->sql_query("UPDATE " . BB_TOPICS . " SET topic_last_post_time = $current_time WHERE topic_id = $topic_id LIMIT 1"); } - $sql = ($mode != "editpost") ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, poster_rg_id, attach_rg_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '" . USER_IP . "', $poster_rg_id, $attach_rg_sig)" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . ", poster_rg_id = $poster_rg_id, attach_rg_sig = $attach_rg_sig WHERE post_id = $post_id"; + $sql = ($mode != 'editpost') ? "INSERT INTO " . BB_POSTS . " (topic_id, forum_id, poster_id, post_username, post_time, poster_ip, poster_rg_id, attach_rg_sig) VALUES ($topic_id, $forum_id, " . $userdata['user_id'] . ", '$post_username', $current_time, '" . USER_IP . "', $poster_rg_id, $attach_rg_sig)" : "UPDATE " . BB_POSTS . " SET post_username = '$post_username'" . $edited_sql . ", poster_rg_id = $poster_rg_id, attach_rg_sig = $attach_rg_sig WHERE post_id = $post_id"; if (!DB()->sql_query($sql)) { bb_die('Error in posting #2'); }