Merge remote branch 'origin/1.0.x' into 1.0.x

This commit is contained in:
Samantha Doherty 2011-05-05 16:00:37 -04:00
commit 68d960cceb
4 changed files with 39 additions and 24 deletions

View File

@ -177,10 +177,17 @@ class DomainStatusNetworkInstaller extends Installer
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()

View File

@ -79,6 +79,10 @@ class EmailregisterAction extends Action
{
parent::prepare($argarray);
if (common_config('site', 'closed')) {
throw new ClientException(_('Registration not allowed.'), 403);
}
if ($this->isPost()) {
$this->checkSessionToken();
@ -86,6 +90,9 @@ class EmailregisterAction extends Action
$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 {
@ -119,6 +126,9 @@ class EmailregisterAction extends Action
$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);

View File

@ -125,28 +125,6 @@ class RequireValidatedEmailPlugin extends Plugin
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.

View File

@ -2,7 +2,7 @@
<?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
@ -20,9 +20,16 @@
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';
@ -41,4 +48,17 @@ foreach (tableDefs() as $table => $def) {
}
$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');