summaryrefslogtreecommitdiff
path: root/actions/newapplication.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-02 08:48:52 +0000
committerZach Copley <zach@status.net>2010-02-02 08:48:52 +0000
commit2be00ce64221197f3c8ad1458eba2488c8836e5c (patch)
treeb3fd0ee62c631f53b2c8670ec1f109283b2d6b34 /actions/newapplication.php
parent952b5806987e12a34e6fd75509b5d78815c1aa2d (diff)
parent5e90f744a6fb58c43f8f5332ef868ba38e82b3d1 (diff)
Merge branch 'oauth-continued' into 0.9.x
Diffstat (limited to 'actions/newapplication.php')
-rw-r--r--actions/newapplication.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/actions/newapplication.php b/actions/newapplication.php
index c499fe7c7..ba1cca5c9 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;
@@ -273,5 +276,22 @@ class NewApplicationAction extends OwnerDesignAction
}
+ /**
+ * Does the app name already exist?
+ *
+ * Checks the DB to see someone has already registered and 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 ($app !== false);
+ }
+
}