Subversion Repositories ALCASAR

Rev

Rev 3037 | Rev 3062 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3037 Rev 3038
Line 50... Line 50...
50
fclose($file_conf);
50
fclose($file_conf);
51
$whiteDomain	= explode(" ", strtolower(trim($conf['MAIL_WHITEDOMAIN'])));
51
$whiteDomain	= explode(" ", strtolower(trim($conf['MAIL_WHITEDOMAIN'])));
52
$adminMail		= $conf['MAIL_ADMIN'];
52
$adminMail		= $conf['MAIL_ADMIN'];
53
$typeMail		= $conf['MAIL_TYPE'];
53
$typeMail		= $conf['MAIL_TYPE'];
54
$fromMail		= $conf['MAIL_ADDR'];
54
$fromMail		= $conf['MAIL_ADDR'];
-
 
55
$organism		= $conf['ORGANISM'];
55
 
56
 
56
/****************************************
57
/****************************************
57
*			Choice of language			*
58
*			Choice of language			*
58
*****************************************/
59
*****************************************/
59
$Language = 'en';
60
$Language = 'en';
60
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
61
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
61
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
62
	$Langue = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
62
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
63
	$Language = strtolower(substr(chop($Langue[0]), 0, 2));
63
}
64
}
64
if ($Language === 'fr') {
65
if ($Language === 'fr') {
65
	$l_invalid_Email = "L'adresse email est invalide";
66
	$l_invalid_Email = "L'adresse e-mail est invalide";
66
	$l_domain = "Le domaine";
67
	$l_domain = "Le domaine";
67
	$l_not_authorized = "n'est pas autorisé";
68
	$l_not_authorized = "n'est pas autorisé";
68
	$l_Email_already_used = "Cette adresse email est déjà utilisée.";
69
	$l_Email_already_used = "Cette adresse e-mail est déjà utilisée.";
69
	$l_subject = "Activation de votre compte ALCASAR";
70
	$l_subject = "Activation de votre compte ALCASAR";
70
	$l_hello = "Bonjour";
71
	$l_hello = "Bonjour";
71
	$l_automatic_mail = "Ceci est un e-mail automatique provenant d'un portail ALCASAR";
72
	$l_automatic_mail = "Ceci est un e-mail automatique provenant du portail ALCASAR : $organism";
72
	$l_login = "Vos indentifiants de connexion :";
73
	$l_login = "Voici vos indentifiants de connexion :";
73
	$l_email = "Adresse e-mail";
-
 
74
	$l_password = "Mot de passe";
74
	$l_password = "Mot de passe";
75
	$l_go_home = "Rendez-vous sur la page d'accueil";
75
	$l_mail_success = "Un mot de passe vient d'être envoyé à votre adresse e-mail.";
76
	$l_mail_error = "Erreur lors de l'envoi du mail. Renouvelez votre inscription ou contactez votre administrateur.";
76
	$l_mail_error = "Erreur lors de l'envoi du mail. Renouvelez votre inscription ou contactez votre administrateur.";
77
} else {
77
} else {
78
	$l_invalid_Email = "Invalid Email address";
78
	$l_invalid_Email = "Invalid Email address";
79
	$l_domain = "The domain";
79
	$l_domain = "The domain";
80
	$l_not_authorized = "is not authorized";
80
	$l_not_authorized = "is not authorized";
81
	$l_Email_already_used = "This Email address is already used.";
81
	$l_Email_already_used = "This Email address is already used.";
82
	$l_subject = "Activation of your ALCASAR account";
82
	$l_subject = "Activation of your ALCASAR account";
83
	$l_hello = "Hello";
83
	$l_hello = "Hello";
84
	$l_automatic_mail = "This is an automatic e-mail from an ALCASAR portal";
84
	$l_automatic_mail = "This is an automatic e-mail from ALCASAR portal : $organism";
85
	$l_login = "Your login credentials :";
85
	$l_login = "Here are your login credentials :";
86
	$l_email = "e-mail address";
-
 
87
	$l_password = "Password";
86
	$l_password = "Password";
88
	$l_go_home = "Go to the home page";
87
	$l_mail_success = "A password has been sent to your e-mail address";
89
	$l_mail_error = "Error while sending the email. Renew your registration or contact your administrator.";
88
	$l_mail_error = "Error while sending the email. Renew your registration or contact your administrator.";
90
}
89
}
91
 
90
 
92
if (is_file("acc/manager/lib/langues.php"))
-
 
93
	include("acc/manager/lib/langues.php");
-
 
94
 
-
 
95
if(!isset($create)) $create=0;
91
if(!isset($create)) $create=0;
96
if(!isset($show)) $show=0;
92
if(!isset($show)) $show=0;
97
if(!isset($login)) $login = '';
93
if(!isset($login)) $login = '';
98
if(!isset($cn)) $cn = '';
94
if(!isset($cn)) $cn = '';
99
if(!isset($mail)) $mail = '';
95
if(!isset($mail)) $mail = '';
Line 258... Line 254...
258
							echo "<b>L'utilisateur est déjà présent dans le groupe $Fgroup</b><br />\n";
254
							echo "<b>L'utilisateur est déjà présent dans le groupe $Fgroup</b><br />\n";
259
					}
255
					}
260
					else
256
					else
261
						echo "<b>Impossible d'ajouter l'utilisateur dans le groupe $Fgroup: " . da_sql_error($link,$config) . "</b><br />\n";
257
						echo "<b>Impossible d'ajouter l'utilisateur dans le groupe $Fgroup: " . da_sql_error($link,$config) . "</b><br />\n";
262
				}
258
				}
263
/*
-
 
264
				if (!$da_abort){
-
 
265
					if (isset($Fgroup) && $Fgroup != '')
-
 
266
						require('acc/manager/lib/defaults.php');
-
 
267
					foreach($show_attrs as $key => $attr){
-
 
268
						if ($attrmap["$key"] == 'none')
-
 
269
							continue;
-
 
270
						if ($key == "Filter-Id" && $$attrmap["$key"] == "None")
-
 
271
							continue;
-
 
272
						if ($attrmap["$key"] == ''){
-
 
273
							$attrmap["$key"] = $key;
-
 
274
							$attr_type["$key"] = 'replyItem';
-
 
275
							$rev_attrmap["$key"] = $key;
-
 
276
						}
-
 
277
						if (isset($attr_type["$key"]) && $attr_type["$key"] == 'checkItem'){
-
 
278
							$table = "$config[sql_check_table]";
-
 
279
							$type = 1;
-
 
280
						}
-
 
281
						else if (isset($attr_type["$key"]) && $attr_type["$key"] == 'replyItem'){
-
 
282
							$table = "$config[sql_reply_table]";
-
 
283
							$type = 2;
-
 
284
						}
-
 
285
						$val = (isset($_POST[$attrmap["$key"]])) ? $_POST[$attrmap["$key"]] : '';
-
 
286
						$val = da_sql_escape_string($link, $val);
-
 
287
						$op_name = $attrmap["$key"] . '_op';
-
 
288
						$op_val = (isset($$op_name)) ? $$op_name : '';
-
 
289
						if ($op_val != ''){
-
 
290
							$op_val = da_sql_escape_string($link, $op_val);
-
 
291
							if (check_operator($op_val,$type) == -1){
-
 
292
								echo "<b>Invalid operator ($op_val) for attribute $key</b><br />\n";
-
 
293
								continue;
-
 
294
							}
-
 
295
							$op_val2 = ",'$op_val'";
-
 
296
						}
-
 
297
						$chkdef = (isset($default_vals["$key"])) ? check_defaults($val,$op_val,$default_vals["$key"]) : 0;
-
 
298
						if ($val == '' || $chkdef)
-
 
299
							continue;
-
 
300
						$sqlquery = "INSERT INTO $table (attribute,value,username $text)
-
 
301
							VALUES ('$attrmap[$key]','$val','$login' $op_val2);";
-
 
302
						$res = da_sql_query($link,$config,$sqlquery);
-
 
303
						if (!$res || !da_sql_affected_rows($link,$res,$config))
-
 
304
							echo "<b>Query failed for attribute $key: " . da_sql_error($link,$config) . "</b><br />\n";
-
 
305
					}
-
 
306
				}
-
 
307
*/
-
 
308
				// Creation of the email with the new user login & passwd
259
				// Creation of the email with the new user login & passwd
309
				$ip = $_SERVER['REMOTE_ADDR'];
260
				$ip = $_SERVER['REMOTE_ADDR'];
310
				$time = date_create('now')->format('d-m-Y H:i:s');
261
				$time = date_create('now')->format('d-m-Y H:i:s');
311
				$domain = $conf["DOMAIN"];
262
				$domain = $conf["DOMAIN"];
312
				$hostname  = $conf["HOSTNAME"];
263
				$hostname  = $conf["HOSTNAME"];
Line 316... Line 267...
316
				else {
267
				else {
317
					$from = "administrator";
268
					$from = "administrator";
318
				}
269
				}
319
				$subject = $l_subject;
270
				$subject = $l_subject;
320
				$message = "<!DOCTYPE html>
271
				$message = "<!DOCTYPE html>
321
						<html>
272
<html>
322
							<head>	
273
	<head>	
323
								<meta charset=\"UTF-8\" />
274
		<meta charset=\"UTF-8\" />
324
							</head>
275
	</head>
325
							<body>
276
		<body>
326
								$l_hello,<br/><br/>
277
			$l_hello,<br/>
327
								<p>$l_automatic_mail ($hostname.$domain)<br/>
278
			<p>$l_automatic_mail<br/>
328
								<h4>$l_login</h4>
279
			<h3>$l_login</h3>
329
								<pre>
280
			<pre>
330
									$l_email : $Fmail 
-
 
331
									Login : $login
281
				Login : $login
332
									$l_password : $password
282
				$l_password : $password
333
								</pre>
283
			</pre>
334
								<p>$l_go_home : <a href=\"https://$hostname.$domain\"></a></p>
-
 
335
							</body>
284
		</body>
336
						</html>";
285
</html>";
337
				$header = "From: $from\n";
286
				$header = "From: $from\n";
338
				$header .= "MIME-Version: 1.0\n";
287
				$header .= "MIME-Version: 1.0\n";
339
				$header .= "Content-type: text/html; charset=utf-8\n";
288
				$header .= "Content-type: text/html; charset=utf-8\n";
340
				if(mail($to, $subject, $message, $header)){
289
				if(mail($to, $subject, $message, $header)){
341
					echo "<center>success : <b>Vous y êtes presque ! $l_user '$login' $l_created</b></center><br />";
-
 
342
					echo "<center>success : <b>Un email contenant vos informations de connexion vient d'être envoyé.</b></center><br />";
-
 
343
					echo "Info : to = $to ; header = $header<br />";
290
					echo "<center>success : <b>$l_mail_success</b><br>";
344
					// Creation of the email for the administrator (if enabled)
291
					if (!empty($adminMail)){ // Creation of the email for the administrator (if enabled)
345
					if (!empty($adminMail)){
-
 
346
						$to = $adminMail;
292
						$to = $adminMail;
347
						$from = "administrator";
-
 
348
						$subject = "New registration on ALCASAR";
293
						$subject = "New registration on ALCASAR";
349
						$message = "<!DOCTYPE html>
294
						$message = "<!DOCTYPE html>
350
							<html>
295
<html>
351
								<head>	
296
	<head>	
352
									<meta charset=\"UTF-8\" />
297
		<meta charset=\"UTF-8\" />
353
								</head>
298
	</head>
354
								<body>
299
	<body>
355
									Hello,<br/><br/>
300
		Hello,<br/>
356
									<p>This is an automatic e-mail from an ALCASAR portal.<br/>
301
		<p>$l_automatic_mail<br/>
357
									<h3>A new registration on <strong>$hostname.$domain</strong> has been made :</h3>
302
		<h3>A new registration on ALCASAR '$organism' has been made :</h3>
358
									<pre>
303
		<pre>
359
										@IP   :	$ip
304
			@IP   : $ip
360
										Hour :	$time
305
			Hour  : $time
361
										Login :	$login
306
			Login : $login
362
										Email :	$Fmail 
307
			Email : $Fmail
363
									</pre>
308
		</pre>
364
									<p><a href=\"https://$hostname\">$domain</a></p>
-
 
365
								</body>
309
	</body>
366
							</html>";
310
</html>";
367
						$header = "From: $from\n";
-
 
368
						$header .= "MIME-Version: 1.0\n";
-
 
369
						$header .= "Content-type: text/html; charset=utf-8\n";
-
 
370
						mail($to, $subject, $message, $header);
311
						mail($to, $subject, $message, $header);
371
					}
312
					}
372
				} else {
313
				} else {
373
					// On smtp error, we remove the new user
314
					// On smtp error, we remove the new user
374
					$link = da_sql_pconnect($config);
315
					$link = da_sql_pconnect($config);