diff --git a/inc/auth.php b/inc/auth.php index 6e97b12c0509a6cb972ffa43cffca83e514e487d..40145ee78531b38e5468d9161c003db60abdcc1d 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -501,16 +501,23 @@ function register(){ return false; } + // create substitutions for use in notification email + $substitutions = array( + 'NEWUSER' => $_POST['login'], + 'NEWNAME' => $_POST['fullname'], + 'NEWEMAIL' => $_POST['email'], + ); + if (!$conf['autopasswd']) { msg($lang['regsuccess2'],1); - notify('', 'register', '', $_POST['login'], false); + notify('', 'register', '', $_POST['login'], false, $substitutions); return true; } // autogenerated password? then send him the password if (auth_sendPassword($_POST['login'],$pass)){ msg($lang['regsuccess'],1); - notify('', 'register', '', $_POST['login'], false); + notify('', 'register', '', $_POST['login'], false, $substitutions); return true; }else{ msg($lang['regmailfail'],-1); diff --git a/inc/common.php b/inc/common.php index bed5105fb73d36d6a8e97465b43851e4a4a80ec1..3064c4fda28798e35b23d02b44a63c7ee7231d8a 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1111,10 +1111,11 @@ function saveOldRevision($id){ * @param int $rev Old page revision * @param string $summary What changed * @param boolean $minor Is this a minor edit? + * @param array $replace Additional string substitutions, @KEY@ to be replaced by value * * @author Andreas Gohr <andi@splitbrain.org> */ -function notify($id,$who,$rev='',$summary='',$minor=false){ +function notify($id,$who,$rev='',$summary='',$minor=false,$replace=array()){ global $lang; global $conf; @@ -1151,6 +1152,10 @@ function notify($id,$who,$rev='',$summary='',$minor=false){ $text = str_replace('@SUMMARY@',$summary,$text); $text = str_replace('@USER@',$_SERVER['REMOTE_USER'],$text); + foreach ($replace as $key => $substitution) { + $text = str_replace('@'.strtoupper($key).'@',$substitution, $text); + } + if($who == 'register'){ $subject = $lang['mail_new_user'].' '.$summary; }elseif($rev){ diff --git a/inc/lang/en/registermail.txt b/inc/lang/en/registermail.txt index 53ffcab70e968f0ff66699e4f3c486a02a6fe1ed..f5ab7e4ead46b5c9e08bf485f151325eae63cccb 100644 --- a/inc/lang/en/registermail.txt +++ b/inc/lang/en/registermail.txt @@ -1,5 +1,9 @@ A new user has registered. Here are the details: +User name : @NEWUSER@ +Full name : @NEWNAME@ +Email : @NEWEMAIL@ + Date : @DATE@ Browser : @BROWSER@ IP-Address : @IPADDRESS@