From: Lo?c C. <lo...@us...> - 2001-04-12 23:38:29
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat In directory usw-pr-cvs1:/tmp/cvs-serv12704/chat Modified Files: whois_popup.php3 loader.php3 Added Files: save.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 script is used to save some messages in a local file. | // | | // | It is called by the 'save' command. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: save.php3,v 1.1 2001/04/12 23:38:25 loic1 Exp $ // // Save messages in a local file. // /** * Gets the extension for the php scripts */ if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; define('C_EXTENSION', (substr($PHP_SELF, -1) == 3) ? 'php3' : 'php'); /** * Gets some core libraries */ require('./config/config.lib.' . C_EXTENSION); require('./lib/common.lib.' . C_EXTENSION); require('./lib/database/' . C_DB_TYPE . '.lib.' . C_EXTENSION); require('./lib/clean.lib.' . C_EXTENSION); /** * Gets the session Id variable sent to this script * * Uses the 'pmcGrabGlobals()' function defined in the * 'chat/lib/common.lib.php3' library. */ pmcGrabGlobals('dbSessionId'); /** * Start the session handler */ require('./lib/db_sessions.lib.' . C_EXTENSION); dbSessionInit( C_DB_TYPE, C_DB_HOST, C_DB_NAME, C_DB_USER, C_DB_PASS, C_SESS_TBL, C_SESS_DEL * 60, C_CHAT_URL ); dbSessionStart(); /** * Defines the language to be used */ require('./localization/' . $dbSessionVars['lang'] . '/chat.loc'); $textDirection = (L_CHARSET == 'windows-1256') ? 'rtl' : 'ltr'; /** * Get messages * * The 'pmcHandleMagicQuotes()' and the 'pmcSlashSingleQuotes()' functions are * defined inside the 'chat/lib/common.lib.php3' script. */ $slashedNick = pmcSlashSingleQuotes($dbSessionVars['nick']); $currentRoomType = $dbSessionVars['roomType']; $slashedCurrentRoomName = pmcSlashSingleQuotes($dbSessionVars['currentRoom']); // 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 '; $savedMessagesLimit = ($dbSessionVars['savedMessagesLimit'] != '*') ? 'LIMIT ' . $dbSessionVars['savedMessagesLimit'] : ''; $getMessagesQuery = 'SELECT username, latin1, m_time, address, color, msg_' . $dbSessionVars['msgKind'] . ' ' . '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 . '\'))' . ') ' . 'ORDER BY m_time DESC ' . $savedMessagesLimit; // Get messages and store them in an array $grabedMessages = array(); $dbLink = new pmcDB; $dbLink->query($getMessagesQuery); while (list($sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord()) { $grabedMessages[] = array( 'sender' => pmcHandleMagicQuotes($sender, '', 1, 'del'), 'senderLatin1' => $senderLatin1, 'sentTime' => $sentTime, 'addressee' => pmcHandleMagicQuotes($addressee, '', 1, 'del'), 'msgColor' => $msgColor, 'message' => pmcHandleMagicQuotes($message, '', 1, 'del') ); } $dbLink->cleanResults(); $dbLink->close(); /** * Format messages * * The 'pmcSpecialChars()' and the 'pmcSlashSingleQuotes()' functions are * defined inside the 'chat/lib/common.lib.php3' script. */ $newMessages = array(); $grabedMessagesCnt = count($grabedMessages); if ($grabedMessagesCnt == 0) { $newMessages[] = '<span class="notify">' . L_NO_MSG . '</span>'; } else { reset($grabedMessages); for ($k = 0; $k < $grabedMessagesCnt; $k++) { // Get the values of messages variables while (list($name, $value) = each($grabedMessages[$k])) $$name = $value; // Separator between messages sent before today and other ones if (!isset($daySeparator) && date('j', $sentTime) != date('j', time())) { $daySeparatorMsg = ($dbSessionVars['jsVersion'] != 'high' && $dbSessionVars['msgOrder'] == 0) ? L_TODAY_UP : L_TODAY_DWN; $newMessages[] = '<p class="msg"><span class="notify">--------- ' . $daySeparatorMsg . ' ---------</span></p>'; $daySeparator = 1; unset($daySeparatorMsg); } // Messages $aMessage = '<p class="msg">'; // The timestamp of the message if ($dbSessionVars['showTimestamp'] == 1) $aMessage .= '<span class="time">' . date('H:i:s', $sentTime + C_TMZ_OFFSET * 60 * 60) . '</span> '; // The message itself $sender = pmcSpecialChars($sender, $senderLatin1); if ($addressee != '') $addressee = ']<bdo dir="' . $textDirection . '"></bdo>>[' . htmlspecialchars($addressee); $aMessage .= '<b>[' . $sender . $addressee . ']<bdo dir="' . $textDirection .'"></bdo></b> ' . '<font color="' . $msgColor . '">' . $message . '</font>'; $aMessage .= '</p>'; $newMessages[] = $aMessage; } } // end of formatting new messages unset($grabedMessages); /** * "Displays" the frame */ $messagesCnt = count($newMessages); if ($messagesCnt > 0) { // Save messages to a file header('Content-Type: application/octetstream'); header('Content-Disposition: attachement; filename="chat_save_' . date('mdY') . '.htm"'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html dir="<?php echo($textDirection); ?>"> <head> <title><?php echo(APP_NAME . ' - ' . htmlspecialchars($dbSessionVars['currentRoom']) . ' - ' . date('F j, Y')); ?></title> <style> <?php if (defined(L_FONT_NAME) && L_FONT_NAME != '') { // For the 'x-user-defined' charset echo("\n"); ?> * {font-family: <?php echo(L_FONT_NAME); ?>, sans-serif;} <?php } else if (L_CHARSET == 'iso-8859-1') { // For the 'latin1' charset echo("\n"); ?> * {font-family: helvetica, arial, geneva, sans-serif;} <?php } echo("\n"); ?> BODY.mainframe { background-color: #CCCCFF; color: #000000; font-size: <?php echo(L_FONT_SIZE); ?>pt; font-weight: 400; margin: 5px; } A { text-decoration: underline; color: #FFFFFF; font-weight: 600; } A:hover, A:active { color: #FF9900; text-decoration: none; } .msg { margin-top: 0px; margin-bottom: 2px; margin-left: <?php echo(L_CHARSET == 'windows-1256') ? 5 : 55; ?>px; margin-right: <?php echo(L_CHARSET == 'windows-1256') ? 55 : 5; ?>px; text-indent: -50px; } .time { direction: ltr; unicode-bidi: embed; color: #000000; font-size: 8pt; } .notify { color: #666699; font-size: <?php echo(L_FONT_SIZE); ?>pt; font-weight: 600; } </style> <head> <body class="mainframe"> <?php echo("\n"); reset($newMessages); for ($k = 0; $k < $messagesCnt; $k++) { $aMessage = ($dbSessionVars['jsVersion'] != 'high' && $dbSessionVars['msgOrder'] == 0) ? $newMessages[$k] : $newMessages[$messagesCnt - $k - 1]; echo($aMessage . "\n"); } unset($newMessages); ?> </body> </html> <?php } ?> Index: whois_popup.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/whois_popup.php3,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** whois_popup.php3 2001/04/11 23:06:12 1.6 --- whois_popup.php3 2001/04/12 23:38:25 1.7 *************** *** 40,48 **** * Gets the values of variables sent or posted to this script * ! * Uses the 'pmcGrabGlobals()' and the 'pmcHandleMagicQuotes()' functions ! * defined in the 'chat/lib/common.lib.php3' library. */ pmcGrabGlobals('%GET'); ! $slashedWhoisTarget = pmcHandleMagicQuotes($whoisTarget, '0', '', 'add'); /** --- 40,50 ---- * Gets the values of variables sent or posted to this script * ! * Uses the 'pmcGrabGlobals()', the 'pmcHandleMagicQuotes()' and the ! * 'pmcSlashSingleQuotes()' functions are defined in the ! * 'chat/lib/common.lib.php3' library. */ pmcGrabGlobals('%GET'); ! $whoisTarget = pmcHandleMagicQuotes($whoisTarget, '1', '', 'del'); ! $slashedWhoisTarget = pmcSlashSingleQuotes($whoisTarget); /** *************** *** 57,61 **** C_CHAT_URL ); ! dbSessionstart(); /** --- 59,63 ---- C_CHAT_URL ); ! dbSessionStart(); /** *************** *** 67,71 **** * Sends HTTP headers * ! * The 'pmcHttpHeaders()' fonction is defined in the 'chat/lib/common.lib.php3' * library */ --- 69,73 ---- * Sends HTTP headers * ! * The 'pmcHttpHeaders()' function is defined in the 'chat/lib/common.lib.php3' * library */ *************** *** 98,102 **** */ $whoisDbLnk = new pmcDB; ! $whoisDbLnk->query("SELECT latin1, firstname, lastname, country, website, email, showemail, perms, rooms, ip, gender FROM " . C_REG_TBL . " WHERE username='$slashedWhoisTarget' LIMIT 1"); list($latin1, $firstname, $lastname, $country, $website, $email, $showemail, $perms, $rooms, $ip, $gender) = $whoisDbLnk->nextRecord(); $whoisDbLnk->cleanResults(); --- 100,104 ---- */ $whoisDbLnk = new pmcDB; ! $whoisDbLnk->query("SELECT latin1, firstname, lastname, country, website, email, showemail, perms, rooms, ip, gender FROM " . C_REG_TBL . " WHERE username = '$slashedWhoisTarget' LIMIT 1"); list($latin1, $firstname, $lastname, $country, $website, $email, $showemail, $perms, $rooms, $ip, $gender) = $whoisDbLnk->nextRecord(); $whoisDbLnk->cleanResults(); *************** *** 150,154 **** <head> ! <title><?php echo(pmcSpecialChars($slashedWhoisTarget, $latin1)); ?></title> <link rel="stylesheet" href="<?php echo($cssUrl); ?>" type="text/css" /> <script type="text/javascript" language="javascript1.1"> --- 152,156 ---- <head> ! <title><?php echo(pmcSpecialChars($whoisTarget, $latin1)); ?></title> <link rel="stylesheet" href="<?php echo($cssUrl); ?>" type="text/css" /> <script type="text/javascript" language="javascript1.1"> *************** *** 157,161 **** function pmcPutFocus() { ! if (typeof(window.opener) == 'undefined') return false; if (window.opener.window.document.title == 'Handle input hidden frame') --- 159,164 ---- function pmcPutFocus() { ! if (typeof(window.opener) == 'undefined' ! || typeof(window.opener.window.parent.jsIsNS4) == 'undefined') return false; if (window.opener.window.document.title == 'Handle input hidden frame') *************** *** 179,183 **** <p class="title"> ! <?php echo($tagOpen . pmcSpecialChars($slashedWhoisTarget, $latin1) . $tagClose . "\n"); ?> </p> <p></p> --- 182,186 ---- <p class="title"> ! <?php echo($tagOpen . pmcSpecialChars($whoisTarget, $latin1) . $tagClose . "\n"); ?> </p> <p></p> *************** *** 258,261 **** --- 261,271 ---- </center> + + <script type="text/javascript" language="javascript1.1"> + <!-- + // Get the focus + self.focus(); + // --> + </script> </body> Index: loader.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/loader.php3,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -r1.6 -r1.7 *** loader.php3 2001/04/10 16:58:34 1.6 --- loader.php3 2001/04/12 23:38:25 1.7 *************** *** 59,63 **** C_CHAT_URL ); ! dbSessionstart(); /** --- 59,63 ---- C_CHAT_URL ); ! dbSessionStart(); /** *************** *** 70,74 **** * Sends HTTP headers * ! * The 'pmcHttpHeaders()' fonction is defined in the 'chat/lib/common.lib.php3' * library */ --- 70,74 ---- * Sends HTTP headers * ! * The 'pmcHttpHeaders()' function is defined in the 'chat/lib/common.lib.php3' * library */ *************** *** 111,115 **** . '(type = 1' . (($dbSessionVars['roomType'] == 0) ! ? ' OR (type = 0 AND room = \'' . $dbSessionVars['currentRoom'] .'\')) ' : ') ') . 'ORDER BY m_time DESC ' --- 111,115 ---- . '(type = 1' . (($dbSessionVars['roomType'] == 0) ! ? ' OR (type = 0 AND room = \'' . $slashedCurrentRoomName .'\')) ' : ') ') . 'ORDER BY m_time DESC ' *************** *** 133,137 **** * defined inside the 'chat/lib/common.lib.php3' script. */ ! // Define the SQL query (depends on the ignored users list and on whether to // display notification messages or not) $ignoredSendersList = ''; --- 133,137 ---- * 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 = ''; |