]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/DomainStatusNetwork/actions/globalregister.php
Merge branch 'tom/noreferrer' into 'nightly'
[quix0rs-gnu-social.git] / plugins / DomainStatusNetwork / actions / globalregister.php
index ad223808ff39b501227996699502d6caca11dced..1e34261099a80b7e1ed2be1d05652d6a887b000e 100644 (file)
@@ -35,7 +35,7 @@ if (!defined('STATUSNET')) {
 }
 
 /**
- * Class comment
+ * An action to globally register a new user
  *
  * @category  Action
  * @package   StatusNet
@@ -45,7 +45,7 @@ if (!defined('STATUSNET')) {
  * @link      http://status.net/
  */
 
-class GlobalRegisterAction extends Action
+class GlobalregisterAction extends GlobalApiAction
 {
     /**
      * For initializing members of the class.
@@ -57,8 +57,17 @@ class GlobalRegisterAction extends Action
 
     function prepare($argarray)
     {
-        parent::prepare($argarray);
-        return true;
+        try {
+            parent::prepare($argarray);
+            return true;
+        } catch (ClientException $e) {
+            $this->showError($e->getMessage(), $e->getCode());
+            return false;
+        } catch (Exception $e) {
+            common_log(LOG_ERR, $e->getMessage());
+            $this->showError(_('An internal error occurred.'), 500);
+            return false;
+        }
     }
 
     /**
@@ -71,48 +80,17 @@ class GlobalRegisterAction extends Action
 
     function handle($argarray=null)
     {
-        return;
-    }
+        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 true if read only.
-     *
-     * MAY override
-     *
-     * @param array $args other arguments
-     *
-     * @return boolean is read only action?
-     */
-
-    function isReadOnly($args)
-    {
-        return false;
-    }
-
-    /**
-     * Return last modified, if applicable.
-     *
-     * MAY override
-     *
-     * @return string last modified http header
-     */
-    function lastModified()
-    {
-        // For comparison with If-Last-Modified
-        // If not applicable, return null
-        return null;
-    }
-
-    /**
-     * Return etag, if applicable.
-     *
-     * MAY override
-     *
-     * @return string etag http header
-     */
-
-    function etag()
-    {
-        return null;
+        return;
     }
 }