X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnewapplication.php;h=0f819b3499881795e3ce597fd1559846875f7f15;hb=2600ad9643cf4bcca291998379b1668f695f9a88;hp=bc5b4edaf84c5b0935ad0294ecf1744638b0e0e7;hpb=42550321ffd40328efa8b3bd8ec627ae219cf005;p=quix0rs-gnu-social.git diff --git a/actions/newapplication.php b/actions/newapplication.php index bc5b4edaf8..0f819b3499 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -49,7 +49,7 @@ class NewApplicationAction extends OwnerDesignAction function title() { - return _('New application'); + return _('New Application'); } /** @@ -158,6 +158,9 @@ class NewApplicationAction extends OwnerDesignAction if (empty($name)) { $this->showForm(_('Name is required.')); return; + } else if ($this->nameExists($name)) { + $this->showForm(_('Name already in use. Try another one.')); + return; } elseif (mb_strlen($name) > 255) { $this->showForm(_('Name is too long (max 255 chars).')); return; @@ -273,5 +276,22 @@ class NewApplicationAction extends OwnerDesignAction } + /** + * Does the app name already exist? + * + * Checks the DB to see someone has already registered an app + * with the same name. + * + * @param string $name app name to check + * + * @return boolean true if the name already exists + */ + + function nameExists($name) + { + $app = Oauth_application::staticGet('name', $name); + return !empty($app); + } + }