1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category frontend
|
5
|
* @package account
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2009-2012, WebsiteBaker Org. e.V.
|
8
|
* @link http://www.websitebaker2.org/
|
9
|
* @license http://www.gnu.org/licenses/gpl.html
|
10
|
* @platform WebsiteBaker 2.8.x
|
11
|
* @requirements PHP 5.2.2 and higher
|
12
|
* @version $Id: signup_mails.php 1934 2013-07-22 07:54:06Z darkviper $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/signup_mails.php $
|
14
|
* @lastmodified $Date: 2013-07-22 09:54:06 +0200 (Mon, 22 Jul 2013) $
|
15
|
*
|
16
|
*/
|
17
|
|
18
|
/* -------------------------------------------------------- */
|
19
|
// Must include code to stop this file being accessed directly
|
20
|
if(!defined('WB_PATH')) {
|
21
|
require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
|
22
|
throw new IllegalFileException();
|
23
|
}
|
24
|
/* -------------------------------------------------------- */
|
25
|
|
26
|
//WB_MAILER settings
|
27
|
$sServerEmail = (defined('SERVER_EMAIL') && SERVER_EMAIL != '' ? SERVER_EMAIL : emailAdmin());
|
28
|
$sWebMailer = (defined('WBMAILER_DEFAULT_SENDERNAME') && WBMAILER_DEFAULT_SENDERNAME != '' ? WBMAILER_DEFAULT_SENDERNAME : 'WebsiteBaker Mailer');
|
29
|
|
30
|
$aDebugUserMail = array();
|
31
|
$aDebugAdminMail = array();
|
32
|
|
33
|
$bSendRegistrationMailtoUser = false;
|
34
|
// Send mail to Admin easy old style
|
35
|
if(!CONFIRMED_REGISTRATION)
|
36
|
{
|
37
|
// first send to admin
|
38
|
$bSendRegistrationMailtoAdmin = false;
|
39
|
$sql = 'SELECT `user_id` FROM `'.TABLE_PREFIX.'users` ';
|
40
|
$sql .= 'ORDER BY `user_id` DESC ';
|
41
|
$user_id = $database->get_one($sql)+1;
|
42
|
|
43
|
$mail_replyto = $email_to;
|
44
|
$mail_replyName = $sDisplayName;
|
45
|
$mail_message = $MESSAGE['SIGNUP2_ADMIN_INFO'];
|
46
|
$email_subject = $MESSAGE['SIGNUP2_NEW_USER'];
|
47
|
$search = array('{LOGIN_EMAIL}','{LOGIN_ID}', '{SIGNUP_DATE}', '{LOGIN_NAME}', '{LOGIN_IP}');
|
48
|
$replace = array($email_to, $email_fromname.' ('.$user_id.')', date(DATE_FORMAT.' '.TIME_FORMAT,$get_ts ), $sLoginName, $get_ip);
|
49
|
$mail_message = str_replace($search, $replace, $mail_message);
|
50
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
|
51
|
$success_email_to = ((defined('OWNER_EMAIL') && OWNER_EMAIL != '') ? OWNER_EMAIL : emailAdmin());
|
52
|
$bSendRegistrationMailtoAdmin = $wb->mail($sServerEmail,$success_email_to,$email_subject,$email_body,$mail_replyName,$mail_replyto);
|
53
|
|
54
|
// prepare confirmation mail to user, easy old style
|
55
|
if(($email_to != '') && $bSaveRegistration) {
|
56
|
$email_subject = $MESSAGE['SIGNUP2_SUBJECT_LOGIN_INFO'];
|
57
|
$mail_message = $MESSAGE['SIGNUP2_BODY_LOGIN_INFO'].$MESSAGE['SUCCESS_EMAIL_TEXT_GENERATED'];
|
58
|
$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
|
59
|
$replace = array($sDisplayName, WEBSITE_TITLE, $sLoginName, $sNewPassword);
|
60
|
$mail_message = str_replace($search, $replace, $mail_message);
|
61
|
}
|
62
|
} else {
|
63
|
// prepare confirmation mail to user, Register with confirmation
|
64
|
if(($email_to != '') && $bSaveRegistration) {
|
65
|
// $daylight_saving = date('I');
|
66
|
$sConfirmedTimeOut = gmdate('Y/m/d H:i',$sTimeOut).' GMT';
|
67
|
$email_subject = $MESSAGE['SIGNUP_ACTIVATION'];
|
68
|
$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LINK}', '{CONFIRMED_REGISTRATION_ENDTIME}');
|
69
|
$replace = array($sDisplayName, WEBSITE_TITLE, $sLoginName, $sConfirmedLink,$sConfirmedTimeOut);
|
70
|
$mail_message = $MESSAGE['SEND_CONFIRMED_REGISTRATION'].$MESSAGE['SUCCESS_EMAIL_TEXT_GENERATED'];
|
71
|
$mail_message = str_replace($search, $replace, $mail_message);
|
72
|
}
|
73
|
}
|
74
|
// now send user email, first prepare values for both of type
|
75
|
$email_body = '';
|
76
|
$regex = "/[^a-z0-9ßöäüÖÄÜ !?:;,.\/_\-=+@#$&\*\(\)]/im";
|
77
|
$recipient = preg_replace( $regex, "?", $sDisplayName );
|
78
|
$email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "?", $recipient );
|
79
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
|
80
|
|
81
|
$bSendRegistrationMailtoUser = $wb->mail($sServerEmail,$email_to,$email_subject,$email_body,$sWebMailer);
|