3 * StatusNet, the distributed open-source microblogging tool
5 * Plugin to automatically sandbox newly registered users in an effort to beat
6 * spammers. If the user proves to be legitimate, moderators can un-sandbox them.
10 * LICENCE: This program is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU Affero General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Affero General Public License for more details.
20 * You should have received a copy of the GNU Affero General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * @author Sean Carmody<seancarmody@gmail.com>
27 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
28 * @link http://status.net/
31 if (!defined('STATUSNET') && !defined('LACONICA')) {
35 define('AUTOSANDBOX', '0.1');
37 //require_once(INSTALLDIR.'/plugins/AutoSandbox/autosandbox.php');
39 class AutoSandboxPlugin extends Plugin
44 function onInitializePlugin()
46 if(!isset($this->debug))
51 if(!isset($this->contact)) {
52 $default = common_config('newuser', 'default');
53 if (!empty($default)) {
54 $this->contact = $default;
59 function onPluginVersion(&$versions)
61 $versions[] = array('name' => 'AutoSandbox',
62 'version' => GNUSOCIAL_VERSION,
63 'author' => 'Sean Carmody',
64 'homepage' => 'http://status.net/wiki/Plugin:AutoSandbox',
66 // TRANS: Plugin description.
67 _m('Automatically sandboxes newly registered members.'));
71 function onStartRegistrationFormData($action)
73 // TRANS: User instructions after registration.
74 $instr = _m('Note you will initially be "sandboxed" so your posts will not appear in the public timeline.');
76 if (isset($this->contact)) {
77 $contactuser = User::getKV('nickname', $this->contact);
78 if ($contactuser instanceof User) {
79 $contactlink = sprintf('@<a href="%s">%s</a>',
80 htmlspecialchars($contactuser->getProfile()->getUrl()),
81 htmlspecialchars($contactuser->getProfile()->getNickname()));
82 // TRANS: User instructions after registration.
83 // TRANS: %s is a clickable OStatus profile URL.
84 $instr = sprintf(_m('Note you will initially be "sandboxed" so your posts will not appear in the public timeline. '.
85 'Send a message to %s to speed up the unsandboxing process.'),$contactlink);
89 $output = common_markup_to_html($instr);
90 $action->elementStart('div', 'instructions');
91 $action->raw($output);
92 $action->elementEnd('div');
95 public function onEndUserRegister(Profile $profile)
99 common_log(LOG_WARNING, "AutoSandbox: sandboxed of $profile->nickname");