aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-12-11 06:10:38 +0000
committerrub <rub@piwigo.org>2007-12-11 06:10:38 +0000
commit89623393d4b1722c399454656dc3abc3e39446f4 (patch)
tree4ec078194906072eb83bbbe917cd899c9308609b /include
parent24553207a974463deaeffde63d0561833ad321a9 (diff)
Resolved issue 0000784: Mail notification disabled on register user
Merge branch-1_7 2176:2177 into BSF git-svn-id: http://piwigo.org/svn/trunk@2178 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_user.inc.php57
-rw-r--r--include/user.inc.php2
2 files changed, 41 insertions, 18 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 148c01dc7..16a67fd8d 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -66,7 +66,8 @@ where upper('.$conf['user_fields']['email'].') = upper(\''.$mail_address.'\')
}
}
-function register_user($login, $password, $mail_address, $errors = array())
+function register_user($login, $password, $mail_address,
+ $with_notification = true, $errors = array())
{
global $conf;
@@ -113,28 +114,29 @@ SELECT MAX('.$conf['user_fields']['id'].') + 1
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
mass_inserts(USERS_TABLE, array_keys($insert), array($insert));
- // Assign by default groups
- {
- $query = '
+ // Assign by default groups
+ {
+ $query = '
SELECT id
FROM '.GROUPS_TABLE.'
WHERE is_default = \''.boolean_to_string(true).'\'
ORDER BY id ASC
;';
- $result = pwg_query($query);
+ $result = pwg_query($query);
- $inserts = array();
- while ($row = mysql_fetch_array($result))
- {
- array_push
- (
- $inserts,
- array
+ $inserts = array();
+ while ($row = mysql_fetch_array($result))
+ {
+ array_push
(
- 'user_id' => $next_id,
- 'group_id' => $row['id']
- )
- );
+ $inserts,
+ array
+ (
+ 'user_id' => $next_id,
+ 'group_id' => $row['id']
+ )
+ );
+ }
}
if (count($inserts) != 0)
@@ -142,10 +144,31 @@ SELECT id
include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
mass_inserts(USER_GROUP_TABLE, array('user_id', 'group_id'), $inserts);
}
- }
create_user_infos($next_id);
+ if ($with_notification and $conf['email_admin_on_new_user'])
+ {
+ include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
+ $username = $_POST['login'];
+ $admin_url = get_absolute_root_url()
+ .'admin.php?page=user_list&username='.$username;
+
+ $keyargs_content = array
+ (
+ get_l10n_args('User: %s', $username),
+ get_l10n_args('Email: %s', $_POST['mail_address']),
+ get_l10n_args('', ''),
+ get_l10n_args('Admin: %s', $admin_url)
+ );
+
+ pwg_mail_notification_admins
+ (
+ get_l10n_args('Registration of %s', $username),
+ $keyargs_content
+ );
+ }
+
trigger_action('register_user',
array(
'id'=>$next_id,
diff --git a/include/user.inc.php b/include/user.inc.php
index 047e68723..965cfa262 100644
--- a/include/user.inc.php
+++ b/include/user.inc.php
@@ -65,7 +65,7 @@ if ($conf['apache_authentication'] and isset($_SERVER['REMOTE_USER']))
{
if (!($user['id'] = get_userid($_SERVER['REMOTE_USER'])))
{
- register_user($_SERVER['REMOTE_USER'], '', '');
+ register_user($_SERVER['REMOTE_USER'], '', '', false);
$user['id'] = get_userid($_SERVER['REMOTE_USER']);
}
}