From e2b520720335efdcc9321a3dca5daa9556b7f8a2 Mon Sep 17 00:00:00 2001 From: git Date: Thu, 21 Feb 2013 02:50:24 -0600 Subject: BUGFIX: Chat filter is case sensitive --- ajax/chat.ajax.php | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index 2a55c23..ae00b6f 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -112,20 +112,19 @@ function prepareChatData($data) { function chatFilter($chat) { //cuss words - $chat = str_replace("fuck you", "i am moron", $chat); - $chat = str_replace("fuck", "dumb", $chat); - - $chat = str_replace("asshole", "dumb", $chat); - $chat = str_replace("damnit", "dumb", $chat); - $chat = str_replace("damn", "dumb", $chat); - $chat = str_replace("cunt", "dumb", $chat); - $chat = str_replace("shit", "dumb", $chat); - $chat = str_replace("bitch", "dumb", $chat); - $chat = str_replace("sucks ass", "is dumb", $chat); - $chat = str_replace("suck ass", "is dumb", $chat); - $chat = str_replace("stfu", "shutup", $chat); - $chat = str_replace("omfg", "omg", $chat); - $chat = str_replace("fuk", "dumb", $chat); + $chat = str_ireplace("fuck you", "i am moron", $chat); + $chat = preg_replace("[fF]+\s*[uUvV]+\s*[hH]*\s*[cC\(kK]+\s*[iI]*\s*[nN]*\s*[gG]*", "dumb", $chat); + $chat = str_ireplace("asshole", "dumb", $chat); + $chat = str_ireplace("damnit", "do'h", $chat); + $chat = str_ireplace("damn", "dumb", $chat); + $chat = str_ireplace("cunt", "dumb", $chat); + $chat = str_ireplace("shit", "dumb", $chat); + $chat = str_ireplace("bitch", "dumb", $chat); + $chat = str_ireplace("cock", "elbow", $chat); + $chat = str_ireplace("sucks ass", "is dumb", $chat); + $chat = str_ireplace("suck ass", "are dumb", $chat); + $chat = str_ireplace("stfu", "be still my beating heart", $chat); + $chat = str_ireplace("omfg", "omg", $chat); return $chat; } -- cgit v1.2.3 From 35dfdc948211d422d52b98a93407c56ac5a67448 Mon Sep 17 00:00:00 2001 From: git Date: Thu, 21 Feb 2013 02:51:02 -0600 Subject: Fixing DB updates to grab names of complex maps as well --- db updates.sql | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/db updates.sql b/db updates.sql index 100c9ed..938e46d 100644 --- a/db updates.sql +++ b/db updates.sql @@ -58,46 +58,45 @@ DROP TABLE `userData`; ALTER TABLE `users` ADD `dateChatGaggedUntil` DATETIME NULL , ADD `isOptedOutOfEmails` BOOLEAN NOT NULL DEFAULT '0'; --- Set the name column in maps table +-- Most special maps (and some others) have the map-name in the map code. Copy it to the name column. +UPDATE maps +INNER JOIN +( + -- Get the code substring, starting at the map name + SELECT SUBSTRING(code, LENGTH(SUBSTRING_INDEX(code, '.', 5))+2) AS codeSubstring, Id + FROM (SELECT code, Id FROM maps) AS mapsInner +) AS mapsOuter ON maps.Id = mapsOuter.Id +INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId +SET maps.name = SUBSTRING(codeSubstring, 1, INSTR(codeSubstring, ':')-2) +WHERE maps.name IS NULL; + +-- Rename the remaining maps UPDATE maps INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId SET maps.name = 'Simple' WHERE mapOfTheDay.mapType = 1 -AND maps.name IS NULL; +AND (maps.name IS NULL OR maps.name = ''); UPDATE maps INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId SET maps.name = 'Normal' WHERE mapOfTheDay.mapType = 2 -AND maps.name IS NULL; +AND (maps.name IS NULL OR maps.name = ''); UPDATE maps INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId SET maps.name = 'Complex' WHERE mapOfTheDay.mapType = 3 -AND maps.name IS NULL; - -UPDATE maps -INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId -SET maps.name = 'Ultra Complex' -WHERE mapOfTheDay.mapType = 5 -AND maps.name IS NULL; +AND (maps.name IS NULL OR maps.name = ''); --- Most special maps (and some others) have the map-name in the map code. Copy it to the name column. UPDATE maps -INNER JOIN -( - -- Get the code substring, starting at the map name - SELECT SUBSTRING(code, LENGTH(SUBSTRING_INDEX(code, '.', 5))+2) AS codeSubstring, Id - FROM (SELECT code, Id FROM maps) AS mapsInner -) AS mapsOuter ON maps.Id = mapsOuter.Id INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId -SET maps.name = SUBSTRING(codeSubstring, 1, INSTR(codeSubstring, ':')-2) -WHERE maps.name IS NULL; +SET maps.name = 'Special' +WHERE mapOfTheDay.mapType = 4 +AND (maps.name IS NULL OR maps.name = ''); --- Rename the remaining special maps UPDATE maps INNER JOIN mapOfTheDay ON maps.Id = mapOfTheDay.mapId -SET maps.name = 'Special' -WHERE mapOfTheDay.mapType = 4 +SET maps.name = 'Ultra Complex' +WHERE mapOfTheDay.mapType = 5 AND (maps.name IS NULL OR maps.name = ''); \ No newline at end of file -- cgit v1.2.3 From f394ba40a189669beafe824f80497401e01c2315 Mon Sep 17 00:00:00 2001 From: git Date: Thu, 21 Feb 2013 02:51:17 -0600 Subject: Fixing a quick injection --- do.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/do.php b/do.php index 758ee7d..ae8ccc3 100644 --- a/do.php +++ b/do.php @@ -157,7 +157,7 @@ if ($_GET['r'] == 'getpath') { // Enables the ability to discover an exact duplicate solution. $solution = formSolution($_GET['solution']); - $userID = $_SESSION['userID']; + $userID = $_SESSION['userID'] + 0; //valid mapID? $mapID = $_GET[mapid] + 0; -- cgit v1.2.3 From 443f381e7f86b92edc0bf546cdfe69920ed1e079 Mon Sep 17 00:00:00 2001 From: BlueRaja Date: Thu, 21 Feb 2013 03:22:09 -0600 Subject: Added a few more chat filters :) --- ajax/chat.ajax.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ajax/chat.ajax.php b/ajax/chat.ajax.php index ae00b6f..02fc396 100644 --- a/ajax/chat.ajax.php +++ b/ajax/chat.ajax.php @@ -113,7 +113,9 @@ function prepareChatData($data) { function chatFilter($chat) { //cuss words $chat = str_ireplace("fuck you", "i am moron", $chat); - $chat = preg_replace("[fF]+\s*[uUvV]+\s*[hH]*\s*[cC\(kK]+\s*[iI]*\s*[nN]*\s*[gG]*", "dumb", $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 = str_ireplace("asshole", "dumb", $chat); $chat = str_ireplace("damnit", "do'h", $chat); $chat = str_ireplace("damn", "dumb", $chat); @@ -121,6 +123,9 @@ function chatFilter($chat) { $chat = str_ireplace("shit", "dumb", $chat); $chat = str_ireplace("bitch", "dumb", $chat); $chat = str_ireplace("cock", "elbow", $chat); + $chat = str_ireplace("dick", "elbow", $chat); + $chat = str_ireplace("hell", "the supermarket", $chat); + $chat = str_ireplace("whore", "entrepreneur", $chat); $chat = str_ireplace("sucks ass", "is dumb", $chat); $chat = str_ireplace("suck ass", "are dumb", $chat); $chat = str_ireplace("stfu", "be still my beating heart", $chat); -- cgit v1.2.3