|
From: Lo?c C. <lo...@us...> - 2001-04-11 23:06:16
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib
In directory usw-pr-cvs1:/tmp/cvs-serv1253/chat/lib
Modified Files:
smilies.lib.php3 format_messages.lib.php3 db_sessions.lib.php3
check_and_kick_user.lib.php3
Log Message:
Two many modifications, I can't detail
Index: smilies.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/smilies.lib.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** smilies.lib.php3 2001/04/10 15:03:35 1.2
--- smilies.lib.php3 2001/04/11 23:06:14 1.3
***************
*** 77,86 ****
* @return string the formatted string
*
* @access public
*/
! function checkForSmilies(&$string, &$theSmilies)
{
! $tmp = split('<a href|</a>', ' ' . $string . ' ');
! $i = 0;
for (reset($tmp); $substring = current($tmp); next($tmp))
--- 77,90 ----
* @return string the formatted string
*
+ * @global array the smilies array
+ *
* @access public
*/
! function pmcCheckForSmilies(&$string)
{
! global $smilies;
!
! $tmp = split('<a href|</a>', ' ' . $string . ' ');
! $i = 0;
for (reset($tmp); $substring = current($tmp); next($tmp))
***************
*** 94,98 ****
else if (($i % 2) == 0)
{
! while (list($key, $prop) = each($theSmilies))
{
$substring = ereg_replace($key, ' <img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] . '" alt="' . str_replace('"', '"', stripslashes($key)) . '" /> ', $substring);
--- 98,102 ----
else if (($i % 2) == 0)
{
! while (list($key, $prop) = each($smilies))
{
$substring = ereg_replace($key, ' <img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] . '" alt="' . str_replace('"', '"', stripslashes($key)) . '" /> ', $substring);
***************
*** 109,113 ****
$string = trim(join('', $tmp));
unset($tmp);
! } // end of the 'checkForSmilies()' function
--- 113,117 ----
$string = trim(join('', $tmp));
unset($tmp);
! } // end of the 'pmcCheckForSmilies()' function
***************
*** 115,132 ****
* Display smilies in the help popup and in the tutorials
*
- * @param array the list of smilies codes in HTML format
- * @param array the smilies array
- * @param integer the smilies number
* @param string the script to put smilies code into ('help' or 'tutorial')
*
! * @return string the formatted string
*
! * @global integer the maximum width among similes
! * @global integer the maximum height among similes
*
* @access public
*/
! function displaySmilies(&$toDisplay, &$theSmilies, &$theSmiliesCnt, $target)
{
global $maxWidth, $maxHeight;
--- 119,135 ----
* Display smilies in the help popup and in the tutorials
*
* @param string the script to put smilies code into ('help' or 'tutorial')
*
! * @return array the formatted list of smilies
*
! * @global array the smilies array
! * @global integer the maximum width among smilies
! * @global integer the maximum height among smilies
*
* @access public
*/
! function pmcDisplaySmilies($target = 'tutorial')
{
+ global $smilies;
global $maxWidth, $maxHeight;
***************
*** 135,145 ****
$str2 = '';
$perLines = floor(600 / $maxWidth);
! while(list($key, $prop) = each($theSmilies))
{
$i++;
if ($target == 'help')
! $str1 .= "\t\t" . '<td align="center" width="'. $maxWidth . '" height="' . $maxHeight . '"><a href="#" onclick="smiley2Input(\'' . specialSlash($key) . '\'); return false;"><img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] .'" border="0" alt="' . str_replace('"', '"', stripslashes($key)) . '" /></a></td>' . "\n";
else
$str1 .= "\t\t" . '<td align="center" width="'. $maxWidth . '" height="' . $maxHeight . '"><img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] .'" border="0" alt="' . str_replace('"', '"', stripslashes($key)) . '" /></td>' . "\n";
--- 138,150 ----
$str2 = '';
$perLines = floor(600 / $maxWidth);
+ $smilCnt = count($smilies);
+ $ret = array();
! while (list($key, $prop) = each($smilies))
{
$i++;
if ($target == 'help')
! $str1 .= "\t\t" . '<td align="center" width="'. $maxWidth . '" height="' . $maxHeight . '"><a href="#" onclick="pmcSmiley2Input(\'' . specialSlash($key) . '\'); return false"><img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] .'" border="0" alt="' . str_replace('"', '"', stripslashes($key)) . '" /></a></td>' . "\n";
else
$str1 .= "\t\t" . '<td align="center" width="'. $maxWidth . '" height="' . $maxHeight . '"><img src="images/smilies/' . $prop[0] . '" width="' . $prop[1] . '" height="' . $prop[2] .'" border="0" alt="' . str_replace('"', '"', stripslashes($key)) . '" /></td>' . "\n";
***************
*** 147,159 ****
$str2 .= "\t\t" . '<td align="center" nowrap="nowrap">' . stripslashes($key) . '</td>' . "\n";
! if (is_integer($i / $perLines) || $i == $theSmiliesCnt)
{
! $toDisplay[] = $str1;
! $toDisplay[] = $str2;
$str1 = '';
$str2 = '';
}
}
! } // end of the 'displaySmilies()' function
?>
--- 152,166 ----
$str2 .= "\t\t" . '<td align="center" nowrap="nowrap">' . stripslashes($key) . '</td>' . "\n";
! if (is_integer($i / $perLines) || $i == $smilCnt)
{
! $ret[] = $str1;
! $ret[] = $str2;
$str1 = '';
$str2 = '';
}
}
!
! return $ret;
! } // end of the 'pmcDisplaySmilies()' function
?>
Index: format_messages.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/format_messages.lib.php3,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** format_messages.lib.php3 2001/04/10 09:38:14 1.2
--- format_messages.lib.php3 2001/04/11 23:06:14 1.3
***************
*** 64,68 ****
// Remove swearings
! if (C_BAD_WORDS)
{
include('./lib/swearing.lib.' . C_EXTENSION);
--- 64,68 ----
// Remove swearings
! if (C_NO_SWEAR)
{
include('./lib/swearing.lib.' . C_EXTENSION);
Index: db_sessions.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/db_sessions.lib.php3,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** db_sessions.lib.php3 2001/04/10 14:19:48 1.3
--- db_sessions.lib.php3 2001/04/11 23:06:14 1.4
***************
*** 378,382 ****
// Garbage collection
! $dbSessionDbLink->query("DELETE FROM " . $dbSessionDbTable . " WHERE last < " . (time() - $dbSessionLifeTime));
// Try to get the session ID from a cookie if no one exists yet
--- 378,382 ----
// Garbage collection
! $dbSessionDbLink->query("DELETE FROM $dbSessionDbTable WHERE last < " . (time() - $dbSessionLifeTime));
// Try to get the session ID from a cookie if no one exists yet
***************
*** 392,396 ****
{
// The ID exists in the database -> get session data
! $dbSessionDbLink->query("SELECT data FROM " . $dbSessionDbTable . " WHERE session_id = '" . $dbSessionId . "' LIMIT 1");
if (list($serialized) = $dbSessionDbLink->nextRecord())
{
--- 392,396 ----
{
// The ID exists in the database -> get session data
! $dbSessionDbLink->query("SELECT data FROM $dbSessionDbTable WHERE session_id = '$dbSessionId' LIMIT 1");
if (list($serialized) = $dbSessionDbLink->nextRecord())
{
***************
*** 602,606 ****
}
! $dbSessionDbLink->query("DELETE FROM " . $dbSessionDbTable ." WHERE session_id = '" . $dbSessionId ."'");
$dbSessionDbLink->close();
unset($GLOBALS['dbSessionDbLink']);
--- 602,606 ----
}
! $dbSessionDbLink->query("DELETE FROM $dbSessionDbTable WHERE session_id = '$dbSessionId'");
$dbSessionDbLink->close();
unset($GLOBALS['dbSessionDbLink']);
***************
*** 654,666 ****
}
! $dbSessionDbLink->query("SELECT COUNT(*) FROM " . $dbSessionDbTable . " WHERE session_id = '" . $dbSessionId . "'");
list($nb) = $dbSessionDbLink->nextRecord();
if ($nb)
{
! $dbSessionDbLink->query("UPDATE " . $dbSessionDbTable ." SET data = '" . $serialized . "', last = " . time() . " WHERE session_id = '" . $dbSessionId . "'");
}
else
{
! $dbSessionDbLink->query("INSERT INTO " . $dbSessionDbTable . " (session_id, last, data) VALUES ('" . $dbSessionId . "', " . time() . ", '" . $serialized . "')");
}
--- 654,666 ----
}
! $dbSessionDbLink->query("SELECT COUNT(*) FROM $dbSessionDbTable WHERE session_id = '$dbSessionId'");
list($nb) = $dbSessionDbLink->nextRecord();
if ($nb)
{
! $dbSessionDbLink->query("UPDATE $dbSessionDbTable SET data = '$serialized', last = " . time() . " WHERE session_id = '$dbSessionId'");
}
else
{
! $dbSessionDbLink->query("INSERT INTO $dbSessionDbTable (session_id, last, data) VALUES ('$dbSessionId', " . time() . ", '$serialized')");
}
Index: check_and_kick_user.lib.php3
===================================================================
RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/check_and_kick_user.lib.php3,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** check_and_kick_user.lib.php3 2001/04/10 14:19:48 1.6
--- check_and_kick_user.lib.php3 2001/04/11 23:06:14 1.7
***************
*** 63,88 ****
// Same nick in another room
if ($loggedInRoom != $slashedCurrentRoomName)
- {
- echo($loggedInRoom . ' ' . $slashedCurrentRoomName); exit();
- $checkLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($currentRoomType, '$slashedCurrentRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf(L_EXIT_ROM, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')', 'sprintf(L_EXIT_ROM, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')')");
$dbSessionVars['kicked'] = 1;
! }
// The admin just deleted the room
else if ($status == 'd')
- {
$dbSessionVars['kicked'] = 2;
! }
// Kicked by a moderator or the admin.
else if ($status == 'k')
- {
- $checkLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($currentRoomType, '$slashedCurrentRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf(L_KICKED, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')', 'sprintf(L_KICKED, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')')");
$dbSessionVars['kicked'] = 3;
! }
// Banished by a moderator or the admin.
else if ($status == 'b')
- {
- $checkLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($currentRoomType, '$slashedCurrentRoomName', 'SYS exit', '', " . time() . ", NULL, '#666699', 'sprintf(L_BANISHED, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')', 'sprintf(L_BANISHED, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')')");
$dbSessionVars['kicked'] = 4;
- }
// Do exit from the current room if required
--- 63,79 ----
// Same nick in another room
if ($loggedInRoom != $slashedCurrentRoomName)
$dbSessionVars['kicked'] = 1;
!
// The admin just deleted the room
else if ($status == 'd')
$dbSessionVars['kicked'] = 2;
!
// Kicked by a moderator or the admin.
else if ($status == 'k')
$dbSessionVars['kicked'] = 3;
!
// Banished by a moderator or the admin.
else if ($status == 'b')
$dbSessionVars['kicked'] = 4;
// Do exit from the current room if required
***************
*** 90,94 ****
{
dbSessionSave();
! $exitQueryUrl = '?' . dbSessionSID() . $GLOBALS['pmcQueryArgSeparator'] . 'exitMessage=0';
$jsExitUrl = $dbSessionVars['from'] . $exitQueryUrl;
$htmlExitUrl = C_CHAT_URL . $exitQueryUrl;
--- 81,85 ----
{
dbSessionSave();
! $exitQueryUrl = '?' . dbSessionSID() . $GLOBALS['pmcQueryArgSeparator'] . 'exitMessage=1';
$jsExitUrl = $dbSessionVars['from'] . $exitQueryUrl;
$htmlExitUrl = C_CHAT_URL . $exitQueryUrl;
***************
*** 109,115 ****
<body>
<!-- For browser that do not support JavaScript -->
! <p><b>
! <a href="<?php echo($htmlExitUrl); ?>" target="_parent"><?php echo(C_CHAT_URL); ?></a>
! </b></p>
</body>
</html>
--- 100,106 ----
<body>
<!-- For browser that do not support JavaScript -->
! <p>
! <a href="<?php echo($htmlExitUrl); ?>" target="_parent"><b><?php echo(C_CHAT_URL); ?></b></a>
! </p>
</body>
</html>
|