From: Lo?c C. <lo...@us...> - 2001-04-04 08:36:10
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs In directory usw-pr-cvs1:/tmp/cvs-serv11060/chat/lib/index_libs Modified Files: main_index.lib.php3 index_validation.lib.php3 do_enter_frameset.lib.php3 Log Message: Fix some reloading bugs and improve the work for abnormal termination of a chat session Index: main_index.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/main_index.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** main_index.lib.php3 2001/04/03 20:14:52 1.1 --- main_index.lib.php3 2001/04/04 08:36:06 1.2 *************** *** 178,183 **** if ($dbSessionIsNew) { ! if (isset($exitMode)) ! unset($exitMode); if (isset($newTargetRoom)) unset($newTargetRoom); --- 178,183 ---- if ($dbSessionIsNew) { ! if (isset($exitMessage)) ! unset($exitMessage); if (isset($newTargetRoom)) unset($newTargetRoom); *************** *** 192,196 **** /** * Removes user from the 'users' table if he left a room and, if required ! * ($exitMode value is 2), sends a notification of exit to the 'messages' * table * --- 192,196 ---- /** * Removes user from the 'users' table if he left a room and, if required ! * ($exitMessage value is 1), sends a notification of exit to the 'messages' * table * *************** *** 198,230 **** * inside the 'chat/lib/common.lib.php3' library */ ! // Check for abnormal termination of a chat session ! if (!isset($exitMode)) { ! $dbLink->query("SELECT COUNT(*) FROM " . C_USR_TBL . " WHERE session_id = '$dbSessionId'"); ! list($exitMode) = $dbLink->nextRecord(); ! $dbLink->cleanResults(); } ! // Do remove user ! if ($exitMode) { $nickForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($slashedNick, $latin1))); $exitedRoomName = pmcSlashSingleQuotes($dbSessionVars['targetRoom']); ! $dbLink->query("DELETE FROM " . C_USR_TBL . " WHERE session_id = '$dbSessionId' AND room = '$exitedRoomName'"); ! // Put exit notification if necessary ! if ($exitMode == 2 && $dbLink->affectedRows() > 0) ! { ! $exitedRoomType = $dbSessionVars['roomType']; ! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($exitedRoomType, '$exitedRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')')"); ! unset($exitedRoomType); ! } ! // Defines the room to enter settings if required ! if (isset($newTargetRoom)) ! { ! $roomType = substr($newTargetRoom, 0, 1); ! $targetRoom = substr($newTargetRoom, 1); ! unset($newTargetRoom); ! $reloading = 'joinCmd'; ! $jsVersion = $dbSessionVars['jsVersion']; ! } } --- 198,240 ---- * inside the 'chat/lib/common.lib.php3' library */ ! // Delete any chatting user whith the same session Id ! if (!isset($reloading)) { ! $dbLink->query("DELETE FROM " . C_USR_TBL . " WHERE session_id = '$dbSessionId'"); } ! // Put an exited notification and prepare reloading of the chat ! if ((isset($exitMessage) && $exitMessage) ! && $dbLink->affectedRows() > 0) { $nickForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($slashedNick, $latin1))); $exitedRoomName = pmcSlashSingleQuotes($dbSessionVars['targetRoom']); ! $exitedRoomType = $dbSessionVars['roomType']; ! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($exitedRoomType, '$exitedRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')')"); ! unset($exitedRoomType); ! unset($exitedRoomName); ! unset($nickForNotifications); ! } ! ! ! /** ! * Prepares reloading (in case a 'join' command has just been submitted or the ! * user clicked on a room name at the message frame or he/she resizes the ! * Netscape 4+ window) ! */ ! // 'join' command or clicked room name case ! if (isset($newTargetRoom)) ! { ! $roomType = substr($newTargetRoom, 0, 1); ! $targetRoom = substr($newTargetRoom, 1); ! unset($newTargetRoom); ! $reloading = 'joinCmd'; ! $jsVersion = $dbSessionVars['jsVersion']; ! } ! // fix for the NS resize bug case ! else if (isset($reloading) && $reloading == 'nsResize') ! { ! $roomType = $dbSessionVars['roomType']; ! $targetRoom = $dbSessionVars['targetRoom']; ! $jsVersion = $dbSessionVars['jsVersion']; } Index: index_validation.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/index_validation.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** index_validation.lib.php3 2001/04/03 20:10:15 1.1 --- index_validation.lib.php3 2001/04/04 08:36:06 1.2 *************** *** 116,121 **** // Skip the validation work when it has already be done before the ! // 'main_index.lib.php3' is run ! if (!isset($GLOBALS['$exitMode']) && $isRegNick) { // Reserved nick but no password submitted -> deny access --- 116,121 ---- // Skip the validation work when it has already be done before the ! // 'main_index.lib.php3' is ran ! if (!isset($GLOBALS['$exitMessage']) && $isRegNick) { // Reserved nick but no password submitted -> deny access Index: do_enter_frameset.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/do_enter_frameset.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** do_enter_frameset.lib.php3 2001/04/03 20:10:15 1.1 --- do_enter_frameset.lib.php3 2001/04/04 08:36:06 1.2 *************** *** 29,32 **** --- 29,33 ---- $nsResizeUrl = $dbSessionVars['from'] . '?' . dbSessionSID('GET') + . $pmcQueryArgSeparator . 'exitMessage=0' . $pmcQueryArgSeparator . 'reloading=nsResize'; // The url to be used for the loader |