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 2063 2014-01-01 02:56:56Z Luisehahne $
|
13
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/account/confirm_mails.php $
|
14
|
* @lastmodified $Date: 2014-01-01 03:56:56 +0100 (Wed, 01 Jan 2014) $
|
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
|
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 = Translate::getInstance();
|
50
|
$mLang->enableAddon('account');
|
51
|
|
52
|
//WB_MAILER settings
|
53
|
$sServerEmail = (defined('SERVER_EMAIL') && SERVER_EMAIL != '' ? SERVER_EMAIL : emailAdmin());
|
54
|
$sWebMailer = (defined('WBMAILER_DEFAULT_SENDERNAME') && WBMAILER_DEFAULT_SENDERNAME != '' ? WBMAILER_DEFAULT_SENDERNAME : 'WebsiteBaker Mailer');
|
55
|
$sIncludeHeadLinkCss = '';
|
56
|
if( is_readable(WB_PATH .'/account/frontend.css')) {
|
57
|
$sIncludeHeadLinkCss .= '<link href="'.WB_URL.'/account/frontend.css"';
|
58
|
$sIncludeHeadLinkCss .= ' rel="stylesheet" type="text/css" media="screen" />'."\n";
|
59
|
print $sIncludeHeadLinkCss;
|
60
|
}
|
61
|
|
62
|
/**
|
63
|
* now send user email, if activation don't failed'
|
64
|
*
|
65
|
*
|
66
|
*/
|
67
|
|
68
|
if(($email_to != '') && $bSaveRegistration ) {
|
69
|
|
70
|
$email_body = '';
|
71
|
// $get_ip = ObfuscateIp();
|
72
|
$get_ts = time();
|
73
|
$mail_message = $mLang->MESSAGE_SEND_CONFIRMED_ACTIVATION.$mLang->MESSAGE_SUCCESS_EMAIL_TEXT_GENERATED;
|
74
|
$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{{webmaster_email}}');
|
75
|
$replace = array($sDisplayName, WEBSITE_TITLE, $sServerEmail);
|
76
|
$mail_message = str_replace($search, $replace, $mail_message);
|
77
|
|
78
|
$email_subject = $mLang->MESSAGE_SIGNUP_ACTIVATION;
|
79
|
$regex = "/[^a-z0-9ßöäüÖÄÜ !?:;,.\/_\-=+@#$&\*\(\)]/im";
|
80
|
$recipient = preg_replace( $regex, "?", $sDisplayName );
|
81
|
$email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "?", $recipient );
|
82
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|from:)/im", "", $mail_message );
|
83
|
|
84
|
$bSendRegistrationMailtoUser = $wb->mail($sServerEmail,$email_to,$email_subject,$email_body,$sWebMailer);
|
85
|
}
|
86
|
|
87
|
$mail_replyto = $email_to;
|
88
|
$mail_replyName = $sDisplayName;
|
89
|
$mail_message = $mLang->MESSAGE_SIGNUP2_ADMIN_INFO;
|
90
|
$email_subject = $mLang->MESSAGE_SIGNUP2_NEW_USER;
|
91
|
$search = array('{LOGIN_EMAIL}','{LOGIN_ID}', '{SIGNUP_DATE}', '{LOGIN_NAME}', '{LOGIN_IP}');
|
92
|
$replace = array($email_to, $email_fromname.' ('.$iUserId.')', date(DATE_FORMAT.' '.TIME_FORMAT,$get_ts ), $sLoginName, $sLoginIp);
|
93
|
$mail_message = str_replace($search, $replace, $mail_message);
|
94
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
|
95
|
$success_email_to = emailAdmin();
|
96
|
|
97
|
$bSendRegistrationMailtoAdmin = $wb->mail($sServerEmail,$success_email_to,$email_subject,$email_body,$mail_replyName,$mail_replyto);
|
98
|
|
99
|
$output = '';
|
100
|
msgQueue::clear();
|
101
|
// success registration output
|
102
|
$oTpl = new Template(dirname(__FILE__).'/htt','keep');
|
103
|
$oTpl->set_file('page', 'success.htt');
|
104
|
$oTpl->debug = false; // false, true
|
105
|
$oTpl->set_block('page', 'main_block', 'main');
|
106
|
// $oTpl->parse('CSS_BLOCK', $sIncludeHeadLinkCss);
|
107
|
// show messages, default block off
|
108
|
$oTpl->set_block('main_block', 'show_registration_block', 'message');
|
109
|
$oTpl->parse('message', '');
|
110
|
if( ($msg = msgQueue::getSuccess()) != '')
|
111
|
{
|
112
|
$output = $wb->format_message($msg, 'ok');
|
113
|
$oTpl->set_var('MESSAGE_VALUE',$output);
|
114
|
$oTpl->parse('message', 'show_registration_block', true);
|
115
|
}
|
116
|
$oTpl->set_var(array(
|
117
|
'BACK' => $TEXT['BACK'],
|
118
|
'HTTP_REFERER' => isset($_SESSION['HTTP_REFERER']) ? $_SESSION['HTTP_REFERER'] : WB_URL.'/',
|
119
|
)
|
120
|
);
|
121
|
|
122
|
if(CONFIRMED_REGISTRATION) {
|
123
|
$sMessage = $mLang->MESSAGE_SIGNUP2_SUBJECT_NEW_USER.'<br /> ';
|
124
|
$sMessage .= $mLang->MESSAGE_ACTIVATED_NEW_USER;
|
125
|
$oTpl->set_var('MESSAGE',$sMessage);
|
126
|
} else {
|
127
|
$sMessage = $mLang->MESSAGE_SIGNUP2_SUBJECT_NEW_USER.' ';
|
128
|
$sMessage .= $mLang->MESSAGE_SIGNUP_REGISTRATION;
|
129
|
$oTpl->set_var('MESSAGE',$sMessage);
|
130
|
}
|
131
|
//$oTpl->parse('message', 'message_block', true);
|
132
|
$oTpl->parse('main', 'main_block', false);
|
133
|
$output = $oTpl->finish($oTpl->parse('output', 'page'));
|
134
|
unset($oTpl);
|
135
|
print $output;
|