cvs: pearweb /public_html/bugs report.php /public_html/bugs/include functions.inc

From: Date: Tue, 08 Jun 2004 14:56:36 +0000
Subject: cvs: pearweb /public_html/bugs report.php /public_html/bugs/include functions.inc
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-20356@lists.php.net to get a copy of this message
danielc Tue Jun 8 10:56:36 2004 EDT Modified files: /pearweb/public_html/bugs report.php /pearweb/public_html/bugs/include functions.inc Log: Add format param to spam_protect() so output can be html'ized or text. http://cvs.php.net/diff.php/pearweb/public_html/bugs/report.php?r1=1.25&r2=1.26&ty=u Index: pearweb/public_html/bugs/report.php diff -u pearweb/public_html/bugs/report.php:1.25 pearweb/public_html/bugs/report.php:1.26 --- pearweb/public_html/bugs/report.php:1.25 Mon Jun 7 15:07:56 2004 +++ pearweb/public_html/bugs/report.php Tue Jun 8 10:56:36 2004 @@ -1,6 +1,6 @@ <?php /* vim: set noet ts=4 sw=4: : */ -// $Id: report.php,v 1.25 2004/06/07 19:07:56 mj Exp $ +// $Id: report.php,v 1.26 2004/06/08 14:56:36 danielc Exp $ require_once './include/prepend.inc'; require_once './include/cvs-auth.inc'; @@ -133,7 +133,7 @@ $cid = mysql_insert_id(); $report = ""; - $report .= "From: ".spam_protect(stripslashes($in['email']))."\n"; + $report .= "From: ".spam_protect(stripslashes($in['email']), 'text')."\n"; $report .= "Operating system: ".stripslashes($in['php_os'])."\n"; $report .= "PHP version: ".stripslashes($in['php_version'])."\n"; $report .= "Package: $in[package_name]\n"; @@ -150,7 +150,7 @@ $email = stripslashes($in['email']); - $protected_email = '"'.spam_protect($email)."\" <$mailfrom>"; + $protected_email = '"'.spam_protect($email, 'text')."\" <$mailfrom>"; // provide shortcut URLS for "quick bug fixes" $dev_extra = ""; http://cvs.php.net/diff.php/pearweb/public_html/bugs/include/functions.inc?r1=1.39&r2=1.40&ty=u Index: pearweb/public_html/bugs/include/functions.inc diff -u pearweb/public_html/bugs/include/functions.inc:1.39 pearweb/public_html/bugs/include/functions.inc:1.40 --- pearweb/public_html/bugs/include/functions.inc:1.39 Tue Jun 8 01:41:29 2004 +++ pearweb/public_html/bugs/include/functions.inc Tue Jun 8 10:56:36 2004 @@ -1,6 +1,6 @@ <?php /* vim: set noet ts=4 sw=4 ft=php : */ -// $Id: functions.inc,v 1.39 2004/06/08 05:41:29 danielc Exp $ +// $Id: functions.inc,v 1.40 2004/06/08 14:56:36 danielc Exp $ /** * Obfuscates email addresses to hinder spammer's spiders @@ -8,15 +8,23 @@ * Turns "@" into character entities that get interpreted as "at" and * turns "." into character entities that get interpreted as "dot". * - * @param string $txt the email address to be obfuscated + * @param string $txt the email address to be obfuscated + * @param string $format how the output will be displayed ('html', 'text') * @return string the altered email address */ -function spam_protect($txt) +function spam_protect($txt, $format = 'html') { - $translate = array( - '@' => ' &#x61;&#116; ', - '.' => ' &#x64;&#111;&#x74; ', - ); + if ($format == 'html') { + $translate = array( + '@' => ' &#x61;&#116; ', + '.' => ' &#x64;&#111;&#x74; ', + ); + } else { + $translate = array( + '@' => ' at ', + '.' => ' dot ', + ); + } return strtr($txt, $translate); } @@ -246,12 +254,12 @@ switch ($edit) { case 3: - $from = spam_protect(rinse($in['commentemail'])); + $from = spam_protect(rinse($in['commentemail']), 'text'); $headers[] = array(" Comment by", $from); $from = "\"$from\" <$mailfrom>"; break; case 2: - $from = spam_protect(txfield('email')); + $from = spam_protect(txfield('email'), 'text'); $headers[] = array(" User updated by", $from); $from = "\"$from\" <$mailfrom>"; break; @@ -265,10 +273,10 @@ $prefix = " "; if (changed('email')) { - $headers[] = array("-Reported By", spam_protect($bug['email'])); + $headers[] = array("-Reported By", spam_protect($bug['email']), 'text'); $prefix = "+"; } - if ($f = spam_protect(txfield('email'))) { + if ($f = spam_protect(txfield('email'), 'text')) { $headers[] = array($prefix.'Reported By', $f); } @@ -438,7 +446,7 @@ } while (($row =& $res->fetchRow(DB_FETCHMODE_ORDERED)) && strlen($output) < $max_message_length && $count++ < $max_comments) { - $output .= "[$row[0]] ". spam_protect($row[1]) ."\n\n$row[2]\n\n$divider\n\n"; + $output .= "[$row[0]] ". spam_protect($row[1], 'text') ."\n\n$row[2]\n\n$divider\n\n"; } if (strlen($output) < $max_message_length && $count < $max_comments) { @@ -446,7 +454,7 @@ if (!$res) return $output; $row =& $res->fetchRow(DB_FETCHMODE_ORDERED); if (!$row) return $output; - return ("\n\nPrevious Comments:\n$divider\n\n" . $output . "[$row[0]] ". spam_protect($row[1]) ."\n\n$row[2]\n\n$divider\n\n"); + return ("\n\nPrevious Comments:\n$divider\n\n" . $output . "[$row[0]] ". spam_protect($row[1], 'text') ."\n\n$row[2]\n\n$divider\n\n"); } else { return ("\n\nPrevious Comments:\n$divider\n\n" . $output . "The remainder of the comments for this report are too long. To view\nthe rest of the comments, please view the bug report online at\n http://pear.php.net/bugs/bug.php?id=$bug_id\n");

« previous php.pear.cvs (#20356) next »