summaryrefslogtreecommitdiff
path: root/plugins/RegisterThrottle/Registration_ip.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-10-22 13:29:51 -0400
committerEvan Prodromou <evan@status.net>2010-10-22 13:29:51 -0400
commit1caa08429f591b170da210d72f3501843f2bc657 (patch)
tree15eda6837cf064487cd31debc455978a65c9335c /plugins/RegisterThrottle/Registration_ip.php
parent1d85bfece1ac3d6de3b4c350cbb617982e9d8638 (diff)
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.
Diffstat (limited to 'plugins/RegisterThrottle/Registration_ip.php')
-rw-r--r--plugins/RegisterThrottle/Registration_ip.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugins/RegisterThrottle/Registration_ip.php b/plugins/RegisterThrottle/Registration_ip.php
index 5c7396b9b..2486e36b4 100644
--- a/plugins/RegisterThrottle/Registration_ip.php
+++ b/plugins/RegisterThrottle/Registration_ip.php
@@ -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;
+ }
}