feat: Prevent robots indexing for private topics (#2071)
Some checks are pending
PHPMD / Run PHPMD scanning (push) Waiting to run
Continuous Integration / Nightly builds 📦 (push) Waiting to run
Continuous Integration / 🎉 Deploy (push) Waiting to run

This commit is contained in:
Roman Kelesidis 2025-08-03 14:51:18 +03:00 committed by GitHub
commit eecfe1a951
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 5 deletions

View file

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

View file

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