/**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handle($argarray = null)
 {
     try {
         $confirm = DomainStatusNetworkPlugin::registerEmail($this->email);
         EmailRegistrationPlugin::sendConfirmEmail($confirm);
         $this->showSuccess();
     } catch (ClientException $e) {
         $this->showError($e->getMessage(), $e->getCode());
     } catch (Exception $e) {
         common_log(LOG_ERR, $e->getMessage());
         $this->showError(_('An internal error occurred.'), 500);
     }
     return;
 }
 * 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/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
$helptext = <<<END_OF_INSTALLFOREMAIL_HELP

installforemail.php [options] <email address>
Create a new account and, if necessary, a new network for the given email address

-w --welcome   Send a welcome email
-t --template= Use this email template

END_OF_INSTALLFOREMAIL_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$email = $args[0];
$sendWelcome = have_option('w', 'welcome');
if ($sendWelcome && have_option('t', 'template')) {
    $template = get_option_value('t', 'template');
}
try {
    $confirm = DomainStatusNetworkPlugin::registerEmail($email);
    if ($sendWelcome) {
        EmailRegistrationPlugin::sendConfirmEmail($confirm, $template);
    }
    $confirmUrl = common_local_url('register', array('code' => $confirm->code));
    print $confirmUrl . "\n";
} catch (Exception $e) {
    print "ERROR: " . $e->getMessage() . "\n";
}
 static function registerEmail($email)
 {
     $domain = self::toDomain($email);
     if (FreeEmail::isFree($domain)) {
         throw new ClientException(_("Use your work email."));
     }
     $sn = self::siteForDomain($domain);
     if (empty($sn)) {
         $installer = new DomainStatusNetworkInstaller($domain);
         // Do the thing
         $installer->main();
         $sn = $installer->getStatusNetwork();
         $config = $installer->getConfig();
         Status_network::$wildcard = $config['WILDCARD'];
     }
     StatusNet::switchSite($sn->nickname);
     $confirm = EmailRegistrationPlugin::registerEmail($email);
     return $confirm;
 }
 function nicknameFromEmail($email)
 {
     return EmailRegistrationPlugin::nicknameFromEmail($email);
 }
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$shortoptions = 'wt::';
$longoptions = array('welcome', 'template=');
$helptext = <<<END_OF_REGISTEREMAILUSER_HELP
registeremailuser.php [options] <email address>

Options:
-w --welcome   Send a welcome email
-t --template= Use this email template

register a new user by email address.

END_OF_REGISTEREMAILUSER_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (count($args) == 0) {
    show_help();
}
$email = $args[0];
$confirm = EmailRegistrationPlugin::registerEmail($email);
if (have_option('w', 'welcome')) {
    if (have_option('t', 'template')) {
        // use the provided template
        EmailRegistrationPlugin::sendConfirmEmail($confirm, get_option_value('t', 'template'));
    } else {
        // use the default template
        EmailRegistrationPlugin::sendConfirmEmail($confirm);
    }
}
$confirmUrl = common_local_url('register', array('code' => $confirm->code));
print $confirmUrl . "\n";