Project

General

Profile

1 1773 Luisehahne
<?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$
13
 * @filesource		$HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17
18
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(defined('WB_PATH') == false)
21
{
22
	die('<h2 style="color:red;margin:3em auto;text-align:center;">Cannot access this file directly</h2>');
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 = emailAdmin();
52
53
				$bSendRegistrationMailtoAdmin = $wb->mail($sServerEmail,$success_email_to,$email_subject,$email_body,$mail_replyName,$mail_replyto);
54
55
// prepare confirmation mail to user, easy old style
56
				if(($email_to != '') && $bSaveRegistration) {
57
					$email_subject = $MESSAGE['SIGNUP2_SUBJECT_LOGIN_INFO'];
58
					$mail_message = $MESSAGE['SIGNUP2_BODY_LOGIN_INFO'].$MESSAGE['SUCCESS_EMAIL_TEXT_GENERATED'];
59
					$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
60
					$replace = array($sDisplayName, WEBSITE_TITLE, $sLoginName, $sNewPassword);
61
					$mail_message = str_replace($search, $replace, $mail_message);
62
				}
63
			} else {
64
// prepare confirmation mail to user, Register with confirmation
65
				if(($email_to != '') && $bSaveRegistration) {
66
//					$daylight_saving = date('I');
67
					$sConfirmedTimeOut = gmdate('Y/m/d H:i',$sTimeOut).' GMT';
68
					$email_subject = $MESSAGE['SIGNUP_ACTIVATION'];
69
					$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LINK}', '{CONFIRMED_REGISTRATION_ENDTIME}');
70
					$replace = array($sDisplayName, WEBSITE_TITLE, $sLoginName, $sConfirmedLink,$sConfirmedTimeOut);
71
					$mail_message = $MESSAGE['SEND_CONFIRMED_REGISTRATION'].$MESSAGE['SUCCESS_EMAIL_TEXT_GENERATED'];
72
					$mail_message = str_replace($search, $replace, $mail_message);
73
				}
74
			}
75
// now send user email, first prepare values for both of type
76
			$email_body = '';
77
			$regex = "/[^a-z0-9ßöäüÖÄÜ !?:;,.\/_\-=+@#$&\*\(\)]/im";
78
			$recipient = preg_replace( $regex, "?", $sDisplayName );
79
			$email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "?", $recipient );
80
			$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
81
82
			$bSendRegistrationMailtoUser = $wb->mail($sServerEmail,$email_to,$email_subject,$email_body,$sWebMailer);