From: Lo?c C. <lo...@us...> - 2001-04-11 23:06:17
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands In directory usw-pr-cvs1:/tmp/cvs-serv1253/chat/lib/commands Modified Files: me.cmd.php3 announce.cmd.php3 Added Files: invite.cmd.php3 ignore.cmd.php3 Log Message: Two many modifications, I can't detail --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'invite' 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: invite.cmd.php3,v 1.1 2001/04/11 23:06:14 loic1 Exp $ // // The work for the 'invite' command. // /** * Check for invalid characters in the target user name */ if ($cmd[2] != '' && ereg('[\ ]', $cmd[2])) { $error = L_ERR_USR_16; } /** * Put the message (it depends on the room type) * * The 'pmcSlashSingleQuotes()' and 'pmcSpecialChars()' functions are defined * inside the 'chat/lib/common.lib.php3' library */ 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 . '\\\')' . $reqRegist; $invitedQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . 'VALUES (' . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'SYS inviteTo\', ' . $latin1 . ', ' . $currentTime . ', ' . '\'%ADDRESSEE%\', ' . '\'#666699\', ' . '\'' . $theMessage . '\', ' . '\'' . $theMessage . '\'' . ')'; $theMessage = 'sprintf(L_INVITE_DONE, \\\'' . $invitedsForNotifications . '\\\')'; $inviterQuery = 'INSERT INTO ' . C_MSG_TBL . ' ' . 'VALUES (' . $currentRoomType . ', ' . '\'' . $slashedCurrentRoomName . '\', ' . '\'SYS inviteFrom\', ' . $latin1 . ', ' . $currentTime . ', ' . '\'' . $slashedNick . '\', ' . '\'#666699\', ' . '\'' . $theMessage . '\', ' . '\'' . $theMessage . '\'' . ')'; // Get all addressee and insert a message for each one of them $invitedUsers = explode(',', $cmd[2]); for ($i = 0; $i < count($invitedUsers); $i++) { $invitedUsers[$i] = trim($invitedUsers[$i]); if ($invitedUsers[$i] == '') continue; $slashedInvited = pmcSlashSingleQuotes($invitedUsers[$i]); $currentQuery = str_replace('%ADDRESSEE%', $slashedInvited, $invitedQuery); $dbLink->query($currentQuery); } unset($invitedUsers); // Insert a message for the sender $dbLink->query($inviterQuery); } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library does the work associated to the 'ignore' 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: ignore.cmd.php3,v 1.1 2001/04/11 23:06:14 loic1 Exp $ // // The work for the 'ignore' command. // /** * Check for invalid characters in the target user name */ if ($cmd[3] != '' && ereg('[\ ]', $cmd[3])) { $error = L_ERR_USR_16; } /** * No minus sign in the command */ else if ($cmd[1] == '') { // Launch the ignored popup if ($cmd[3] == '') { $isCommand = true; $isPopup = true; $ignoredUrl = 'ignore_popup.' . C_EXTENSION . '?' . dbSessionSID(); // Define a table that contains JavaScript instructions to be ran $jsToRun = array( '<script type="text/javascript" language="javascript">', '<!--', 'with (window.parent)', '{', "\t" . 'if (typeof(jsIgnoredPopupWin) != \'undefined\' && jsIgnoredPopupWin != null && !jsIgnoredPopupWin.closed)', "\t" . '{', "\t\t" . 'jsIgnoredPopupWin.focus();', "\t" . '}', "\t" . 'else', "\t" . '{', "\t\t" . 'jsIgnoredPopupWin = window.open(\'' . $ignoredUrl . '\', \'ignore_popup\', \'width=180,height=300,scrollbars=yes,resizable=yes\');', "\t" . '}', '}', '// -->', '</script>' ); } // Add user(s) to the ignored list else { if (!dbSessionIsRegistered('ignoredSenders')) $dbSessionVars['ignoredSenders'] = ''; $toAdd = explode(',', $cmd[3]); for ($i = 0; $i < count($toAdd); $i++) { $toAdd[$i] = trim($toAdd[$i]); if ($toAdd[$i] == '') continue; if ($toAdd[$i] != $dbSessionVars['nick'] && pmcIsInto($toAdd[$i], $dbSessionVars['ignoredSenders']) < 0) { $dbSessionVars['ignoredSenders'] .= ($dbSessionVars['ignoredSenders'] == '') ? $toAdd[$i] : ',' . $toAdd[$i]; $isCommand = true; $doRefreshMessages = true; } } } } /** * A minus sign in the command */ else { // Unset ignored list if ($cmd[3] == '') { $isCommand = true; if (dbSessionIsRegistered('ignoredSenders')) { $doRefreshMessages = true; dbSessionUnregister('ignoredSenders'); } } // Remove user(s) from ignored list else { $isCommand = true; if (dbSessionIsRegistered('ignoredSenders') && $dbSessionVars['ignoredSenders'] != '') { $toRemove = explode(',', $cmd[3]); $ignoredUsers = explode(',', $dbSessionVars['ignoredSenders']); $updateList = false; reset($toRemove); for ($i = 0; $i < count($toRemove); $i++) { $toRemove[$i] = trim($toRemove[$i]); if ($toRemove[$i] == '') continue; $pos = pmcIsInto($toRemove[$i], $ignoredUsers); if ($pos >= 0) { $ignoredUsers[$i] = ''; $updateList = true; } } unset($toRemove); if ($updateList) { $ignList = ''; for (reset($ignoredUsers); $ignName = current($ignoredUsers); next($ignoredUsers)) { if ($ignName != '') $ignList .= ($ignList != '') ? ',' . $ignName : $ignName; } $dbSessionVars['ignoredSenders'] = $ignList; $doRefreshMessages = true; } unset($ignoredUsers); } } } // Will completly reload the loader script if ($isCommand) $enforceFirstLoad = 1; if (!$isPopup && $isCommand) { $ignoredUrl = 'ignore_popup.' . C_EXTENSION . '?' . dbSessionSID(); // Define a table that contains JavaScript instructions to be ran $jsToRun = array( '<script type="text/javascript" language="javascript">', '<!--', '// Refresh the ignored popup', 'with (window.parent)', '{', "\t" . 'if (typeof(jsIgnoredPopupWin) != \'undefined\' && jsIgnoredPopupWin != null && !jsIgnoredPopupWin.closed)', "\t" . '{', "\t\t" . 'jsIgnoredPopupWin.document.forms[\'ignoredForm\'].elements[\'refresh\'].value = 1;', "\t\t" . 'jsIgnoredPopupWin.location = \'' . $ignoredUrl . '\';', "\t" . '}', '}', '// -->', '</script>' ); } ?> Index: me.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/me.cmd.php3,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** me.cmd.php3 2001/04/10 09:38:14 1.2 --- me.cmd.php3 2001/04/11 23:06:14 1.3 *************** *** 35,39 **** { include('./lib/smilies.lib.' . C_EXTENSION); ! checkForSmilies($enhancedMessage, $smilies); unset($smilies); } --- 35,39 ---- { include('./lib/smilies.lib.' . C_EXTENSION); ! pmcCheckForSmilies($enhancedMessage); unset($smilies); } Index: announce.cmd.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/commands/announce.cmd.php3,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** announce.cmd.php3 2001/04/10 15:00:06 1.3 --- announce.cmd.php3 2001/04/11 23:06:14 1.4 *************** *** 35,39 **** { include('./lib/smilies.lib.' . C_EXTENSION); ! checkForSmilies($enhancedMessage, $smilies); unset($smilies); } --- 35,39 ---- { include('./lib/smilies.lib.' . C_EXTENSION); ! pmcCheckForSmilies($enhancedMessage); unset($smilies); } |