From 227a7126578e4a1fddd20e4f76a7a1494ae07416 Mon Sep 17 00:00:00 2001 From: z0rglub Date: Sun, 14 Sep 2003 15:02:52 +0000 Subject: 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 --- admin/user_list.php | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) 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']; -- cgit v1.2.3