Fixes for obfuscate_text() when printing emails with numbers in them.

(Patch from Zbigniew Fiedorowicz  - thanks)
This commit is contained in:
moodler
2003-09-09 02:22:36 +00:00
parent c1e5e14a1c
commit 2b09e37782
+9 -2
View File
@@ -1605,13 +1605,20 @@ function obfuscate_text($plaintext) {
$i=0;
$length = strlen($plaintext);
$obfuscated="";
$prev_obfuscated = false;
while ($i < $length) {
if (rand(0,2)) {
$c = ord($plaintext{$i});
$numerical = ($c >= ord('0')) && ($c <= ord('9'));
if ($prev_obfuscated and $numerical ) {
$obfuscated.='&#'.ord($plaintext{$i});
} else if (rand(0,2)) {
$obfuscated.='&#'.ord($plaintext{$i});
$prev_obfuscated = true;
} else {
$obfuscated.=$plaintext{$i};
$prev_obfuscated = false;
}
$i++;
$i++;
}
return $obfuscated;
}