svn: /pear/pearweb/trunk/public_html/ account-request-existingpackage.php account-request-vote.php

From: Date: Wed, 13 Apr 2011 02:54:03 +0000
Subject: svn: /pear/pearweb/trunk/public_html/ account-request-existingpackage.php account-request-vote.php
Groups: php.pear.cvs php.pear.core 
Request: Send a blank email to pear-core+get-9885@lists.php.net to get a copy of this message
clockwerx Wed, 13 Apr 2011 02:54:03 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=310187 Log: Fix Services_ProjectHoneyPot usage Changed paths: U pear/pearweb/trunk/public_html/account-request-existingpackage.php U pear/pearweb/trunk/public_html/account-request-vote.php Modified: pear/pearweb/trunk/public_html/account-request-existingpackage.php =================================================================== --- pear/pearweb/trunk/public_html/account-request-existingpackage.php 2011-04-13 02:50:16 UTC (rev 310186) +++ pear/pearweb/trunk/public_html/account-request-existingpackage.php 2011-04-13 02:54:03 UTC (rev 310187) @@ -138,28 +138,43 @@ //$resolver = new Net_DNS_Resolver; //$resolver->nameservers = array('66.114.197.251'); - $sphp = Services_ProjectHoneyPot::factory(HONEYPOT_API_KEY, $resolver); + $sphp = new Services_ProjectHoneyPot(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); + $results = $sphp->query($ip); } catch (Services_ProjectHoneyPot_Exception $e) { report_error($e); $display_form = false; } -// Check about the last 30 days -if ($status && $status->getLastActivity() < 30 - && ($status->suspicious || $status->isCommentSpammer() || $status->isHarvester() || $status->isSearchEngine()) -) { - $errors = 'We can not allow you to continue since your IP has been marked suspicious within the past 30 days - 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); - $display_form = false; +foreach ($results as $status) { + foreach ($status as $ip => $item) { + if (empty($item)) { + continue; + } + + foreach ($status as $ip => $item) { + if (empty($item)) { + continue; + } + + if ($status->getLastActivity() < 30 && ($status->isCommentSpammer() + || $status->isHarvester() + || $status->isSearchEngine())) { + // Check about the last 30 days + $errors = 'We can not allow you to continue since your IP has been marked suspicious within the past 30 days + 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); + $display_form = false; + } + } + } } + if ($display_form) { $mailto = '<a href="mailto:' . PEAR_DEV_EMAIL . '">PEAR developers mailing list</a>'; echo <<<MSG Modified: pear/pearweb/trunk/public_html/account-request-vote.php =================================================================== --- pear/pearweb/trunk/public_html/account-request-vote.php 2011-04-13 02:50:16 UTC (rev 310186) +++ pear/pearweb/trunk/public_html/account-request-vote.php 2011-04-13 02:54:03 UTC (rev 310187) @@ -18,7 +18,7 @@ $Id$ */ -require_once 'HTML/QuickForm.php'; +require_once 'HTML/QuickForm2.php'; require_once 'Damblan/Mailer.php'; require_once 'election/pear-election-accountrequest.php'; require_once 'Text/CAPTCHA/Numeral.php'; @@ -115,28 +115,43 @@ //$resolver = new Net_DNS_Resolver; //$resolver->nameservers = array('66.114.197.251'); - $sphp = Services_ProjectHoneyPot::factory(HONEYPOT_API_KEY, $resolver); + $sphp = new Services_ProjectHoneyPot(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); + $results = $sphp->query($ip); } catch (Services_ProjectHoneyPot_Exception $e) { report_error($e); $display_form = false; } -// Check about the last 30 days -if ($status && $status->getLastActivity() < 30 - && ($status->suspicious || $status->isCommentSpammer() || $status->isHarvester() || $status->isSearchEngine()) -) { - $errors = 'We can not allow you to continue since your IP has been marked suspicious within the past 30 days - 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); - $display_form = false; +foreach ($results as $status) { + foreach ($status as $ip => $item) { + if (empty($item)) { + continue; + } + + foreach ($status as $ip => $item) { + if (empty($item)) { + continue; + } + + if ($status->getLastActivity() < 30 && ($status->isCommentSpammer() + || $status->isHarvester() + || $status->isSearchEngine())) { + // Check about the last 30 days + $errors = 'We can not allow you to continue since your IP has been marked suspicious within the past 30 days + 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); + $display_form = false; + } + } + } } + if ($display_form) { $mailto = '<a href="mailto:' . PEAR_DEV_EMAIL . '">PEAR developers mailing list</a>'; echo <<<MSG

« previous php.pear.core (#9885) next »