aboutsummaryrefslogtreecommitdiffstats
path: root/admin/user_list.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-09-14 15:02:52 +0000
committerz0rglub <z0rglub@piwigo.org>2003-09-14 15:02:52 +0000
commit227a7126578e4a1fddd20e4f76a7a1494ae07416 (patch)
tree1b92aff3a9285a76128e03612277f14dd984ddb3 /admin/user_list.php
parenta8e9f95b165bffd74d0b852be3961fe20f71a81f (diff)
Adding a small form to add users, instead of user_add.php
git-svn-id: http://piwigo.org/svn/trunk@98 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/user_list.php')
-rw-r--r--admin/user_list.php32
1 files changed, 31 insertions, 1 deletions
diff --git a/admin/user_list.php b/admin/user_list.php
index 984c5488b..1a15bc980 100644
--- a/admin/user_list.php
+++ b/admin/user_list.php
@@ -23,9 +23,32 @@ $tpl = array( 'listuser_confirm','listuser_modify_hint','listuser_modify',
'listuser_permission','listuser_permission_hint',
'listuser_delete_hint','listuser_delete','yes','no',
'listuser_button_all','listuser_button_invert',
- 'listuser_button_create_address' );
+ 'listuser_button_create_address','title_add','login','password',
+ 'add','errors_title' );
templatize_array( $tpl, 'lang', $sub );
$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
+//------------------------------------------------------------------ add a user
+$errors = array();
+if ( isset( $_POST['submit'] ) )
+{
+ $errors = register_user(
+ $_POST['username'], $_POST['password'], $_POST['password'], '', 'guest' );
+}
+//-------------------------------------------------------------- errors display
+if ( sizeof( $errors ) != 0 )
+{
+ $vtp->addSession( $sub, 'errors' );
+ foreach ( $errors as $error ) {
+ $vtp->addSession( $sub, 'li' );
+ $vtp->setVar( $sub, 'li.li', $error );
+ $vtp->closeSession( $sub, 'li' );
+ }
+ $vtp->closeSession( $sub, 'errors' );
+}
+else
+{
+ $_POST = array();
+}
//--------------------------------------------------------------- delete a user
if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
{
@@ -82,6 +105,13 @@ if ( isset ( $_GET['delete'] ) and is_numeric( $_GET['delete'] ) )
//------------------------------------------------------------------ users list
else
{
+ // add a user
+ $vtp->addSession( $sub, 'add_user' );
+ $action = './admin.php?'.$_SERVER['QUERY_STRING'];
+ $vtp->setVar( $sub, 'add_user.form_action', $action );
+ $vtp->setVar( $sub, 'add_user.f_username', $_POST['username'] );
+ $vtp->closeSession( $sub, 'add_user' );
+
$vtp->addSession( $sub, 'users' );
$action = './admin.php?'.$_SERVER['QUERY_STRING'];