From: Lo?c C. <lo...@us...> - 2001-06-10 14:58:21
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands In directory usw-pr-cvs1:/tmp/cvs-serv17318/chat/lib/commands Modified Files: announce.cmd.php3 banish.cmd.php3 ignore.cmd.php3 invite.cmd.php3 join.cmd.php3 kick.cmd.php3 me.cmd.php3 notify.cmd.php3 priv_msg.cmd.php3 promote.cmd.php3 quit.cmd.php3 refresh.cmd.php3 save.cmd.php3 show.cmd.php3 whois.cmd.php3 Added Files: away.cmd.php3 Log Message: Too many changes to detail. --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | License: GNU/GPL - http://www.gnu.org/copyleft/gpl.html | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'away' command. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <te...@ph...> | // +--------------------------------------------------------------------------+ // // $Id: away.cmd.php3,v 1.1 2001/06/10 14:57:48 loic1 Exp $ // // The work for the 'away' command. // /** * Ensure this library is called by another of the phpMyChat scripts (fix a * security hole) */ if (!dbSessionIsRegistered('lang')) { exit(); } /** * Define whether the user goes away or returns back from away, then do the * work */ $dbSessionVars['away'] = 1 - $dbSessionVars['away']; $isCommand = true; // The user wants a message to be send if (!empty($cmd[2])) { $cmd[2] = trim($cmd[2]); $doRefreshMessages = true; // Format original message and set enhanced one (with graphical smilies) $originalMessage = formatMessage($cmd[2]); $enhancedMessage = $originalMessage; if (C_MAX_GSMILIES) { include('./lib/smilies.lib.' . C_EXTENSION); pmcCheckForSmilies($enhancedMessage); unset($smilies); } // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . '(room, username, latin1, m_time, color, msg_original, msg_enhanced) ' . 'VALUES (' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' . '\'' . pmcSlashSingleQuotes($enhancedMessage) . '\'' . ')'; $dbLink->query($msgQuery); } // Update the 'users' and 'rooms' table $dbLink->query("UPDATE " . C_USR_TBL . " SET away = " . $dbSessionVars['away'] . " WHERE username = '$slashedNick'"); $dbLink->query("UPDATE " . C_ROOM_TBL . " SET last_user_modif = " . time() . " WHERE room_name = '$slashedCurrentRoomName'"); ?> Index: announce.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/announce.cmd.php3,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** announce.cmd.php3 2001/05/30 08:07:12 1.9 --- announce.cmd.php3 2001/06/10 14:57:48 1.10 *************** *** 39,43 **** * table */ ! if ($dbSessionVars['status'] == 'a') { // Format original message and set enhanced one (with graphical smilies) --- 39,43 ---- * table */ ! if ($dbSessionVars['status'] == 10) { // Format original message and set enhanced one (with graphical smilies) *************** *** 53,64 **** // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . $currentRoomType . ', ' ! . '\'' . $slashedCurrentRoomName . '\', ' ! . '\'SYS announce\', ' . $latin1 . ', ' . time() . ', ' - . '\' *\', ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' --- 53,62 ---- // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, latin1, m_time, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "'\\\*\\\', " ! . "'SYS announce', " . $latin1 . ', ' . time() . ', ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' Index: banish.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/banish.cmd.php3,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** banish.cmd.php3 2001/06/01 20:44:40 1.11 --- banish.cmd.php3 2001/06/10 14:57:48 1.12 *************** *** 46,50 **** * Ensure the current user is allowed to use the 'banish' command */ ! else if ($dbSessionVars['status'] != 'a' && $dbSessionVars['status'] != 'm') { $error = L_NO_MODERATOR; --- 46,50 ---- * Ensure the current user is allowed to use the 'banish' command */ ! else if ($dbSessionVars['status'] < 5) { $error = L_NO_MODERATOR; *************** *** 64,68 **** // Define an additional condition for moderators so they can only banish an // user from their current room ! $queryRoomPart = ($dbSessionVars['status'] == 'm') ? 'room = \'' . $slashedCurrentRoomName . '\' AND ' : ''; --- 64,68 ---- // Define an additional condition for moderators so they can only banish an // user from their current room ! $queryRoomPart = ($dbSessionVars['status'] == 5) ? 'room = \'' . $slashedCurrentRoomName . '\' AND ' : ''; *************** *** 82,87 **** // Ensure the user to be banished is not a more powerfull user // (admin > moderator) ! if ($targetStatus == 'a' ! || ($targetStatus == 'm' && $dbSessionVars['status'] != 'a')) { $error = sprintf(L_NO_BANISHED, $cmd[2]); --- 82,86 ---- // Ensure the user to be banished is not a more powerfull user // (admin > moderator) ! if (intval($targetStatus) >= $dbSessionVars['status']) { $error = sprintf(L_NO_BANISHED, $cmd[2]); *************** *** 90,95 **** { $targetCurrentRoom = pmcHandleMagicQuotes($targetCurrentRoom, '', 1, 'del'); ! if ($cmd[1] == '* ' && $dbSessionVars['status'] != 'a') $cmd[1] = ''; // Define the duration of the banishment --- 89,96 ---- { $targetCurrentRoom = pmcHandleMagicQuotes($targetCurrentRoom, '', 1, 'del'); ! if ($cmd[1] == '* ' && $dbSessionVars['status'] < 10) ! { $cmd[1] = ''; + } // Define the duration of the banishment *************** *** 111,115 **** if ($cmd[1] == '* ') { ! $targetNewBanRooms = '*'; } else --- 112,116 ---- if ($cmd[1] == '* ') { ! $targetNewBanRooms = '\\\\*\\\\'; } else *************** *** 121,125 **** { $targetNewBanRooms = (count($tmpArray) > 2) ! ? '*' : $slashedOldBanRooms . ',' . pmcSlashSingleQuotes($targetCurrentRoom); } --- 122,126 ---- { $targetNewBanRooms = (count($tmpArray) > 2) ! ? '\\\\*\\\\' : $slashedOldBanRooms . ',' . pmcSlashSingleQuotes($targetCurrentRoom); } *************** *** 143,147 **** { $targetNewBanRooms = ($cmd[1] == '* ') ! ? '*' : pmcSlashSingleQuotes($targetCurrentRoom); $dbLink->query("INSERT INTO " . C_BAN_TBL . " (username, latin1, ip, rooms, ban_until) VALUES ('$slashedTarget', $targetLatin1, '$targetIp', '$targetNewBanRooms', '$banUntil')"); --- 144,148 ---- { $targetNewBanRooms = ($cmd[1] == '* ') ! ? '\\\\*\\\\' : pmcSlashSingleQuotes($targetCurrentRoom); $dbLink->query("INSERT INTO " . C_BAN_TBL . " (username, latin1, ip, rooms, ban_until) VALUES ('$slashedTarget', $targetLatin1, '$targetIp', '$targetNewBanRooms', '$banUntil')"); Index: ignore.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/ignore.cmd.php3,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** ignore.cmd.php3 2001/06/01 20:44:40 1.8 --- ignore.cmd.php3 2001/06/10 14:57:48 1.9 *************** *** 110,113 **** --- 110,121 ---- } } + // For browsers that do not parse javascript, save a session data which + // liftetime is 1 minut to remove the cutoff used while grabbing + // messages in the 'messages' frame + if ($dbSessionVars['jsVersion'] == 'noJs' + && $doRefreshMessages) + { + $dbSessionVars['newMsgCutoff'] = time() + 60; + } } } Index: invite.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/invite.cmd.php3,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** invite.cmd.php3 2001/06/01 20:44:40 1.12 --- invite.cmd.php3 2001/06/10 14:57:48 1.13 *************** *** 56,70 **** // Prepares the messages ! $roomUrl = '$dbSessionVars[\\\'from\\\'] . \\\'?\\\' . dbSessionSID(\\\'GET\\\') . \\\'' . $pmcQueryArgSeparator . 'exitMessage=1' . $pmcQueryArgSeparator . 'newTargetRoom=' . $currentRoomType . urlencode($dbSessionVars['currentRoom']); $reqRegist = ($dbSessionVars['roomType'] == 0 && !C_REQUIRE_REGISTER) ? ' . \\\' \\\' . L_INVITE_REG' : ''; ! $theMessage = 'sprintf(L_INVITE, \\\'' . $nickForNotifications . '\\\', ' . $roomUrl . '\\\', \\\'JOIN\\\', \\\'' . $currentRoomType . ' #' . $roomForJs . '\\\', \\\'' . $roomForNotifications . '\\\')' . $reqRegist; $invitedQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' - . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'SYS inviteTo\', ' --- 56,69 ---- // Prepares the messages ! $roomUrl = '$dbSessionVars[\\\'from\\\'] . \\\'?\\\' . dbSessionSID(\\\'GET\\\') . \\\'' . $pmcQueryArgSeparator . 'exitMessage=1' . $pmcQueryArgSeparator . 'newTargetRoom=' . $dbSessionVars['roomType'] . urlencode($dbSessionVars['currentRoom']); $reqRegist = ($dbSessionVars['roomType'] == 0 && !C_REQUIRE_REGISTER) ? ' . \\\' \\\' . L_INVITE_REG' : ''; ! $theMessage = 'sprintf(L_INVITE, \\\'' . $nickForNotifications . '\\\', ' . $roomUrl . '\\\', \\\'JOIN\\\', \\\'' . $dbSessionVars['roomType'] . ' #' . $roomForJs . '\\\', \\\'' . $roomForNotifications . '\\\')' . $reqRegist; $invitedQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' . '\'' . $slashedCurrentRoomName . '\', ' . '\'SYS inviteTo\', ' *************** *** 78,82 **** // Get all addressee and insert a message for each one of them - $currentTime = time(); $invitedUsers = explode(',', $cmd[2]); $invitedUsersCnt = count($invitedUsers); --- 77,80 ---- *************** *** 89,93 **** continue; } ! $currentQuery = str_replace('%TIME%', $currentTime + $i, $invitedQuery); $slashedInvited = pmcSlashSingleQuotes($invitedUsers[$i]); $currentQuery = str_replace('%ADDRESSEE%', $slashedInvited, $currentQuery); --- 87,91 ---- continue; } ! $currentQuery = str_replace('%TIME%', time(), $invitedQuery); $slashedInvited = pmcSlashSingleQuotes($invitedUsers[$i]); $currentQuery = str_replace('%ADDRESSEE%', $slashedInvited, $currentQuery); Index: join.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/join.cmd.php3,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -r1.8 -r1.9 *** join.cmd.php3 2001/05/30 08:07:12 1.8 --- join.cmd.php3 2001/06/10 14:57:48 1.9 *************** *** 93,97 **** unset($toCheck); // ...neither among other rooms created by users ! $dbLink->query("SELECT type, room FROM " . C_MSG_TBL . " WHERE room = '$slashedTargetRoomName' LIMIT 1"); $roomExist = (list($trueTargetType, $trueTargetName) = $dbLink->nextRecord()); if ($roomExist && $targetRoomType != $trueTargetType) --- 93,97 ---- unset($toCheck); // ...neither among other rooms created by users ! $dbLink->query("SELECT room_type, room_name FROM " . C_ROOM_TBL . " WHERE room_name = '$slashedTargetRoomName' LIMIT 1"); $roomExist = (list($trueTargetType, $trueTargetName) = $dbLink->nextRecord()); if ($roomExist && $targetRoomType != $trueTargetType) *************** *** 138,144 **** { // Ensure the user is a registered one ! if ($dbSessionVars['status'] != 'a' ! && $dbSessionVars['status'] != 'm' ! && $dbSessionVars['status'] != 'r') { $error = L_ERR_USR_13; --- 138,142 ---- { // Ensure the user is a registered one ! if ($dbSessionVars['status'] > 0) { $error = L_ERR_USR_13; *************** *** 153,157 **** // 3. Ensure the user is not banished from the room he wants to enter in ! if (empty($error) && C_BANISH && $dbSessionVars['status'] != 'a') { if (!function_exists('pmcCheckBanish')) --- 151,155 ---- // 3. Ensure the user is not banished from the room he wants to enter in ! if (empty($error) && C_BANISH && $dbSessionVars['status'] < 10) { if (!function_exists('pmcCheckBanish')) *************** *** 170,186 **** if (empty($error)) { ! $regUserPerms = ($dbSessionVars['status'] == 'a') ? 'admin' : 'noreg'; ! $regUserModeratedRooms = ''; ! // Get data from the registered users table if required ! if ($regUserPerms != 'admin') ! { ! $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(); ! } if (!function_exists('pmcRightLevel')) { --- 168,173 ---- if (empty($error)) { ! $isRegUser = ($dbSessionVars['status'] > 0); ! $nick = $dbSessionVars['nick']; if (!function_exists('pmcRightLevel')) { *************** *** 210,224 **** // Update tables $queries[] = 'UPDATE ' . C_USR_TBL . ' ' ! . "SET u_time = $currentTime , room = '$slashedTargetRoomName', status = '$status' " . "WHERE session_id = '$dbSessionId'"; $queries[] = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES ' ! . "($currentRoomType, '$slashedCurrentRoomName', 'SYS exit', '', $currentTime, NULL, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')')"; $queries[] = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES ' ! . "($targetRoomType, '$slashedTargetRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')')"; if (C_WELCOME) { --- 197,212 ---- // Update tables + // 1. Messages and users table $queries[] = 'UPDATE ' . C_USR_TBL . ' ' ! . "SET u_time = $currentTime , room = '$slashedTargetRoomName', status = $status " . "WHERE session_id = '$dbSessionId'"; $queries[] = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, m_time, color, msg_original, msg_enhanced) ' . 'VALUES ' ! . "('$slashedCurrentRoomName', 'SYS exit', $currentTime, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')')"; $queries[] = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, m_time, color, msg_original, msg_enhanced) ' . 'VALUES ' ! . "('$slashedTargetRoomName', 'SYS enter', $currentTime, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')')"; if (C_WELCOME) { *************** *** 228,238 **** include('./lib/welcome.lib.' . C_EXTENSION); $slashedWelcomeMsg = pmcSlashSingleQuotes(WELCOME_MSG); ! // Delete the old welcome messages sent to the current user $queries[] = 'DELETE FROM ' . C_MSG_TBL . ' ' ! . 'WHERE username = \'SYS welcome\' AND address = \'' . $slashedNick . '\''; $queries[] = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES ' ! . "($targetRoomType, '$slashedTargetRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg')"; } $queriesCnt = count($queries); --- 216,227 ---- include('./lib/welcome.lib.' . C_EXTENSION); $slashedWelcomeMsg = pmcSlashSingleQuotes(WELCOME_MSG); ! // Delete the old welcome messages sent to the current user (check if ! // m_time and rooms aren't null to enforce the use of existing indexes) $queries[] = 'DELETE FROM ' . C_MSG_TBL . ' ' ! . "WHERE m_time != '' AND room != '' AND address = '$slashedNick' AND username = 'SYS welcome'"; $queries[] = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES ' ! . "('$slashedTargetRoomName', 'SYS welcome', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg')"; } $queriesCnt = count($queries); *************** *** 243,248 **** } // Delete invitations sent to the current user for the room he is going to ! // enter in ! $dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE username = 'SYS inviteTo' AND address = '$slashedNick' AND room = '$slashedTargetRoomName'"); // Update session data and enforce a complete refresh of the --- 232,246 ---- } // Delete invitations sent to the current user for the room he is going to ! // enter in (check if m_time isn't null to enforce the use of existing ! // indexes) ! $dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE m_time != '' AND room = '$slashedTargetRoomName' AND address = '$slashedNick' AND username = 'SYS inviteTo'"); ! ! // 2. Rooms table ! $dbLink->query("UPDATE " . C_ROOM_TBL . " SET last_user_modif = $currentTime WHERE room_name = '$slashedCurrentRoomName'"); ! $dbLink->query("UPDATE " . C_ROOM_TBL . " SET last_user_modif = $currentTime WHERE room_name = '$slashedTargetRoomName'"); ! if ($dbLink->affectedRows() < 1) ! { ! $dbLink->query("INSERT INTO " . C_ROOM_TBL . " (room_type, room_name, last_user_modif) VALUES ($targetRoomType, '$slashedTargetRoomName', $currentTime)"); ! } // Update session data and enforce a complete refresh of the Index: kick.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/kick.cmd.php3,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** kick.cmd.php3 2001/05/30 08:07:12 1.5 --- kick.cmd.php3 2001/06/10 14:57:48 1.6 *************** *** 46,50 **** * Ensure the current user is allowed to use the 'kick' command */ ! else if ($dbSessionVars['status'] != 'a' && $dbSessionVars['status'] != 'm') { $error = L_NO_MODERATOR; --- 46,50 ---- * Ensure the current user is allowed to use the 'kick' command */ ! else if ($dbSessionVars['status'] < 5) { $error = L_NO_MODERATOR; *************** *** 65,69 **** // Define an additional condition for moderators so they can only kick an // user from their current room ! $queryRoomPart = ($dbSessionVars['status'] == 'm') ? 'room = \'' . $slashedCurrentRoomName . '\' AND ' : ''; --- 65,69 ---- // Define an additional condition for moderators so they can only kick an // user from their current room ! $queryRoomPart = ($dbSessionVars['status'] == 5) ? 'room = \'' . $slashedCurrentRoomName . '\' AND ' : ''; *************** *** 84,89 **** // Ensure the user to be banished is not a more powerfull user // (admin > moderator) ! if ($targetStatus == 'a' ! || ($targetStatus == 'm' && $dbSessionVars['status'] != 'a')) { $error = sprintf(L_NO_KICKED, $cmd[1]); --- 84,88 ---- // Ensure the user to be banished is not a more powerfull user // (admin > moderator) ! if (intval($targetStatus) >= $dbSessionVars['status']) { $error = sprintf(L_NO_KICKED, $cmd[1]); Index: me.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/me.cmd.php3,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** me.cmd.php3 2001/05/30 08:07:12 1.9 --- me.cmd.php3 2001/06/10 14:57:48 1.10 *************** *** 53,64 **** // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' - . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' - . 'NULL, ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' --- 53,62 ---- // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, latin1, m_time, color, msg_original, msg_enhanced) ' . 'VALUES (' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' Index: notify.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/notify.cmd.php3,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** notify.cmd.php3 2001/04/19 21:05:04 1.3 --- notify.cmd.php3 2001/06/10 14:57:48 1.4 *************** *** 31,34 **** --- 31,42 ---- // cookie expires in one year setcookie('cookieNotify', $dbSessionVars['notify'], time() + 60*60*24*365); + // For browsers that do not parse javascript, save a session data which + // liftetime is 1 minut to remove the cutoff used while grabbing messages in + // the 'messages' frame + if ($dbSessionVars['jsVersion'] == 'noJs' && $dbSessionVars['notify'] == 0) + { + $dbSessionVars['newMsgCutoff'] = time() + 60; + } + $isCommand = true; $enforceFirstLoad = 1; Index: priv_msg.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/priv_msg.cmd.php3,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** priv_msg.cmd.php3 2001/05/30 08:07:12 1.6 --- priv_msg.cmd.php3 2001/06/10 14:57:48 1.7 *************** *** 67,73 **** // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' - . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' --- 67,72 ---- // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' Index: promote.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/promote.cmd.php3,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** promote.cmd.php3 2001/05/30 08:07:12 1.6 --- promote.cmd.php3 2001/06/10 14:57:48 1.7 *************** *** 47,51 **** * Ensure the current user is allowed to use the 'promote' command */ ! else if ($dbSessionVars['status'] != 'a' && $dbSessionVars['status'] != 'm') { $error = L_NO_MODERATOR; --- 47,51 ---- * Ensure the current user is allowed to use the 'promote' command */ ! else if ($dbSessionVars['status'] < 5) { $error = L_NO_MODERATOR; *************** *** 61,96 **** else { ! $slashedTarget = pmcSlashSingleQuotes($cmd[1]); // Ensure the user to be promoted is a registered one ! $dbLink->query("SELECT latin1, perms, rooms FROM " . C_REG_TBL . " WHERE username = '$slashedTarget' LIMIT 1"); ! $isReg = (list($targetLatin1, $targetPerms, $targetModeratedRooms) = $dbLink->nextRecord()); if ($isReg) { ! $targetModeratedRooms = pmcHandleMagicQuotes($targetModeratedRooms, '', 1, 'del'); ! $slashedModeratedRooms = pmcSlashSingleQuotes($targetModeratedRooms); ! $isCommand = true; // Promote the user if he/she is not administrator or already moderator // for the current room ! if ($targetPerms == 'admin') { $error = sprintf(L_ADMIN, $cmd[1]); } ! else if (pmcIsInto($dbSessionVars['currentRoom'], $targetModeratedRooms) < 0) { $doRefreshMessages = true; - $slashedModeratedRooms .= ($slashedModeratedRooms == '') - ? $slashedCurrentRoomName - : ',' . $slashedCurrentRoomName; $targetForNotifications = pmcSlashSingleQuotes(pmcSpecialChars($slashedTarget, $targetLatin1), 2); ! $dbLink->query("UPDATE " . C_REG_TBL . " SET perms = 'moderator', rooms = '$slashedModeratedRooms' WHERE username = '$slashedTarget'"); ! $dbLink->query("UPDATE " . C_USR_TBL . " SET status = 'm' WHERE username = '$slashedTarget' AND room = '$slashedCurrentRoomName'"); $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "$currentRoomType, '$slashedCurrentRoomName', 'SYS promote', $latin1, " . time() . ", NULL, '#666699', 'sprintf(L_MODERATOR, \'$targetForNotifications\')', 'sprintf(L_MODERATOR, \'$targetForNotifications\')'" . ')'; $dbLink->query($msgQuery); } else --- 61,99 ---- else { ! $slashedTarget = pmcSlashSingleQuotes($cmd[1]); ! $slashedRoom = pmcSlashSingleQuotes($dbSessionVars['currentRoom']); // Ensure the user to be promoted is a registered one ! $dbLink->query("SELECT charset FROM " . C_REG_TBL . " WHERE username = '$slashedTarget' LIMIT 1"); ! $isReg = (list($targetCharset) = $dbLink->nextRecord()); ! $dbLink->cleanResults(); if ($isReg) { ! $targetLatin1 = ($targetCharset == 'iso-8859-1') ? 1 : 0; ! $isCommand = true; // Promote the user if he/she is not administrator or already moderator // for the current room ! $dbLink->query("SELECT right_level FROM " . C_RIGHT_TBL . " WHERE username = '$slashedTarget' AND room IN ('$slashedRoom', '') LIMIT 1"); ! list($targetPerms) = $dbLink->nextRecord(); ! $dbLink->cleanResults(); ! if ($targetPerms == 10) { $error = sprintf(L_ADMIN, $cmd[1]); } ! else if (empty($targetPerms)) { $doRefreshMessages = true; $targetForNotifications = pmcSlashSingleQuotes(pmcSpecialChars($slashedTarget, $targetLatin1), 2); + $promoteTime = time(); ! $dbLink->query("INSERT INTO " . C_RIGHT_TBL . " (username, room, right_level) VALUES ('$slashedTarget', '$slashedRoom', 5)"); ! $dbLink->query("UPDATE " . C_USR_TBL . " SET status = 5 WHERE username = '$slashedTarget' AND room = '$slashedCurrentRoomName'"); $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, m_time, color, msg_original, msg_enhanced) ' . 'VALUES (' ! . "'$slashedCurrentRoomName', 'SYS promote', $promoteTime, '#666699', 'sprintf(L_MODERATOR, \'$targetForNotifications\')', 'sprintf(L_MODERATOR, \'$targetForNotifications\')'" . ')'; $dbLink->query($msgQuery); + $dbLink->query("UPDATE " . C_ROOM_TBL . " SET last_user_modif = $promoteTime WHERE room_name = '$slashedCurrentRoomName'"); } else Index: quit.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/quit.cmd.php3,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** quit.cmd.php3 2001/05/30 08:07:12 1.7 --- quit.cmd.php3 2001/06/10 14:57:48 1.8 *************** *** 55,66 **** $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) ' . 'VALUES (' - . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' - . 'NULL, ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' --- 55,64 ---- $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' ! . '(room, username, latin1, m_time, color, msg_original, msg_enhanced) ' . 'VALUES (' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' Index: refresh.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/refresh.cmd.php3,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** refresh.cmd.php3 2001/04/19 21:05:04 1.3 --- refresh.cmd.php3 2001/06/10 14:57:48 1.4 *************** *** 36,39 **** --- 36,45 ---- $dbSessionVars['refreshDelay'] = ($dbSessionVars['refreshDelay'] == 0) ? C_MSG_REFRESH : 0; } + + if ($dbSessionVars['jsVersion'] == 'noJs' && $dbSessionVars['refreshDelay'] > 0) + { + $htmlPopupLink = '<a href="./messages_low.' . C_EXTENSION . '?' . dbSessionSID('GET') . '" target="messages">Refresh ' . $dbSessionVars['refreshDelay'] . '</a>'; + } + $isCommand = true; $doRefreshMessages = true; Index: save.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/save.cmd.php3,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -r1.5 -r1.6 *** save.cmd.php3 2001/05/30 08:07:12 1.5 --- save.cmd.php3 2001/06/10 14:57:48 1.6 *************** *** 43,63 **** // Define the SQL query (it depends on the ignored users list and on whether to // display notification messages or not) ! $ignoredSendersList = '('; if (dbSessionIsRegistered('ignoredSenders') && !empty($dbSessionVars['ignoredSenders'])) $ignoredSendersList .= '\'' . str_replace(',', '\', \'', pmcSlashSingleQuotes($dbSessionVars['ignoredSenders'])) . '\''; ! if ($ignoredSendersList != '(') ! $ignoredSendersList = 'username NOT IN (' . $ignoredSendersList . ') AND '; ! $ignoredSendersList .= 'username NOT LIKE \'SYS %\') AND '; $getMessagesQuery = 'SELECT COUNT(*) FROM ' . C_MSG_TBL . ' ' . 'WHERE ' ! . $ignoredSendersList ! . '(' ! . 'address = \' *\' OR ' ! . '(address = \'' . $slashedNick .'\' AND (room = \'' . $slashedCurrentRoomName . '\' OR username = \'SYS inviteTo\')) OR ' ! . '(room = \'' . $slashedCurrentRoomName . '\' AND (address IS NULL OR username = \''. $slashedNick . '\'))' ! . ') ' . 'LIMIT 1'; --- 43,62 ---- // Define the SQL query (it depends on the ignored users list and on whether to // display notification messages or not) ! $ignoredSendersList = ' AND ('; if (dbSessionIsRegistered('ignoredSenders') && !empty($dbSessionVars['ignoredSenders'])) $ignoredSendersList .= '\'' . str_replace(',', '\', \'', pmcSlashSingleQuotes($dbSessionVars['ignoredSenders'])) . '\''; ! if ($ignoredSendersList != ' AND (') ! $ignoredSendersList = ' username NOT IN (' . $ignoredSendersList . ') AND '; ! $ignoredSendersList .= ' username NOT LIKE \'SYS %\')'; $getMessagesQuery = 'SELECT COUNT(*) FROM ' . C_MSG_TBL . ' ' . 'WHERE ' ! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') AND " ! . '(' ! . "(address != '' AND username = '$slashedNick') OR " ! . "((address = '' OR address = '$slashedNick')$ignoredSendersList)" ! . ') ' . 'LIMIT 1'; Index: show.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/show.cmd.php3,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** show.cmd.php3 2001/04/19 21:05:04 1.3 --- show.cmd.php3 2001/06/10 14:57:48 1.4 *************** *** 28,31 **** --- 28,39 ---- * Just modify some variables */ + // For browsers that do not parse javascript, save a session data which + // liftetime is 1 minut to remove the cutoff used while grabbing messages in + // the 'messages' frame + if ($dbSessionVars['jsVersion'] == 'noJs' + && (isset($cmd[3]) && $cmd[3] > $dbSessionVars['msgNumber'])) + { + $dbSessionVars['newMsgCutoff'] = time() + 60; + } $dbSessionVars['msgNumber'] = ($cmd[3] != '') ? max(abs($cmd[3]), 5) : 5; $isCommand = true; Index: whois.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/whois.cmd.php3,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** whois.cmd.php3 2001/06/01 20:44:40 1.9 --- whois.cmd.php3 2001/06/10 14:57:48 1.10 *************** *** 60,64 **** if (!$isProfile) { ! if ($dbSessionVars['status'] == 'a' || $dbSessionVars['nick'] == $cmd[1]) { $dbLink->query("SELECT ip FROM " . C_USR_TBL . " WHERE username='" . $slashedTarget . "' LIMIT 1"); --- 60,64 ---- if (!$isProfile) { ! if ($dbSessionVars['status'] == 10 || $dbSessionVars['nick'] == $cmd[1]) { $dbLink->query("SELECT ip FROM " . C_USR_TBL . " WHERE username='" . $slashedTarget . "' LIMIT 1"); |