DefSTONED
09-14-2001, 10:00 PM
About
This is a simple hack that replaces evil goatse.cx links with a friendly link to gratuitous kitty pictures at www.oralse.cx
This should work on all versions of vB but has only been tested in v2.0.3
Code
In functions.php, add the following function anywhere you please...I've put it above the function censortext to keep the hack all in one place.
// ###################### Start stri_replace #####################
// Case-insensitive str_replace function found on php.net
function stri_replace($searchFor, $replaceWith, $string, $offset = 0) {
$lsearchFor = strtolower($searchFor);
$lstring = strtolower($string);
$newPos = strpos($lstring, $lsearchFor, $offset);
if (strlen($newPos) == 0) {
return($string);
} else {
$left = substr($string, 0, $newPos);
$right = substr($string, $newPos + strlen($searchFor));
$newStr = $left . $replaceWith . $right;
return stri_replace($searchFor, $replaceWith, $newStr, $newPos + strlen($replaceWith));
}
}
At the top of the function censortext replace the following code:
// ###################### Start censortext #######################
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
with this:
// ###################### Start censortext #######################
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
//start goatse hack
$text = stri_replace("http://www.goatse.cx","http://www.oralse.cx",$text);
$text = stri_replace("http://goatse.cx","http://oralse.cx",$text);
//end goatse
That is all folks! People can now blindly click links in the knowledge that they won't be faced with Mr Goatse, but instead a friendly little kitten :)
This is a simple hack that replaces evil goatse.cx links with a friendly link to gratuitous kitty pictures at www.oralse.cx
This should work on all versions of vB but has only been tested in v2.0.3
Code
In functions.php, add the following function anywhere you please...I've put it above the function censortext to keep the hack all in one place.
// ###################### Start stri_replace #####################
// Case-insensitive str_replace function found on php.net
function stri_replace($searchFor, $replaceWith, $string, $offset = 0) {
$lsearchFor = strtolower($searchFor);
$lstring = strtolower($string);
$newPos = strpos($lstring, $lsearchFor, $offset);
if (strlen($newPos) == 0) {
return($string);
} else {
$left = substr($string, 0, $newPos);
$right = substr($string, $newPos + strlen($searchFor));
$newStr = $left . $replaceWith . $right;
return stri_replace($searchFor, $replaceWith, $newStr, $newPos + strlen($replaceWith));
}
}
At the top of the function censortext replace the following code:
// ###################### Start censortext #######################
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
with this:
// ###################### Start censortext #######################
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
//start goatse hack
$text = stri_replace("http://www.goatse.cx","http://www.oralse.cx",$text);
$text = stri_replace("http://goatse.cx","http://oralse.cx",$text);
//end goatse
That is all folks! People can now blindly click links in the knowledge that they won't be faced with Mr Goatse, but instead a friendly little kitten :)