Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands In directory usw-pr-cvs1:/tmp/cvs-serv12704/chat/lib/commands Modified Files: invite.cmd.php3 banish.cmd.php3 Added Files: save.cmd.php3 quit.cmd.php3 promote.cmd.php3 priv_msg.cmd.php3 kick.cmd.php3 join.cmd.php3 Log Message: Some more commands and fixes for them --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'save' command. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: save.cmd.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // The work for the 'save' command. // /** * Ensure there are some messages to save * * The 'pmcSlashSingleQuotes()' function is defined inside the * 'chat/lib/common.lib.php3' script. */ // 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'; // Check if there is message $dbLink->query($getMessagesQuery); list($isMessages) = $dbLink->nextRecord(); $dbLink->cleanResults(); /** * Just modidify some variables and define an array of JavaScript instructions * to be ran at the end of the calling script */ if ($isMessages) { $isCommand = true; $isPopup = true; if (C_SAVE != "*" && ($cmd[2] = '*' || $cmd[2] > C_SAVE || $cmd[2] == '')) $cmd[2] = C_SAVE; else if ($cmd[2] == '') $cmd[2] = C_SAVE; $dbSessionVars['savedMessagesLimit'] = $cmd[2]; $exportUrl = 'save.' . C_EXTENSION . '?' . dbSessionSID('GET'); // Define a table that contains JavaScript instructions to be ran $jsToRun = array( '<script type="text/javascript" language="javascript">', '<!--', '// Save messages to a file', 'window.open(\'' . $exportUrl . '\', \'save_popup\', \'width=0,height=0,resizable=yes,scrollbars=yes\');', '// -->', '</script>' ); } else { $error = L_NO_SAVE; } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'banish' command. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: quit.cmd.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // The work for the 'banish' command. // /** * Put the message in the messages table if required * * The 'pmcSlashSingleQuotes()' function is defined inside the * 'chat/lib/common.lib.php3' library */ $cmd[3] = trim($cmd[3]); if ($cmd[3] != '') { // Format original message and set enhanced one (with graphical smilies) $originalMessage = formatMessage($cmd[3]); $enhancedMessage = $originalMessage; if (C_USE_SMILIES) { include('./lib/smilies.lib.' . C_EXTENSION); pmcCheckForSmilies($enhancedMessage); unset($smilies); } $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . 'VALUES (' . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' . 'NULL, ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' . '\'' . pmcSlashSingleQuotes($enhancedMessage) . '\'' . ')'; $dbLink->query($msgQuery); } /** * Do quit */ dbSessionSave(); $exitQueryUrl = '?' . dbSessionSID('GET') . $GLOBALS['pmcQueryArgSeparator'] . 'exitMessage=1'; $jsExitUrl = $dbSessionVars['from'] . $exitQueryUrl; $htmlExitUrl = C_CHAT_URL . $exitQueryUrl; $dbLink->close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Exit whith the quit command</title> <script type="text/javascript" language="javascript"> <!-- // Close the loader if (window.parent.frames['loader'] && !window.parent.frames['loader'].closed) { if (typeof(window.parent.jsLeaveChat) != 'undefined') window.parent.jsLeaveChat = true; window.parent.frames['loader'].close(); } // Move to the start page window.parent.window.location = '<?php echo($jsExitUrl); ?>'; // --> </script> </head> <body> <!-- For browsers that do not support JavaScript --> <p> <a href="<?php echo($htmlExitUrl); ?>" target="_parent"><b><?php echo(C_CHAT_URL); ?></b></a> </p> </body> </html> <?php exit(); ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'promote' command. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: promote.cmd.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // The work for the 'promote' command. // /** * Check for invalid characters in the target user name */ if (ereg('[\, ]', $cmd[1])) { $error = L_ERR_USR_16; } /** * Ensure the current user is allowed to use the 'promote' command */ else if ($dbSessionVars['status'] != 'a' && $dbSessionVars['status'] != 'm') { $error = L_NO_MODERATOR; } /** * Ensure the target user can be promoted before doing the work * * The 'pmcSlashSingleQuotes()', 'pmcHandleMagicQuotes()' and 'pmcIsInto()' * functions are defined inside the 'chat/lib/common.lib.php3' library */ 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(pmcSlashSingleQuotes(pmcSpecialChars($slashedTarget, $targetLatin1))); $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'"); $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($currentRoomType, '$slashedCurrentRoomName', 'SYS promote', $latin1, " . time() . ", NULL, '#666699', 'sprintf(L_MODERATOR, \'$targetForNotifications\')', 'sprintf(L_MODERATOR, \'$targetForNotifications\')')"); } else { $error = sprintf(L_IS_MODERATOR, $cmd[1]); } } else { $error = sprintf(L_NONREG_USER, $cmd[1]); } } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to private messages. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: priv_msg.cmd.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // The work for private messages. // $cmd[2] = trim($cmd[2]); $cmd[3] = trim($cmd[3]); /** * Check for invalid characters in the addressee name */ if (ereg('[\, ]', $cmd[2])) { $error = L_ERR_USR_16; } /** * Put the private message in the 'messages' table * * The 'pmcSlashSingleQuotes()' function is defined in the * 'chat/lib/common.lib.php3' library */ else if ($cmd[2] != '' && $cmd[3] != '') { // Format original message and set enhanced one (with graphical smilies) $originalMessage = formatMessage($cmd[3]); $enhancedMessage = $originalMessage; if (C_USE_SMILIES) { include('./lib/smilies.lib.' . C_EXTENSION); pmcCheckForSmilies($enhancedMessage); unset($smilies); } // Put the message in the 'messages' table $msgQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . 'VALUES (' . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'' . $slashedNick . '\', ' . $latin1 . ', ' . time() . ', ' . '\'' . pmcSlashSingleQuotes($cmd[2]) . '\', ' . '\'' . $color . '\', ' . '\'' . pmcSlashSingleQuotes($originalMessage) . '\', ' . '\'' . pmcSlashSingleQuotes($enhancedMessage) . '\'' . ')'; $dbLink->query($msgQuery); $isCommand = true; $doRefreshMessages = true; } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'kick' command. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: kick.cmd.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // The work for the 'kick' command. // /** * Check for invalid characters in the target user name */ if (ereg('[\, ]', $cmd[1])) { $error = L_ERR_USR_16; } /** * Ensure the current user is allowed to use the 'kick' command */ else if ($dbSessionVars['status'] != 'a' && $dbSessionVars['status'] != 'm') { $error = L_NO_MODERATOR; } /** * Ensure the current user is allowed to 'kick' the target user before doing * the work * * The 'pmcSlashSingleQuotes()' and 'pmcHandleMagicQuotes()' functions are * defined inside the 'chat/lib/common.lib.php3' library */ else { $slashedTarget = pmcSlashSingleQuotes($cmd[1]); // Define an additional condition for moderators so they can only kick an // user from their current room $queryRoomPart = ($dbSessionVars['status'] == 'm') ? 'room = \'' . $slashedCurrentRoomName . '\' AND ' : ''; // Ensure the user to be kicked is logged in (into the current room for // moderators) $dbLink->query("SELECT room, status FROM " . C_USR_TBL . " WHERE " . $queryRoomPart . "username = '$slashedTarget' LIMIT 1"); $isChatting = (list($targetCurrentRoom, $targetStatus) = $dbLink->nextRecord()); $dbLink->cleanResults(); // He/she is not chatting -> send an error message if (!$isChatting) { $error = sprintf(L_NONEXIST_USER, $cmd[1]); } // He/she is chatting else { // 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]); } else { $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = " . time() . ", status = 'k' WHERE " . $queryRoomPart . "username = '$slashedTarget'"); // kicked confirmation message when an user has been kicked // from an other room than the current one $targetCurrentRoom = pmcHandleMagicQuotes($targetCurrentRoom, '', 1, 'del'); if ($targetCurrentRoom != $dbSessionVars['currentRoom']) $error = sprintf(L_KICKED, $cmd[1]); $isCommand = true; $doRefreshMessages = true; } } } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'join' command. | // | | // | It is called by the 'commands.lib.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: join.cmd.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // The work for the 'join' command. // /** * Get the swearing library and defines some variables * * The 'pmcSlashSingleQuotes()' function is defined in the * 'chat/lib/common.lib.php3' library */ if (C_NO_SWEAR == 1) include('./lib/swearing.lib.' . C_EXTENSION); $targetRoomType = ($cmd[2] != '') ? $cmd[2] : 1; $targetRoom = $cmd[3]; $slashedTarget = pmcSlashSingleQuotes($cmd[3]); /** * Creation of room is not allowed -> ensure that the target room is among * default ones * * The 'pmcIsInto()' function is defined in the 'chat/lib/common.lib.php3' * library */ if (C_VERSION == 1) { if (pmcIsInto($targetRoom, $defaultChatRooms) >= 0) $isCommand = true; else $error = L_ERR_USR_17; } /** * Creation of room is allowed -> ensure that the target room has valid * name and type * * The 'pmcIsInto()' function is defined in the 'chat/lib/common.lib.php3' * library */ // Check for invalid characters else if (ereg('[\,]', $targetRoom)) { $error = L_ERR_ROM_1; } // Check for swear words if necessary else if (C_NO_SWEAR == 1 && checkWords($targetRoom, true)) { $error = L_ERR_ROM_2; } // Ensure there is no existing room with the same name but a different type // among reserved name for private/public (default) rooms else { $toCheck = ($targetRoomType == 1) ? $defaultPrivateRooms : $defaultChatRooms; if (pmcIsInto($targetRoom, $toCheck) >= 0) $error = ($targetRoomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4; else $isCommand = true; unset($toCheck); } /** * If the target room has valid name and type, do the work * * The 'pmcIsInto()' function is defined in the 'chat/lib/common.lib.php3' * library */ if ($isCommand) { $found = false; // Get the case sensitive name of the target room // 1. Among default rooms $toCheck = ($targetRoomType == 1) ? $defaultChatRooms : $defaultPrivateRooms; $pos = pmcIsInto($targetRoom, $toCheck); if ($pos >= 0) { $targetRoom = $toCheck[$pos]; $found = true; } unset($toCheck); // 2. Among other existing rooms with the same type if (!$found) { $dbLink->query("SELECT type, room FROM " . C_MSG_TBL . " WHERE room = '$slashedTarget' LIMIT 1"); $roomExist = (list($trueTargetType, $trueTargetName) = $dbLink->nextRecord()); if ($roomExist && $targetRoomType == $trueTargetType) { $targetRoom = pmcHandleMagicQuotes($trueTargetName, '', 1, 'del'); $found = true; } $dbLink->cleanResults(); } // Room should be created // 1. ensure the user is registered if (!$found || $targetRoomType == 0) { // Ensure the user is a registered one if ($dbSessionVars['status'] != 'a' && $dbSessionVars['status'] != 'm' && $dbSessionVars['status'] != 'r') { $error = L_ERR_USR_13; $found = false; } } // 2. ensure there is no existing room with the same name but a different // type among rooms created by users if (!$found && $roomExist && empty($error)) { $error = ($targetRoomType == 0) ? L_ERR_ROM_3 : L_ERR_ROM_4; } else if (empty($error)) { $found = true; } // Ensure the user is not banished from the room he wants to enter in if ($found && C_BANISH && $dbSessionVars['status'] != 'a') { $enterOtherRoomName = $targetRoom; include('./lib/banish.lib.' . C_EXTENSION); if ($isBanished) { $found = false; $error = L_ERR_USR_20; } unset($enterOtherRoomName); } // If the room can't be created if (!$found) { $isCommand = false; } // Log into the new room else { $joinQueryUrl = '?' . dbSessionSID('GET') . $pmcQueryArgSeparator . 'exitMessage=1' . $pmcQueryArgSeparator . 'reloading=joinCmd' . $pmcQueryArgSeparator . 'newTargetRoom=' . $targetRoomType . urlencode($targetRoom); $jsJoinUrl = $dbSessionVars['from'] . $joinQueryUrl; $htmlJoinUrl = C_CHAT_URL . $joinQueryUrl; $dbLink->close(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Exit from join command</title> <script type="text/javascript" language="javascript"> <!-- // Close the loader if (window.parent.frames['loader'] && !window.parent.frames['loader'].closed) { if (typeof(window.parent.jsLeaveChat) != 'undefined') window.parent.jsLeaveChat = true; window.parent.frames['loader'].close(); } window.parent.window.location = '<?php echo($jsJoinUrl); ?>'; // --> </script> </head> <body> <!-- For browsers that do not support JavaScript --> <p> <a href="<?php echo($htmlJoinUrl); ?>" target="_parent"><b><?php echo(C_CHAT_URL); ?></b></a> </p> </body> </html> <?php exit(); } } ?> Index: invite.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/invite.cmd.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** invite.cmd.php3 2001/04/11 23:06:14 1.1 --- invite.cmd.php3 2001/04/12 23:38:25 1.2 *************** *** 39,52 **** else { - $isCommand = true; $currentTime = time(); $nickForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($slashedNick, $latin1))); $roomForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($slashedCurrentRoomName, 0))); ! $roomForJs = pmcSlashSingleQuotes(pmcSlashSingleQuotes($roomForNotifications)); ! $invitedsForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($cmd[2], 0))); // Prepares the messages $reqRegist = ($dbSessionVars['roomType'] == 0 && !C_REQUIRE_REGISTER) ! ? ' . \' \' . L_INVITE_REG' : ''; $theMessage = 'sprintf(L_INVITE, \\\'' . $nickForNotifications . '\\\', \\\'JOIN\\\', \\\'' . $currentRoomType . ' #' . $roomForJs . '\\\', \\\'' . $roomForNotifications . '\\\')' --- 39,51 ---- else { $currentTime = time(); $nickForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($slashedNick, $latin1))); $roomForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($slashedCurrentRoomName, 0))); ! $roomForJs = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSlashSingleQuotes($roomForNotifications)))); ! $invitedsForNotifications = pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSlashSingleQuotes(pmcSpecialChars($cmd[2], 0)))); // Prepares the messages $reqRegist = ($dbSessionVars['roomType'] == 0 && !C_REQUIRE_REGISTER) ! ? ' . \\\' \\\' . L_INVITE_REG' : ''; $theMessage = 'sprintf(L_INVITE, \\\'' . $nickForNotifications . '\\\', \\\'JOIN\\\', \\\'' . $currentRoomType . ' #' . $roomForJs . '\\\', \\\'' . $roomForNotifications . '\\\')' *************** *** 96,99 **** --- 95,101 ---- // Insert a message for the sender $dbLink->query($inviterQuery); + + $isCommand = true; + $doRefreshMessages = true; } Index: banish.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/banish.cmd.php3,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** banish.cmd.php3 2001/04/10 21:25:55 1.4 --- banish.cmd.php3 2001/04/12 23:38:25 1.5 *************** *** 42,45 **** --- 42,48 ---- * Ensure the current user is allowed to 'banish' the target user before doing * the work + * + * The 'pmcSlashSingleQuotes()', 'pmcHandleMagicQuotes()' and 'pmcIsInto()' + * functions are defined inside the 'chat/lib/common.lib.php3' library */ else *************** *** 50,56 **** // user from their current room $queryRoomPart = ($dbSessionVars['status'] == 'm') ! ? 'room = \'' . pmcSlashSingleQuotes($dbSessionVars['currentRoom']) . '\' AND ' : ''; ! // Ensure the user to be banished is logged in (into the current room for moderators) $dbLink->query("SELECT latin1, room, status, ip FROM " . C_USR_TBL . " WHERE " . $queryRoomPart . "username = '$slashedTarget' LIMIT 1"); $isChatting = (list($targetLatin1, $targetCurrentRoom, $targetStatus, $targetIp) = $dbLink->nextRecord()); --- 53,60 ---- // user from their current room $queryRoomPart = ($dbSessionVars['status'] == 'm') ! ? 'room = \'' . $slashedCurrentRoomName . '\' AND ' : ''; ! // Ensure the user to be banished is logged in (into the current room for ! // moderators) $dbLink->query("SELECT latin1, room, status, ip FROM " . C_USR_TBL . " WHERE " . $queryRoomPart . "username = '$slashedTarget' LIMIT 1"); $isChatting = (list($targetLatin1, $targetCurrentRoom, $targetStatus, $targetIp) = $dbLink->nextRecord()); *************** *** 98,108 **** else { $tmpArray = explode(',', $targetOldBanRooms); if (pmcIsInto($targetCurrentRoom, $tmpArray) < 0) $targetNewBanRooms = (count($tmpArray) > 2) ? '*' ! : pmcSlashSingleQuotes($targetOldBanRooms . ',' . $targetCurrentRoom); else ! $targetNewBanRooms = pmcSlashSingleQuotes($targetOldBanRooms); unset($tmpArray); } --- 102,115 ---- else { + $targetCurrentRoom = pmcHandleMagicQuotes($targetCurrentRoom, '', 1, 'del'); + $targetOldBanRooms = pmcHandleMagicQuotes($targetOldBanRooms, '', 1, 'del'); + $slashedOldBanRooms = pmcSlashSingleQuotes($targetOldBanRooms); $tmpArray = explode(',', $targetOldBanRooms); if (pmcIsInto($targetCurrentRoom, $tmpArray) < 0) $targetNewBanRooms = (count($tmpArray) > 2) ? '*' ! : $slashedOldBanRooms . ',' . pmcSlashSingleQuotes($targetCurrentRoom); else ! $targetNewBanRooms = $slashedOldBanRooms; unset($tmpArray); } *************** *** 119,124 **** $targetNewBanRooms = ($cmd[1] == '* ') ? '*' ! : pmcSlashSingleQuotes($targetCurrentRoom); ! $dbLink->query("INSERT INTO " . C_BAN_TBL . " VALUES ('$slashedTarget', '$targetLatin1', '$targetIp', '$targetNewBanRooms', '$banUntil')"); } // end of 'first banishment for the target user' --- 126,131 ---- $targetNewBanRooms = ($cmd[1] == '* ') ? '*' ! : $slashedCurrentRoomName; ! $dbLink->query("INSERT INTO " . C_BAN_TBL . " VALUES ('$slashedTarget', $targetLatin1, '$targetIp', '$targetNewBanRooms', '$banUntil')"); } // end of 'first banishment for the target user' *************** *** 128,132 **** // banishment confirmation message when an user has been banished // from an other room than the current one ! if ($targetCurrentRoom != pmcSlashSingleQuotes($dbSessionVars['currentRoom'])) $error = sprintf(L_BANISHED, $cmd[2]); --- 135,140 ---- // banishment confirmation message when an user has been banished // from an other room than the current one ! $targetCurrentRoom = pmcHandleMagicQuotes($targetCurrentRoom, '', 1, 'del'); ! if ($targetCurrentRoom != $dbSessionVars['currentRoom']) $error = sprintf(L_BANISHED, $cmd[2]); |