From eecfe1a9515034d263a49f84210d3d32430253be Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 3 Aug 2025 14:51:18 +0300 Subject: [PATCH] feat: Prevent robots indexing for private topics (#2071) --- posting.php | 8 ++++++-- viewtopic.php | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/posting.php b/posting.php index b75e17091..f823d5a66 100644 --- a/posting.php +++ b/posting.php @@ -253,7 +253,11 @@ if (!empty($bb_cfg['tor_cannot_edit']) && $post_info['allow_reg_tracker'] && $po $robots_indexing = $post_info['topic_allow_robots'] ?? true; if ($submit || $refresh) { if (IS_AM) { - $robots_indexing = !empty($_POST['robots']); + if ($post_info['auth_read'] == AUTH_ALL) { + $robots_indexing = !empty($_POST['robots']); + } else { + $robots_indexing = true; + } } $notify_user = (int)!empty($_POST['notify']); } else { @@ -504,7 +508,7 @@ if (!IS_GUEST) { $topic_type_toggle = ''; if ($mode == 'newtopic' || ($mode == 'editpost' && $post_data['first_post'])) { // Allow robots indexing - if (IS_AM) { + if (IS_AM && $post_info['auth_read'] == AUTH_ALL) { $template->assign_var('SHOW_ROBOTS_CHECKBOX'); } diff --git a/viewtopic.php b/viewtopic.php index 7a0aec0bf..0ed14fd11 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -113,9 +113,6 @@ $topic_id = $t_data['topic_id']; $forum_id = $t_data['forum_id']; $topic_attachment = isset($t_data['topic_attachment']) ? (int)$t_data['topic_attachment'] : null; -// Allow robots indexing -$page_cfg['allow_robots'] = (bool)$t_data['topic_allow_robots']; - if ($t_data['allow_porno_topic'] && bf($userdata['user_opt'], 'user_opt', 'user_porn_forums')) { bb_die($lang['ERROR_PORNO_FORUM']); } @@ -229,6 +226,13 @@ $datastore->rm('cat_forums'); // Make jumpbox make_jumpbox(); +// Allow robots indexing +if ($is_auth['auth_read']) { + $page_cfg['allow_robots'] = (bool)$t_data['topic_allow_robots']; +} else { + $page_cfg['allow_robots'] = false; +} + if ($post_id && !empty($t_data['prev_posts'])) { $start = floor(($t_data['prev_posts'] - 1) / $posts_per_page) * $posts_per_page; }