# HG changeset patch # User Dan # Date 1184042452 14400 # Node ID 8f532d8ab5f57c393ed76360357b0b0f527f60e3 # Parent fc9762553a3c1fe62235ae66df7c1709ef0f254a# Parent b354deeaa4c4b0a6e40c6238fe3e51ef7f7aa4a5 Merging Scribus and Nighthawk repositories... Mercurial saves the day...again :-) diff -r b354deeaa4c4 -r 8f532d8ab5f5 includes/email.php --- a/includes/email.php Mon Jul 09 22:01:27 2007 -0400 +++ b/includes/email.php Tue Jul 10 00:40:52 2007 -0400 @@ -595,7 +595,19 @@ function mask_address($email) { - return str_replace('.', ' ', str_replace('@', ' ', $email)); + $at = array(' (AT) ', ' __AT__ ', ' *AT* ', ' [AT] ', ' ', ' <__AT__> '); + $dot = array(' (DOT) ', ' __DOT__ ', ' *DOT* ', ' [DOT] ', ' ', ' <__DOT__> '); + while(strstr($email, '@')) + { + $my_at = $at[ array_rand($at) ]; + $email = str_replace_once('@', $my_at, $email); + } + while(strstr($email, '.')) + { + $my_dot = $dot[ array_rand($dot) ]; + $email = str_replace_once('.', $my_dot, $email); + } + return $email; } /** diff -r b354deeaa4c4 -r 8f532d8ab5f5 includes/functions.php --- a/includes/functions.php Mon Jul 09 22:01:27 2007 -0400 +++ b/includes/functions.php Tue Jul 10 00:40:52 2007 -0400 @@ -2298,6 +2298,31 @@ return false; } +/** + * Replaces the FIRST given occurrence of needle within haystack with thread + * @param string Needle + * @param string Thread + * @param string Haystack + */ + +function str_replace_once($needle, $thread, $haystack) +{ + $needle_len = strlen($needle); + for ( $i = 0; $i < strlen($haystack); $i++ ) + { + $test = substr($haystack, $i, $needle_len); + if ( $test == $needle ) + { + // Got it! + $upto = substr($haystack, 0, $i); + $from = substr($haystack, ( $i + $needle_len )); + $new_haystack = "{$upto}{$thread}{$from}"; + return $new_haystack; + } + } + return $haystack; +} + //die('
Original:  01010101010100101010100101010101011010'."\nProcessed: ".uncompress_bitfield(compress_bitfield('01010101010100101010100101010101011010')).'
'); ?>