diff options
-rw-r--r-- | ajax/chat.ajax.php | 46 | ||||
-rw-r--r-- | includes/chats.php | 44 | ||||
-rw-r--r-- | pages/cp.php | 7 |
3 files changed, 48 insertions, 49 deletions
diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index 2561619..02a11c6 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -70,7 +70,7 @@ if (isset($_REQUEST['messages'])) { $messages = $_REQUEST['messages'];
$messages = explode("|:|", $messages);
foreach ($messages as $message) {
- $message = chatFilter($message);
+ $message = filterStringForBadLanguage($message);
if ($message[0] == "/") {
$arguements = explode(" ", substr($message, 1));
$command = $arguements[0];
@@ -142,48 +142,4 @@ function prepareChatData($data) { }
return $data;
}
-
-function chatFilter($chat) {
- //cuss words
- $chat = str_ireplace("fuck you", "i am moron", $chat);
- $chat = preg_replace("/[f]+\s*[uv]+\s*[h]*\s*[c\(k]+\s*(([i]*\s*[n]*\s*[g])|([e]*\s*[r]*))*/i", "dumb ", $chat); //fucker / fucking
- $chat = preg_replace("/[^a-z]fag(g?[oi]t)?/i", " prince", $chat); //faggot
- $chat = preg_replace("/^fag(g?[oi]t)?/i", "prince", $chat); //faggot (beginning of line)
- $chat = preg_replace("/^suck\s*my.*(cock|dick|penis)/i", "join me in a riveting game of checkers", $chat); //suck my dick
-
- $chat = str_ireplace("damn", "dumb", $chat);
- $chat = str_ireplace("bull shit", "cow doodoo of the male variety", $chat);
- $chat = str_ireplace("shit", "poo", $chat);
- $chat = str_ireplace("sucks ass", "is dumb", $chat);
- $chat = str_ireplace("suck ass", "are dumb", $chat);
- $chat = str_ireplace("damnit", "do'h", $chat);
- $chat = str_ireplace("sonuvabitch", "fiddlesticks", $chat);
-
- $chat = str_ireplace("a bitch", "an engaging conversationalist", $chat);
- $chat = str_ireplace("bitch", "engaging conversationalist", $chat);
- $chat = str_ireplace("an asshole", "a pleasant person to be around", $chat);
- $chat = str_ireplace("asshole", "pleasant person to be around", $chat);
-
- $chat = str_ireplace("cock", "elbow", $chat);
- $chat = str_ireplace("dick", "elbow", $chat);
- $chat = str_ireplace("penis", "elbow", $chat);
- $chat = str_ireplace("vagina", "femur bone", $chat);
- $chat = str_ireplace("cunt", "femur bone", $chat);
-
- //$chat = str_ireplace("hell", "the supermarket", $chat);
- $chat = str_ireplace("whore", "entrepreneur", $chat);
- $chat = str_ireplace("stfu", "be still my beating heart", $chat);
- $chat = str_ireplace("omfg", "omg", $chat);
- $chat = str_ireplace("4chan", "NEWT GINGRICH", $chat);
- $chat = str_ireplace("nigger", "classy gentleman", $chat);
- $chat = str_ireplace("pedophile", "Optimus Prime", $chat);
- $chat = str_ireplace(" rape", " shake hands with", $chat);
-
- //Easter Eggs
- $chat = str_ireplace("i just pwned Snap", "Snap just totally pwned me ^^", $chat);
- $chat = str_ireplace("i just pwned Blue", "Blue just epicly pwned me the with chat filter", $chat);
- $chat = str_ireplace("language filter", "highly educated team of monkeys employed to filter bad language", $chat);
- $chat = str_ireplace("chat filter", "highly educated team of monkeys employed to filter bad language", $chat);
- return $chat;
-}
?>
\ No newline at end of file diff --git a/includes/chats.php b/includes/chats.php index 6991a48..7db4c58 100644 --- a/includes/chats.php +++ b/includes/chats.php @@ -91,5 +91,47 @@ function getChat($startID = 0) { return $array;
}
-
+function filterStringForBadLanguage($chat) {
+ //cuss words
+ $chat = str_ireplace("fuck you", "i am moron", $chat);
+ $chat = preg_replace("/[f]+\s*[uv]+\s*[h]*\s*[c\(k]+\s*(([i]*\s*[n]*\s*[g])|([e]*\s*[r]*))*/i", "dumb ", $chat); //fucker / fucking
+ $chat = preg_replace("/[^a-z]fag(g?[oi]t)?/i", " prince", $chat); //faggot
+ $chat = preg_replace("/^fag(g?[oi]t)?/i", "prince", $chat); //faggot (beginning of line)
+ $chat = preg_replace("/^suck\s*my.*(cock|dick|penis)/i", "join me in a riveting game of checkers", $chat); //suck my dick
+
+ $chat = str_ireplace("damn", "dumb", $chat);
+ $chat = str_ireplace("bull shit", "cow doodoo of the male variety", $chat);
+ $chat = str_ireplace("shit", "poo", $chat);
+ $chat = str_ireplace("sucks ass", "is dumb", $chat);
+ $chat = str_ireplace("suck ass", "are dumb", $chat);
+ $chat = str_ireplace("damnit", "do'h", $chat);
+ $chat = str_ireplace("sonuvabitch", "fiddlesticks", $chat);
+
+ $chat = str_ireplace("a bitch", "an engaging conversationalist", $chat);
+ $chat = str_ireplace("bitch", "engaging conversationalist", $chat);
+ $chat = str_ireplace("an asshole", "a pleasant person to be around", $chat);
+ $chat = str_ireplace("asshole", "pleasant person to be around", $chat);
+
+ $chat = str_ireplace("cock", "elbow", $chat);
+ $chat = str_ireplace("dick", "elbow", $chat);
+ $chat = str_ireplace("penis", "elbow", $chat);
+ $chat = str_ireplace("vagina", "femur bone", $chat);
+ $chat = str_ireplace("cunt", "femur bone", $chat);
+
+ //$chat = str_ireplace("hell", "the supermarket", $chat);
+ $chat = str_ireplace("whore", "entrepreneur", $chat);
+ $chat = str_ireplace("stfu", "be still my beating heart", $chat);
+ $chat = str_ireplace("omfg", "omg", $chat);
+ $chat = str_ireplace("4chan", "NEWT GINGRICH", $chat);
+ $chat = str_ireplace("nigger", "classy gentleman", $chat);
+ $chat = str_ireplace("pedophile", "Optimus Prime", $chat);
+ $chat = str_ireplace(" rape", " shake hands with", $chat);
+
+ //Easter Eggs
+ $chat = str_ireplace("i just pwned Snap", "Snap just totally pwned me ^^", $chat);
+ $chat = str_ireplace("i just pwned Blue", "Blue just epicly pwned me the with chat filter", $chat);
+ $chat = str_ireplace("language filter", "highly educated team of monkeys employed to filter bad language", $chat);
+ $chat = str_ireplace("chat filter", "highly educated team of monkeys employed to filter bad language", $chat);
+ return $chat;
+}
?>
\ No newline at end of file diff --git a/pages/cp.php b/pages/cp.php index d5fff2b..0f355f4 100644 --- a/pages/cp.php +++ b/pages/cp.php @@ -32,6 +32,7 @@ if (!$accepted) { include('./includes/maps.php');
include_once('./includes/sqlEmbedded.php');
+include_once('./includes/chats.php');
function validatename($name) {
if (strlen($name) < 1) return "Name to short";
@@ -68,7 +69,6 @@ function setOptedOutOfEmails($userID, $setting) { if (isset($_POST['updateSettings']) AND $_POST['updateSettings'] == 'true') {
$userID = $_SESSION['userID'];
if (isset($_POST['displayName'])) {
-
//$inputname = stripSlashes($_POST['displayName']);
$inputname = $_POST['displayName'];
//Validate before replacements. To perevent < becoming > (longer)
@@ -76,9 +76,9 @@ if (isset($_POST['updateSettings']) AND $_POST['updateSettings'] == 'true') { //$inputname = htmlentities($inputname);
$inputname = htmlspecialchars($inputname, ENT_COMPAT | ENT_HTML5);
- $inputname = chatFilter($inputname);
+ $inputname = filterStringForBadLanguage($inputname);
$inputname = str_replace(" ", " ", $inputname);
-
+
if ($nameError === true) {
$inputname = sql_clean($inputname);
$sql = "UPDATE `users`
@@ -86,6 +86,7 @@ if (isset($_POST['updateSettings']) AND $_POST['updateSettings'] == 'true') { WHERE `ID` = '$userID'
";
mysql_query($sql);
+
$_SESSION['displayName'] = $inputname;
$r .= "<br />Name change success!";
} else {
|