@@ -194,67 +194,64 @@ function user_insert($event_name, $data) {
194194 }
195195 }
196196 }
197-
198- $ global_config = $ app ->getconf ->get_global_config ('mail ' );
199- if ($ global_config ['enable_welcome_mail ' ] == 'n ' ) {
200- return ;
201- }
202-
203- //* Send the welcome email message
204- $ tmp = explode ('@ ' , $ data ["new " ]["email " ]);
205- $ domain = $ tmp [1 ];
206- unset($ tmp );
207- $ html = false ;
208- if (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.html ' )) {
209- $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.html ' );
210- $ html = true ;
211- } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.html ' )) {
212- $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.html ' );
213- $ html = true ;
214- } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.txt ' )) {
215- $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.txt ' );
216- } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' )) {
217- $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' );
218- } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_en.txt ' )) {
219- $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_en.txt ' );
220- } elseif (file_exists ($ conf ['rootpath ' ].'/conf/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' )) {
221- $ lines = file ($ conf ['rootpath ' ].'/conf/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' );
222- } else {
223- $ lines = file ($ conf ['rootpath ' ].'/conf/mail/welcome_email_en.txt ' );
224- }
225197
226- //* Get from address
227- $ parts = explode (': ' , trim ($ lines [0 ]));
228- unset($ parts [0 ]);
229- $ welcome_mail_from = implode (': ' , $ parts );
230- unset($ lines [0 ]);
231-
232- //* Get subject
233- $ parts = explode (': ' , trim ($ lines [1 ]));
234- unset($ parts [0 ]);
235- $ welcome_mail_subject = implode (': ' , $ parts );
236- unset($ lines [1 ]);
237-
238- //* Get message
239- $ welcome_mail_message = trim (implode ($ lines ));
240- unset($ tmp );
241-
242- $ mailHeaders = "MIME-Version: 1.0 " . "\n" ;
243- if ($ html ) {
244- $ mailHeaders .= "Content-Type: text/html; charset=utf-8 " . "\n" ;
245- $ mailHeaders .= "Content-Transfer-Encoding: quoted-printable " . "\n" ;
246- } else {
247- $ mailHeaders .= "Content-Type: text/plain; charset=utf-8 " . "\n" ;
248- $ mailHeaders .= "Content-Transfer-Encoding: 8bit " . "\n" ;
249- }
250- $ mailHeaders .= "From: $ welcome_mail_from " . "\n" ;
251- $ mailHeaders .= "Reply-To: $ welcome_mail_from " . "\n" ;
252- $ mailTarget = $ data ["new " ]["email " ];
253- $ mailSubject = "=?utf-8?B? " .base64_encode ($ welcome_mail_subject )."?= " ;
198+ $ global_config = $ app ->getconf ->get_global_config ('mail ' );
199+ if ($ global_config ['enable_welcome_mail ' ] == 'y ' ) {
200+ //* Send the welcome email message
201+ $ tmp = explode ('@ ' , $ data ["new " ]["email " ]);
202+ $ domain = $ tmp [1 ];
203+ unset($ tmp );
204+ $ html = false ;
205+ if (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.html ' )) {
206+ $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.html ' );
207+ $ html = true ;
208+ } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.html ' )) {
209+ $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.html ' );
210+ $ html = true ;
211+ } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.txt ' )) {
212+ $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ domain .'.txt ' );
213+ } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' )) {
214+ $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' );
215+ } elseif (file_exists ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_en.txt ' )) {
216+ $ lines = file ($ conf ['rootpath ' ].'/conf-custom/mail/welcome_email_en.txt ' );
217+ } elseif (file_exists ($ conf ['rootpath ' ].'/conf/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' )) {
218+ $ lines = file ($ conf ['rootpath ' ].'/conf/mail/welcome_email_ ' .$ conf ['language ' ].'.txt ' );
219+ } else {
220+ $ lines = file ($ conf ['rootpath ' ].'/conf/mail/welcome_email_en.txt ' );
221+ }
254222
255- //* Send the welcome email only on the "master" mail server to avoid duplicate emails
256- if ($ conf ['mirror_server_id ' ] == 0 ) mail ($ mailTarget , $ mailSubject , $ welcome_mail_message , $ mailHeaders );
223+ //* Get from address
224+ $ parts = explode (': ' , trim ($ lines [0 ]));
225+ unset($ parts [0 ]);
226+ $ welcome_mail_from = implode (': ' , $ parts );
227+ unset($ lines [0 ]);
228+
229+ //* Get subject
230+ $ parts = explode (': ' , trim ($ lines [1 ]));
231+ unset($ parts [0 ]);
232+ $ welcome_mail_subject = implode (': ' , $ parts );
233+ unset($ lines [1 ]);
234+
235+ //* Get message
236+ $ welcome_mail_message = trim (implode ($ lines ));
237+ unset($ tmp );
238+
239+ $ mailHeaders = "MIME-Version: 1.0 " . "\n" ;
240+ if ($ html ) {
241+ $ mailHeaders .= "Content-Type: text/html; charset=utf-8 " . "\n" ;
242+ $ mailHeaders .= "Content-Transfer-Encoding: quoted-printable " . "\n" ;
243+ } else {
244+ $ mailHeaders .= "Content-Type: text/plain; charset=utf-8 " . "\n" ;
245+ $ mailHeaders .= "Content-Transfer-Encoding: 8bit " . "\n" ;
246+ }
247+ $ mailHeaders .= "From: $ welcome_mail_from " . "\n" ;
248+ $ mailHeaders .= "Reply-To: $ welcome_mail_from " . "\n" ;
249+ $ mailTarget = $ data ["new " ]["email " ];
250+ $ mailSubject = "=?utf-8?B? " .base64_encode ($ welcome_mail_subject )."?= " ;
257251
252+ //* Send the welcome email only on the "master" mail server to avoid duplicate emails
253+ if ($ conf ['mirror_server_id ' ] == 0 ) mail ($ mailTarget , $ mailSubject , $ welcome_mail_message , $ mailHeaders );
254+ }
258255 }
259256
260257 function user_update ($ event_name , $ data ) {
0 commit comments