From 6b801380ad468ffb6fecfc39a5ffbc8fac483e61 Mon Sep 17 00:00:00 2001 From: hecht Date: Sat, 11 Feb 2012 22:22:58 +0000 Subject: [PATCH] bugfix ... prevent that the newest messages are "blocked" (and loaded later) --- ag/include/clan_chat.inc.php | 10 +++++++++- ag/include/messagefunctions.inc.php | 14 +++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ag/include/clan_chat.inc.php b/ag/include/clan_chat.inc.php index 6e789e5..2169249 100644 --- a/ag/include/clan_chat.inc.php +++ b/ag/include/clan_chat.inc.php @@ -84,13 +84,21 @@ function getClanChatMessages($requester, $clan_chat_id, $count, $asc, $msg_id = $max_id_row = mysql_fetch_row(mysql_query('Select max(msg_id) from clan_chatroom_messages WHERE clan_chat_id = ' . $clan_chat_id)); $sql .= ' AND msg_id > ' . ($max_id_row[0] - $count); } - $sql .= ' ORDER BY msg_id ' . ($asc?'asc':'desc') . ' LIMIT ' .$count; + $sql .= ' ORDER BY msg_id ASC LIMIT ' .$count; $qry = db_query($sql); while($row = mysql_fetch_assoc($qry)) { $result['max_id'] = max($result['max_id'], $row['msg_id']); $result['chat_rows'][] = formatTimestampShortYear($row['zeit']) . ' ' . generateUserNameByID($row['user_id']) . ': ' . encodeNoHTMLWithBB($row['message']); } + if(!$asc) { + $copy = array(); + for ($i=0; $i '.$minid.' ORDER BY ID '.($asc?'ASC':'DESC').' LIMIT '.$limit); + $result = db_query('SELECT *, Minute(zeit) as m, Hour(zeit) as h FROM ag_chat WHERE id > '.$minid.' ORDER BY ID ASC LIMIT '.$limit); while ($row = mysql_fetch_assoc($result)) { $h = $row['h']; if($h < 10){ $h = '0'.$h;} $m = $row['m']; if($m < 10){ $m = '0'.$m;} - $resultstring .= '
'.$h.':'.$m.' '.$row['user'].': '.$row['nachricht'].'
'; + if(!$asc) { + $resultstring = '
'.$h.':'.$m.' '.$row['user'].': '.$row['nachricht'].'
'.$resultstring; + } else { + $resultstring .= '
'.$h.':'.$m.' '.$row['user'].': '.$row['nachricht'].'
'; + } } if(isSpammer($userid)){ - $resultstring.= '
SPAM-BLOCKIERUNG!!
'; + if(!$asc) { + $resultstring = '
SPAM-BLOCKIERUNG!!
'.$resultstring; + } else { + $resultstring.= '
SPAM-BLOCKIERUNG!!
'; + } } return $maxid.';'.$resultstring; }