diff options
author | plegall <plg@piwigo.org> | 2013-10-30 12:54:46 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2013-10-30 12:54:46 +0000 |
commit | df6718f3f868b226328ff292f2b5d13f054850ea (patch) | |
tree | 9e072dcce0034e64c6f9b6dba7c0a8e704a603df /register.php | |
parent | f79ae0902b1fedac5cd5eb66d06c3f9fd7703146 (diff) |
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).
git-svn-id: http://piwigo.org/svn/trunk@25237 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'register.php')
-rw-r--r-- | register.php | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/register.php b/register.php index 4e55fe70d..a4c8f910b 100644 --- a/register.php +++ b/register.php @@ -60,40 +60,20 @@ if (isset($_POST['submit'])) $page['errors'][] = l10n('The passwords do not match'); } - register_user($_POST['login'], - $_POST['password'], - $_POST['mail_address'], - true, - $page['errors']); + register_user( + $_POST['login'], + $_POST['password'], + $_POST['mail_address'], + true, + $page['errors'], + isset($_POST['send_password_by_mail']) + ); if (count($page['errors']) == 0) { // email notification - if (isset($_POST['send_password_by_mail']) and isset($_POST['mail_address'])) + if (isset($_POST['send_password_by_mail']) and email_check_format($_POST['mail_address'])) { - include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php'); - - $keyargs_content = array( - get_l10n_args('Hello %s,', $_POST['login']), - get_l10n_args('Thank you for registering at %s!', $conf['gallery_title']), - get_l10n_args('', ''), - get_l10n_args('Here are your connection settings', ''), - get_l10n_args('Username: %s', $_POST['login']), - get_l10n_args('Password: %s', $_POST['password']), - get_l10n_args('Email: %s', $_POST['mail_address']), - get_l10n_args('', ''), - get_l10n_args('If you think you\'ve received this email in error, please contact us at %s', get_webmaster_mail_address()), - ); - - pwg_mail( - $_POST['mail_address'], - array( - 'subject' => '['.$conf['gallery_title'].'] '.l10n('Registration'), - 'content' => l10n_args($keyargs_content), - 'content_format' => 'text/plain', - ) - ); - $_SESSION['page_infos'][] = l10n('Successfully registered, you will soon receive an email with your connection settings. Welcome!'); } |