| 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 |
1777
|
Luisehahne
|
if(!defined('WB_PATH')) {
|
| 21 |
|
|
require_once(dirname(dirname(__FILE__)).'/framework/globalExceptionHandler.php');
|
| 22 |
|
|
throw new IllegalFileException();
|
| 23 |
1773
|
Luisehahne
|
}
|
| 24 |
|
|
/* -------------------------------------------------------- */
|
| 25 |
|
|
|
| 26 |
2063
|
Luisehahne
|
$search = array();
|
| 27 |
|
|
$replace = array();
|
| 28 |
1773
|
Luisehahne
|
//WB_MAILER settings
|
| 29 |
|
|
$sServerEmail = (defined('SERVER_EMAIL') && SERVER_EMAIL != '' ? SERVER_EMAIL : emailAdmin());
|
| 30 |
|
|
$sWebMailer = (defined('WBMAILER_DEFAULT_SENDERNAME') && WBMAILER_DEFAULT_SENDERNAME != '' ? WBMAILER_DEFAULT_SENDERNAME : 'WebsiteBaker Mailer');
|
| 31 |
|
|
|
| 32 |
|
|
$aDebugUserMail = array();
|
| 33 |
|
|
$aDebugAdminMail = array();
|
| 34 |
|
|
|
| 35 |
|
|
$bSendRegistrationMailtoUser = false;
|
| 36 |
|
|
// Send mail to Admin easy old style
|
| 37 |
|
|
if(!CONFIRMED_REGISTRATION)
|
| 38 |
|
|
{
|
| 39 |
|
|
// first send to admin
|
| 40 |
|
|
$bSendRegistrationMailtoAdmin = false;
|
| 41 |
|
|
$sql = 'SELECT `user_id` FROM `'.TABLE_PREFIX.'users` ';
|
| 42 |
|
|
$sql .= 'ORDER BY `user_id` DESC ';
|
| 43 |
|
|
$user_id = $database->get_one($sql)+1;
|
| 44 |
|
|
|
| 45 |
|
|
$mail_replyto = $email_to;
|
| 46 |
|
|
$mail_replyName = $sDisplayName;
|
| 47 |
2063
|
Luisehahne
|
$mail_message = $mLang->MESSAGE_SIGNUP2_ADMIN_INFO;
|
| 48 |
|
|
$email_subject = $mLang->MESSAGE_SIGNUP2_NEW_USER;
|
| 49 |
1773
|
Luisehahne
|
$search = array('{LOGIN_EMAIL}','{LOGIN_ID}', '{SIGNUP_DATE}', '{LOGIN_NAME}', '{LOGIN_IP}');
|
| 50 |
|
|
$replace = array($email_to, $email_fromname.' ('.$user_id.')', date(DATE_FORMAT.' '.TIME_FORMAT,$get_ts ), $sLoginName, $get_ip);
|
| 51 |
|
|
$mail_message = str_replace($search, $replace, $mail_message);
|
| 52 |
|
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
|
| 53 |
1934
|
darkviper
|
$success_email_to = ((defined('OWNER_EMAIL') && OWNER_EMAIL != '') ? OWNER_EMAIL : emailAdmin());
|
| 54 |
1773
|
Luisehahne
|
$bSendRegistrationMailtoAdmin = $wb->mail($sServerEmail,$success_email_to,$email_subject,$email_body,$mail_replyName,$mail_replyto);
|
| 55 |
|
|
|
| 56 |
|
|
// prepare confirmation mail to user, easy old style
|
| 57 |
|
|
if(($email_to != '') && $bSaveRegistration) {
|
| 58 |
2063
|
Luisehahne
|
$sEmailSubject = $mLang->MESSAGE_SIGNUP2_SUBJECT_LOGIN_INFO;
|
| 59 |
|
|
$mail_message = $mLang->MESSAGE_SIGNUP2_BODY_LOGIN_INFO.$mLang->MESSAGE_SUCCESS_EMAIL_TEXT_GENERATED;
|
| 60 |
|
|
$search = array('{LOGIN_DISPLAY_NAME}', '{LOGIN_WEBSITE_TITLE}', '{LOGIN_NAME}', '{LOGIN_PASSWORD}');
|
| 61 |
1773
|
Luisehahne
|
$replace = array($sDisplayName, WEBSITE_TITLE, $sLoginName, $sNewPassword);
|
| 62 |
|
|
$mail_message = str_replace($search, $replace, $mail_message);
|
| 63 |
|
|
}
|
| 64 |
|
|
} else {
|
| 65 |
|
|
// prepare confirmation mail to user, Register with confirmation
|
| 66 |
|
|
if(($email_to != '') && $bSaveRegistration) {
|
| 67 |
|
|
// $daylight_saving = date('I');
|
| 68 |
|
|
$sConfirmedTimeOut = gmdate('Y/m/d H:i',$sTimeOut).' GMT';
|
| 69 |
2063
|
Luisehahne
|
$sEmailSubject = $mLang->MESSAGE_SIGNUP_ACTIVATION;
|
| 70 |
|
|
$search = array("{LOGIN_DISPLAY_NAME}", "{LOGIN_WEBSITE_TITLE}", "{LOGIN_NAME}", "{LINK}", "{CONFIRMED_REGISTRATION_ENDTIME}" );
|
| 71 |
1773
|
Luisehahne
|
$replace = array($sDisplayName, WEBSITE_TITLE, $sLoginName, $sConfirmedLink,$sConfirmedTimeOut);
|
| 72 |
2063
|
Luisehahne
|
$mail_message = $mLang->MESSAGE_SEND_CONFIRMED_REGISTRATION.$mLang->MESSAGE_SUCCESS_EMAIL_TEXT_GENERATED;
|
| 73 |
1773
|
Luisehahne
|
$mail_message = str_replace($search, $replace, $mail_message);
|
| 74 |
2063
|
Luisehahne
|
//print '<pre style="text-align: left;"><strong>function '.__FUNCTION__.'( '.''.' );</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />';
|
| 75 |
|
|
//print_r( $mail_message ); print '</pre>'; // flush ();sleep(10); die();
|
| 76 |
1773
|
Luisehahne
|
}
|
| 77 |
|
|
}
|
| 78 |
|
|
// now send user email, first prepare values for both of type
|
| 79 |
|
|
$email_body = '';
|
| 80 |
|
|
$regex = "/[^a-z0-9ßöäüÖÄÜ !?:;,.\/_\-=+@#$&\*\(\)]/im";
|
| 81 |
|
|
$recipient = preg_replace( $regex, "?", $sDisplayName );
|
| 82 |
|
|
$email_fromname = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "?", $recipient );
|
| 83 |
|
|
$email_body = preg_replace( "/(content-type:|bcc:|cc:|to:|from:)/im", "", $mail_message );
|
| 84 |
2063
|
Luisehahne
|
$bSendRegistrationMailtoUser = $wb->mail($sServerEmail,$email_to,$sEmailSubject,$email_body,$sWebMailer);
|