/**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handle($argarray = null)
 {
     try {
         $url = DomainStatusNetworkPlugin::login($email, $password);
         $this->showSuccess(array('url' => $url));
     } catch (ClientException $ce) {
         $this->showError($ce->getMessage());
     } catch (Exception $e) {
         common_log(LOG_ERR, $e->getMessage());
         $this->showError(_('An internal error occurred.'));
     }
     return;
 }
 /**
  * Handler method
  *
  * @param array $argarray is ignored since it's now passed in in prepare()
  *
  * @return void
  */
 function handle($argarray = null)
 {
     try {
         DomainStatusNetworkPlugin::recoverPassword($email);
         $this->showSuccess();
     } catch (ClientException $ce) {
         $this->showError($ce->getMessage());
     } catch (Exception $e) {
         common_log(LOG_ERR, $e->getMessage());
         $this->showError(_('An internal error occurred.'));
     }
     return;
 }
 /**
  * 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;
 }
 /**
  * Get our input parameters...
  * @return boolean success
  */
 function prepare()
 {
     $config = $this->getConfig();
     $this->nickname = DomainStatusNetworkPlugin::nicknameForDomain($this->domain);
     // XXX make this configurable
     $this->sitename = sprintf('The %s Status Network', $this->domain);
     $this->server = $this->nickname . '.' . $config['WILDCARD'];
     $this->path = null;
     $this->fancy = true;
     $datanick = $this->databaseize($this->nickname);
     $this->host = $config['DBHOSTNAME'];
     $this->database = $datanick . $config['DBBASE'];
     $this->dbtype = 'mysql';
     // XXX: support others... someday
     $this->username = $datanick . $config['USERBASE'];
     // Max size for MySQL
     if (strlen($this->username) > 16) {
         $this->username = sprintf('%s%08x', substr($this->username, 0, 8), crc32($this->username));
     }
     $pwgen = $config['PWDGEN'];
     $password = `{$pwgen}`;
     $this->password = trim($password);
     // For setting up the database
     $this->rootname = $config['ADMIN'];
     $this->rootpass = $config['ADMINPASS'];
     $this->sitehost = $config['DBHOST'];
     $this->sitedb = $config['SITEDB'];
     $tagstr = $config['TAGS'];
     if (!empty($tagstr)) {
         $this->tags = preg_split('/[\\s,]+/', $tagstr);
     } else {
         $this->tags = array();
     }
     // Explicitly empty
     $this->adminNick = null;
     $this->adminPass = null;
     $this->adminEmail = null;
     $this->adminUpdates = null;
     /** Should we skip writing the configuration file? */
     $this->skipConfig = true;
     if (!$this->validateDb()) {
         return false;
     }
     return true;
 }
 * 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";
}
            // TRANS: Form validation error displayed when trying to log in with incorrect credentials.
            throw new ClientException(_('Incorrect username or password.'));
        }
        $loginToken = Login_token::makeNew($user);
        if (empty($loginToken)) {
            throw new ServerException(sprintf(_('Could not create new login token for user %s'), $user->nickname));
        }
        $url = common_local_url('otp', array('user_id' => $loginToken->user_id, 'token' => $loginToken->token));
        if (empty($url)) {
            throw new ServerException(sprintf(_('Could not create new OTP URL for user %s'), $user->nickname));
        }
        return $url;
    }
    static function recoverPassword($email)
    {
        $domain = self::toDomain($email);
        $sn = self::siteForDomain($domain);
        if (empty($sn)) {
            throw new NoSuchUserException(array('email' => $email));
        }
        StatusNet::switchSite($sn->nickname);
        $user = User::staticGet('email', $email);
        if (empty($user)) {
            throw new ClientException(_('No such user.'));
        }
    }
}
// The way addPlugin() works, this global variable gets disappeared.
// So, we re-appear it.
DomainStatusNetworkPlugin::$_thetree = $tldTree;
 *
 * Script to print out current version of the software
 *
 * 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/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain>
Prints site information for the domain given

END_OF_SITEFORDOMAIN_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$domain = DomainStatusNetworkPlugin::toDomain($args[0]);
$nickname = DomainStatusNetworkPlugin::nicknameForDomain($domain);
if (empty($nickname)) {
    throw new ClientException('No candidate found.');
} else {
    print $nickname;
    print "\n";
}
 * Copyright (C) 2011, StatusNet, Inc.
 *
 * Script to print out current version of the software
 *
 * 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/>.
 */
define('INSTALLDIR', realpath(dirname(__FILE__) . '/../../..'));
$helptext = <<<END_OF_SITEFORDOMAIN_HELP
sitefordomain.php [options] <email address|domain>
Prints site information for the domain given

END_OF_SITEFORDOMAIN_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
$domain = DomainStatusNetworkPlugin::toDomain($args[0]);
$sn = DomainStatusNetworkPlugin::siteForDomain($domain);
if (empty($sn)) {
    exit(1);
}
print $sn->nickname . "\n";
exit(0);