Prevent posting the same message twice, if no other message was posted in-between
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
Don't display empty option for system messages in delete messages by name
|
||||
Don't show a kick button on your own session in the list of active sessions
|
||||
Allow ignoring incognito chatters
|
||||
Prevent posting the same message twice, if no other message was posted in-between
|
||||
|
||||
Version 1.20.6 - Jul. 23, 2016
|
||||
Simplify ignore logic + disallow ignoring chatters with higher status
|
||||
|
12
chat.php
12
chat.php
@ -2911,11 +2911,11 @@ function create_hotlinks(){
|
||||
}
|
||||
|
||||
function add_message(){
|
||||
global $U;
|
||||
global $U, $db;
|
||||
if(empty($U['message'])){
|
||||
return false;
|
||||
}
|
||||
$newmessage=array(
|
||||
$message=array(
|
||||
'postdate' =>time(),
|
||||
'poststatus' =>$U['poststatus'],
|
||||
'poster' =>$U['nickname'],
|
||||
@ -2923,7 +2923,13 @@ function add_message(){
|
||||
'text' =>"<span class=\"usermsg\">$U[displaysend]".style_this($U['message'], $U['style']).'</span>',
|
||||
'delstatus' =>$U['status']
|
||||
);
|
||||
write_message($newmessage);
|
||||
//prevent posting the same message twice, if no other message was posted in-between.
|
||||
$stmt=$db->prepare('SELECT id FROM ' . PREFIX . 'messages WHERE poststatus=? AND poster=? AND recipient=? AND text=? AND id IN (SELECT * FROM (SELECT id FROM ' . PREFIX . 'messages ORDER BY id DESC LIMIT 1) AS t);');
|
||||
$stmt->execute([$message['poststatus'], $message['poster'], $message['recipient'], $message['text']]);
|
||||
if($stmt->fetch(PDO::FETCH_NUM)){
|
||||
return false;
|
||||
}
|
||||
write_message($message);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user