cvs: pearweb /public_html/bugs report.php

[email protected] ("Helgi ?ormar ?orbj?rnsson") Thu, 08 May 2008 19:14:56 -0000
Newsgroups php.pear.cvs,php.pear.core
Message-ID <cvsdufuz1210274096@cvsserver>
dufuz		Thu May  8 19:14:56 2008 UTC

  Modified files:              
    /pearweb/public_html/bugs	report.php 
  Log:
  Add honeypot checkin to the bug reporting
  
http://cvs.php.net/viewvc.cgi/pearweb/public_html/bugs/report.php?r1=1.128&r2=1.129&diff_format=u
Index: pearweb/public_html/bugs/report.php
diff -u pearweb/public_html/bugs/report.php:1.128 pearweb/public_html/bugs/report.php:1.129
--- pearweb/public_html/bugs/report.php:1.128	Thu May  8 19:07:42 2008
+++ pearweb/public_html/bugs/report.php	Thu May  8 19:14:56 2008
@@ -17,7 +17,7 @@
  * @package   Bugs
  * @copyright Copyright (c) 1997-2005 The PHP Group
  * @license   http://www.php.net/license/3_0.txt  PHP License
- * @version   $Id: report.php,v 1.128 2008/05/08 19:07:42 dufuz Exp $
+ * @version   $Id: report.php,v 1.129 2008/05/08 19:14:56 dufuz Exp $
  */
 
 // Obtain common includes
@@ -28,6 +28,7 @@
 
 // Numeral Captcha Class
 require_once 'Text/CAPTCHA/Numeral.php';
+require_once 'Services/ProjectHoneyPot.php';
 
 $errors              = array();
 $ok_to_submit_report = false;
@@ -409,6 +410,32 @@
 } else {
     response_header('Report - New');
 
+    try {
+        // Uncomment this if you need to test on Windows
+        $resolver = null;
+        // $resolver = new Net_DNS_Resolver;
+        // $resolver->nameservers = array('66.114.197.251');
+
+        $sphp = Services_ProjectHoneyPot::factory(HONEYPOT_API_KEY, $resolver);
+        $sphp->setResponseFormat('object');
+        $ip = $_SERVER['REMOTE_ADDR'];
+        // Uncomment for testing or get one from http://www.projecthoneypot.org/top_harvesters.php
+        // $ip = '209.85.138.136';
+        $status = $sphp->query($ip);
+    } catch (Services_ProjectHoneyPot_Exception $e) {
+       report_error($e);
+       $display_form = false;
+    }
+
+    if ($status && $status->suspicious) {
+        $errors = 'We can not allow you to continue since your IP has been marked suspecious by the
+                   http://projecthoneypot.org/, if that was done in error then please contact ' .
+                   PEAR_DEV_EMAIL . ' as well as the projecthoneypot people to resolve the issue.';
+        report_error($errors);
+        response_footer();
+        exit;
+    }
+
     // See if this package uses an external bug system
     require_once 'bugs/pear-bugs-utils.php';
     $bug_link = PEAR_Bugs_Utils::getExternalSystem($clean_package);