From 4d5525c650598b369d3beb7a44d41b7052100c1c Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Mon, 17 Apr 2006 21:03:44 +0000 Subject: [PATCH] mod/chat: make http-chat more database friendly and change msg insertion to use POST + we are now more conservative in the fields it asks from the db + also more conservative with upates to chat_users + messages are now added via POST requests instead of GET --- mod/chat/gui_header_js/chatinput.php | 4 ++-- mod/chat/gui_header_js/insert.php | 2 +- mod/chat/gui_header_js/jsupdate.php | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/mod/chat/gui_header_js/chatinput.php b/mod/chat/gui_header_js/chatinput.php index 8e718d4c7a..2ed66eafff 100644 --- a/mod/chat/gui_header_js/chatinput.php +++ b/mod/chat/gui_header_js/chatinput.php @@ -44,13 +44,13 @@ print_header('', '', '', 'inputForm.chat_message', $meta, false); ?> -
>>
-
+
diff --git a/mod/chat/gui_header_js/insert.php b/mod/chat/gui_header_js/insert.php index 5321fc02b2..7fd33fb838 100644 --- a/mod/chat/gui_header_js/insert.php +++ b/mod/chat/gui_header_js/insert.php @@ -14,7 +14,7 @@ error('No chat found'); } - if (!$course = get_record('course', 'id', $chat->course)) { + if (!$course = get_record('course', 'id', $chat->course, '', '', '','', 'id, shortname')) { error('Could not find the course this belongs to!'); } diff --git a/mod/chat/gui_header_js/jsupdate.php b/mod/chat/gui_header_js/jsupdate.php index a0f356a4c9..ba008fa93b 100644 --- a/mod/chat/gui_header_js/jsupdate.php +++ b/mod/chat/gui_header_js/jsupdate.php @@ -99,7 +99,9 @@ $us = array (); if (($chat_lasttime != $chat_newlasttime) and $messages) { - if (!$currentuser = get_record('user', 'id', $chatuser->userid)) { + // $currentuser is only used in chat_format_message() which passes it along to + // chat_format_message_manually() -- and only id and timezone are used. + if (!$currentuser = get_record('user', 'id', $chatuser->userid, '','', '','', 'id, username, timezone')) { error('User does not exist!'); } $currentuser->description = ''; @@ -119,7 +121,7 @@ } $chatuser->lastping = time(); - update_record('chat_users', $chatuser); + set_field('chat_users', 'lastping', $chatuser->lastping, 'sid', $chatuser->sid ); if ($refreshusers) { echo "if (parent.users.document.anchors[0] != null) {" . -- 2.39.5