misc(announcer): Some minor improvements (#1819)

* misc(announcer): Some minor improvements

* Update announce.php

* Update README.md

* Update Post.php
This commit is contained in:
Roman Kelesidis 2025-02-19 14:58:37 +03:00 committed by GitHub
commit bdefed4dab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 4 deletions

View file

@ -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

View file

@ -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');
}

View file

@ -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');
}