X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnewapplication.php;h=5032bb74951a8f05a8096ec9115999a33b2f8b33;hb=4d17d9533552ea620b83109c550e250a5c236291;hp=d3dd9b291aaa73bd169073b1e7232ef6a9dcaeaf;hpb=32dacb93696bc49b8933951aa290d1ed0c26504b;p=quix0rs-gnu-social.git diff --git a/actions/newapplication.php b/actions/newapplication.php index d3dd9b291a..5032bb7495 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -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;