summaryrefslogtreecommitdiff
path: root/src/controllers
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2011-10-04 14:42:59 -0700
committerLuke Shumaker <lukeshu@sbcglobal.net>2011-10-04 14:42:59 -0700
commitdbeb76f57aab441e5e93dcb1919b0b442c889965 (patch)
tree6673b8aac803b66e02ee8e5083e7e26892242483 /src/controllers
parent2f1d74bdd48e3beaf6b52cad126de0271875e7ac (diff)
Add the ability to close user registration.
Diffstat (limited to 'src/controllers')
-rw-r--r--src/controllers/Users.class.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/controllers/Users.class.php b/src/controllers/Users.class.php
index a5d23fc..27efbcd 100644
--- a/src/controllers/Users.class.php
+++ b/src/controllers/Users.class.php
@@ -22,7 +22,12 @@ class Users extends Controller {
switch ($method) {
case 'POST':
// We're POSTing a new user.
- $this->create_user();
+ if ($this->registrationOpen()) {
+ $this->create_user();
+ } else {
+ $this->showView('users/new-locked', array());
+ exit();
+ }
break;
case 'HEAD': // fall-through to GET
case 'GET':
@@ -61,6 +66,10 @@ class Users extends Controller {
$this->showView('users/new-logged-in', array());
exit();
}
+ if (!$this->registrationOpen()) {
+ $this->showView('users/new-locked', array());
+ exit();
+ }
if (!isset($vars['errors'])) $vars['errors'] = array();
global $mm; $pm = $mm->pluginManager();
$vars['antispam_html'] = $pm->callHook('antispam_html');
@@ -404,4 +413,14 @@ class Users extends Controller {
$attribs[] = $this->attrib('auth_name', 'Username');
return $attribs;
}
+
+ private function registrationOpen() {
+ global $mm; $db = $mm->database();
+ $val = $db->getSysConf('registration_open');
+ switch ($val) {
+ case 'true': return true;
+ case 'false': return false;
+ default: return true;
+ }
+ }
}