From: Lo?c C. <lo...@us...> - 2001-04-10 09:38:18
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib In directory usw-pr-cvs1:/tmp/cvs-serv12897/chat/lib Modified Files: format_messages.lib.php3 Log Message: Changed a bit format_messages.lib.php3 and removed trailing whitespaces Index: format_messages.lib.php3 =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/format_messages.lib.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** format_messages.lib.php3 2001/04/03 20:10:14 1.1 --- format_messages.lib.php3 2001/04/10 09:38:14 1.2 *************** *** 26,29 **** --- 26,47 ---- /** + * 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 + + + /** * Format a message according to the configuartion file directives * *************** *** 42,45 **** --- 60,73 ---- global $latin1; + // Ensure color is valid + checkColor($GLOBALS['color']); + + // Remove swearings + if (C_BAD_WORDS) + { + include('./lib/swearing.lib.' . C_EXTENSION); + $theMessage = checkWords($theMessage, false); + } + // Text formating tags if (C_HTML_TAGS_KEEP == 'none') *************** *** 95,99 **** && ($regs[1] == '' && $regs[4] == '')) $regs[4] = $theMessage; ! if (!ereg('&[[:alnum:]]{1,10}', $regs[1]) && !ereg('&[[:alnum:]]{1,10}',$regs[4])) --- 123,127 ---- && ($regs[1] == '' && $regs[4] == '')) $regs[4] = $theMessage; ! if (!ereg('&[[:alnum:]]{1,10}', $regs[1]) && !ereg('&[[:alnum:]]{1,10}',$regs[4])) *************** *** 103,143 **** 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 ?> --- 131,153 ---- 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 ?> |