aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-02-13 19:53:07 +0000
committerplegall <plg@piwigo.org>2005-02-13 19:53:07 +0000
commitb3aff324b9943e9f32e3f0a4e6be49d4cad0ee48 (patch)
treece8b99efd304406c484ce5fdc1d15976775a6f22
parent72b4671ba9242ea2fd1ee48fcd68a9e3896bc3db (diff)
- ability to add users from administration panel
git-svn-id: http://piwigo.org/svn/trunk@741 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--profile.php33
-rw-r--r--template/default/profile.tpl28
2 files changed, 40 insertions, 21 deletions
diff --git a/profile.php b/profile.php
index 28a7af672..a36fdbc74 100644
--- a/profile.php
+++ b/profile.php
@@ -208,6 +208,11 @@ UPDATE '.USERS_TABLE.'
}
}
}
+else if (defined('IN_ADMIN') and IN_ADMIN and isset($_POST['submit_add']))
+{
+ $errors = register_user($_POST['login'], $_POST['password'],
+ $_POST['password'], '');
+}
// +-----------------------------------------------------------------------+
// | page header and options |
// +-----------------------------------------------------------------------+
@@ -227,9 +232,10 @@ $template->set_filenames(array('profile_body'=>'profile.tpl'));
if (defined('IN_ADMIN') and IN_ADMIN and empty($userdata))
{
- $template->assign_block_vars('select_user',array());
-
$admin_profile = add_session_id(PHPWG_ROOT_PATH.'admin.php?page=profile');
+
+ $template->assign_block_vars('add_user', array('F_ACTION'=>$admin_profile));
+ $template->assign_block_vars('select_user',array());
$conf['users_page'] = 20;
$start = isset($_GET['start']) ? $_GET['start'] : 0;
@@ -253,9 +259,11 @@ SELECT COUNT(*) AS counter
'L_LOOKUP_USER'=>$lang['Look_up_user'],
'L_FIND_USERNAME'=>$lang['Find_username'],
'L_AUTH_USER'=>$lang['permuser_only_private'],
+ 'L_GROUP_ADD_USER' => $lang['group_add_user'],
'L_SUBMIT'=>$lang['submit'],
'L_STATUS'=>$lang['user_status'],
'L_USERNAME' => $lang['login'],
+ 'L_PASSWORD' => $lang['password'],
'L_EMAIL' => $lang['mail_address'],
'L_ORDER_BY' => $lang['order_by'],
'L_ACTIONS' => $lang['actions'],
@@ -426,16 +434,6 @@ else
$url_return = PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'];
$template->assign_vars(array('U_RETURN' => add_session_id($url_return)));
}
-//-------------------------------------------------------------- errors display
- if (count($errors) != 0)
- {
- $template->assign_block_vars('modify.errors',array());
- foreach ($errors as $error)
- {
- $template->assign_block_vars('modify.errors.error',
- array('ERROR'=>$error));
- }
- }
//------------------------------------------------------------- user management
if (defined('IN_ADMIN') and IN_ADMIN)
{
@@ -465,6 +463,17 @@ else
}
}
// +-----------------------------------------------------------------------+
+// | errors display |
+// +-----------------------------------------------------------------------+
+if (count($errors) != 0)
+{
+ $template->assign_block_vars('errors',array());
+ foreach ($errors as $error)
+ {
+ $template->assign_block_vars('errors.error', array('ERROR'=>$error));
+ }
+}
+// +-----------------------------------------------------------------------+
// | html code display |
// +-----------------------------------------------------------------------+
if (defined('IN_ADMIN') and IN_ADMIN)
diff --git a/template/default/profile.tpl b/template/default/profile.tpl
index 79f15764e..ad6619c37 100644
--- a/template/default/profile.tpl
+++ b/template/default/profile.tpl
@@ -1,3 +1,22 @@
+<!-- BEGIN errors -->
+<div class="errors">
+ <ul>
+ <!-- BEGIN error -->
+ <li>{errors.error.ERROR}</li>
+ <!-- END error -->
+ </ul>
+</div>
+<!-- END errors -->
+
+<!-- BEGIN add_user -->
+<div class="admin">{L_GROUP_ADD_USER}</div>
+<form method="post" name="post" action="{add_user.F_ACTION}">
+ {L_USERNAME} <input type="text" name="login" maxlength="50" size="20" />
+ {L_PASSWORD} <input type="text" name="password" />
+ <input type="submit" name="submit_add" value="add" class="bouton" />
+</form>
+<!-- END add_user -->
+
<!-- BEGIN select_user -->
<div class="admin">{L_SELECT_USERNAME}</div>
<form method="post" name="post" action="{F_SEARCH_USER_ACTION}">
@@ -50,15 +69,6 @@
<!-- BEGIN profile -->
<div class="titrePage">{L_TITLE}</div>
<!-- END profile -->
-<!-- BEGIN errors -->
-<div class="errors">
- <ul>
- <!-- BEGIN error -->
- <li>{modify.errors.error.ERROR}</li>
- <!-- END error -->
- </ul>
-</div>
-<!-- END errors -->
<form method="post" action="{F_ACTION}">
<table width="70%" align="center">
<tr class="admin">