Changeset 25237 for trunk/register.php


Ignore:
Timestamp:
Oct 30, 2013, 1:54:46 PM (10 years ago)
Author:
plg
Message:

feature 1668, user manager redesign: ability to add a new user (call to pwg.users.add through AJAX)

Move the "send connection settings" code to function register_user (avoid code duplication).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/register.php

    r25121 r25237  
    6161  }
    6262
    63   register_user($_POST['login'],
    64                 $_POST['password'],
    65                 $_POST['mail_address'],
    66                 true,
    67                 $page['errors']);
     63  register_user(
     64    $_POST['login'],
     65    $_POST['password'],
     66    $_POST['mail_address'],
     67    true,
     68    $page['errors'],
     69    isset($_POST['send_password_by_mail'])
     70    );
    6871
    6972  if (count($page['errors']) == 0)
    7073  {
    7174    // email notification
    72     if (isset($_POST['send_password_by_mail']) and isset($_POST['mail_address']))
     75    if (isset($_POST['send_password_by_mail']) and email_check_format($_POST['mail_address']))
    7376    {
    74       include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
    75            
    76       $keyargs_content = array(
    77         get_l10n_args('Hello %s,', $_POST['login']),
    78         get_l10n_args('Thank you for registering at %s!', $conf['gallery_title']),
    79         get_l10n_args('', ''),
    80         get_l10n_args('Here are your connection settings', ''),
    81         get_l10n_args('Username: %s', $_POST['login']),
    82         get_l10n_args('Password: %s', $_POST['password']),
    83         get_l10n_args('Email: %s', $_POST['mail_address']),
    84         get_l10n_args('', ''),
    85         get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()),
    86         );
    87        
    88       pwg_mail(
    89         $_POST['mail_address'],
    90         array(
    91           'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'),
    92           'content' => l10n_args($keyargs_content),
    93           'content_format' => 'text/plain',
    94           )
    95         );
    96        
    9777      $_SESSION['page_infos'][] = l10n('Successfully registered, you will soon receive an email with your connection settings. Welcome!');
    9878    }
Note: See TracChangeset for help on using the changeset viewer.