|
From: Lo?c C. <lo...@us...> - 2001-11-29 22:01:01
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat
In directory usw-pr-cvs1:/tmp/cvs-serv4944/chat
Modified Files:
save.php3 messages_low.php3 loader.php3
Log Message:
For Tinou: improved messages tables (lower database soft. charge)
Index: save.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/save.php3,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** save.php3 2001/11/26 20:22:15 1.9
--- save.php3 2001/11/29 22:00:56 1.10
***************
*** 81,109 ****
$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 = ' 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 %\')';
! $savedMessagesLimit = ($dbSessionVars['savedMessagesLimit'] != '*' && (C_DB_TYPE == 'mysql' || C_DB_TYPE == 'pgsql'))
! ? 'LIMIT ' . $dbSessionVars['savedMessagesLimit']
! : '';
!
$getMessagesQuery = 'SELECT username, latin1, m_time, address, color, msg_original FROM ' . C_MSG_TBL . ' '
. 'WHERE '
. 'm_id > 0 AND '
! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') AND "
! . '('
! . "(address > '' AND username = '$slashedNick') OR "
! . "((address = '' OR address = '$slashedNick')$ignoredSendersList)"
! . ') '
! . 'ORDER BY m_time DESC '
! . $savedMessagesLimit;
// Get messages and store them in an array
--- 81,97 ----
$slashedCurrentRoomName = pmcSlashSingleQuotes($dbSessionVars['currentRoom']);
! // Defines the list of senders to be ignored
! $ignoredSendersList = '';
if (dbSessionIsRegistered('ignoredSenders') && !empty($dbSessionVars['ignoredSenders']))
! $ignoredSendersList .= $dbSessionVars['ignoredSenders'];
! $ignoredSendersList .= (($ignoredSendersList != '') ? ',':'')
! . 'SYS enter,SYS exit,SYS welcome,SYS delreg,SYS promote,SYS announce,SYS inviteTo';
! // Builds the SQL query
$getMessagesQuery = 'SELECT username, latin1, m_time, address, color, msg_original FROM ' . C_MSG_TBL . ' '
. 'WHERE '
. 'm_id > 0 AND '
! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') "
! . 'ORDER BY m_id DESC';
// Get messages and store them in an array
***************
*** 114,121 ****
while (list($sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord())
{
! $grabedMessages[] = array( pmcHandleMagicQuotes($sender, '', 1, 'del'),
$senderLatin1,
$sentTime,
! pmcHandleMagicQuotes($addressee, '', 1, 'del'),
$msgColor,
pmcHandleMagicQuotes($message, '', 1, 'del')
--- 102,123 ----
while (list($sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord())
{
! $sender = pmcHandleMagicQuotes($sender, '', 1, 'del');
! $addressee = pmcHandleMagicQuotes($addressee, '', 1, 'del');
! // Skip the row if $sender is into the ignored list (notifications
! // included)
! if ($ignoredSendersList != '' && pmcIsInto($sender, $ignoredSendersList) != -1)
! continue;
!
! // Skip the row if it's a private message for an other user not send by the
! // the current one
! if (($addressee != '')
! && ($addressee != $dbSessionVars['nick'] && $sender != $dbSessionVars['nick'])) {
! continue;
! }
!
! $grabedMessages[] = array( $sender,
$senderLatin1,
$sentTime,
! $addressee,
$msgColor,
pmcHandleMagicQuotes($message, '', 1, 'del')
Index: messages_low.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/messages_low.php3,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** messages_low.php3 2001/11/26 20:22:15 1.21
--- messages_low.php3 2001/11/29 22:00:56 1.22
***************
*** 113,147 ****
* 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 ($dbSessionVars['notify'] == 0)
! $ignoredSendersList .= (($ignoredSendersList != '') ? ', ':'')
! . '\'SYS enter\', \'SYS exit\'';
! if ($ignoredSendersList != '')
! $ignoredSendersList = ' AND username NOT IN (' . $ignoredSendersList . ')';
$cutoffClause = (isset($firstMsgToLoad))
? 'm_id > ' . $firstMsgToLoad . ' AND '
: 'm_id > 0 AND ';
- $limitClause = (C_DB_TYPE == 'mysql' || C_DB_TYPE == 'pgsql')
- ? ' LIMIT ' . $dbSessionVars['msgNumber']
- : '';
-
$getMessagesQuery = 'SELECT m_id, username, latin1, m_time, address, color, msg_' . $dbSessionVars['msgKind'] . ' '
. 'FROM ' . C_MSG_TBL . ' '
. 'WHERE '
. $cutoffClause
! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') AND "
! . '('
! . "(address > '' AND username = '$slashedNick') OR "
! . "((address = '' OR address = '$slashedNick')$ignoredSendersList)"
! . ') '
! . 'ORDER BY m_time DESC '
! . $limitClause;
// Get messages and store them in an array
--- 113,134 ----
* defined inside the 'chat/lib/common.lib.php3' script.
*/
! // Defines the list of senders to be ignored
$ignoredSendersList = '';
if (dbSessionIsRegistered('ignoredSenders') && !empty($dbSessionVars['ignoredSenders']))
! $ignoredSendersList .= $dbSessionVars['ignoredSenders'];
if ($dbSessionVars['notify'] == 0)
! $ignoredSendersList .= (($ignoredSendersList != '') ? ',':'')
! . 'SYS enter,SYS exit';
+ // Builds the SQL query
$cutoffClause = (isset($firstMsgToLoad))
? 'm_id > ' . $firstMsgToLoad . ' AND '
: 'm_id > 0 AND ';
$getMessagesQuery = 'SELECT m_id, username, latin1, m_time, address, color, msg_' . $dbSessionVars['msgKind'] . ' '
. 'FROM ' . C_MSG_TBL . ' '
. 'WHERE '
. $cutoffClause
! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') "
! . 'ORDER BY m_id DESC';
// Get messages and store them in an array
***************
*** 152,160 ****
while (list($msgId, $sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord())
{
$grabedMessages[] = array( $msgId,
! pmcHandleMagicQuotes($sender, '', 1, 'del'),
$senderLatin1,
$sentTime,
! pmcHandleMagicQuotes($addressee, '', 1, 'del'),
$msgColor,
pmcHandleMagicQuotes($message, '', 1, 'del')
--- 139,162 ----
while (list($msgId, $sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord())
{
+ $sender = pmcHandleMagicQuotes($sender, '', 1, 'del');
+ $addressee = pmcHandleMagicQuotes($addressee, '', 1, 'del');
+ // Skip the row if $sender is into the ignored list (notifications
+ // included)
+ if ($ignoredSendersList != '' && pmcIsInto($sender, $ignoredSendersList) != -1)
+ continue;
+
+ // Skip the row if it's a private message for an other user not send by the
+ // the current one
+ if (($addressee != '')
+ && ($addressee != $dbSessionVars['nick'] && $sender != $dbSessionVars['nick'])) {
+ continue;
+ }
+
+ // Build the messages list
$grabedMessages[] = array( $msgId,
! $sender,
$senderLatin1,
$sentTime,
! $addressee,
$msgColor,
pmcHandleMagicQuotes($message, '', 1, 'del')
Index: loader.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/loader.php3,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** loader.php3 2001/11/26 20:22:15 1.24
--- loader.php3 2001/11/29 22:00:56 1.25
***************
*** 146,180 ****
* 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 ($dbSessionVars['notify'] == 0)
! $ignoredSendersList .= (($ignoredSendersList != '') ? ', ':'')
! . '\'SYS enter\', \'SYS exit\'';
! if ($ignoredSendersList != '')
! $ignoredSendersList = ' AND username NOT IN (' . $ignoredSendersList . ')';
$cutoffClause = ($isInitLoad)
? 'm_id > 0 AND '
: 'm_id > ' . $lastMsgLoad . ' AND ';
- $limitClause = ($isInitLoad && (C_DB_TYPE == 'mysql' || C_DB_TYPE == 'pgsql'))
- ? ' LIMIT ' . $dbSessionVars['msgNumber']
- : '';
-
$getMessagesQuery = 'SELECT m_id, username, latin1, m_time, address, color, msg_' . $dbSessionVars['msgKind'] . ' '
. 'FROM ' . C_MSG_TBL . ' '
. 'WHERE '
. $cutoffClause
! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') AND "
! . '('
! . "(address > '' AND username = '$slashedNick') OR "
! . "((address = '' OR address = '$slashedNick')$ignoredSendersList)"
! . ') '
! . 'ORDER BY m_time DESC'
! . $limitClause;
// Get new messages and store them in an array
--- 146,167 ----
* defined inside the 'chat/lib/common.lib.php3' script.
*/
! // Defines the list of senders to be ignored
$ignoredSendersList = '';
if (dbSessionIsRegistered('ignoredSenders') && !empty($dbSessionVars['ignoredSenders']))
! $ignoredSendersList .= $dbSessionVars['ignoredSenders'];
if ($dbSessionVars['notify'] == 0)
! $ignoredSendersList .= (($ignoredSendersList != '') ? ',':'')
! . 'SYS enter,SYS exit';
+ // Builds the SQL query
$cutoffClause = ($isInitLoad)
? 'm_id > 0 AND '
: 'm_id > ' . $lastMsgLoad . ' AND ';
$getMessagesQuery = 'SELECT m_id, username, latin1, m_time, address, color, msg_' . $dbSessionVars['msgKind'] . ' '
. 'FROM ' . C_MSG_TBL . ' '
. 'WHERE '
. $cutoffClause
! . "room IN ('$slashedCurrentRoomName', '\\\*\\\') "
! . 'ORDER BY m_id DESC';
// Get new messages and store them in an array
***************
*** 184,192 ****
while (list($msgId, $sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord())
{
$grabedMessages[] = array( $msgId,
! pmcHandleMagicQuotes($sender, '', 1, 'del'),
$senderLatin1,
$sentTime,
! pmcHandleMagicQuotes($addressee, '', 1, 'del'),
$msgColor,
pmcHandleMagicQuotes($message, '', 1, 'del')
--- 171,194 ----
while (list($msgId, $sender, $senderLatin1, $sentTime, $addressee, $msgColor, $message) = $dbLink->nextRecord())
{
+ $sender = pmcHandleMagicQuotes($sender, '', 1, 'del');
+ $addressee = pmcHandleMagicQuotes($addressee, '', 1, 'del');
+ // Skip the row if $sender is into the ignored list (notifications
+ // included)
+ if ($ignoredSendersList != '' && pmcIsInto($sender, $ignoredSendersList) != -1)
+ continue;
+
+ // Skip the row if it's a private message for an other user not send by the
+ // the current one
+ if (($addressee != '')
+ && ($addressee != $dbSessionVars['nick'] && $sender != $dbSessionVars['nick'])) {
+ continue;
+ }
+
+ // Build the messages list
$grabedMessages[] = array( $msgId,
! $sender,
$senderLatin1,
$sentTime,
! $addressee,
$msgColor,
pmcHandleMagicQuotes($message, '', 1, 'del')
|