]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
can't subscribe to blacklisted domains/users
authorEvan Prodromou <evan@status.net>
Tue, 26 Oct 2010 15:48:27 +0000 (11:48 -0400)
committerEvan Prodromou <evan@status.net>
Tue, 26 Oct 2010 15:48:27 +0000 (11:48 -0400)
plugins/Blacklist/BlacklistPlugin.php

index 60b59168fcf553fafbc551dcf4761bd17d474a78..d4a4c9626ad9d33f9af9391666b40332927dcfe9 100644 (file)
@@ -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;
+    }
 }