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: confirm_mails.php 1773 2012-09-27 23:42:13Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/confirm_mails.php $
|
14
|
* @lastmodified $Date: 2012-09-28 01:42:13 +0200 (Fri, 28 Sep 2012) $
|
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
|
if (!function_exists('ObfuscateIp')) {
|
26
|
function ObfuscateIp() {
|
27
|
$sClientIp = (isset($_SERVER['REMOTE_ADDR']))
|
28
|
? $_SERVER['REMOTE_ADDR'] : '000.000.000.000';
|
29
|
// $iClientIp = ip2long($sClientIp);
|
30
|
// $sClientIp = long2ip(($iClientIp & ~65535));
|
31
|
return $sClientIp;
|
32
|
}
|
33
|
}
|
34
|
|
35
|
if (!function_exists('emailAdmin')) {
|
36
|
function emailAdmin() {
|
37
|
global $database,$admin;
|
38
|
$retval = $admin->get_email();
|
39
|
if($admin->get_user_id()!='1') {
|
40
|
$sql = 'SELECT `email` FROM `'.TABLE_PREFIX.'users` ';
|
41
|
$sql .= 'WHERE `user_id`=\'1\' ';
|
42
|
$retval = $database->get_one($sql);
|
43
|
}
|
44
|
return $retval;
|
45
|
}
|
46
|
}
|
47
|
|
48
|
// load module language file
|
49
|
$mLang = ModLanguage::getInstance();
|
50
|
//WB_MAILER settings
|
51
|
$sServerEmail = (defined('SERVER_EMAIL') && SERVER_EMAIL != '' ? SERVER_EMAIL : emailAdmin());
|
52
|
$sWebMailer = (defined('WBMAILER_DEFAULT_SENDERNAME') && WBMAILER_DEFAULT_SENDERNAME != '' ? WBMAILER_DEFAULT_SENDERNAME : 'WebsiteBaker Mailer');
|
53
|
|
54
|
/**
|
55
|
* now send user email, if activation don't failed'
|
56
|
*
|
57
|
*
|
58
|
*/
|
59
|
|
60
|
if(($email_to != '') && $bSaveRegistration ) {
|
61
|
|
62
|
$email_body = '';
|
63
|
// $get_ip = ObfuscateIp();
|
64
|
$get_ts = time();
|
65
|
$mail_message = $mLang->MESSAGE_SEND_CONFIRMED_ACTIVATION.$mLang->MESSAGE_SUCCESS_EMAIL_TEXT_GENERATED;
|
66
|
$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{{webmaster_email}}');
|
67
|
$replace = array($sDisplayName, WEBSITE_TITLE, $sServerEmail);
|
68
|
$mail_message = str_replace($search, $replace, $mail_message);
|
69
|
|
70
|
$email_subject = $mLang->MESSAGE_SIGNUP_ACTIVATION;
|
71
|
$regex = "/[^a-z0-9ßöäüÖÄÜ !?:;,.\/_\-=+@#$&\*\(\)]/im";
|
72
|
$recipient = preg_replace( $regex, "?", $sDisplayName );
|
73
|
$email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "?", $recipient );
|
74
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|from:)/im", "", $mail_message );
|
75
|
|
76
|
$bSendRegistrationMailtoUser = $wb->mail($sServerEmail,$email_to,$email_subject,$email_body,$sWebMailer);
|
77
|
}
|
78
|
|
79
|
$mail_replyto = $email_to;
|
80
|
$mail_replyName = $sDisplayName;
|
81
|
$mail_message = $MESSAGE['SIGNUP2_ADMIN_INFO'];
|
82
|
$email_subject = $MESSAGE['SIGNUP2_NEW_USER'];
|
83
|
$search = array('{LOGIN_EMAIL}','{LOGIN_ID}', '{SIGNUP_DATE}', '{LOGIN_NAME}', '{LOGIN_IP}');
|
84
|
$replace = array($email_to, $email_fromname.' ('.$iUserId.')', date(DATE_FORMAT.' '.TIME_FORMAT,$get_ts ), $sLoginName, $sLoginIp);
|
85
|
$mail_message = str_replace($search, $replace, $mail_message);
|
86
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
|
87
|
$success_email_to = emailAdmin();
|
88
|
|
89
|
$bSendRegistrationMailtoAdmin = $wb->mail($sServerEmail,$success_email_to,$email_subject,$email_body,$mail_replyName,$mail_replyto);
|
90
|
|
91
|
$output = '';
|
92
|
msgQueue::clear();
|
93
|
// success registration output
|
94
|
$oTpl = new Template(dirname(__FILE__).'/htt','keep');
|
95
|
$oTpl->set_file('page', 'success.htt');
|
96
|
$oTpl->debug = false; // false, true
|
97
|
$oTpl->set_block('page', 'main_block', 'main');
|
98
|
// show messages, default block off
|
99
|
$oTpl->set_block('main_block', 'show_registration_block', 'message');
|
100
|
$oTpl->parse('message', '');
|
101
|
if( ($msg = msgQueue::getSuccess()) != '')
|
102
|
{
|
103
|
$output = $wb->format_message($msg, 'ok');
|
104
|
$oTpl->set_var('MESSAGE_VALUE',$output);
|
105
|
$oTpl->parse('message', 'show_registration_block', true);
|
106
|
}
|
107
|
$oTpl->set_var(array(
|
108
|
'BACK' => $TEXT['BACK'],
|
109
|
'HTTP_REFERER' => isset($_SESSION['HTTP_REFERER']) ? $_SESSION['HTTP_REFERER'] : WB_URL.'/',
|
110
|
)
|
111
|
);
|
112
|
|
113
|
if(CONFIRMED_REGISTRATION) {
|
114
|
$sMessage = $mLang->MESSAGE_SIGNUP2_SUBJECT_NEW_USER.'<br /> ';
|
115
|
$sMessage .= $mLang->MESSAGE_ACTIVATED_NEW_USER;
|
116
|
$oTpl->set_var('MESSAGE',$sMessage);
|
117
|
} else {
|
118
|
$sMessage = $mLang->MESSAGE_SIGNUP2_SUBJECT_NEW_USER.' ';
|
119
|
$sMessage .= $mLang->MESSAGE_SIGNUP_REGISTRATION;
|
120
|
$oTpl->set_var('MESSAGE',$sMessage);
|
121
|
}
|
122
|
//$oTpl->parse('message', 'message_block', true);
|
123
|
$oTpl->parse('main', 'main_block', false);
|
124
|
$output = $oTpl->finish($oTpl->parse('output', 'page'));
|
125
|
unset($oTpl);
|
126
|
print $output;
|