summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Carmody <sean@stubbornmule.net>2010-03-18 00:06:42 +1100
committerZach Copley <zach@status.net>2010-03-22 17:18:43 +0000
commitc810f2485132fe124e671dee4f86eb721eee15e4 (patch)
tree112ab409a29e2ea4cc4698b294162ef942794c02
parent0a6b30552d16201e5a1999da6e7d3ab0f63852cd (diff)
Added plugin AutoSandbox for spam-management: new users sandboxed by default
-rw-r--r--plugins/AutoSandbox/AutoSandboxPlugin.php96
-rw-r--r--plugins/AutoSandbox/LICENSE21
-rw-r--r--plugins/AutoSandbox/README39
3 files changed, 156 insertions, 0 deletions
diff --git a/plugins/AutoSandbox/AutoSandboxPlugin.php b/plugins/AutoSandbox/AutoSandboxPlugin.php
new file mode 100644
index 000000000..ffd8bf455
--- /dev/null
+++ b/plugins/AutoSandbox/AutoSandboxPlugin.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * StatusNet, the distributed open-source microblogging tool
+ *
+ * Plugin to automatically sandbox newly registered users in an effort to beat
+ * spammers. If the user proves to be legitimate, moderators can un-sandbox them.
+ *
+ * PHP version 5
+ *
+ * LICENCE: This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * @category Plugin
+ * @package StatusNet
+ * @author Sean Carmody<seancarmody@gmail.com>
+ * @copyright 2010
+ * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
+ * @link http://status.net/
+ */
+
+if (!defined('STATUSNET') && !defined('LACONICA')) {
+ exit(1);
+}
+
+define('AUTOSANDBOX', '0.1');
+
+//require_once(INSTALLDIR.'/plugins/AutoSandbox/autosandbox.php');
+
+class AutoSandboxPlugin extends Plugin
+{
+ var $contact;
+ var $debug;
+
+ function onInitializePlugin()
+ {
+ if(!isset($this->debug))
+ {
+ $this->debug = 0;
+ }
+
+ if(!isset($this->contact)) {
+ $default = common_config('newuser', 'default');
+ if (!empty($default)) {
+ $this->contact = $default;
+ }
+ }
+ }
+
+ function onPluginVersion(&$versions)
+ {
+ $versions[] = array('name' => 'AutoSandbox',
+ 'version' => STATUSNET_VERSION,
+ 'author' => 'Sean Carmody',
+ 'homepage' => 'http://status.net/wiki/Plugin:AutoSandbox',
+ 'rawdescription' =>
+ _m('Automatically sandboxes newly registered members.'));
+ return true;
+ }
+
+ function onStartRegistrationFormData($action)
+ {
+
+ $instr = 'Note you will initially be "sandboxed" so your posts will not appear in the public timeline.';
+
+ if (isset($this->contact)) {
+ $contactuser = User::staticGet('nickname', $this->contact);
+ if (!empty($contactuser)) {
+ $contactlink = "@<a href=\"$contactuser->uri\">$contactuser->nickname</a>";
+ $instr = $instr . " Send a message to $contactlink to speed up the unsandboxing process.";
+ }
+ }
+
+ $output = common_markup_to_html($instr);
+ $action->elementStart('div', 'instructions');
+ $action->raw($output);
+ $action->elementEnd('div');
+ }
+
+ function onEndUserRegister(&$profile,&$user)
+ {
+ $profile->sandbox();
+ if ($this->debug) {
+ common_log(LOG_WARNING, "AutoSandbox: sandboxed of $user->nickname");
+ }
+ }
+}
diff --git a/plugins/AutoSandbox/LICENSE b/plugins/AutoSandbox/LICENSE
new file mode 100644
index 000000000..011faa4e7
--- /dev/null
+++ b/plugins/AutoSandbox/LICENSE
@@ -0,0 +1,21 @@
+Copyright (c) 2010 Stubborn Mule - http://www.stubbornmule.net
+AUTHORS:
+ Sean Carmody
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/plugins/AutoSandbox/README b/plugins/AutoSandbox/README
new file mode 100644
index 000000000..2f5d625f7
--- /dev/null
+++ b/plugins/AutoSandbox/README
@@ -0,0 +1,39 @@
+StatusNet AutoSandbox plugin 0.1 03/16/10
+=========================================
+Automatically sandboxes newly registered users as a spam-management technique.
+Only really suits small sites where all users can be hand-moderated. A moderator
+will then have to unbox legimate users, using the following built-in script:
+
+./scripts/userrole.php -n username -r moderator
+
+(replace 'username' with the nickname of the user you wish to make a moderator).
+
+The following note will be added to the top of the Registration form:
+
+"Note you will initially be "sandboxed" so your posts will not appear in the
+public timeline."
+
+This can be followed by the following extra information if a contact user (denoted
+here by XXX) is specified:
+
+"Send a message to @XXX to speed up the unsandboxing process."
+
+If no contact user is specified, it will default to the "Default subscription" user
+who automatically subscribes to new users (set in Admin -> User).
+
+Use:
+1. Add plugin:
+
+Default usage:
+addPlugin('AutoSandbox');
+
+Specify a contact user (replace 'someuser' with appropriate username):
+addPlugin('AutoSandbox', array('contact' => 'someuser'));
+
+Stop contact user from defaulting to the Defaul subscription:
+addPlugin('AutoSandbox', array('contact' => ''));
+
+Changelog
+=========
+0.1 initial release
+