Removed wbr() (#1387)

This commit is contained in:
Roman Kelesidis 2024-02-08 14:30:22 +07:00 committed by GitHub
commit 80fe5a5e60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 22 additions and 28 deletions

View file

@ -250,7 +250,7 @@ foreach ($cat_forums as $cid => $c) {
$template->assign_block_vars('c.f.last', [ $template->assign_block_vars('c.f.last', [
'LAST_TOPIC_ID' => $f['last_topic_id'], 'LAST_TOPIC_ID' => $f['last_topic_id'],
'LAST_TOPIC_TIP' => $f['last_topic_title'], 'LAST_TOPIC_TIP' => $f['last_topic_title'],
'LAST_TOPIC_TITLE' => wbr(str_short($f['last_topic_title'], $last_topic_max_len)), 'LAST_TOPIC_TITLE' => str_short($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_TIME' => bb_date($f['last_post_time'], $bb_cfg['last_post_date_format']),
'LAST_POST_USER' => profile_url(['username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank']]), 'LAST_POST_USER' => profile_url(['username' => str_short($f['last_post_username'], 15), 'user_id' => $f['last_post_user_id'], 'user_rank' => $f['last_post_user_rank']]),
]); ]);

View file

@ -88,7 +88,7 @@ if ($tor_auth_reg || $tor_auth_del) {
$tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url; $tracker_link = ($tor_reged) ? $unreg_tor_url : $reg_tor_url;
} }
$display_name = wbr($t_data['topic_title']) . ' [' . $bb_cfg['server_name'] . '-' . $bt_topic_id . ']' . '.' . TORRENT_EXT; $display_name = $t_data['topic_title'] . ' [' . $bb_cfg['server_name'] . '-' . $bt_topic_id . ']' . '.' . TORRENT_EXT;
if (!$tor_reged) { if (!$tor_reged) {
$template->assign_block_vars('postrow.attach.tor_not_reged', [ $template->assign_block_vars('postrow.attach.tor_not_reged', [

View file

@ -790,11 +790,6 @@ function str_short($text, $max_length, $space = ' ')
return $text ?? ''; return $text ?? '';
} }
function wbr($text, $max_word_length = HTML_WBR_LENGTH)
{
return preg_replace("/([\w\->;:.,~!?(){}@#$%^*\/\\\\]{" . $max_word_length . "})/ui", '$1<wbr>', $text);
}
function generate_user_info($row, bool $have_auth = IS_ADMIN): array function generate_user_info($row, bool $have_auth = IS_ADMIN): array
{ {
global $userdata, $lang, $images, $bb_cfg; global $userdata, $lang, $images, $bb_cfg;

View file

@ -81,10 +81,10 @@ if ($watch_count > 0) {
'ROW_CLASS' => (!($i % 2)) ? 'row1' : 'row2', 'ROW_CLASS' => (!($i % 2)) ? 'row1' : 'row2',
'POST_ID' => $watch[$i]['topic_first_post_id'], 'POST_ID' => $watch[$i]['topic_first_post_id'],
'TOPIC_ID' => $watch[$i]['topic_id'], 'TOPIC_ID' => $watch[$i]['topic_id'],
'TOPIC_TITLE' => wbr(str_short($watch[$i]['topic_title'], 70)), 'TOPIC_TITLE' => str_short($watch[$i]['topic_title'], 70),
'FULL_TOPIC_TITLE' => wbr($watch[$i]['topic_title']), 'FULL_TOPIC_TITLE' => $watch[$i]['topic_title'],
'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'], 'U_TOPIC' => TOPIC_URL . $watch[$i]['topic_id'],
'FORUM_TITLE' => wbr($watch[$i]['forum_name']), 'FORUM_TITLE' => $watch[$i]['forum_name'],
'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'], 'U_FORUM' => FORUM_URL . $watch[$i]['forum_id'],
'REPLIES' => $watch[$i]['topic_replies'], 'REPLIES' => $watch[$i]['topic_replies'],
'AUTHOR' => profile_url($watch[$i]), 'AUTHOR' => profile_url($watch[$i]),

View file

@ -49,7 +49,7 @@ foreach ($sql as $rowset) {
if ($releasing) { if ($releasing) {
foreach ($releasing as $i => $row) { foreach ($releasing as $i => $row) {
$topic_title = wbr($row['topic_title']); $topic_title = $row['topic_title'];
$template->assign_block_vars('released', [ $template->assign_block_vars('released', [
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
@ -69,7 +69,7 @@ if ($releasing) {
if ($seeding) { if ($seeding) {
foreach ($seeding as $i => $row) { foreach ($seeding as $i => $row) {
$topic_title = wbr($row['topic_title']); $topic_title = $row['topic_title'];
$template->assign_block_vars('seed', [ $template->assign_block_vars('seed', [
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',
@ -89,9 +89,9 @@ if ($seeding) {
if ($leeching) { if ($leeching) {
foreach ($leeching as $i => $row) { foreach ($leeching as $i => $row) {
$compl_size = ($row['remain'] && $row['size'] && $row['size'] > $row['remain']) ? ($row['size'] - $row['remain']) : 0; $compl_size = ($row['remain'] && $row['size'] && ($row['size'] > $row['remain'])) ? ($row['size'] - $row['remain']) : 0;
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $row['size']) : 0; $compl_perc = $compl_size ? floor($compl_size * 100 / $row['size']) : 0;
$topic_title = wbr($row['topic_title']); $topic_title = $row['topic_title'];
$template->assign_block_vars('leech', [ $template->assign_block_vars('leech', [
'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2',

View file

@ -564,7 +564,7 @@ switch ($mode) {
$template->assign_block_vars('postrow', [ $template->assign_block_vars('postrow', [
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'POSTER_NAME' => wbr($poster), 'POSTER_NAME' => $poster,
'POST_DATE' => $post_date, 'POST_DATE' => $post_date,
'MESSAGE' => $message, 'MESSAGE' => $message,
'CHECKBOX' => defined('BEGIN_CHECKBOX'), 'CHECKBOX' => defined('BEGIN_CHECKBOX'),
@ -674,7 +674,7 @@ switch ($mode) {
$template->assign_block_vars('userrow', [ $template->assign_block_vars('userrow', [
'ROW_CLASS' => !($i % 2) ? 'row4' : 'row5', 'ROW_CLASS' => !($i % 2) ? 'row4' : 'row5',
'USERNAME' => wbr($username), 'USERNAME' => $username,
'POSTS' => $row['postings'], 'POSTS' => $row['postings'],
'U_PROFILE' => ($id == GUEST_UID) ? "modcp.php?mode=ip&amp;p=$post_id&amp;t=$topic_id" : PROFILE_URL . $id, 'U_PROFILE' => ($id == GUEST_UID) ? "modcp.php?mode=ip&amp;p=$post_id&amp;t=$topic_id" : PROFILE_URL . $id,
'U_SEARCHPOSTS' => "search.php?search_author=1&amp;uid=$id", 'U_SEARCHPOSTS' => "search.php?search_author=1&amp;uid=$id",

View file

@ -441,7 +441,7 @@ if ($refresh || $error_msg || ($submit && $topic_has_new_posts)) {
$template->assign_vars([ $template->assign_vars([
'TPL_PREVIEW_POST' => true, 'TPL_PREVIEW_POST' => true,
'TOPIC_TITLE' => wbr($preview_subject), 'TOPIC_TITLE' => $preview_subject,
'POST_SUBJECT' => $preview_subject, 'POST_SUBJECT' => $preview_subject,
'POSTER_NAME' => $preview_username, 'POSTER_NAME' => $preview_username,
'POST_DATE' => bb_date(TIMENOW), 'POST_DATE' => bb_date(TIMENOW),
@ -618,7 +618,7 @@ $template->assign_vars([
'PAGE_TITLE' => $page_title, 'PAGE_TITLE' => $page_title,
'POSTING_TYPE_TITLE' => $page_title, 'POSTING_TYPE_TITLE' => $page_title,
'POSTING_TOPIC_ID' => ($mode != 'newtopic') ? $topic_id : '', 'POSTING_TOPIC_ID' => ($mode != 'newtopic') ? $topic_id : '',
'POSTING_TOPIC_TITLE' => ($mode != 'newtopic') ? wbr($post_info['topic_title']) : '', 'POSTING_TOPIC_TITLE' => ($mode != 'newtopic') ? $post_info['topic_title'] : '',
'U_VIEW_FORUM' => FORUM_URL . $forum_id, 'U_VIEW_FORUM' => FORUM_URL . $forum_id,
'USERNAME' => @$username, 'USERNAME' => @$username,

View file

@ -1074,7 +1074,7 @@ if ($mode == 'read') {
$template->assign_vars([ $template->assign_vars([
'TPL_PREVIEW_POST' => true, 'TPL_PREVIEW_POST' => true,
'TOPIC_TITLE' => wbr($preview_subject), 'TOPIC_TITLE' => $preview_subject,
'POST_SUBJECT' => $preview_subject, 'POST_SUBJECT' => $preview_subject,
'MESSAGE_TO' => $to_username, 'MESSAGE_TO' => $to_username,
'MESSAGE_FROM' => $userdata['username'], 'MESSAGE_FROM' => $userdata['username'],

View file

@ -801,7 +801,7 @@ else {
'FORUM_NAME' => $forum_name_html[$forum_id], 'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'], 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPIC_TITLE' => $topic['topic_title'],
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $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']), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),

View file

@ -149,7 +149,7 @@ class Atom
@unlink($file_path); @unlink($file_path);
return false; return false;
} }
if (self::create_atom($file_path, 'u', $user_id, wbr($username), $topics)) { if (self::create_atom($file_path, 'u', $user_id, $username, $topics)) {
return true; return true;
} }
@ -210,8 +210,7 @@ class Atom
if (\count($orig_word)) { if (\count($orig_word)) {
$topic_title = preg_replace($orig_word, $replacement_word, $topic_title); $topic_title = preg_replace($orig_word, $replacement_word, $topic_title);
} }
$topic_title = wbr($topic_title); $author_name = $topic['first_username'] ?: $lang['GUEST'];
$author_name = $topic['first_username'] ? wbr($topic['first_username']) : $lang['GUEST'];
$last_time = $topic['topic_last_post_time']; $last_time = $topic['topic_last_post_time'];
if ($topic['topic_last_post_edit_time']) { if ($topic['topic_last_post_edit_time']) {
$last_time = $topic['topic_last_post_edit_time']; $last_time = $topic['topic_last_post_edit_time'];

View file

@ -732,7 +732,7 @@ if ($allowed_forums) {
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_id ? $forum_name_html[$forum_id] : '', 'FORUM_NAME' => $forum_id ? $forum_name_html[$forum_id] : '',
'TOPIC_ID' => $tor['topic_id'], 'TOPIC_ID' => $tor['topic_id'],
'TOPIC_TITLE' => wbr($tor['topic_title']), 'TOPIC_TITLE' => $tor['topic_title'],
'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']), 'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']),
'POST_ID' => $tor['post_id'], 'POST_ID' => $tor['post_id'],
'POSTER_ID' => $poster_id, 'POSTER_ID' => $poster_id,

View file

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

View file

@ -475,7 +475,7 @@ $template->assign_vars([
'FORUM_NAME' => htmlCHR($forum_name), 'FORUM_NAME' => htmlCHR($forum_name),
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'PAGE_TITLE' => $page_title, 'PAGE_TITLE' => $page_title,
'TOPIC_TITLE' => wbr($topic_title), 'TOPIC_TITLE' => $topic_title,
'PORNO_FORUM' => $t_data['allow_porno_topic'], 'PORNO_FORUM' => $t_data['allow_porno_topic'],
'REPLY_IMG' => $reply_img, 'REPLY_IMG' => $reply_img,
'SHOW_BOT_NICK' => $bb_cfg['show_bot_nick'], 'SHOW_BOT_NICK' => $bb_cfg['show_bot_nick'],
@ -569,7 +569,7 @@ for ($i = 0; $i < $total_posts; $i++) {
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']); $post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
$max_post_time = max($max_post_time, $postrow[$i]['post_time']); $max_post_time = max($max_post_time, $postrow[$i]['post_time']);
$poster_posts = !$poster_guest ? $postrow[$i]['user_posts'] : ''; $poster_posts = !$poster_guest ? $postrow[$i]['user_posts'] : '';
$poster_from = ($postrow[$i]['user_from'] && !$poster_guest) ? wbr($postrow[$i]['user_from']) : ''; $poster_from = ($postrow[$i]['user_from'] && !$poster_guest) ? $postrow[$i]['user_from'] : '';
$poster_joined = !$poster_guest ? $lang['JOINED'] . ': ' . bb_date($postrow[$i]['user_regdate'], 'Y-m-d H:i') : ''; $poster_joined = !$poster_guest ? $lang['JOINED'] . ': ' . bb_date($postrow[$i]['user_regdate'], 'Y-m-d H:i') : '';
$poster_longevity = !$poster_guest ? delta_time($postrow[$i]['user_regdate']) : ''; $poster_longevity = !$poster_guest ? delta_time($postrow[$i]['user_regdate']) : '';
$post_id = $postrow[$i]['post_id']; $post_id = $postrow[$i]['post_id'];