From: Lo?c C. <lo...@us...> - 2001-04-03 20:17:44
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib In directory usw-pr-cvs1:/tmp/cvs-serv6312/chat/lib Added Files: swearing.lib.php3 upgrades.lib.php3 welcome.lib.php3 Log Message: The first dev. version that works! Still many things to do, of course... --- NEW FILE --- <? // This library allows to check for "bad words". Users cannot login or create a room with such words, // in messages they are replaced by the "@#$*!" string or the one you choose. // Credit for this lib goes to Gustavo Iwamoto <iw...@za...> and Fabiano R. Prestes <zo...@po...> function checkwords ($String, $TestOnly) { // You can add the words you don't want users to use in the $BadWords array bellow. As an eregi // function is called to find them in strings, you may use valid POSIX 1003.2 regular expressions // (see second line of the array for an example). // Note that search is not case sensitive, except for special characters such as accentued ones. $BadWords = array ( "shit", "fuck([[:alpha:]]*)" ); $ReplaceString = "@#$*!"; // String that will replace "bad words" // Don't modify lines bellow $Found = false; for (reset($BadWords); $ToFind = current($BadWords); next($BadWords)) { $Found = eregi(addslashes($ToFind), $String); if ($Found) { if ($TestOnly) { break; } else { $String = eregi_replace(addslashes($ToFind), $ReplaceString, $String); }; }; }; unset($BadWords); return ($TestOnly ? $Found : $String); } ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This script is used to ensure compatibility with older releases of | // | phpMyChat. | // | | // | It is called by most of the scripts from the phpMyChat package. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: upgrades.lib.php3,v 1.1 2001/04/03 20:17:40 loic1 Exp $ // // Ensure compatibility with older releases of phpMyChat. // /** * Updates the names of the cookies */ // If cookies haven't already been updated, do the work if (isset($CookieLang)) { $oldCookies = array(); if (isset($CookieBeep)) $oldCookies['CookieBeep'] = $CookieBeep; if (isset($CookieColor)) $oldCookies['CookieColor'] = $CookieColor; if (isset($CookieLang)) $oldCookies['CookieLang'] = $CookieLang; if (isset($CookieMsgOrder)) $oldCookies['CookieMsgOrder'] = $CookieMsgOrder; if (isset($CookieNotify)) $oldCookies['CookieNotify'] = $CookieNotify; if (isset($CookieRoom)) $oldCookies['CookieRoom'] = $CookieRoom; if (isset($CookieRoomType)) $oldCookies['CookieRoomType'] = $CookieRoomType; if (isset($CookieShowTimestamp)) $oldCookies['CookieShowTimestamp'] = $CookieShowTimestamp; if (isset($CookieUsername)) $oldCookies['CookieUsername'] = $CookieUsername; // Defines the new cookies (they will expire in one year) and kills the // old ones $newExpireTime = time() + (60 * 60 * 24 * 365); $delExpireTime = time() - (60 * 60 * 24 * 365); while (list($oldName, $value) = each($oldCookies)) { $newName = str_replace('Cookie', 'cookie', $oldName); setcookie($newName, $value, $newExpireTime); setcookie($oldName, '', $delExpireTime); $$newName = $value; unset($$oldName); } unset($oldCookies); } // end of 'cookies haven't been already been updated' /** * Udpates variables sent by the starting page of phpMyChat */ // If settings from an old release of phpMyChat seems to be used, do the work if (isset($Form_Send)) { $submitType = $Form_Send; unset($Form_Send); if (isset($L)) { $lang = $L; unset($L); } if (isset($Ver)) { switch ($Ver) { case 'H': $jsVersion = 'high'; break; case 'M': $jsVersion = 'medium'; break; default: $jsVersion = 'low'; } unset($Ver); } if (isset($N) && empty($submitType)) { $submitType = 'done'; } if (isset($U)) { $nick = $U; unset($U); } if (isset($PASSWORD)) { $password = $PASSWORD; unset($PASSWORD); } if (isset($R0)) { $enterDefaultRoomName = $R0; unset($R0); } if (isset($R1)) { $enterOtherRoomName = $R1; unset($R1); } if (isset($T)) { $roomType = $T; unset($T); } if (isset($R2)) { $createRoomName = $R2; unset($R2); } } // end of the case where an old release seems to send settings ?> --- NEW FILE --- <?php // // +--------------------------------------------------------------------------+ // | phpMyChat version 0.15.0 | // +--------------------------------------------------------------------------+ // | Copyright (c) 2000-2001 The phpHeaven-team | // +--------------------------------------------------------------------------+ // | This script defines the welcome message to be used when the 'C_WELCOME' | // | directive is set to 1 inside the 'chat/config/config.lib.php3' file. | // | | // | It is called by the 'chat/messages_low.php3' and 'chat/loader.php3' | // | scripts. | // +--------------------------------------------------------------------------+ // | From the phpMyChat project: | // | http://www.phpheaven.net/projects/phpMyChat/ | // | | // | Authors: the phpHeaven-team <php...@ya...> | // +--------------------------------------------------------------------------+ // // $Id: welcome.lib.php3,v 1.1 2001/04/03 20:17:40 loic1 Exp $ // // Defines the welcome message. // switch ($dbSessionVars['lang']) { case 'french': // For french users define('WELCOME_MSG', 'Bienvenu(e) sur notre chat. N\'oubliez pas les <i>règles de politesse élémentaire</i> au cours de vos discussions.'); break; case 'english': // For english users define('WELCOME_MSG', 'Welcome to our chat. Please obey the net etiquette while chatting: <i>try to be pleasant and polite</i>.'); break; default: // When there is no translation for the language of the user define('WELCOME_MSG', 'Welcome to our chat. Please obey the net etiquette while chatting: <i>try to be pleasant and polite</i>.'); } ?> |