]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/newapplication.php
Require Profile for Profile->getOtherTags
[quix0rs-gnu-social.git] / actions / newapplication.php
index d3dd9b291aaa73bd169073b1e7232ef6a9dcaeaf..5032bb74951a8f05a8096ec9115999a33b2f8b33 100644 (file)
@@ -41,7 +41,7 @@ if (!defined('GNUSOCIAL')) { exit(1); }
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-class NewApplicationAction extends FormAction
+class NewApplicationAction extends SettingsAction
 {
     function title()
     {
@@ -54,6 +54,7 @@ class NewApplicationAction extends FormAction
         if ($this->arg('cancel')) {
             common_redirect(common_local_url('oauthappssettings'), 303);
         } elseif ($this->arg('save')) {
+            //trySave will never return, just throw exception or redirect
             $this->trySave();
         }
 
@@ -61,30 +62,18 @@ class NewApplicationAction extends FormAction
         $this->clientError(_('Unexpected form submission.'));
     }
 
-    function showForm($msg=null)
+    protected function getForm()
     {
-        $this->msg = $msg;
-        $this->showPage();
+        return new ApplicationEditForm($this);
     }
 
-    function showContent()
+    protected function getInstructions()
     {
-        $form = new ApplicationEditForm($this);
-        $form->show();
+        // TRANS: Form instructions for registering a new application.
+        return _('Use this form to register a new application.');
     }
 
-    function showPageNotice()
-    {
-        if ($this->msg) {
-            $this->element('p', 'error', $this->msg);
-        } else {
-            $this->element('p', 'instructions',
-                           // TRANS: Form instructions for registering a new application.
-                           _('Use this form to register a new application.'));
-        }
-    }
-
-    private function trySave()
+    protected function trySave()
     {
         $name         = $this->trimmed('name');
         $description  = $this->trimmed('description');
@@ -149,7 +138,7 @@ class NewApplicationAction extends FormAction
         $app->query('BEGIN');
 
         $app->name         = $name;
-        $app->owner        = $this->scoped->id;
+        $app->owner        = $this->scoped->getID();
         $app->description  = $description;
         $app->source_url   = $source_url;
         $app->organization = $organization;