. * * @category Email registration * @package StatusNet * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ if (!defined('STATUSNET')) { // This check helps protect against security problems; // your code file can't be executed directly from the web. exit(1); } /** * Email based registration plugin * * @category Email registration * @package StatusNet * @author Brion Vibber * @author Evan Prodromou * @copyright 2011 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 * @link http://status.net/ */ class EmailRegistrationPlugin extends Plugin { function onAutoload($cls) { $dir = dirname(__FILE__); switch ($cls) { case 'EmailregisterAction': include_once $dir . '/' . strtolower(mb_substr($cls, 0, -6)) . '.php'; return false; default: return true; } } /** * Hijack main/register */ function onStartConnectPath(&$path, &$defaults, &$rules, &$result) { static $toblock = array('main/register', 'main/register/:code'); if (in_array($path, $toblock)) { common_debug("Request came in for $path"); if ($defaults['action'] != 'emailregister') { common_debug("Action is {$defaults['action']}, so: rejected."); $result = false; return false; } } return true; } function onStartInitializeRouter($m) { $m->connect('main/register', array('action' => 'emailregister')); $m->connect('main/register/:code', array('action' => 'emailregister')); return true; } function onPluginVersion(&$versions) { $versions[] = array('name' => 'EmailRegistration', 'version' => STATUSNET_VERSION, 'author' => 'Evan Prodromou', 'homepage' => 'http://status.net/wiki/Plugin:EmailRegistration', 'rawdescription' => _m('Use email only for registration')); return true; } }