PDA

View Full Version : Eximpt super-mods from censortext!!


Remi
03-22-2002, 04:47 PM
neo

I don't think FireFly has got this one :D

Remi
03-24-2002, 08:56 PM
Any idia how can this be done please!!

Zzed
03-25-2002, 05:05 AM
In functions.php:

look for:


function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;


replace with:

function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ,$bbuserinfo;
if($bbuserinfo[usergroupid] == 5) {
$enablecensor = 0;
}


Viola... :D

Neo
03-25-2002, 05:08 AM
HAHAHAHAH.. thanks for the mentions Remi

Remi
03-25-2002, 11:05 AM
Thank you very much, but it is not working!!

My functions.php is a bit deferint

======

// ###################### Start censortext #######################
function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
if ($enablecensor==1 and $censorwords!="") {
if (!isset($censorword)) {


any other suggestions please?

Zzed
03-25-2002, 02:24 PM
What version are you on?

This works like a charm in version 2.2.4. ;)

Remi
03-25-2002, 03:21 PM
I am using 2.2.4 !!

I have noticed you dont have this line in your code:

if ($enablecensor==1 and $censorwords!="") {

Do I have to remove it ?

Thanks

Zzed
03-25-2002, 03:57 PM
No, you keep everything else the same. ;) Maybe my lack of indentation threw you off. :)

Original censortext:

function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ;
if ($enablecensor==1 and $censorwords!="") {
if (!isset($censorword)) {
$censorwords = preg_quote($censorwords);
$censorwords = str_replace('/', '\\/', $censorwords);
$censorword=explode(" ",$censorwords);
} else {
reset($censorword);
}

while (list($key,$val)=each($censorword)) {
if ($val!="") {
if (substr($val,0,2)=="\\{") {
$val=substr($val,2,-2);

$text=trim(preg_replace("/([^A-Za-z])".$val."(?=[^A-Za-z])/si","\\1".repeatchar($censorchar,strlen($val))," $text "));
} else {
$text=trim(preg_replace("/$val/si",repeatchar($censorchar,strlen($val))," $text "));
}
}
}
}
return $text;
}


Modified censortext:

function censortext($text) {
global $enablecensor,$censorwords,$censorword,$censorchar ,$bbuserinfo;
if($bbuserinfo[usergroupid] == 5) {
$enablecensor = 0;
}
if ($enablecensor==1 and $censorwords!="") {
if (!isset($censorword)) {
$censorwords = preg_quote($censorwords);
$censorwords = str_replace('/', '\\/', $censorwords);
$censorword=explode(" ",$censorwords);
} else {
reset($censorword);
}

while (list($key,$val)=each($censorword)) {
if ($val!="") {
if (substr($val,0,2)=="\\{") {
$val=substr($val,2,-2);

$text=trim(preg_replace("/([^A-Za-z])".$val."(?=[^A-Za-z])/si","\\1".repeatchar($censorchar,strlen($val))," $text "));
} else {
$text=trim(preg_replace("/$val/si",repeatchar($censorchar,strlen($val))," $text "));
}
}
}
}
return $text;
}

Remi
03-25-2002, 04:29 PM
Thank very much Zzed

Now I understand what do you mean, it still doesn't work for me.

but I think the problem is with my overhacked functions.php file.

I will try it later on a clean board :D

Thanks

Zzed
03-25-2002, 04:39 PM
Ah... I see. :D It 's working fine on my board. :)

You are very welcome. :)

BTW, I released this as a hack. ;)