!!!!!!!!!!!
and other characters at the end? This snippet will replace strings in a posts from !!!!! to
!
and some other stuff../includes/functions.php wrote: FindAdd AfterCode: Select all
function phpbb_user_session_handler() { global $phpbb_hook; if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) { if ($phpbb_hook->hook_return(__FUNCTION__)) { return $phpbb_hook->hook_return_result(__FUNCTION__); } } return; }
Code: Select all
//Spelling corrector START function message_validate_spam($message) { if(isset($message) && $message != '') { $corr = array( 'accidentally', // 0 'accordion', 'acquaintance', 'acquaintance', 'aquire', 'acquit', // 5 'a lot', 'a lot', 'argument', 'a while', 'axle', // 10 'barbeque', 'believable', 'broccoli', 'cemetary', 'chauvinism', // 15 'chocolaty', 'colosseum', 'collectible', 'definite', // 20 'development', 'drunkenness', 'dumbbell', 'exercise', 'existence', // 25 'fiery', 'flabbergast', 'flotation', 'frustum', 'genius', //30 'grammar', 'handkerchief', 'harass', 'inadvertent', 'incidentally', //35 'indispensable', ); $wrong = array( 'accidently', // 1 'accordian', 'acquaintence', 'aquaintance', 'acquire', 'aquit', // 5 'alot', 'allot', 'arguement', 'awhile', 'axel', // 10 'barbeque', 'believeable', 'brocolli', 'cemetery', 'chauvanism', // 15 'chocolatey', 'colliseum', 'collectable', 'definate', // 20 'developement', 'drunkeness', 'dumbell', 'excercise', 'existance', // 25 'firey', 'flabberghast', 'floatation', 'frustrum', 'genious', // 30 'grammer', 'hankerchief', 'harrass', 'inadvertant', 'incidently', // 35 'indispensible', ); $l['corr'] = count($wrong) - 1; $l['wrong'] = count($corr) - 1; $typos = 0; if($l['corr'] == $l['wrong']) { while($l['corr'] >= 0&& $typos <= 20) { while(strstr($message,$wrong[$l['corr']]) !== false) { $message = str_replace($wrong[$l['corr']], $corr[$l['corr']], $message); } while(strstr($message, ucwords($wrong[$l['corr']])) !== false) { $message = str_replace(ucwords($wrong[$l['corr']]), ucwords($corr[$l['corr']]), $message); } $l['corr'] = $l['corr'] - 1; $typos = $typos + 1; } return $message; } else { return $message; } } else { return $message; } } //Spelling corrector END
---------------------------- THE NEXT PART IS OPTIONAL FOR MCHAT INTEGRATION ----------------------------./includes/functions_posting.php wrote: FindAdd AfterCode: Select all
// Start the transaction here $db->sql_transaction('begin');
Code: Select all
$data['message'] = message_validate_spam($data['message']); $subject = message_validate_spam($subject);
You can add strings to replace in the./mchat.php wrote:FindAdd AfterCode: Select all
// Reguest... $message = utf8_normalize_nfc(request_var('message', '', true));
Code: Select all
$message = message_validate_spam($message);
message_validate_spam
function in ./includes/functions.php
. I'm sure you'll know how.