Added word censor in some cases (#104)

This commit is contained in:
Roman Kelesidis 2023-04-01 12:43:34 +07:00 committed by GitHub
parent 584cf6784b
commit c3a320f4dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 9 deletions

View File

@ -9,6 +9,12 @@ $page_cfg['load_tpl_vars'] = array(
'post_icons',
);
//
// Define censored word matches
//
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$show_last_topic = true;
$last_topic_max_len = 28;
$show_online_users = true;
@ -269,8 +275,8 @@ foreach ($cat_forums as $cid => $c)
{
$template->assign_block_vars('c.f.last', array(
'LAST_TOPIC_ID' => $f['last_topic_id'],
'LAST_TOPIC_TIP' => $f['last_topic_title'],
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)),
'LAST_TOPIC_TIP' => preg_replace($orig_word, $replacement_word, $f['last_topic_title']),
'LAST_TOPIC_TITLE' => wbr(str_short(preg_replace($orig_word, $replacement_word, $f['last_topic_title']), $last_topic_max_len)),
'LAST_POST_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
'LAST_POST_USER' => profile_url(array('username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank'])),
));
@ -334,7 +340,7 @@ if ($bb_cfg['show_latest_news'])
{
$template->assign_block_vars('news', array(
'NEWS_TOPIC_ID' => $news['topic_id'],
'NEWS_TITLE' => str_short($news['topic_title'], $bb_cfg['max_news_title']),
'NEWS_TITLE' => str_short(preg_replace($orig_word, $replacement_word, $news['topic_title']), $bb_cfg['max_news_title']),
'NEWS_TIME' => bb_date($news['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($news['topic_time'], $news['topic_id'], $news['forum_id']),
));
@ -358,7 +364,7 @@ if ($bb_cfg['show_network_news'])
{
$template->assign_block_vars('net', array(
'NEWS_TOPIC_ID' => $net['topic_id'],
'NEWS_TITLE' => str_short($net['topic_title'], $bb_cfg['max_net_title']),
'NEWS_TITLE' => str_short(preg_replace($orig_word, $replacement_word, $net['topic_title']), $bb_cfg['max_net_title']),
'NEWS_TIME' => bb_date($net['topic_time'], 'd-M', false),
'NEWS_IS_NEW' => is_unread($net['topic_time'], $net['topic_id'], $net['forum_id']),
));

View File

@ -5,6 +5,12 @@ if (empty($bb_cfg['topic_notify_enabled']))
bb_die($lang['DISABLED']);
}
//
// Define censored word matches
//
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
$page_cfg['use_tablesorter'] = true;
$page_cfg['include_bbcode_js'] = true;
$tracking_topics = get_tracks('topic');
@ -66,8 +72,8 @@ if ($watch_count > 0)
'ROW_CLASS' => ( !($i % 2) ) ? 'row1' : 'row2',
'POST_ID' => $watch[$i]['topic_first_post_id'],
'TOPIC_ID' => $watch[$i]['topic_id'],
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)),
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']),
'TOPIC_TITLE' => wbr(str_short(preg_replace($orig_word, $replacement_word, $watch[$i]['topic_title']), 70)),
'FULL_TOPIC_TITLE' => wbr(preg_replace($orig_word, $replacement_word, $watch[$i]['topic_title'])),
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
'FORUM_TITLE' => wbr($watch[$i]['forum_name']),
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],

View File

@ -811,7 +811,7 @@ else
'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']),
'TOPIC_TITLE' => wbr(preg_replace($orig_word, $replacement_word, $topic['topic_title'])),
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),

View File

@ -16,6 +16,12 @@ $page_cfg['load_tpl_vars'] = array(
'post_icons',
);
//
// Define censored word matches
//
$orig_word = $replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
// Session start
$user->session_start(array('req_login' => $bb_cfg['bt_tor_browse_only_reg']));
@ -800,7 +806,7 @@ if ($allowed_forums)
'FORUM_ID' => $forum_id,
'FORUM_NAME' => ($forum_id) ? $forum_name_html[$forum_id] : '',
'TOPIC_ID' => $tor['topic_id'],
'TOPIC_TITLE' => wbr($tor['topic_title']),
'TOPIC_TITLE' => wbr(preg_replace($orig_word, $replacement_word, $tor['topic_title'])),
'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') .' <b>&middot;</b> '. delta_time($tor['topic_time']),
'POST_ID' => $tor['post_id'],
'POSTER_ID' => $poster_id,

View File

@ -483,7 +483,7 @@ foreach ($topic_rowset as $topic)
'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']),
'TOPIC_TITLE' => wbr(preg_replace($orig_word, $replacement_word, $topic['topic_title'])),
'TOPICS_SEPARATOR' => $separator,
'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread),