Show user's ban status (#1258)

This commit is contained in:
Cønstantine Kovalensky 2023-12-25 23:07:47 +04:00 committed by GitHub
commit 0791859923
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 3 deletions

View file

@ -74,12 +74,18 @@ if (bf($profiledata['user_opt'], 'user_opt', 'dis_sig')) {
$signature = bbcode2html($signature);
}
$user_banned = false;
if (DB()->fetch_row('SELECT ban_userid FROM ' . BB_BANLIST . " WHERE ban_userid = {$profiledata['user_id']} LIMIT 1")) {
$user_banned = true;
}
$template->assign_vars([
'PAGE_TITLE' => sprintf($lang['VIEWING_USER_PROFILE'], $profiledata['username']),
'USERNAME' => $profiledata['username'],
'PROFILE_USER_ID' => $profiledata['user_id'],
'PROFILE_USER' => $profile_user_id,
'USER_REGDATE' => bb_date($profiledata['user_regdate'], 'Y-m-d H:i', false),
'BANNED' => $user_banned,
'POSTER_RANK' => ($poster_rank) ? "<span class=\"$rank_style\">" . $poster_rank . "</span>" : $lang['USER'],
'RANK_IMAGE' => $rank_image,
'RANK_SELECT' => $rank_select,

View file

@ -889,7 +889,7 @@ class SqlDb
$q_time = ($this->cur_query_time >= 10) ? round($this->cur_query_time, 0) : sprintf('%.4f', $this->cur_query_time);
$msg = [];
$msg[] = round($this->sql_starttime);
$msg[] = date('m-d H:i:s', $this->sql_starttime);
$msg[] = date('m-d H:i:s', (int)$this->sql_starttime);
$msg[] = sprintf('%-6s', $q_time);
$msg[] = sprintf('%05d', getmypid());
$msg[] = $this->db_server;

View file

@ -489,6 +489,17 @@ a.postLink:visited {
line-height: 110%;
}
.poster-banned {
background:#f6f6f6;
border:1px solid #b71c1c;
padding:4px;
border-radius:2px;
font-size:11px;
font-weight:bold;
letter-spacing:1px;
text-align:center
}
.poster_info .avatar {
margin: 5px 0 4px;
max-width: 100px;

View file

@ -295,6 +295,7 @@ ajax.callback.index_data = function(data) {
<th>{L_USERNAME}:</th>
<td id="username">
<span class="editable bold">{USERNAME}</span>
<!-- IF BANNED --><b title="{L_BANNED_USERS}" style="color: red;">{L_BANNED}</b><!-- ENDIF -->
</td>
</tr>
<!-- IF SHOW_ROLE -->

View file

@ -361,6 +361,7 @@ function build_poll_add_form (src_el)
<p class="nick">{postrow.POSTER_NAME} <!-- IF postrow.POSTER_AUTHOR --><sup>&reg;</sup><!-- ENDIF --></p>
<!-- ENDIF -->
<!-- IF postrow.POSTER_BANNED --><p class="poster-banned" title="{L_BANNED_USERS}">{L_BANNED}</p><!-- ENDIF -->
<!-- IF postrow.POSTER_RANK --><p class="rank_txt">{postrow.POSTER_RANK}</p><!-- ENDIF -->
<!-- IF postrow.RANK_IMAGE --><p class="rank_img">{postrow.RANK_IMAGE}</p><!-- ENDIF -->
<!-- IF postrow.POSTER_AVATAR --><p class="avatar">{postrow.POSTER_AVATAR}</p><!-- ENDIF -->

View file

@ -317,13 +317,15 @@ if ($t_data['topic_show_first_post'] && $start) {
u.user_opt, u.user_gender, u.user_birthday,
p.*, g.group_name, g.group_description, g.group_id, g.group_signature, g.avatar_ext_id as rg_avatar_id,
u2.username as mc_username, u2.user_rank as mc_user_rank,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
ban.ban_userid
FROM " . BB_POSTS . " p
LEFT JOIN " . BB_USERS . " u ON(u.user_id = p.poster_id)
LEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)
LEFT JOIN " . BB_POSTS_HTML . " h ON(h.post_id = p.post_id)
LEFT JOIN " . BB_USERS . " u2 ON(u2.user_id = p.mc_user_id)
LEFT JOIN " . BB_GROUPS . " g ON(g.group_id = p.poster_rg_id)
LEFT JOIN " . BB_BANLIST . " ban ON(ban.ban_userid = u.user_id)
WHERE
p.post_id = {$t_data['topic_first_post_id']}
LIMIT 1
@ -338,13 +340,15 @@ $sql = "
u.user_opt, u.user_gender, u.user_birthday,
p.*, g.group_name, g.group_description, g.group_id, g.group_signature, g.avatar_ext_id as rg_avatar_id,
u2.username as mc_username, u2.user_rank as mc_user_rank,
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
ban.ban_userid
FROM " . BB_POSTS . " p
LEFT JOIN " . BB_USERS . " u ON(u.user_id = p.poster_id)
LEFT JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)
LEFT JOIN " . BB_POSTS_HTML . " h ON(h.post_id = p.post_id)
LEFT JOIN " . BB_USERS . " u2 ON(u2.user_id = p.mc_user_id)
LEFT JOIN " . BB_GROUPS . " g ON(g.group_id = p.poster_rg_id)
LEFT JOIN " . BB_BANLIST . " ban ON(ban.ban_userid = u.user_id)
WHERE p.topic_id = $topic_id
$limit_posts_time
GROUP BY p.post_id
@ -591,6 +595,7 @@ for ($i = 0; $i < $total_posts; $i++) {
$poster_rank = $rank_image = '';
$user_rank = $postrow[$i]['user_rank'];
$user_ban_status = $postrow[$i]['ban_userid'];
if (!$user->opt_js['h_rnk_i'] and isset($ranks[$user_rank])) {
$rank_image = ($bb_cfg['show_rank_image'] && $ranks[$user_rank]['rank_image']) ? '<img src="' . $ranks[$user_rank]['rank_image'] . '" alt="" title="" border="0" />' : '';
$poster_rank = $bb_cfg['show_rank_text'] ? $ranks[$user_rank]['rank_title'] : '';
@ -689,6 +694,7 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_NAME_JS' => addslashes($poster),
'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image,
'POSTER_BANNED' => $user_ban_status,
'POSTER_JOINED' => $bb_cfg['show_poster_joined'] ? $poster_longevity : '',
'POSTER_JOINED_DATE' => $poster_joined,