throw new ServerException("Could not create status_network: " . print_r($sn, true));
}
+ // Re-fetch; stupid auto-increment integer isn't working
+
+ $sn = Status_network::staticGet('nickname', $sn->nickname);
+
+ if (empty($sn)) {
+ throw new ServerException("Created {$this->nickname} status_network and could not find it again.");
+ }
+
$sn->setTags(array('domain='.$this->domain));
$this->sn = $sn;
-
}
function checkSchema()
{
parent::prepare($argarray);
+ if (common_config('site', 'closed')) {
+ throw new ClientException(_('Registration not allowed.'), 403);
+ }
+
if ($this->isPost()) {
$this->checkSessionToken();
$this->email = $this->trimmed('email');
if (!empty($this->email)) {
+ if (common_config('site', 'inviteonly')) {
+ throw new ClientException(_('Sorry, only invited people can register.'), 403);
+ }
$this->email = common_canonical_email($this->email);
$this->state = self::NEWEMAIL;
} else {
$this->code = $this->trimmed('code');
if (empty($this->code)) {
+ if (common_config('site', 'inviteonly')) {
+ throw new ClientException(_('Sorry, only invited people can register.'), 403);
+ }
$this->state = self::NEWREGISTER;
} else {
$this->invitation = Invitation::staticGet('code', $this->code);
return true;
}
- /**
- * Event handler for registration attempts; rejects the registration
- * if email field is missing.
- *
- * @param Action $action Action being executed
- *
- * @return bool hook result code
- */
- function onStartRegistrationTry($action)
- {
- $email = $action->trimmed('email');
-
- if (empty($email)) {
- $action->showForm(_m('You must provide an email address to register.'));
- return false;
- }
-
- // Default form will run address format validation and reject if bad.
-
- return true;
- }
-
/**
* Event handler for registration attempts; rejects the registration
* if email field is missing.
<?php
/*
* StatusNet - a distributed open-source microblogging tool
- * Copyright (C) 2008, 2009, StatusNet, Inc.
+ * Copyright (C) 2008-2011 StatusNet, Inc.
*
* 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
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
+$shortoptions = 'x::';
+$longoptions = array('extensions=');
+
$helptext = <<<END_OF_CHECKSCHEMA_HELP
+php checkschema.php [options]
Gives plugins a chance to update the database schema.
+ -x --extensions= Comma-separated list of plugins to load before checking
+
+
END_OF_CHECKSCHEMA_HELP;
require_once INSTALLDIR.'/scripts/commandline.inc';
}
$schemaUpdater->checkSchema();
+if (have_option('x', 'extensions')) {
+ $ext = trim(get_option_value('x', 'extensions'));
+ $exts = explode(',', $ext);
+ foreach ($exts as $plugin) {
+ try {
+ addPlugin($plugin);
+ } catch (Exception $e) {
+ print $e->getMessage()."\n";
+ exit(1);
+ }
+ }
+}
+
Event::handle('CheckSchema');