From e51fba28c7384233482abc1ca9bca7e9b93fd3c6 Mon Sep 17 00:00:00 2001 From: Daniel Winzen Date: Sun, 24 Jan 2021 13:03:45 +0100 Subject: [PATCH] change appearance of print_chatters --- chat.php | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/chat.php b/chat.php index 8752985..a0e6b4f 100644 --- a/chat.php +++ b/chat.php @@ -268,7 +268,7 @@ function prepare_stylesheets(bool $init = false){ $styles['default'] .= '.setup table table table,.admin table table table,.profile table table table{border-spacing:0px;margin-left:auto;margin-right:unset;width:unset} '; $styles['default'] .= '.setup table table td,.backup #restoresubmit,.backup #backupsubmit,.admin table table td,.profile table table td,.login td+td,.alogin td+td{text-align:right} '; $styles['default'] .= '.init td,.backup #restorecheck td,.admin #clean td,.admin #regnew td,.session td,.messages,.inbox,.approve_waiting td,.choose_messages,.greeting,.help,.login td,.alogin td{text-align:left} '; - $styles['default'] .= '.messages #chatters{max-height:100px;overflow-y:auto} .messages #chatters a{text-decoration-line:none} .messages #chatters table{border-spacing:0px} '; + $styles['default'] .= '.messages #chatters{max-height:100px;overflow-y:auto} .messages #chatters .messages #chatters table{border-spacing:0px} '; $styles['default'] .= '.messages #chatters th,.messages #chatters td,.post #firstline{vertical-align:top} '; $styles['default'] .= '.approve_waiting #action td:only-child,.help #backcredit,.login td:only-child,.alogin td:only-child,.init td:only-child{text-align:center} .sessions td,.sessions th,.approve_waiting td,.approve_waiting th{padding: 5px} '; $styles['default'] .= '.sessions td td{padding: 1px} .messages #bottom_link{position:fixed;top:0.5em;right:0.5em} .messages #top_link{position:fixed;bottom:0.5em;right:0.5em} '; @@ -2224,6 +2224,7 @@ function print_notifications(){ } echo ''; } + function print_chatters(){ global $I, $U, $db, $language; if(!$U['hidechatters']){ @@ -2231,35 +2232,37 @@ function print_chatters(){ $stmt=$db->prepare('SELECT nickname, style, status FROM ' . PREFIX . 'sessions WHERE entry!=0 AND status>0 AND incognito=0 AND nickname NOT IN (SELECT ign FROM '. PREFIX . 'ignored WHERE ignby=? UNION SELECT ignby FROM '. PREFIX . 'ignored WHERE ign=?) ORDER BY status DESC, lastpost DESC;'); $stmt->execute([$U['nickname'], $U['nickname']]); $nc=substr(time(), -6); - $G=$M=[]; + $G=$M=$S=$A=[]; + $channellink="fetch(PDO::FETCH_NUM)){ - $lnk="'.style_this(htmlspecialchars($user[0]), $user[1]).''; - if($user[2]<=2){ + $link=$nicklink.htmlspecialchars($user[0]).'" target="post">'.style_this(htmlspecialchars($user[0]), $user[1]).''; + if($user[2]<3){ // guest or superguest $G[]=$link; - }else{ + } elseif($user[2]>=7){ // admin or superadmin + $A[]=$link; + } elseif(($user[2]>=5) && ($user[2]<=6)){ // moderator or supermoderator + $S[]=$link; + } elseif($user[2]=3){ // member $M[]=$link; } } - if($U['status']>5){ - echo '' . $lnk . 's _" target="post">[' . $I['admin'] . '] '; - } - if($U['status']>4){ - echo '' . $lnk . 's %" target="post">[' . $I['staff'] . '] '; - } - if(!empty($M)){ - if($U['status']<3){ - echo "$I[members]: ".implode('   ', $M).''; + if($U['status']>5){ // can chat in admin channel + echo '' . $channellink . 's _" target="post">' . $I['admin'] . ': '.implode('   ', $A).''; } else { - echo '' . $lnk . 's ?" target="post">' . $I['members'] . ': '.implode('   ', $M).''; - } - if(!empty($M)){ - echo '  '; - } + echo "$I[admin]: ".implode('   ', $A).''; } - if(!empty($G)){ - echo '' . $lnk . 's *" target="post">' . $I['guests'] . ': '.implode('   ', $G).''; + if($U['status']>4){ // can chat in staff channel + echo '
' . $channellink . 's %" target="post">' . $I['staff'] . ': '.implode('   ', $S).''; + } else { + echo "
$I[staff]: ".implode('   ', $S).''; } + if($U['status']>=3){ // can chat in member channel + echo '' . $channellink . 's ?" target="post">
' . $I['members'] . ': '.implode('   ', $M).''; + } else { + echo "
$I[members]: ".implode('   ', $M).''; + } + echo '' . $channellink . 's *" target="post">
' . $I['guests'] . ': '.implode('   ', $G).''; echo ''; } }