diff --git a/mod/chat/chatd.php b/mod/chat/chatd.php index 5d9f8a92d24b1..f940efe49a28a 100755 --- a/mod/chat/chatd.php +++ b/mod/chat/chatd.php @@ -408,9 +408,16 @@ function dispatch_sidekick($handle, $type, $sessionid, $customdata) { break; } + // A slight hack to prevent malformed SQL inserts + $origmsg = $msg->message; + $msg->message = addslashes($msg->message); + // Commit to DB insert_record('chat_messages', $msg); + // Undo the hack + $msg->message = $origmsg; + // OK, now push it out to all users $this->message_broadcast($msg, $this->sets_info[$sessionid]['user']);