aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--actions/register.php3
-rw-r--r--actions/useradd.php2
-rw-r--r--views/default/account/forms/register.php34
-rw-r--r--views/default/account/forms/useradd.php33
4 files changed, 34 insertions, 38 deletions
diff --git a/actions/register.php b/actions/register.php
index b404d844a..43a653b3f 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -13,6 +13,8 @@
require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
global $CONFIG;
+
+ action_gatekeeper();
// Get variables
$username = get_input('username');
@@ -22,6 +24,7 @@
$name = get_input('name');
$admin = get_input('admin');
+ if (is_array($admin)) $admin = $admin[0];
if (!$CONFIG->disable_registration)
diff --git a/actions/useradd.php b/actions/useradd.php
index 3ca17dba7..cdd9adcf7 100644
--- a/actions/useradd.php
+++ b/actions/useradd.php
@@ -14,6 +14,7 @@
require_once(dirname(dirname(__FILE__)) . "/engine/start.php");
admin_gatekeeper(); // Only admins can make someone an admin
+ action_gatekeeper();
// Get variables
$username = get_input('username');
@@ -23,6 +24,7 @@
$name = get_input('name');
$admin = get_input('admin');
+ if (is_array($admin)) $admin = $admin[0];
// For now, just try and register the user
if (
diff --git a/views/default/account/forms/register.php b/views/default/account/forms/register.php
index 931383aa4..f8c9ffe5b 100644
--- a/views/default/account/forms/register.php
+++ b/views/default/account/forms/register.php
@@ -13,26 +13,24 @@
$admin_option = false;
if (($_SESSION['user']->admin) && ($vars['show_admin']))
- $admin_option = true;
+ $admin_option = true;
+
+ $form_body = "<p><label>" . elgg_echo('name') . "<br />" . elgg_view('input/text' , array('internalname' => 'name', 'class' => "general-textarea")) . "</label><br />";
+
+ $form_body .= "<label>" . elgg_echo('email') . "<br />" . elgg_view('input/text' , array('internalname' => 'email', 'class' => "general-textarea")) . "</label><br />";
+ $form_body .= "<label>" . elgg_echo('username') . "<br />" . elgg_view('input/text' , array('internalname' => 'username', 'class' => "general-textarea")) . "</label><br />";
+ $form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password' , array('internalname' => 'password', 'class' => "general-textarea")) . "</label><br />";
+ $form_body .= "<label>" . elgg_echo('passwordagain') . "<br />" . elgg_view('input/password' , array('internalname' => 'password2', 'class' => "general-textarea")) . "</label><br />";
+
+ if ($admin_option)
+ $form_body .= elgg_view('input/checkboxes', array('internalname' => "admin", 'options' => array(elgg_echo('admin_option'))));
+
+ $form_body .= elgg_view('input/hidden', array('internalname' => 'action', 'value' => 'register'));
+ $form_body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('register'))) . "</p>";
?>
<div id="register-box">
- <h2><?php echo elgg_echo('register'); ?></h2>
- <form action="<?php echo $vars['url']; ?>action/register" method="POST">
- <p><label><?php echo elgg_echo('name'); ?><br /><input name="name" type="text" class="general-textarea" /></label><br />
- <label><?php echo elgg_echo('email'); ?><br /><input name="email" type="text" class="general-textarea" /></label><br />
- <label><?php echo elgg_echo('username'); ?><br /><input name="username" type="text" class="general-textarea" /></label><br />
- <label><?php echo elgg_echo('password'); ?><br /><input name="password" type="password" class="general-textarea" /></label><br />
- <label><?php echo elgg_echo('passwordagain'); ?><br /><input name="password2" type="password" class="general-textarea" /></label><br />
- <?php
- if ($admin_option) {
-?>
- <label><?php echo elgg_echo('admin_option'); ?><br /><input type="checkbox" name="admin" /></label> <br />
-<?php
- }
- ?>
- <input type="submit" name="submit" class="submit_button" value="<?php echo elgg_echo('register'); ?>" /></p>
- <input type="hidden" name="action" value="register" />
- </form>
+ <h2><?php echo elgg_echo('register'); ?></h2>
+ <?php echo elgg_view('input/form', array('action' => "{$vars['url']}action/register", 'body' => $form_body)) ?>
</div> \ No newline at end of file
diff --git a/views/default/account/forms/useradd.php b/views/default/account/forms/useradd.php
index c170f30f1..28e5d3d30 100644
--- a/views/default/account/forms/useradd.php
+++ b/views/default/account/forms/useradd.php
@@ -13,29 +13,22 @@
$admin_option = false;
if (($_SESSION['user']->admin) && ($vars['show_admin']))
$admin_option = true;
+
+ $form_body = "<p><label>" . elgg_echo('name') . "<br />" . elgg_view('input/text' , array('internalname' => 'name')) . "</label><br />";
+
+ $form_body .= "<label>" . elgg_echo('email') . "<br />" . elgg_view('input/text' , array('internalname' => 'email')) . "</label><br />";
+ $form_body .= "<label>" . elgg_echo('username') . "<br />" . elgg_view('input/text' , array('internalname' => 'username')) . "</label><br />";
+ $form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password' , array('internalname' => 'password')) . "</label><br />";
+ $form_body .= "<label>" . elgg_echo('passwordagain') . "<br />" . elgg_view('input/password' , array('internalname' => 'password2')) . "</label><br />";
+
+ if ($admin_option)
+ $form_body .= elgg_view('input/checkboxes', array('internalname' => "admin", 'options' => array(elgg_echo('admin_option'))));
+
+ $form_body .= elgg_view('input/submit', array('internalname' => 'submit', 'value' => elgg_echo('register'))) . "</p>";
?>
<div id="add-box">
<h2><?php echo elgg_echo('adduser'); ?></h2>
- <form action="<?php echo $vars['url']; ?>action/useradd" method="POST">
- <p><label><?php echo elgg_echo('name'); ?>:
- <?php echo elgg_view('input/text', array('internalname' => 'name')); ?></label><br />
- <label><?php echo elgg_echo('email'); ?>:
- <?php echo elgg_view('input/email', array('internalname' => 'email')); ?></label><br />
- <label><?php echo elgg_echo('username'); ?>:
- <?php echo elgg_view('input/text', array('internalname' => 'username')); ?></label><br />
- <label><?php echo elgg_echo('password'); ?>:
- <?php echo elgg_view('input/password', array('internalname' => 'password')); ?></label><br />
- <label><?php echo elgg_echo('passwordagain'); ?>:
- <?php echo elgg_view('input/password', array('internalname' => 'password2')); ?></label><br />
- <?php
- if ($admin_option) {
-?>
- <label><?php echo elgg_echo('admin_option'); ?> <input type="checkbox" name="admin" /></label> <br />
-<?php
- }
- ?>
- <input type="submit" name="submit" class="submit_button" value="<?php echo elgg_echo('adduser'); ?>" /></p>
- </form>
+ <?php echo elgg_view('input/form', array('action' => "{$vars['url']}action/useradd", 'body' => $form_body)) ?>
</div> \ No newline at end of file