mirror of
https://github.com/Piwigo/Piwigo.git
synced 2026-06-01 20:04:51 +02:00
The generation of mail address works back. Since the add of another form on
the same page, it didn't work, because, when adding a new user and no errors, the $_POST was cleaned, but made no differences between the 2 forms... git-svn-id: http://piwigo.org/svn/trunk@164 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
+10
-18
@@ -29,7 +29,7 @@ templatize_array( $tpl, 'lang', $sub );
|
||||
$vtp->setGlobalVar( $sub, 'user_template', $user['template'] );
|
||||
//------------------------------------------------------------------ add a user
|
||||
$errors = array();
|
||||
if ( isset( $_POST['submit'] ) )
|
||||
if ( isset( $_POST['submit_add_user'] ) )
|
||||
{
|
||||
$errors = register_user(
|
||||
$_POST['username'], $_POST['password'], $_POST['password'], '', 'guest' );
|
||||
@@ -45,7 +45,7 @@ if ( sizeof( $errors ) != 0 )
|
||||
}
|
||||
$vtp->closeSession( $sub, 'errors' );
|
||||
}
|
||||
else
|
||||
else if ( isset( $_POST['submit_add_user'] ) )
|
||||
{
|
||||
$_POST = array();
|
||||
}
|
||||
@@ -220,32 +220,24 @@ else
|
||||
}
|
||||
$vtp->closeSession( $sub, 'category' );
|
||||
// mail management : creation of the mail address if asked by administrator
|
||||
if ( isset( $_GET['mail'] ) )
|
||||
if ( isset( $_POST['submit_generate_mail'] ) and isset( $_GET['mail'] ) )
|
||||
{
|
||||
$mail_address = array();
|
||||
$i = 0;
|
||||
$mails = array();
|
||||
$query = 'SELECT id,mail_address';
|
||||
$query.= ' FROM '.PREFIX_TABLE.'users';
|
||||
$query.= ';';
|
||||
$result = mysql_query( $query );
|
||||
while ( $row = mysql_fetch_array( $result ) )
|
||||
{
|
||||
$key = 'mail-'.$row['id'];
|
||||
if ( $_POST[$key] == 1 )
|
||||
{
|
||||
$mail_address[$i++] = $row['mail_address'];
|
||||
}
|
||||
if ( $_POST['mail-'.$row['id']] == 1 )
|
||||
array_push( $mails, $row['mail_address'] );
|
||||
}
|
||||
$mail_destination = '';
|
||||
for ( $i = 0; $i < sizeof( $mail_address ); $i++ )
|
||||
{
|
||||
$mail_destination.= $mail_address[$i];
|
||||
if ( sizeof( $mail_address ) > 1 )
|
||||
{
|
||||
$mail_destination.= ';';
|
||||
}
|
||||
foreach ( $mails as $i => $mail_address ) {
|
||||
if ( $i > 0 ) $mail_destination.= ',';
|
||||
$mail_destination.= $mail_address;
|
||||
}
|
||||
if ( sizeof( $mail_address ) > 0 )
|
||||
if ( sizeof( $mails ) > 0 )
|
||||
{
|
||||
$vtp->addSession( $sub, 'mail_link' );
|
||||
$vtp->setVar( $sub, 'mail_link.mailto', $mail_destination );
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
<span style="font-weight:bold;">{#title_add}</span> ->
|
||||
{#login} : <input type="text" name="username" value="{#f_username}" />
|
||||
{#password} : <input type="text" name="password" value="{#f_password}" />
|
||||
<input type="submit" value="{#add}" name="submit" />
|
||||
<input type="submit" value="{#add}" name="submit_add_user" />
|
||||
</div>
|
||||
</form>
|
||||
<!--/VTP_add_user-->
|
||||
|
||||
<!--VTP_users-->
|
||||
<form method="post" action="{#form_action}" name="{#form_name}">
|
||||
<form method="post" action="{#form_action}">
|
||||
<table width="100%">
|
||||
<!--VTP_category-->
|
||||
<tr>
|
||||
@@ -90,7 +90,7 @@
|
||||
<img src="../template/{#user_template}/admin/images/arrow_select.gif" alt="<" />
|
||||
<input type="button" value="{#listuser_button_all}" onClick="SelectAll(this.form)" style="margin-left:5px;margin-right:5px;" />
|
||||
<input type="button" value="{#listuser_button_invert}" onClick="Inverser(this.form)" style="margin-left:5px;margin-right:5px;" />
|
||||
<input type="submit" value="{#listuser_button_create_address}" style="margin-left:5px;margin-right:5px;" />
|
||||
<input type="submit" value="{#listuser_button_create_address}" name="submit_generate_mail" style="margin-left:5px;margin-right:5px;" />
|
||||
<!--VTP_mail_link-->
|
||||
<a href="mailto:{#mailto}">mailto:{#mail_address_start}...</a>
|
||||
<!--/VTP_mail_link-->
|
||||
|
||||
Reference in New Issue
Block a user