From: Lo?c C. <lo...@us...> - 2001-04-03 20:10:19
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib In directory usw-pr-cvs1:/tmp/cvs-serv3216/chat/lib Modified Files: clean.lib.php3 common.lib.php3 db_sessions.lib.php3 Added Files: banish.lib.php3 check_and_kick_user.lib.php3 format_messages.lib.php3 gen_password.lib.php3 get_ip.lib.php3 Log Message: The first dev. version that works! Still many things to do, of course... --- NEW FILE --- <? // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library allows to ensure the user who wants to enter in the chat is | // | not a banished one. | // | | // | It is called by the 'chat/lib/index_libs/main_index.lib.php3', the | // | 'chat/lib/index_libs/index_validation.lib.php3' and the | // | 'chat/lib/commands/join.cmd.php3' scripts. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // | & Tomas Haluza <th...@ki...> | // | & Fabiano R. Prestes <zo...@po...> | // +--------------------------------------------------------------------------+ // // $Id: banish.lib.php3,v 1.1 2001/04/03 20:10:14 loic1 Exp $ // // Checks for banishment status of the current user. // /** * Initializes some variables and cleans the banished users table */ $isBanished = false; $dbLink->query("DELETE FROM " . C_BAN_TBL . " WHERE ban_until < " . time()); /** * Gets the IP of the user */ if (!defined('_CHAT_PATH')) define('_CHAT_PATH', ''); if (empty($ip)) include('./' . _CHAT_PATH . 'lib/get_ip.lib.' . C_EXTENSION); /** * Searches for a banished nick * * The 'pmcHandleMagicQuotes()' and the 'pmcIsInto()' functions are defined * inside the 'chat/lib/common.lib.php3' library */ $dbLink->query("SELECT ip, rooms FROM " . C_BAN_TBL . " WHERE username = '$slashedNick' LIMIT 1"); // This nick is banished from some rooms if (list($oldIp, $banishedFromRooms) = $dbLink->nextRecord()) { $dbLink->cleanResults(); $banishedFromRooms = pmcHandleMagicQuotes($banishedFromRooms, '', 1, 'del'); // Is the user banished from the room he wants to enter in? if ($banishedFromRooms == '*') { $isBanished = true; } else if (!empty($createRoomName)) { $isBanished = (pmcIsInto($createRoomName, $banishedFromRooms) >= 0); } else if (!empty($enterOtherRoomName)) { $isBanished = (pmcIsInto($enterOtherRoomName, $banishedFromRooms) >= 0); } else if (!empty($enterDefaultRoomName)) { $isBanished = (pmcIsInto($enterDefaultRoomName, $banishedFromRooms) >= 0); } // Update the IP of the user in the banished table if necessary if ($isBanished && $ip != $oldIp && (substr($ip, 0, 1) != 'p' || substr($oldIp, 0, 1) == 'p')) { $dbLink->query("UPDATE " . C_BAN_TBL . " SET ip = '$ip' WHERE username = '$slashedNick'"); } } // end of the case where nick is banished from some rooms // This nick isn't banished from any room, seek for a banished IP else { $dbLink->cleanResults(); $dbLink->query("SELECT rooms, ban_until FROM " . C_BAN_TBL . " WHERE ip = '$ip' LIMIT 1"); // IP is banished from some rooms if (list($banishedFromRooms, $banUntil) = $dbLink->nextRecord()) { $dbLink->cleanResults(); $banishedFromRooms = pmcHandleMagicQuotes($banishedFromRooms, '', 1, 'del'); // Is the IP banished from the room user wants to enter in? if ($banishedFromRooms == '*') { $isBanished = true; } else if (!empty($createRoomName)) { $isBanished = (pmcIsInto($createRoomName, $banishedFromRooms) >= 0); } else if (!empty($enterOtherRoomName)) { $isBanished = (pmcIsInto($enterOtherRoomName, $banishedFromRooms) >= 0); } else if (!empty($enterDefaultRoomName)) { $isBanished = (pmcIsInto($enterDefaultRoomName, $banishedFromRooms) >= 0); } // Add the nick to the banished users table if necessary if ($isBanished) $dbLink->query("INSERT INTO " . C_BAN_TBL . " VALUES ('$slashedNick', '$latin1', '$ip', '$banishedFromRooms', '$banUntil')"); } // end of the case where IP is banished from some rooms else { $dbLink->cleanResults(); } } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library is used to ensure an user is defined inside the connected | // | users table (else it can creates it) and then to get his/her status to | // | enforce him/her to leave the chat if it is required. | // | | // | This library is called by the 'chat/input.php3', the | // | 'chat/handle_input.php3', the 'chat/messages_low.php3' and the | // | 'chat/loader.php3' scripts. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: check_and_kick_user.lib.php3,v 1.1 2001/04/03 20:10:14 loic1 Exp $ // // Checks users existence and kick him/her if required. // /** * Gets/Updates the users' informations from/in the connected users table * * The 'pmcSlashSingleQuotes()', 'pmcHandleMagicQuotes()' and * 'pmcSpecialChars()' functions are defined inside the * 'chat/lib/common.lib.php3' library * * @param boolean whether the connected users table should be updated or not * * @global boolean whether the current character set is 'iso-8859-1' or not * @global string the session id * @global array the session data * @global string the slashed nick of the current user * @global integer the type of the current room * @global string the slashed name of the current room */ function pmcCheckAndKickUser($doUpdate = false) { global $latin1; global $dbSessionId; global $dbSessionVars; global $slashedNick; global $currentRoomType; global $slashedCurrentRoomName; $checkLink = new pmcDB; $checkLink->query("SELECT room, status FROM " . C_USR_TBL . " WHERE username = '$slashedNick' LIMIT 1"); $isLoggedIn = (list($loggedInRoom, $status) = $checkLink->nextRecord()); $checkLink->cleanResults(); // The user exists in the connected users table if ($isLoggedIn) { // Same nick in another room if ($loggedInRoom != $slashedCurrentRoomName) { $checkLink->query("INSERT INTO " . C_MSG_TBL . " VALUES ($currentRoomType, '$slashedCurrentRoomName', 'SYS exit', '', " . time() . ", '', '#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() . ", '', '#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() . ", '', '#666699', 'sprintf(L_BANISHED, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')', 'sprintf(L_BANISHED, \'" . pmcSpecialChars($slashedNick, $latin1) . "\')')"); $dbSessionVars['kicked'] = 4; } // Do exit from the current room if required if (!empty($dbSessionVars['kicked'])) { dbSessionSave(); $exitQueryUrl = '?' . dbSessionSID() . $GLOBALS['pmcQueryArgSeparator'] . 'exitMode=0'; $jsExitUrl = $dbSessionVars['from'] . $exitQueryUrl; $htmlExitUrl = C_CHAT_URL . $exitQueryUrl; $checkLink->close(); // Do exit ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Exit from input</title> <script type="text/javascript" language="javascript"> <!-- window.parent.window.location = '<?php echo($jsExitUrl); ?>'; // --> </script> </head> <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> <?php exit(); } // end of the case where the user has to be left from the current room // Do some updates... else { // ... the status if it has been modified if ($dbSessionVars['status'] != $status) $dbSessionVars['status'] = $status; // ... the time to ensure the user won't be cleaned from the // connected users table $checkLink->query("UPDATE " . C_USR_TBL . " SET u_time = " . time() . " WHERE session_id = '$dbSessionId'"); } } // end the case where the user has been found // The user doesn't exists in the connected users table but it should! else if ($doUpdate) { // Gets the IP address include('./lib/get_ip.lib.' . C_EXTENSION); $checkLink->query("INSERT INTO " . C_USR_TBL . " VALUES ('$dbSessionId', " . time() . ", '$slashedCurrentRoomName', '$slashedNick', '$latin1', '$status', '$ip')"); } // end of the case where user should be in users table $checkLink->close(); } // end of the 'pmcCheckAndKickUser()' function ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library is used to define formated message that will be inserted | // | into the message table and ensure the associated color is valid. | // | | // | This library is called by the 'chat/input.php3' and the | // | 'chat/handle_input.php3' scripts. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: format_messages.lib.php3,v 1.1 2001/04/03 20:10:14 loic1 Exp $ // // Define formated message and the associated color. // /** * Format a message according to the configuartion file directives * * The 'pmcSlashSingleQuotes()', 'pmcHandleMagicQuotes()' and * 'pmcSpecialChars()' functions are defined inside the * 'chat/lib/common.lib.php3' library * * @param string the message sent by the user * * @return string the formatted message * * @global boolean whether the current character set is 'iso-8859-1' or not */ function formatMessage($theMessage) { global $latin1; // Text formating tags if (C_HTML_TAGS_KEEP == 'none') { if (!C_HTML_TAGS_SHOW) { // eliminates every HTML like tags $theMessage = ereg_replace('<[^>]+>', '', $theMessage); } else { // or keep it without effect $theMessage = str_replace('<', '<', $theMessage); $theMessage = str_replace('>', '>', $theMessage); } } else { // then C_HTML_TAGS_KEEP == 'simple', we keep u, b and i tags $theMessage = str_replace('<', '<', $theMessage); $theMessage = str_replace('>', '>', $theMessage); if (@function_exists('preg_match')) { while (preg_match('/<([ubi]?)>(.*?)<(\/\\1)>/i', $theMessage)) { $theMessage = preg_replace('/<([ubi]?)>(.*?)<(\/\\1)>/i', '<\\1>\\2<\\3>', $theMessage); } if (!C_HTML_TAGS_SHOW) { $theMessage = preg_replace('/<\/?[ubi]?>/i', '', $theMessage); } } } // URLs // no prefix (www.myurl.ext) -> add 'http://' $theMessage = eregi_replace('([[:space:]]|^)(www)', '\\1http://\\2', $theMessage); // creates html link $prefix = '(http|https|ftp|telnet|news|gopher|file|wais)://'; $pureUrl = '([[:alnum:]/\n+-=%&:_.~?]+[#[:alnum:]+]*)'; $theMessage = eregi_replace($prefix . $pureUrl, '<a href="\\1://\\2" target="_blank">\\1://\\2</a>', $theMessage); // e-mail addresses $theMessage = eregi_replace('([0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-wyz][a-z](fo|g|l|m|mes|o|op|pa|ro|seum|t|u|v|z)?)', '<a href="mailto:\\1">\\1</a>', $theMessage); // transform ISO-8859-1 special characters if ($latin1) { $pattern = '(.*)(' . $GLOBALS['msgTo']. '(>)?)(.*)'; ereg($pattern, $theMessage, $regs); if ($GLOBALS['msgTo'] != '' && ($regs[1] == '' && $regs[4] == '')) $regs[4] = $theMessage; if (!ereg('&[[:alnum:]]{1,10}', $regs[1]) && !ereg('&[[:alnum:]]{1,10}',$regs[4])) { for ($i = 1; $i <= 4; $i++) { if (($i != 1 && $i != 4) || $regs[$i] == '') continue; $part = $regs[$i]; $part = htmlentities($part); $part = str_replace('<', '<', $part); $part = str_replace('>', '>', $part); $part = str_replace('&lt;', '<', $part); $part = str_replace('&gt;', '>', $part); $part = str_replace('"', '"', $part); $part = ereg_replace('&(#[[:digit:]]{2,5})', '&\\1', $part); $regs[$i] = $part; } $theMessage = $regs[1] . $regs[2] . $regs[4]; } } // end if ($latin1) // Slashes the slash character $theMessage = str_replace('\\', '\\\\', $theMessage); return $theMessage; } // end of the 'formatMessage()' function /** * Check and validate the color of the message * * @param string the color code * * @global array the session data */ function checkColor(&$theColor) { global $dbSessionVars; // Red colors are reserved to the admin or a moderator for the current room if ((ereg('#(FF0000|fc403f|fc4b34|fa582a|f66421|f27119|ec7e11|ec117f|f21971|f62164|fa2a58|fc344b)', $theColor)) && !($dbSessionVars['status'] == 'a' || $dbSessionVars['status'] == 'm')) $theColor = '#000000'; } // end of the 'checkColor()' function ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library is used during the registration process to generate a | // | random password. | // | | // | It is called by the 'chat/profile_reg.php3' script. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: gen_password.lib.php3,v 1.1 2001/04/03 20:10:14 loic1 Exp $ // // Generates a password. // /** * Length of the password to generate */ if (!defined('_MAILV_PSWD_LENGTH')) define('_MAILV_PSWD_LENGTH', 8); /** * Generates the password * * It uses the 'pmcIsInto()' function defined inside the * 'chat/lib/common.lib.php3' script * * Credit for this function goes to halcyon_42. * It can be found here: http://www.zend.com/codex.php?id=149&single=1 * * @return string the password * * @access private */ function genPassword() { // set ASCII range for random character generation $lowerAsciiBound = 50; // '2' $upperAsciiBound = 122; // 'z' // Exclude special characters and some confusing alphanumerics // o,O,0,I,1,l etc $notUse = array(58, 59, 60, 61, 62, 63, 64, 73, 79, 91, 92, 93, 94, 95, 96, 108, 111); $i = 0; $password = ''; while ($i < _MAILV_PSWD_LENGTH) { mt_srand((double)microtime() * 1000000); // random limits within ASCII table $randNum = mt_rand($lowerAsciiBound, $upperAsciiBound); if (pmcIsInto($randNum, $notUse) < 0) { $password = $password . chr($randNum); $i++; } } return $password; } // end of the 'genPassword()' function ?> --- NEW FILE --- <? // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This library will try to get the most probable IP address of an user. | // | It is based on a free of charge 'identifier' script written by Marc | // | Meurrens (http://www.cgsa.net/php). | // | | // | It is called by many of the phpMyChat scripts. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: get_ip.lib.php3,v 1.1 2001/04/03 20:10:14 loic1 Exp $ // // Gets the IP address of an user. // /** * Gets the values of some PHP environment variables that may contain the * IP address * * Uses the 'pmcGrabGlobals()' function defined in the * 'chat/lib/common.lib.php3' library. */ $toGrab = array('REMOTE_ADDR', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED'); pmcGrabGlobals($toGrab); $simpleIp = $REMOTE_ADDR; $trueIp = isset($HTTP_X_FORWARDED_FOR) ? $HTTP_X_FORWARDED_FOR : ''; if ($trueIp == '' && isset($HTTP_X_FORWARDED)) $trueIp = $HTTP_X_FORWARDED; if ($trueIp == '' && isset($HTTP_FORWARDED_FOR)) $trueIp = $HTTP_FORWARDED_FOR; if ($trueIp == '' && isset($HTTP_FORWARDED)) $trueIp = $HTTP_FORWARDED; $isProxy = ($trueIp != ''); if (!$isProxy) { $toGrab = array('HTTP_VIA', 'HTTP_X_COMING_FROM', 'HTTP_COMING_FROM'); pmcGrabGlobals($toGrab); $trueIp = isset($HTTP_VIA) ? $HTTP_VIA : ''; if ($trueIp == '' && isset($HTTP_X_COMING_FROM)) $trueIp = $HTTP_X_COMING_FROM; if ($trueIp == '' && isset($HTTP_COMING_FROM)) $trueIp = $HTTP_COMING_FROM; if ($trueIp != '') $isProxy = '2'; } if ($trueIp == $simpleIp) $isProxy = 0; unset($toGrab); /** * Returns the true IP if it has been found, else the proxy IP prefixed with * a 'p' character */ switch ($isProxy) { case 0: // True IP without proxy $ip = $simpleIp; break; case 1: $b = ereg ('^([0-9]{1,3}\.){3,3}[0-9]{1,3}', $trueIp, $regs); if ($b && (count($regs) > 0)) { // True IP behind a proxy $ip = $regs[0]; } else { // Proxy IP $ip = 'p' . $simpleIp; } break; case 2: // Proxy IP $ip = 'p' . $simpleIp; default: // void } ?> Index: clean.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/clean.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** clean.lib.php3 2001/03/29 22:52:17 1.1 --- clean.lib.php3 2001/04/03 20:10:14 1.2 *************** *** 25,52 **** $chatClean = new pmcDB; $chatClean->query("DELETE FROM " . C_MSG_TBL . " WHERE m_time < " . (time() - C_MSG_DEL * 60 * 60)); ! ! // TODO: This is uggly !!! It must be improved. ! $usrToDeleteQuery = 'SELECT u.session_id FROM ' . C_USR_TBL . ' u, ' . C_SESS_TBL . ' s ' ! . 'WHERE u.session_id = s.session_id ' ! . 'AND ((s.last < ' . (time() - C_USR_DEL * 60) . ') ' ! . 'OR (u.status = \'k\' AND s.last < ' . (time() - 20) . '))'; ! $chatClean->query($usrToDeleteQuery); ! $listToDelete = ''; ! while (list($toDelete) = $chatClean->nextRecord()) ! { ! if (!empty($listToDelete)) ! $listToDelete .= ', '; ! $listToDelete .= '\'' . $toDelete . '\''; ! } ! if (!empty($listToDelete)) ! { ! $usrToDeleteQuery = 'DELETE FROM ' . C_USR_TBL . ' WHERE session_id IN (' . $listToDelete . ')'; ! $chatClean->query($usrToDeleteQuery); ! $isUsrCleaned = ($chatClean->affectedRows() > 0); ! } ! else ! { ! $isUsrCleaned = FALSE; ! } $chatClean->close(); ?> --- 25,30 ---- $chatClean = new pmcDB; $chatClean->query("DELETE FROM " . C_MSG_TBL . " WHERE m_time < " . (time() - C_MSG_DEL * 60 * 60)); ! $chatClean->query("DELETE FROM " . C_USR_TBL . " WHERE u_time < " . (time() - C_USR_DEL * 60) . " OR (status = 'k' AND u_time < " . (time() - 20) . ")"); ! $isUsrCleaned = ($chatClean->affectedRows() > 0); $chatClean->close(); ?> Index: common.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/common.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** common.lib.php3 2001/03/29 22:52:17 1.1 --- common.lib.php3 2001/04/03 20:10:14 1.2 *************** *** 8,28 **** // | This library contains a set of variables and functions used by many of | // | the phpMyChat scripts: | ! // | - $pmcIsPhp4 = whether the current release of phpMyChat | ! // | is 4+ or not | ! // | - $pmcQueryArgSeparator = the separator used in PHP generated URLs | ! // | to separate arguments | ! // | - isInto() = ensures a value exist inside a list or an | ! // | array | ! // | - grabGlobals() = grabs variables from the $HHTP_*_VARS | ! // | arrays | ! // | - handleMagicQuotes() = adds or removes slashes before special | ! // | characters according to the 'magic quotes | ! // | gpc' and the 'magic quotes runtime' PHP | ! // | configuration directives | ! // | - httpHeaders() = sends HTTP headers | ! // | - slashSingleQuotes() = slashes single quotes in a string | ! // | - specialChars() = converts all applicable characters to HTML | ! // | entities, depending on the charset used | ! // | - urlForStyleSheet() = defines the URL of the stylesheet | // +------------------------------------------------------------------------+ // | From the phpMyChat project: | --- 8,29 ---- // | This library contains a set of variables and functions used by many of | // | the phpMyChat scripts: | ! // | - $pmcIsPhp4 = whether the current release of phpMyChat | ! // | is 4+ or not | ! // | - $pmcQueryArgSeparator = the separator used in PHP generated URLs | ! // | to separate arguments | ! // | - pmcIsInto() = ensures a value exist inside a list or an | ! // | array | ! // | - pmcGrabGlobals() = grabs variables from the $HTTP_*_VARS | ! // | arrays | ! // | - pmcHandleMagicQuotes() = adds or removes slashes before special | ! // | characters according to the 'magic quotes | ! // | gpc' and the 'magic quotes runtime' PHP | ! // | configuration directives | ! // | - pmcHttpHeaders() = sends HTTP headers | ! // | - pmcSlashSingleQuotes() = slashes single quotes in a string | ! // | - pmcSpecialChars() = converts all applicable characters to | ! // | HTML entities, depending on the charset | ! // | used | ! // | - pmcUrlForStyleSheet() = defines the URL of the stylesheet | // +------------------------------------------------------------------------+ // | From the phpMyChat project: | *************** *** 69,73 **** * @access public */ ! function isInto($toFind = '', &$in) { $target = (is_array($in)) ? $in : explode(',', $in); --- 70,74 ---- * @access public */ ! function pmcIsInto($toFind = '', &$in) { $target = (is_array($in)) ? $in : explode(',', $in); *************** *** 80,84 **** unset($target); return ($i < $max) ? $i : -1; ! } // end of the 'isInto()' function --- 81,85 ---- unset($target); return ($i < $max) ? $i : -1; ! } // end of the 'pmcIsInto()' function *************** *** 123,127 **** * @access public */ ! function grabGlobals($which = '%ALL') { global $pmcIsPhp4; --- 124,128 ---- * @access public */ ! function pmcGrabGlobals($which = '%ALL') { global $pmcIsPhp4; *************** *** 148,152 **** while (list($key, $value) = each($which)) { ! $ret += grabGlobals($value); } return $ret; --- 149,153 ---- while (list($key, $value) = each($which)) { ! $ret += pmcGrabGlobals($value); } return $ret; *************** *** 158,162 **** // Get the array to handle $atomKeywordsList = array('%ENV', '%GET', '%POST', '%COOKIE', '%SERVER', '%SESSION'); ! if (isInto($which, $atomKeywordsList) >= 0) eval('$theArray = ' . ($pmcIsPhp4 ? '&' : '') . '$GLOBALS[\'HTTP_' . substr($which, 1) . '_VARS\'];'); unset($atomsKeywordsList); --- 159,163 ---- // Get the array to handle $atomKeywordsList = array('%ENV', '%GET', '%POST', '%COOKIE', '%SERVER', '%SESSION'); ! if (pmcIsInto($which, $atomKeywordsList) >= 0) eval('$theArray = ' . ($pmcIsPhp4 ? '&' : '') . '$GLOBALS[\'HTTP_' . substr($which, 1) . '_VARS\'];'); unset($atomsKeywordsList); *************** *** 167,176 **** { $ret = 0; ! $ret += grabGlobals('%ENV'); ! $ret += grabGlobals('%GET'); ! $ret += grabGlobals('%POST'); ! $ret += grabGlobals('%COOKIE'); ! $ret += grabGlobals('%SERVER'); ! $ret += grabGlobals('%SESSION'); // Return true if at least one of the previous actions returns true return $ret; --- 168,177 ---- { $ret = 0; ! $ret += pmcGrabGlobals('%ENV'); ! $ret += pmcGrabGlobals('%GET'); ! $ret += pmcGrabGlobals('%POST'); ! $ret += pmcGrabGlobals('%COOKIE'); ! $ret += pmcGrabGlobals('%SERVER'); ! $ret += pmcGrabGlobals('%SESSION'); // Return true if at least one of the previous actions returns true return $ret; *************** *** 240,244 **** } // end of variable case } ! } // end of the 'grabGlobals()' function --- 241,245 ---- } // end of variable case } ! } // end of the 'pmcGrabGlobals()' function *************** *** 251,257 **** * @access public */ ! function httpHeaders($theCharset = '', $noCache = true) { ! grabGlobals('HTTP_USER_AGENT'); // Avoids using cache --- 252,258 ---- * @access public */ ! function pmcHttpHeaders($theCharset = '', $noCache = true) { ! pmcGrabGlobals('HTTP_USER_AGENT'); // Avoids using cache *************** *** 276,280 **** flush(); ! } // end of the 'httpHeaders()' function --- 277,281 ---- flush(); ! } // end of the 'pmcHttpHeaders()' function *************** *** 293,298 **** * @access public */ ! function urlForStyleSheet( $theCssFileName = '', ! $theCharset = '', $theFontName = '', $theFontSize = '' ) { --- 294,299 ---- * @access public */ ! function pmcUrlForStyleSheet( $theCssFileName = '', ! $theCharset = '', $theFontName = '', $theFontSize = '' ) { *************** *** 306,310 **** return $tmpUrl; ! } // end of the 'urlForStyleSheet()' function --- 307,311 ---- return $tmpUrl; ! } // end of the 'pmcUrlForStyleSheet()' function *************** *** 320,327 **** * @access public */ ! function specialChars($str = '', $isLatin1 = false) { return ($isLatin1) ? htmlentities($str) : htmlspecialchars($str); ! } // end of the 'specialChars()' function --- 321,328 ---- * @access public */ ! function pmcSpecialChars($str = '', $isLatin1 = false) { return ($isLatin1) ? htmlentities($str) : htmlspecialchars($str); ! } // end of the 'pmcSpecialChars()' function *************** *** 343,347 **** * @access public */ ! function handleMagicQuotes($str = '', $isGpcOn = '', $isRtimeOn = '', $action = 'del') { if ($isGpcOn != '') --- 344,348 ---- * @access public */ ! function pmcHandleMagicQuotes($str = '', $isGpcOn = '', $isRtimeOn = '', $action = 'del') { if ($isGpcOn != '') *************** *** 358,362 **** return $str; ! } // end of the 'handleMagicQuotes()' function --- 359,363 ---- return $str; ! } // end of the 'pmcHandleMagicQuotes()' function *************** *** 370,377 **** * @access public */ ! function slashSingleQuotes($str = '') { return str_replace('\'', '\\\'', $str); ! } // end of the 'slashSingleQuotes()' function ?> --- 371,378 ---- * @access public */ ! function pmcSlashSingleQuotes($str = '') { return str_replace('\'', '\\\'', $str); ! } // end of the 'pmcSlashSingleQuotes()' function ?> Index: db_sessions.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/db_sessions.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 |