X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fnewapplication.php;h=8b150c315139d8c3fdb446685b05d3313c28684f;hb=9b9ba297913fdfa62d9e6d37afa5ec17341442e3;hp=c499fe7c76ed995bcb9896448dc410f3738cccfb;hpb=a85a3ddc725a99ea182e86ec65f6be574752b18f;p=quix0rs-gnu-social.git diff --git a/actions/newapplication.php b/actions/newapplication.php index c499fe7c76..8b150c3151 100644 --- a/actions/newapplication.php +++ b/actions/newapplication.php @@ -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; @@ -167,7 +170,7 @@ class NewApplicationAction extends OwnerDesignAction } elseif (Oauth_application::descriptionTooLong($description)) { $this->showForm(sprintf( _('Description is too long (max %d chars).'), - Oauth_application::maxDescription())); + Oauth_application::maxDesc())); return; } elseif (empty($source_url)) { $this->showForm(_('Source URL is required.')); @@ -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); + } + }