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 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
|
Don't show a kick button on your own session in the list of active sessions
|
||||||
Allow ignoring incognito chatters
|
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
|
Version 1.20.6 - Jul. 23, 2016
|
||||||
Simplify ignore logic + disallow ignoring chatters with higher status
|
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(){
|
function add_message(){
|
||||||
global $U;
|
global $U, $db;
|
||||||
if(empty($U['message'])){
|
if(empty($U['message'])){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$newmessage=array(
|
$message=array(
|
||||||
'postdate' =>time(),
|
'postdate' =>time(),
|
||||||
'poststatus' =>$U['poststatus'],
|
'poststatus' =>$U['poststatus'],
|
||||||
'poster' =>$U['nickname'],
|
'poster' =>$U['nickname'],
|
||||||
@ -2923,7 +2923,13 @@ function add_message(){
|
|||||||
'text' =>"<span class=\"usermsg\">$U[displaysend]".style_this($U['message'], $U['style']).'</span>',
|
'text' =>"<span class=\"usermsg\">$U[displaysend]".style_this($U['message'], $U['style']).'</span>',
|
||||||
'delstatus' =>$U['status']
|
'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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user