Collective guilt for registrants from the same IP address

If someone tries to register from an IP address that a silenced user
has registered from, prevent it.

When silencing someone, silence everyone else who registered from the
same IP address.
This commit is contained in:
Evan Prodromou
2010-10-22 13:29:51 -04:00
parent 1d85bfece1
commit 1caa08429f
2 changed files with 105 additions and 0 deletions

View File

@@ -111,8 +111,33 @@ class Registration_ip extends Memcached_DataObject
*
* @return array magic three-false array that stops auto-incrementing.
*/
function sequenceKey()
{
return array(false, false, false);
}
/**
* Get the users who've registered with this ip address.
*
* @param Array $ipaddress IP address to check for
*
* @return Array IDs of users who registered with this address.
*/
static function usersByIP($ipaddress)
{
$ids = array();
$ri = new Registration_ip();
$ri->ipaddress = $ipaddress;
if ($ri->find()) {
while ($ri->fetch()) {
$ids[] = $ri->user_id;
}
}
return $ids;
}
}