Subversion Repositories ALCASAR

Rev

Rev 1707 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1707 Rev 1805
Line 1... Line 1...
1
<?php
1
<?php
2
// ticket d'impression (thank's to Geoffroy MUSITELLI)
2
// ticket d'impression (thank's to Geoffroy MUSITELLI)
3
//gestion de la langue
3
//gestion de la langue
4
if (is_file("../lib/langues.php"))
4
if (is_file("../lib/langues.php"))
5
	include("../lib/langues.php");
5
	include("../lib/langues.php");
-
 
6
 
-
 
7
require('../lib/operators.php');
-
 
8
 
-
 
9
if(!isset($create)) $create=0;
-
 
10
if(!isset($show)) $show=0;
-
 
11
if(!isset($login)) $login = '';
-
 
12
if(!isset($cn)) $cn = '';
-
 
13
if(!isset($mail)) $mail = '';
-
 
14
if(!isset($langue_imp)) $langue_imp = '';
-
 
15
if(!isset($selected)) $selected = array();
-
 
16
if(!isset($selected['='])) $selected['='] = '';
-
 
17
 
6
require('/etc/freeradius-web/config.php');
18
require('/etc/freeradius-web/config.php');
7
if($show == 2)
19
if($show == 2)
8
{
20
{
9
	header("Location: user_new.php");
21
	header("Location: user_new.php");
10
	exit;
22
	exit;
11
}
23
}
12
require('../lib/attrshow.php');
24
require('../lib/attrshow.php');
13
require('../lib/defaults.php');
25
require('../lib/defaults.php');
14
 
26
 
15
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
27
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){
16
	$colspan=2;
28
	$colspan=2;
17
	$show_ops=1;
29
	$show_ops=1;
18
}else{
30
}else{
19
	$show_ops = 0;
31
	$show_ops = 0;
20
	$colspan=1;
32
	$colspan=1;
21
}
33
}
22
?>
34
?>
23
 
35
 
24
<html><head><title>User creation</title>
36
<html><head><title>User creation</title>
25
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
37
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
26
<link rel="stylesheet" href="/css/style.css">
38
<link rel="stylesheet" href="/css/style.css">
27
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
39
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
28
<script type="text/javascript" src="/js/epoch_classes.js"></script>
40
<script type="text/javascript" src="/js/epoch_classes.js"></script>
29
<script type="text/javascript" src="/js/fonctions.js"></script>
41
<script type="text/javascript" src="/js/fonctions.js"></script>
30
<script language="javascript" type="text/javascript">
42
<script language="javascript" type="text/javascript">
31
 
43
 
32
/*Insertion du calendrier */
44
/*Insertion du calendrier */
33
	var dp_cal;      
45
	var dp_cal;
34
window.onload = function () {
46
window.onload = function () {
35
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
47
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
36
};
48
};
37
/*Fin calendrier*/
49
/*Fin calendrier*/
38
 
50
 
Line 58... Line 70...
58
	</th></tr>
70
	</th></tr>
59
	</table>
71
	</table>
60
</td></tr>
72
</td></tr>
61
<tr bgcolor="black" valign=top><td colspan=2>
73
<tr bgcolor="black" valign=top><td colspan=2>
62
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
74
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
63
	<tr><td>   
75
	<tr><td>
64
<?php
76
<?php
65
function sec_imp($time)
77
function sec_imp($time)
66
	/*Formatage des secondes avant l'impression */
78
/*Formatage des secondes avant l'impression */
67
    {
79
{
-
 
80
	$result = '';
68
	$jour = 0;$heure = 0;$minute = 0;$seconde = 0;
81
	$jour = 0;$heure = 0;$minute = 0;$seconde = 0;
69
	$jour = floor($time/86400);
82
	$jour = floor($time/86400);
70
	$reste = $time%86400;
83
	$reste = $time%86400;
71
    	if ($jour!=0) $result = $jour.' J ';
84
    	if ($jour!=0) $result = $jour.' J ';
72
	$heure = floor($reste/3600);
85
	$heure = floor($reste/3600);
Line 75... Line 88...
75
	$minute = floor($reste/60);
88
	$minute = floor($reste/60);
76
    	if ($minute!=0) $result = $result.$minute.' min ';
89
    	if ($minute!=0) $result = $result.$minute.' min ';
77
	$seconde = $reste%60;
90
	$seconde = $reste%60;
78
    	if ($seconde!=0) $result = $result.$seconde.' s ';
91
    	if ($seconde!=0) $result = $result.$seconde.' s ';
79
   	return $result;
92
   	return $result;
80
    }
93
}
81
 
94
 
82
if ($create == 1){
95
if ($create == 1){
83
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
96
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
84
		include("../lib/$config[general_lib_type]/user_info.php");
97
		include("../lib/$config[general_lib_type]/user_info.php");
85
	if ($user_exists != "no"){
98
	if ($user_exists != "no"){
Line 90... Line 103...
90
	else{
103
	else{
91
		if (is_file("../lib/$config[general_lib_type]/create_user.php"))
104
		if (is_file("../lib/$config[general_lib_type]/create_user.php"))
92
			include("../lib/$config[general_lib_type]/create_user.php");
105
			include("../lib/$config[general_lib_type]/create_user.php");
93
		/*  Petit traitement pré-impression pour la lisibilité */
106
		/*  Petit traitement pré-impression pour la lisibilité */
94
		/*  Récupération des attributs du groupe le cas échéant */
107
		/*  Récupération des attributs du groupe le cas échéant */
95
		if ($group!=''){
108
		if (isset($group) && $group!=''){
96
			$saved_login = $login;
109
			$saved_login = $login;
97
			$login = $group;
110
			$login = $group;
98
			if (is_file("../lib/sql/group_info.php"))
111
			if (is_file("../lib/sql/group_info.php"))
99
				include("../lib/sql/group_info.php");
112
				include("../lib/sql/group_info.php");
100
			$login = $saved_login;}
113
			$login = $saved_login;}
101
		/*  Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/
114
		/*  Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/
102
		/*  et formatage des secondes sous le format Heure min ses*/
115
		/*  et formatage des secondes sous le format Heure min ses*/
103
		if ($sto_imp==''){ $sto_imp=$v_illimit;}
116
		if ($sto_imp==''){ $sto_imp='-';}
104
			else { $sto_imp=sec_imp($sto_imp);}
117
			else { $sto_imp=sec_imp($sto_imp);}
105
		if ($mas_imp==''){ $mas_imp=$v_illimit;}
118
		if ($mas_imp==''){ $mas_imp='-';}
106
			else { $mas_imp=sec_imp($mas_imp);}
119
			else { $mas_imp=sec_imp($mas_imp);}
107
		if ($mds_imp==''){ $mds_imp=$v_illimit;}
120
		if ($mds_imp==''){ $mds_imp='-';}
108
			else { $mds_imp=sec_imp($mds_imp);}
121
			else { $mds_imp=sec_imp($mds_imp);}
109
		if ($mms_imp==''){ $mms_imp=$v_illimit;}
122
		if ($mms_imp==''){ $mms_imp='-';}
110
			else { $mms_imp=sec_imp($mms_imp);}
123
			else { $mms_imp=sec_imp($mms_imp);}
111
		/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/
124
		/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/
112
		if ($Expiration!=''){ $Expiration=date("d - m - Y",strtotime($Expiration));}
125
		if ($Expiration!=''){ $Expiration=date("d - m - Y",strtotime($Expiration));}
113
			else { $Expiration=$v_without;}
126
			else { $Expiration='-';}
114
		if ($show != 3)
127
		if ($show != 3)
115
		{		
128
		{
116
			//Appel du ticket d'impression , passage en paramètres des valeurs à afficher
129
			//Appel du ticket d'impression , passage en paramètres des valeurs à afficher
117
			echo'	<form name="impression" method="post" action="ticket_user.php" target=_blank>
130
			echo'	<form name="impression" method="post" action="ticket_user.php" target=_blank>
118
					<input type="hidden" name="langue_imp" value="'.$langue_imp.'">
131
					<input type="hidden" name="langue_imp" value="'.$langue_imp.'">
119
					<input type="hidden" name="log_imp" value="'.$login.'">
132
					<input type="hidden" name="log_imp" value="'.$login.'">
120
					<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
133
					<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
Line 160... Line 173...
160
		<br><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
173
		<br><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
161
		<input type="text" value="" name="pwdgene" size=10 readonly>
174
		<input type="text" value="" name="pwdgene" size=10 readonly>
162
		</td>
175
		</td>
163
	</tr>
176
	</tr>
164
EOM;
177
EOM;
165
	if ($config[general_lib_type] == 'sql'){
178
	if ($config['general_lib_type'] == 'sql'){
166
		if (isset($member_groups))
179
		if (isset($member_groups))
167
			$selected[$member_groups[0]] = 'selected';
180
			$selected[$member_groups[0]] = 'selected';
168
		echo <<<EOM
181
		echo <<<EOM
169
	<tr>
182
	<tr>
170
		<td class="etiquette" colspan=$colspan>
183
		<td class="etiquette" colspan=$colspan>
Line 180... Line 193...
180
			echo " </select>";
193
			echo " </select>";
181
			}
194
			}
182
		else echo "$l_group_empty";
195
		else echo "$l_group_empty";
183
	echo "</td></tr>";
196
	echo "</td></tr>";
184
	}
197
	}
185
	if ($config[general_lib_type] == 'ldap' ||
198
	if ($config['general_lib_type'] == 'ldap' ||
186
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
199
	($config['general_lib_type'] == 'sql' && $config['sql_use_user_info_table'] == 'true')){
187
		echo <<<EOM
200
		echo <<<EOM
188
	<tr>
201
	<tr>
189
		<td class="etiquette" colspan=$colspan>
202
		<td class="etiquette" colspan=$colspan>
190
		$l_name
203
		$l_name
191
		</td><td>
204
		</td><td>
Line 204... Line 217...
204
	foreach($show_attrs as $key => $desc){
217
	foreach($show_attrs as $key => $desc){
205
		$name = $attrmap["$key"];
218
		$name = $attrmap["$key"];
206
		if ($name == 'none')
219
		if ($name == 'none')
207
			continue;
220
			continue;
208
		$oper_name = $name . '_op';
221
		$oper_name = $name . '_op';
209
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
222
		if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != '') {
-
 
223
			$val = $item_vals["$key"][0];
-
 
224
		} else if(isset($default_vals["$key"][0])){
-
 
225
			$val = $default_vals["$key"][0];
-
 
226
		} else{
-
 
227
			$val = '';
-
 
228
		}
210
		switch ($key)
229
		switch ($key)
211
		{
230
		{
212
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) 
231
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
213
			case 'Simultaneous-Use' : 
232
			case 'Simultaneous-Use' :
214
				$advanced=1;
233
				$advanced=1;
215
				$help_link="help/simultaneous_use_help.html";
234
				$help_link="help/simultaneous_use_help.html";
216
				$desc=$l_simultaneous_use;
235
				$desc=$l_simultaneous_use;
217
				break;
236
				break;
218
			case 'Max-All-Session' :
237
			case 'Max-All-Session' :
219
				$advanced=1;
238
				$advanced=1;
220
				$help_link="help/max_all_session_help.html";
239
				$help_link="help/max_all_session_help.html";
221
				$desc=$l_max_all_session;
240
				$desc=$l_max_all_session;
222
				break;
241
				break;
223
			case 'Session-Timeout' : 
242
			case 'Session-Timeout' :
224
				$advanced=1;
243
				$advanced=1;
225
				$help_link="help/session_timeout_help.html";
244
				$help_link="help/session_timeout_help.html";
226
				$desc=$l_session_timeout;
245
				$desc=$l_session_timeout;
227
				break;
246
				break;
228
			case 'Max-Daily-Session' :
247
			case 'Max-Daily-Session' :
Line 233... Line 252...
233
			case 'Max-Monthly-Session' :
252
			case 'Max-Monthly-Session' :
234
				$advanced=1;
253
				$advanced=1;
235
				$help_link="help/session_timeout_help.html";
254
				$help_link="help/session_timeout_help.html";
236
				$desc=$l_monthly_timeout;
255
				$desc=$l_monthly_timeout;
237
				break;
256
				break;
238
			case 'Login-Time' : 
257
			case 'Login-Time' :
239
				$advanced=1;
258
				$advanced=1;
240
				$help_link="help/login_time_help.html";
259
				$help_link="help/login_time_help.html";
241
				$desc=$l_login_time;
260
				$desc=$l_login_time;
242
				break;
261
				break;
243
			case 'Expiration' :
262
			case 'Expiration' :
Line 290... Line 309...
290
			<td class="etiquette">
309
			<td class="etiquette">
291
			<a href="$help_link" target=help onclick=window.open("$help_link","help","width=600,height=250,toolbar=no,scrollbars=no,resizable=yes") title="$l_click_for_help"><font color="blue">$desc</font></a>
310
			<a href="$help_link" target=help onclick=window.open("$help_link","help","width=600,height=250,toolbar=no,scrollbars=no,resizable=yes") title="$l_click_for_help"><font color="blue">$desc</font></a>
292
			</td>
311
			</td>
293
EOM;
312
EOM;
294
			switch ($key){
313
			switch ($key){
295
				case 'Simultaneous-Use' : 
314
				case 'Simultaneous-Use' :
296
				case 'Max-All-Session' :
315
				case 'Max-All-Session' :
297
				case 'Max-Daily-Session' :
316
				case 'Max-Daily-Session' :
298
				case 'Max-Weekly-Session' :
317
				case 'Max-Weekly-Session' :
299
				case 'Max-Monthly-Session' :
318
				case 'Max-Monthly-Session' :
300
				case 'Login-Time' : 
319
				case 'Login-Time' :
301
				case 'Expiration' :
320
				case 'Expiration' :
302
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
321
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
303
					break;
322
					break;
304
				case 'Filter-Id' :
323
				case 'Filter-Id' :
305
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
324
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
Line 334... Line 353...
334
					</td>
353
					</td>
335
EOM;
354
EOM;
336
					break;
355
					break;
337
			}
356
			}
338
		}
357
		}
339
/* 
358
/*
340
Ajout du choix d'unité (pour les durées limites de session,journée et de mois) 
359
Ajout du choix d'unité (pour les durées limites de session,journée et de mois)
341
et d'un calendrier pour la date d'expiration
360
et d'un calendrier pour la date d'expiration
342
Sauf dans le cas de la visualisation
361
Sauf dans le cas de la visualisation
343
*/
362
*/
344
		if ($advanced){echo "<td>";}
363
		if ($advanced){echo "<td>";}
345
		if ($create==0 ){
364
		if ($create==0 ){
346
			switch ($name){
365
			switch ($name){
347
				/*
366
				/*
348
				Choix de l'unité jour, heures, minutes ou secondes 
367
				Choix de l'unité jour, heures, minutes ou secondes
349
				pour les durées limites max, de session,de journée et de mois	
368
				pour les durées limites max, de session,de journée et de mois
350
				*/	
369
				*/
351
				case 'Session-Timeout' :
370
				case 'Session-Timeout' :
352
				case 'Max-Daily-Session' :
371
				case 'Max-Daily-Session' :
353
					/*valeur d'origine de durée limite */
372
					/*valeur d'origine de durée limite */
354
					echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
373
					echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
355
					/* Choix d'unité*/
374
					/* Choix d'unité*/
Line 403... Line 422...
403
			<option value=\"nl\" >Nederlandse</option>
422
			<option value=\"nl\" >Nederlandse</option>
404
			<option value=\"de\" >Deutsch</option>
423
			<option value=\"de\" >Deutsch</option>
405
			<option value=\"es\" >Espa&ntilde;ol</option>
424
			<option value=\"es\" >Espa&ntilde;ol</option>
406
			<option value=\"it\" >Italiano</option>
425
			<option value=\"it\" >Italiano</option>
407
			<option value=\"pt\" >Portugês</option>
426
			<option value=\"pt\" >Portugês</option>
408
		</select></td></tr>";	
427
		</select></td></tr>";
409
	}
428
	}
410
echo "</table><BR>";
429
echo "</table><BR>";
411
if($create == 1)
430
if($create == 1)
412
{
431
{
413
	echo "<a href=\"ticket.pdf\">Ticket</a><br>";
432
	echo "<a href=\"ticket.pdf\">Ticket</a><br>";
414
	echo "<center><a href=\"user_admin.php?login=$login\">$l_show_profile</a></center>";
433
	echo "<center><a href=\"user_admin.php?login=$login\">$l_show_profile</a></center>";
415
}
434
}
416
else	
435
else
417
{
436
{
418
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newuser');\">";
437
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newuser');\">";
419
	echo "<input type='hidden' name='nbtickets' value=''>";
438
	echo "<input type='hidden' name='nbtickets' value=''>";
420
	echo "<input type=submit class=button value=\"$l_simple_menu\" style=\"float: right;\" OnClick=\"this.form.show.value=2\">";
439
	echo "<input type=submit class=button value=\"$l_simple_menu\" style=\"float: right;\" OnClick=\"this.form.show.value=2\">";
421
}
440
}