diff options
author | Evan Prodromou <evan@status.net> | 2010-10-26 11:48:27 -0400 |
---|---|---|
committer | Evan Prodromou <evan@status.net> | 2010-10-26 11:48:27 -0400 |
commit | 22633a5af6b1f0211f2437bd586811053e66037b (patch) | |
tree | 47fb534400f9ce75068205e9eae066dea1203538 | |
parent | bec00094a7447df2f2cc831083f7dd2edc904ff7 (diff) |
can't subscribe to blacklisted domains/users
-rw-r--r-- | plugins/Blacklist/BlacklistPlugin.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/plugins/Blacklist/BlacklistPlugin.php b/plugins/Blacklist/BlacklistPlugin.php index 60b59168f..d4a4c9626 100644 --- a/plugins/Blacklist/BlacklistPlugin.php +++ b/plugins/Blacklist/BlacklistPlugin.php @@ -504,4 +504,38 @@ class BlacklistPlugin extends Plugin return true; } + + /** + * Check URLs and homepages for blacklisted users. + */ + + function onStartSubscribe($subscriber, $other) + { + foreach (array($other->profileurl, $other->homepage) as $url) { + + if (empty($url)) { + continue; + } + + $url = strtolower($url); + + if (!$this->_checkUrl($url)) { + $msg = sprintf(_m("Users from '%s' blocked."), + $url); + throw new ClientException($msg); + } + } + + $nickname = $other->nickname; + + if (!empty($nickname)) { + if (!$this->_checkNickname($nickname)) { + $msg = sprintf(_m("Can't subscribe to nickname '%s'."), + $nickname); + throw new ClientException($msg); + } + } + + return true; + } } |