Skip to content

Commit

Permalink
json_send_chat now uses send_chat() to prevent duplicate messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Vazquez committed Oct 6, 2010
1 parent 02e416a commit 46aeebb
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions deploy/www/api.php
Expand Up @@ -86,14 +86,8 @@ function json_latest_chat_id() {
function json_send_chat($msg) {
if (is_logged_in()) {
$msg = trim($msg);
if (strlen($msg) > 0) {
DatabaseConnection::getInstance();
$user_id = (int) get_user_id();
$query = 'INSERT INTO chat (sender_id, message) VALUES (:sender, :msg)';
$statement = DatabaseConnection::$pdo->prepare($query);
$statement->bindValue(':msg', $msg);
$statement->bindValue(':sender', $user_id);
$statement->execute();
send_chat(get_user_id(), $msg);
}
}
}
Expand Down

0 comments on commit 46aeebb

Please sign in to comment.