]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge remote-tracking branch 'gitorious/1.0.x' into 1.0.x
authorEvan Prodromou <evan@status.net>
Thu, 5 May 2011 19:09:10 +0000 (12:09 -0700)
committerEvan Prodromou <evan@status.net>
Thu, 5 May 2011 19:09:10 +0000 (12:09 -0700)
plugins/DomainStatusNetwork/domainstatusnetworkinstaller.php
plugins/EmailRegistration/emailregister.php
plugins/RequireValidatedEmail/RequireValidatedEmailPlugin.php
scripts/checkschema.php

index ea8220056cf0b2eb4f7e0b5ef2aa644cf30b0d8b..c871c2328e34757c68beaf0e51cab879f4520612 100644 (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()
index 062b054ad74ecd5a4cb686139efc40bc95715864..a7c8e8a2dae17cf6f3ab445f1d981849fe531c2a 100644 (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);
index 0d4bc4da16db8f648e1cb1623e46c0999fad28d4..fdb039afec26cc4470ebbf0edd42bd17e654e972 100644 (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.
index 73fd74302c6ad1230794f5b4ba12e897cb608298..cec5773683ef8ef52d7c7b13ab615fe896a2163c 100755 (executable)
@@ -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
 
 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');