|
From: Lo?c C. <lo...@us...> - 2001-04-21 19:37:42
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs
In directory usw-pr-cvs1:/tmp/cvs-serv32717/chat/lib/index_libs
Modified Files:
main_index.lib.php3 do_enter_db_work.lib.php3
Log Message:
Some SQL queries has been rewriten in order to avois errors with customized tables
Index: main_index.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/main_index.lib.php3,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** main_index.lib.php3 2001/04/20 19:55:47 1.20
--- main_index.lib.php3 2001/04/21 19:37:40 1.21
***************
*** 214,218 ****
$exitedRoomType = $dbSessionVars['roomType'];
! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($exitedRoomType, '$exitedRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf($messageKind, \'$nickForNotifications\')', 'sprintf($messageKind, \'$nickForNotifications\')')");
unset($messageKind);
unset($nickForNotifications);
--- 214,223 ----
$exitedRoomType = $dbSessionVars['roomType'];
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$exitedRoomType, '$exitedRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf($messageKind, \'$nickForNotifications\')', 'sprintf($messageKind, \'$nickForNotifications\')'"
! . ')';
! $dbLink->query($aQuery);
unset($messageKind);
unset($nickForNotifications);
Index: do_enter_db_work.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/do_enter_db_work.lib.php3,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** do_enter_db_work.lib.php3 2001/04/19 21:05:04 1.12
--- do_enter_db_work.lib.php3 2001/04/21 19:37:40 1.13
***************
*** 142,146 ****
*/
if ($isRegUser)
! $dbLink->query("UPDATE " . C_REG_TBL . " SET reg_time = '$currentTime', ip = '$ip' WHERE username = '$slashedNick'");
--- 142,146 ----
*/
if ($isRegUser)
! $dbLink->query("UPDATE " . C_REG_TBL . " SET reg_time = $currentTime, ip = '$ip' WHERE username = '$slashedNick'");
***************
*** 161,165 ****
if ($targetRoom == $wasInRoom)
{
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', ip = '$ip' WHERE session_id = '$dbSessionId'");
}
--- 161,165 ----
if ($targetRoom == $wasInRoom)
{
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = $currentTime, ip = '$ip' WHERE session_id = '$dbSessionId'");
}
***************
*** 174,182 ****
list($type) = $dbLink->nextRecord();
$dbLink->cleanResults();
! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS exit', '', '$currentTime', NULL, '#666699', 'sprintf(L_EXIT_ROM, \'" . $nickForNotifications . "\')', 'sprintf(L_EXIT_ROM, \'" . $nickForNotifications . "\')')");
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS enter', '', '$currentTime', NULL, '#666699', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')')");
! $dbLink->query("UPDATE " . C_USR_TBL . " SET session_id = '$dbSessionId', u_time = '$currentTime', room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$previousId'");
if (C_WELCOME)
--- 174,192 ----
list($type) = $dbLink->nextRecord();
$dbLink->cleanResults();
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$roomType, '$slashedRoomName', 'SYS exit', '', $currentTime, NULL, '#666699', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')', 'sprintf(L_EXIT_ROM, \'$nickForNotifications\')'"
! . ')';
! $dbLink->query($aQuery);
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$roomType, '$slashedRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')'"
! . ')';
! $dbLink->query($aQuery);
! $dbLink->query("UPDATE " . C_USR_TBL . " SET session_id = '$dbSessionId', u_time = $currentTime, room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$previousId'");
if (C_WELCOME)
***************
*** 184,188 ****
// Delete the old welcome messages sent to the current user
$dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE username = 'SYS welcome' AND address = '$slashedNick'");
! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS welcome', '', '$currentTimePlus', '$slashedNick', '#666699', '" . $slashedWelcomeMsg . "', '" . $slashedWelcomeMsg . "')");
}
}
--- 194,203 ----
// Delete the old welcome messages sent to the current user
$dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE username = 'SYS welcome' AND address = '$slashedNick'");
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$roomType, '$slashedRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg'"
! . ')';
! $dbLink->query($aQuery);
}
}
***************
*** 195,199 ****
{
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', room = '$slashedRoomName', ip = '$ip' WHERE session_id = '$dbSessionId'");
} // end of case where an is relogged because of NS4+ resize bug
--- 210,214 ----
{
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = $currentTime, room = '$slashedRoomName', ip = '$ip' WHERE session_id = '$dbSessionId'");
} // end of case where an is relogged because of NS4+ resize bug
***************
*** 206,213 ****
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
if (isset($reloading) && $reloading == 'joinCmd')
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = '$currentTime', room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$dbSessionId'");
else
! $dbLink->query("INSERT INTO " . C_USR_TBL . " VALUES ('$dbSessionId', '$currentTime', '$slashedRoomName', '$slashedNick', $latin1, '$status', '$ip')");
! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS enter', '', '$currentTime', NULL, '#666699', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')', 'sprintf(L_ENTER_ROM, \'" . $nickForNotifications . "\')')");
if (C_WELCOME)
--- 221,242 ----
$slashedRoomName = pmcSlashSingleQuotes($targetRoom);
if (isset($reloading) && $reloading == 'joinCmd')
! {
! $dbLink->query("UPDATE " . C_USR_TBL . " SET u_time = $currentTime, room = '$slashedRoomName', status = '$status', ip = '$ip' WHERE session_id = '$dbSessionId'");
! }
else
! {
! $aQuery = 'INSERT INTO ' . C_USR_TBL . ' '
! . '(session_id, u_time, room, username, latin1, status, ip) '
! . 'VALUES ('
! . "'$dbSessionId', $currentTime, '$slashedRoomName', '$slashedNick', $latin1, '$status', '$ip'"
! . ')';
! $dbLink->query($aQuery);
! }
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$roomType, '$slashedRoomName', 'SYS enter', '', $currentTime, NULL, '#666699', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')', 'sprintf(L_ENTER_ROM, \'$nickForNotifications\')'"
! . ')';
! $dbLink->query($aQuery);
if (C_WELCOME)
***************
*** 215,219 ****
// Deletes the old welcome messages sent to the current user
$dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE username = 'SYS welcome' AND address = '$slashedNick'");
! $dbLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($roomType, '$slashedRoomName', 'SYS welcome', '', '$currentTimePlus', '$slashedNick', '#666699', '" . $slashedWelcomeMsg . "', '" . $slashedWelcomeMsg . "')");
}
} // end of "all other cases"
--- 244,253 ----
// Deletes the old welcome messages sent to the current user
$dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE username = 'SYS welcome' AND address = '$slashedNick'");
! $aQuery = 'INSERT INTO ' . C_MSG_TBL . ' '
! . '(type, room, username, latin1, m_time, address, color, msg_original, msg_enhanced) '
! . 'VALUES ('
! . "$roomType, '$slashedRoomName', 'SYS welcome', '', $currentTimePlus, '$slashedNick', '#666699', '$slashedWelcomeMsg', '$slashedWelcomeMsg'"
! . ')';
! $dbLink->query($aQuery);
}
} // end of "all other cases"
***************
*** 256,260 ****
while (list($sentTime) = $dbLink->nextRecord())
{
! $dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE m_time = '$sentTime' AND (username = 'SYS inviteFrom' OR (username = 'SYS inviteTo' AND address = '$slashedNick'))");
}
--- 290,294 ----
while (list($sentTime) = $dbLink->nextRecord())
{
! $dbLink->query("DELETE FROM " . C_MSG_TBL . " WHERE m_time = $sentTime AND (username = 'SYS inviteFrom' OR (username = 'SYS inviteTo' AND address = '$slashedNick'))");
}
|