From: Lo?c C. <lo...@us...> - 2001-05-22 20:40:37
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs In directory usw-pr-cvs1:/tmp/cvs-serv30745/chat/lib/index_libs Modified Files: main_index.lib.php3 index_validation.lib.php3 do_enter_db_work.lib.php3 Log Message: Too many changes to detail... Index: main_index.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/main_index.lib.php3,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** main_index.lib.php3 2001/05/16 20:54:32 1.30 --- main_index.lib.php3 2001/05/22 20:40:34 1.31 *************** *** 94,99 **** C_DB_USER, C_DB_PASS, C_SESS_TBL, ! C_SESS_DEL * 60, ! '' ); dbSessionStart(); --- 94,98 ---- C_DB_USER, C_DB_PASS, C_SESS_TBL, ! C_SESS_DEL * 60 ); dbSessionStart(); *************** *** 208,211 **** --- 207,211 ---- } // end of switch + // Display the message if (isset($messageKind)) { *************** *** 225,237 **** unset($exitedRoomType); } } // end of remove user and possibly put an exit notification /** ! * 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)) { --- 225,254 ---- unset($exitedRoomType); } + + // Kill the current session if the user has been kicked + if ($dbSessionVars['kicked']) + { + $retSessVar = $dbSessionVars; + dbSessionDestroy(); + dbSessionInit( C_DB_TYPE, + C_DB_HOST, C_DB_NAME, + C_DB_USER, C_DB_PASS, + C_SESS_TBL, + C_SESS_DEL * 60 + ); + dbSessionStart(); + $dbSessionVars['from'] = $retSessVar['from']; + $dbSessionVars['lang'] = $retSessVar['lang']; + $dbSessionVars['nick'] = $retSessVar['nick']; + unset($retSessVar); + } } // end of remove user and possibly put an exit notification /** ! * Prepares reloading (in case the user clicked on a room name at the message ! * frame or he/she resizes the Netscape 4+ window) */ ! // clicked room name case if (isset($newTargetRoom)) { *************** *** 239,244 **** $targetRoom = substr($newTargetRoom, 1); unset($newTargetRoom); ! if (empty($reloading)) ! $reloading = 'joinLink'; $jsVersion = $dbSessionVars['jsVersion']; } --- 256,260 ---- $targetRoom = substr($newTargetRoom, 1); unset($newTargetRoom); ! $reloading = 'joinLink'; $jsVersion = $dbSessionVars['jsVersion']; } *************** *** 271,291 **** } $isRegUser = false; ! $regUserPerms = 'user'; $regUserModeratedRooms = ''; $wasInRoom = ''; ! // If no room has been specified, defines the first room among the default ! // public ones as the room to enter in ! if (isset($submitType) && ! (C_VERSION == 0 || (empty($enterDefaultRoomName) && empty($enterOtherRoomName) && empty($createRoomName)))) ! $enterDefaultRoomName = $defaultChatRooms[0]; /** ! * Gets some more libraries that will be used to validate the settings * submitted */ if (C_NO_SWEAR == 1) include('./' . _CHAT_PATH . 'lib/swearing.lib.' . C_EXTENSION); include('./' . _CHAT_PATH . 'lib/index_libs/index_validation.lib.' . C_EXTENSION); --- 287,349 ---- } $isRegUser = false; ! $regUserPerms = 'noreg'; $regUserModeratedRooms = ''; $wasInRoom = ''; ! $isCreateRoom = false; /** ! * Define the room name and type to check if the starting form has been * submitted + * + * Priority order: room to create > other public room > default public room + */ + if (isset($submitType)) + { + // Room has to be created + if (!empty($createRoomName)) + { + $targetRoom = $createRoomName; + $isCreateRoom = true; + } + // Room is among other public ones + else if (!empty($enterOtherRoomName)) + { + $targetRoom = $enterOtherRoomName; + $roomType = 1; + } + // Room is among other public ones + else if (!empty($enterDefaultRoomName)) + { + $targetRoom = $enterDefaultRoomName; + $roomType = 1; + } + // If no room has been specified, defines the first room among the default + // public ones as the room to enter in + if (C_VERSION == 0 || empty($targetRoom)) + { + $targetRoom = $defaultChatRooms[0]; + $roomType = 1; + } + unset($createRoomName); + unset($enterOtherRoomName); + unset($enterDefaultRoomName); + } + + + /** + * Gets some more libraries that will be used to validate the settings + * submitted and get his/her ip + * + * The 'pmcGetIp()' function is defined inside the + * 'chat/lib/get_user_infos.lib.php3' library. */ if (C_NO_SWEAR == 1) + { include('./' . _CHAT_PATH . 'lib/swearing.lib.' . C_EXTENSION); + } include('./' . _CHAT_PATH . 'lib/index_libs/index_validation.lib.' . C_EXTENSION); + include('./' . _CHAT_PATH . 'lib/get_user_infos.lib.' . C_EXTENSION); + $ip = pmcGetIp(); *************** *** 303,308 **** * * This part of the script is skipped if the frameset is reloaded because ! * of the NS4+ resize bug, because the user has run the '/join' command or ! * because he has clicked on a room name at the 'users' frame. * In these cases, the nick and the password have already been validated. * --- 361,366 ---- * * This part of the script is skipped if the frameset is reloaded because ! * of the NS4+ resize bug or because the user has clicked on a room name at ! * the 'users' frame. * In these cases, the nick and the password have already been validated. * *************** *** 324,340 **** /** ! * Gets the permission level of the user and the list of the rooms he is ! * moderator for if this script is run following a '/join' command or a click ! * on a room name at the 'users' frame. * * The 'pmcHandleMagicQuotes()' function is defined inside the * 'chat/lib/common.lib.php3' library */ ! else if ($reloading == 'joinCmd' || $reloading == 'joinLink') { $dbLink->query("SELECT perms, rooms FROM " . C_REG_TBL . " WHERE username = '$slashedNick' LIMIT 1"); $isRegUser = (list($regUserPerms, $regUserModeratedRooms) = $dbLink->nextRecord()); if ($isRegUser) $regUserModeratedRooms = pmcHandleMagicQuotes($regUserModeratedRooms, '', 1, 'del'); $dbLink->cleanResults(); } // end of get permission level in reloading case --- 382,400 ---- /** ! * Gets the permission level of the user and the list of the rooms he/she ! * is moderator for from the database if this script is run following a ! * click on a room name at the 'users' frame. * * The 'pmcHandleMagicQuotes()' function is defined inside the * 'chat/lib/common.lib.php3' library */ ! else if ($reloading == 'joinLink') { $dbLink->query("SELECT perms, rooms FROM " . C_REG_TBL . " WHERE username = '$slashedNick' LIMIT 1"); $isRegUser = (list($regUserPerms, $regUserModeratedRooms) = $dbLink->nextRecord()); if ($isRegUser) + { $regUserModeratedRooms = pmcHandleMagicQuotes($regUserModeratedRooms, '', 1, 'del'); + } $dbLink->cleanResults(); } // end of get permission level in reloading case *************** *** 345,360 **** * * This part of the script is skipped if the frameset is reloaded because ! * of the NS4+ resize bug, because the user has run the '/join' command or ! * because he has clicked on a room name at the 'users' frame. ! * In these cases, banishement of the user has already been checked. */ if ($error == '' && (empty($reloading) || $reloading == 'joinLink')) { ! if (C_BANISH && $regUserPerms != 'admin') { ! include('./' . _CHAT_PATH . 'lib/banish.lib.' . C_EXTENSION); ! if ($isBanished) ! $error = L_ERR_USR_20; } } // end of the banishment test --- 405,419 ---- * * This part of the script is skipped if the frameset is reloaded because ! * of the NS4+ resize bug. ! * ! * The 'pmcCheckBanish()' function is defined inside the ! * 'chat/lib/get_user_infos.lib.php3' library. */ if ($error == '' && (empty($reloading) || $reloading == 'joinLink')) { ! if (C_BANISH && $regUserPerms != 'admin' && pmcCheckBanish()) { ! $error = L_ERR_USR_20; } } // end of the banishment test *************** *** 365,376 **** * permission level this user will be granted for this room * * The function 'pmcValidateRoomCreation()' is defined inside the ! * 'chat/lib/index_validation.lib.php3' library */ ! if ($error == '' && !empty($createRoomName)) { $error = pmcValidateRoomCreation($regUserPerms, $regUserModeratedRooms); } // end of the validation of room creation /** --- 424,452 ---- * permission level this user will be granted for this room * + * Skipped if the frameset is reloaded. + * * The function 'pmcValidateRoomCreation()' is defined inside the ! * 'chat/lib/index_validation.lib.php3' library. */ ! if ($error == '' && !isset($reloading) && $isCreateRoom) { $error = pmcValidateRoomCreation($regUserPerms, $regUserModeratedRooms); } // end of the validation of room creation + + /** + * Defines the right level the user will be granted for the room he/she + * will enter in (skipped when the frameset is reloaded because of the NS4+ + * resize bug). + * + * The 'pmcSlashSingleQuotes()' function is defined inside the + * 'chat/lib/common.lib.php3' library and the 'pmcRightLevel()' one inside + * the 'chat/lib/get_user_infos.lib.php3' library. + */ + $slashedTargetRoomName = pmcSlashSingleQuotes($targetRoom); + if (!isset($reloading) || $reloading != 'nsResize') + { + $status = pmcRightLevel(); + } /** Index: index_validation.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/index_validation.lib.php3,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** index_validation.lib.php3 2001/05/21 19:21:32 1.11 --- index_validation.lib.php3 2001/05/22 20:40:34 1.12 *************** *** 70,74 **** if (!$isJsValidated && $nick == '') { ! $error1 = L_ERR_USR_2; } // Checks for invalid characters or empty nick --- 70,74 ---- if (!$isJsValidated && $nick == '') { ! $error1 = L_ERR_USR_2; } // Checks for invalid characters or empty nick *************** *** 76,80 **** (trim($nick) == '' || ereg('[\, ]', $nick))) { ! $error1 = L_ERR_USR_16; } // Checks for swear words in the nick --- 76,80 ---- (trim($nick) == '' || ereg('[\, ]', $nick))) { ! $error1 = L_ERR_USR_16; } // Checks for swear words in the nick *************** *** 82,86 **** { if (checkWords($nick, true)) ! $error1 = L_ERR_USR_18; } // end of the 1st stage (character validation inside the nick) --- 82,88 ---- { if (checkWords($nick, true)) ! { ! $error1 = L_ERR_USR_18; ! } } // end of the 1st stage (character validation inside the nick) *************** *** 94,99 **** if ($isLoggedIn) { ! $loggedInRoom = pmcHandleMagicQuotes($loggedInRoom, '', 1, 'del'); ! $requireReg = true; } } --- 96,101 ---- if ($isLoggedIn) { ! $loggedInRoom = pmcHandleMagicQuotes($loggedInRoom, '', 1, 'del'); ! $requireReg = true; } } *************** *** 105,109 **** { if ($password == '') ! $error1 = ($isLoggedIn) ? L_ERR_USR_1 : L_ERR_USR_14; } // end of the 3rd stage (a password has been submitted if required) --- 107,113 ---- { if ($password == '') ! { ! $error1 = ($isLoggedIn) ? L_ERR_USR_1 : L_ERR_USR_14; ! } } // end of the 3rd stage (a password has been submitted if required) *************** *** 168,171 **** --- 172,176 ---- * @global string the slashed nick of the user who wants to enter the chat * @global boolean whether this nick is a registered one or not + * @global boolean whether the room has to be trully created or not * @global string the name of the room to create * @global integer the type of the room to create *************** *** 181,343 **** global $slashedNick; global $isRegUser; ! global $createRoomName, $roomType; global $defaultChatRooms, $defaultPrivateRooms; ! $error2 = ''; ! $isNewRoom = true; ! // 1. Validates the room name ! // Skipped if the frameset is reloaded because of the NS4+ resize bug, ! // because the user has run a '/join' command or because he has clicked ! // on a room name at the users frame. ! if (!isset($GLOBALS['reloading'])) { ! // User is not registered -> deny room creation ! if (!$isRegUser) ! { ! $error2 = L_ERR_USR_13; ! } ! // Checks for invalid characters or empty room name ! else if (!$isJsValidated && ! (trim($createRoomName) == '' || ereg('[\,]', $createRoomName))) ! { ! $error2 = L_ERR_ROM_1; ! } ! // Checks for swear words in the room name ! else if (C_NO_SWEAR && checkWords($createRoomName, true)) { ! $error2 = L_ERR_ROM_2; } - // Ensures there is no existing room with the same name but a different - // type and if this condition is true get case sensitive name of room... else { ! $theSlashedRoomName = pmcSlashSingleQuotes($createRoomName); ! ! // ...among reserved name for private/public (default) rooms ! $searchIn = ($roomType == 1) ? $defaultPrivateRooms : $defaultChatRooms; ! if (pmcIsInto($createRoomName, $searchIn) >= 0) ! { ! $error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4; ! } ! else ! { ! $searchIn = ($roomType == 1) ? $defaultChatRooms : $defaultPrivateRooms; ! $roomExist = pmcIsInto($createRoomName, $searchIn); ! if ($roomExist >= 0) ! { ! $isNewRoom = false; ! if ($roomType == 1) ! { ! $GLOBALS['enterDefaultRoomName'] = $searchIn[$roomExist]; ! $createRoomName = ''; ! } ! else ! { ! $createRoomName = $searchIn[$roomExist]; ! } ! } ! } ! unset($searchIn); ! ! // ...among other rooms created by users ! if ($error2 == '' && $isNewRoom) { ! $dbLink->query("SELECT type, room FROM " . C_MSG_TBL . " WHERE room = '$theSlashedRoomName' LIMIT 1"); ! $roomExist = (list($trueType, $trueCaseName) = $dbLink->nextRecord()); ! $dbLink->cleanResults(); ! if ($roomExist) ! { ! if ($roomType != $trueType) ! $error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4; ! else ! $createRoomName = pmcHandleMagicQuotes($trueCaseName, '', 1, 'del'); ! } } } ! } ! // end of the 1st stage (validation of the name of the room to create) ! // 2. Defines the permission level of the user for the room to create. ! // Skipped for administrator and if the room to "create" is among ! // default public ones. ! if ($error2 == '' && $isNewRoom && $userPerms != 'admin') ! { ! // If the name of the room to be created is the same than one of an ! // existing room containing 'true' messages (not only notifications of ! // users entrance/exit) or containing only 'system' message but an user ! // is currently logged in, status will be 'user' ! $dbLink->query("SELECT COUNT(*) FROM " . C_MSG_TBL . " WHERE room = '$theSlashedRoomName' AND username NOT LIKE 'SYS %' LIMIT 1"); ! list($isTrueMsg) = $dbLink->nextRecord(); ! $isNewRoom = ($isTrueMsg == 0); ! $dbLink->cleanResults(); ! ! if ($isNewRoom) { ! $dbLink->query("SELECT COUNT(*) FROM " . C_USR_TBL . " WHERE room = '$theSlashedRoomName' AND username != '$slashedNick' LIMIT 1"); ! list($isAnybody) = $dbLink->nextRecord(); ! $isNewRoom = ($isAnybody == 0); $dbLink->cleanResults(); ! } // end of true new room ! } ! // end of the 2nd stage (getting the status of the user) ! ! // 3. Updating permission levels inside the registered users table ! // (skipped for administrator and if the room to create is not a true new ! // one) ! if ($error2 == '' && $isNewRoom && $userPerms != 'admin') ! { ! // If an other registered user is already moderator for the room to ! // create but there is no 'true' message in this room then sets his ! // status to 'user' for this room ! $dbLink->query("SELECT username, rooms FROM " . C_REG_TBL . " WHERE perms = 'moderator' AND username != '$slashedNick'"); ! while (list($otherModerator, $otherModeratedRooms) = $dbLink->nextRecord()) ! { ! $changed = false; ! $otherModerator = pmcHandleMagicQuotes($otherModerator, '', 1, 'del'); ! $otherModeratedRooms = pmcHandleMagicQuotes($otherModeratedRooms, '', 1, 'del'); ! $rooms = explode(',', $otherModeratedRooms); ! $arrayCnt = count($rooms); ! reset($rooms); ! for ($i = 0; $i < $arrayCnt; $i++) { ! if (strcasecmp($createRoomName, $rooms[$i]) == 0) { ! $rooms[$i] = ''; ! $changed = true; ! break; } } - if ($changed) - { - $otherModeratedRooms = implode(',', $rooms); - $otherModeratedRooms = ereg_replace('^,|,$', '', $otherModeratedRooms); - $otherModeratedRooms = str_replace(',,', ',', $otherModeratedRooms); - $dbLink->query("UPDATE " . C_REG_TBL . " SET rooms = '" . pmcSlashSingleQuotes($otherModeratedRooms) . "' WHERE username = '" . pmcSlashSingleQuotes($otherModerator) . "'"); - $dbLink->query("UPDATE " . C_USR_TBL . " SET status = 'r' WHERE room = '$theSlashedRoomName' AND username = '" . pmcSlashSingleQuotes($otherModerator) . "'"); - } - unset($rooms); - } - - // Update the current user status for the room to be created - $changed = false; - if (pmcIsInto($createRoomName, $userModeratedRooms) < 0) - { - if ($userModeratedRooms != '') - $userModeratedRooms .= ','; - $userModeratedRooms .= $createRoomName; - $changed = true; } - if ($userPerms == 'user' || $userPerms == '') - { - $userPerms = 'moderator'; - $changed = true; - } - if ($changed) - { - $dbLink->query("UPDATE " . C_REG_TBL . " SET perms = '$userPerms', rooms = '" . pmcSlashSingleQuotes($userModeratedRooms) ."' WHERE username = '$slashedNick'"); - } // end of updating tables } - // end of the 3rd stage (updating registered users tables) return $error2; --- 186,253 ---- global $slashedNick; global $isRegUser; ! global $isCreateRoom; ! global $targetRoom, $roomType; global $defaultChatRooms, $defaultPrivateRooms; ! $error2 = ''; ! // User is not registered -> deny room creation ! if (!$isRegUser) { ! $error2 = L_ERR_USR_13; ! } ! // Checks for invalid characters or empty room name ! else if (!$isJsValidated ! && (trim($targetRoom) == '' || ereg('[\,]', $targetRoom))) ! { ! $error2 = L_ERR_ROM_1; ! } ! // Checks for swear words in the room name ! else if (C_NO_SWEAR && checkWords($targetRoom, true)) ! { ! $error2 = L_ERR_ROM_2; ! } ! // Ensures there is no existing room with the same name but a different ! // type and if this condition is true get case sensitive name of room... ! else ! { ! // ...among reserved name for private/public (default) rooms ! $searchIn = ($roomType == 1) ? $defaultPrivateRooms : $defaultChatRooms; ! if (pmcIsInto($targetRoom, $searchIn) >= 0) { ! $error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4; } else { ! $searchIn = ($roomType == 1) ? $defaultChatRooms : $defaultPrivateRooms; ! $roomExist = pmcIsInto($targetRoom, $searchIn); ! if ($roomExist >= 0) { ! $isCreateRoom = false; ! $targetRoom = $searchIn[$roomExist]; } } ! unset($searchIn); ! // ...among other rooms created by users ! if ($error2 == '' && $isCreateRoom) { ! $theSlashedRoomName = pmcSlashSingleQuotes($targetRoom); ! $dbLink->query("SELECT type, room FROM " . C_MSG_TBL . " WHERE room = '$theSlashedRoomName' LIMIT 1"); ! $roomExist = (list($trueType, $trueCaseName) = $dbLink->nextRecord()); $dbLink->cleanResults(); ! if ($roomExist) { ! if ($roomType != $trueType) { ! $error2 = ($roomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4; } + else + { + $targetRoom = pmcHandleMagicQuotes($trueCaseName, '', 1, 'del'); + } } } } return $error2; Index: do_enter_db_work.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/do_enter_db_work.lib.php3,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -r1.16 -r1.17 *** do_enter_db_work.lib.php3 2001/05/16 20:55:37 1.16 --- do_enter_db_work.lib.php3 2001/05/22 20:40:34 1.17 *************** *** 31,50 **** /** - * Harmonizes type and name of the room to enter in - */ - if (!empty($createRoomName)) - { - $targetRoom = $createRoomName; - } - else if (!isset($targetRoom)) // $targetRoom is set when the frameset is - { // reloaded because of the NN4+ resize bug. - $roomType = 1; - $targetRoom = (!empty($enterDefaultRoomName)) - ? $enterDefaultRoomName - : $enterOtherRoomName; - } - - - /** * Sets cookies that will expire in one year */ --- 31,34 ---- *************** *** 53,56 **** --- 37,41 ---- setcookie('cookieRoomType', $roomType, time() + 60*60*24*365); + /** * Gets some variables values from session data or cookies *************** *** 86,124 **** /** - * Gets the ip of the user - */ - if (empty($ip)) - include('./' . _CHAT_PATH .'lib/get_ip.lib.' . C_EXTENSION); - - - /** - * Defines the user status to be put in the users table (skipped when the - * frameset is reloaded because of the NS4+ resize bug). - */ - if (!isset($reloading) || $reloading != 'nsResize') - { - if ($regUserPerms == '' && !$isRegUser) - $regUserPerms = 'noreg'; - switch ($regUserPerms) - { - case 'admin': // administrator - $status = 'a'; - break; - - case 'moderator': // moderator or registered user - $status = (pmcIsInto($targetRoom, $regUserModeratedRooms) >= 0) ? 'm' : 'r'; - break; - - case 'noreg': // non-registered user - $status = 'u'; - break; - - default: // registered user - $status = 'r'; - } - } - - - /** * Defines some more variables including the welcome message. */ --- 71,74 ---- *************** *** 140,144 **** --- 90,96 ---- */ if ($isRegUser) + { $dbLink->query("UPDATE " . C_REG_TBL . " SET reg_time = $currentTime, ip = '$ip' WHERE username = '$slashedNick'"); + } *************** *** 149,153 **** --- 101,107 ---- // this "other" session if (!empty($previousId) && $dbSessionId != $previousId) + { $dbLink->query("DELETE FROM " . C_SESS_TBL . " WHERE session_id = '$previousId'"); + } *************** *** 168,190 **** else { ! $slashedRoomName = pmcSlashSingleQuotes($wasInRoom); ! $dbLink->query("SELECT type FROM " . C_MSG_TBL . " WHERE room = '$slashedRoomName' LIMIT 1"); ! list($type) = $dbLink->nextRecord(); $dbLink->cleanResults(); $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedRoomName', 'SYS exit', '', $currentTime, NULL, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')'" . ')'; $dbLink->query($aQuery); - $slashedRoomName = pmcSlashSingleQuotes($targetRoom); $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')'" . ')'; $dbLink->query($aQuery); ! $dbLink->query("UPDATE " . C_USR_TBL . " SET session_id = '$dbSessionId', u_time = $currentTime, room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$previousId'"); if (C_WELCOME) --- 122,143 ---- else { ! $slashedPrevRoomName = pmcSlashSingleQuotes($wasInRoom); ! $dbLink->query("SELECT type FROM " . C_MSG_TBL . " WHERE room = '$slashedPrevRoomName' LIMIT 1"); ! list($prevRoomType) = $dbLink->nextRecord(); $dbLink->cleanResults(); $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$prevRoomType, '$slashedPrevRoomName', 'SYS exit', '', $currentTime, NULL, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')'" . ')'; $dbLink->query($aQuery); $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedTargetRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')'" . ')'; $dbLink->query($aQuery); ! $dbLink->query("UPDATE " . C_USR_TBL . " SET session_id = '$dbSessionId', u_time = $currentTime, room = '$slashedTargetRoomName', status = '$status', ip = '$ip' WHERE session_id = '$previousId'"); if (C_WELCOME) *************** *** 195,199 **** . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg'" . ')'; $dbLink->query($aQuery); --- 148,152 ---- . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedTargetRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg'" . ')'; $dbLink->query($aQuery); *************** *** 207,212 **** else if (isset($reloading) && $reloading == 'nsResize') { ! $slashedRoomName = pmcSlashSingleQuotes($targetRoom); ! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = $currentTime, room = '$slashedRoomName', ip = '$ip' WHERE session_id = '$dbSessionId'"); } // end of case where an is relogged because of NS4+ resize bug --- 160,164 ---- else if (isset($reloading) && $reloading == 'nsResize') { ! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = $currentTime, ip = '$ip' WHERE session_id = '$dbSessionId'"); } // end of case where an is relogged because of NS4+ resize bug *************** *** 217,238 **** else { ! $slashedRoomName = pmcSlashSingleQuotes($targetRoom); ! if (isset($reloading) && $reloading == 'joinCmd') ! { ! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = $currentTime, room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$dbSessionId'"); ! } ! else ! { ! $aQuery = 'INSERT INTO ' . C_USR_TBL . ' ' ! . '(session_id, u_time, room, username, latin1, status, ip) ' ! . 'VALUES (' ! . "'$dbSessionId', $currentTime, '$slashedRoomName', '$slashedNick', $latin1, '$status', '$ip'" ! . ')'; ! $dbLink->query($aQuery); ! } $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')'" . ')'; $dbLink->query($aQuery); --- 169,183 ---- else { ! $aQuery = 'INSERT INTO ' . C_USR_TBL . ' ' ! . '(session_id, u_time, room, username, latin1, status, ip) ' ! . 'VALUES (' ! . "'$dbSessionId', $currentTime, '$slashedTargetRoomName', '$slashedNick', $latin1, '$status', '$ip'" ! . ')'; ! $dbLink->query($aQuery); ! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedTargetRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')'" . ')'; $dbLink->query($aQuery); *************** *** 245,249 **** . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg'" . ')'; $dbLink->query($aQuery); --- 190,194 ---- . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$roomType, '$slashedTargetRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg'" . ')'; $dbLink->query($aQuery); *************** *** 296,302 **** * Deletes invite messages sent to the user for the room he will enter in */ ! if (!isset($slashedRoomName)) ! $slashedRoomName = pmcSlashSingleQuotes($targetRoom); ! $dbLink->query("SELECT m_time FROM " . C_MSG_TBL . " WHERE username = 'SYS inviteTo' AND address = '$slashedNick' AND room = '$slashedRoomName'"); while (list($sentTime) = $dbLink->nextRecord()) { --- 241,245 ---- * Deletes invite messages sent to the user for the room he will enter in */ ! $dbLink->query("SELECT m_time FROM " . C_MSG_TBL . " WHERE username = 'SYS inviteTo' AND address = '$slashedNick' AND room = '$slashedTargetRoomName'"); while (list($sentTime) = $dbLink->nextRecord()) { |