Discussion:
svn: /pear/pearweb/trunk/public_html/ account-request-existingpackage.php account-request-vote.php
Daniel O'Connor
2011-04-13 02:54:03 UTC
Permalink
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
Daniel O'Connor
2011-04-13 03:05:05 UTC
Permalink
clockwerx Wed, 13 Apr 2011 03:05:05 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310188

Log:
Swap to QF2

Changed paths:
U pear/pearweb/trunk/public_html/account-request-existingpackage.php
U pear/pearweb/trunk/public_html/account-request-vote.php
Daniel O'Connor
2011-04-13 03:21:50 UTC
Permalink
clockwerx Wed, 13 Apr 2011 03:21:50 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=310190

Log:
Typos

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 03:15:38 UTC (rev 310189)
+++ pear/pearweb/trunk/public_html/account-request-existingpackage.php 2011-04-13 03:21:50 UTC (rev 310190)
@@ -223,7 +223,7 @@
'homepage' => @$hsc['homepage'],
'moreinfo' => @$hsc['moreinfo'],
'read_everything' => @$hsc['read_everything'],
- ))_;
+ )));

$form->addElement('text', 'handle', array('placeholder' => 'psmith', 'maxlength' => "20", 'accesskey' => "r", 'required' => 'required'))->setLabel('Use<span class="accesskey">r</span>name:');
$form->addElement('text', 'firstname', array('placeholder' => 'Peter', 'required' => 'required'))->setLabel('First Name:');

Modified: pear/pearweb/trunk/public_html/account-request-vote.php
===================================================================
--- pear/pearweb/trunk/public_html/account-request-vote.php 2011-04-13 03:15:38 UTC (rev 310189)
+++ pear/pearweb/trunk/public_html/account-request-vote.php 2011-04-13 03:21:50 UTC (rev 310190)
@@ -189,14 +189,14 @@

$hsc = array_map('htmlspecialchars', $stripped);
// Set defaults for the form elements
- $form->setDefaults(array(
+ $form->addDataSource(new HTML_QuickForm2_DataSource_Array(array(
'handle' => @$hsc['handle'],
'firstname' => @$hsc['firstname'],
'lastname' => @$hsc['lastname'],
'email' => @$hsc['email'],
'showemail' => @$hsc['showemail'],
'read_everything' => @$hsc['read_everything'],
- ));
+ )));


$form->addElement('text', 'handle', array('placeholder' => 'psmith', 'maxlength' => "20", 'accesskey' => "r", 'required' => 'required'))->setLabel('Use<span class="accesskey">r</span>name:');
Loading...