Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
324 richard 1
<?php
508 richard 2
//gestion de la langue
3
$origine='user_new';
4
if (is_file("../lib/langues.php"))
5
	include("../lib/langues.php");
324 richard 6
 
7
require('/etc/freeradius-web/config.php');
8
if ($show == 1){
9
	header("Location: user_admin.php?login=$login");
10
	exit;
11
}
12
require('../lib/attrshow.php');
13
require('../lib/defaults.php');
14
 
15
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
16
	$colspan=2;
17
	$show_ops=1;
18
}else{
19
	$show_ops = 0;
20
	$colspan=1;
21
}
22
echo "<html><head><title>$l_title</title>";
23
?>
24
 
25
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
26
<link rel="stylesheet" href="/css/style.css">
508 richard 27
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
28
<script type="text/javascript" src="/javascript/epoch_classes.js"></script>
29
<script type="text/javascript" src="/javascript/fonctions.js"></script>
324 richard 30
<script language="javascript" type="text/javascript">
508 richard 31
 
32
/*Insertion du calendrier*/
33
	var dp_cal;      
34
window.onload = function () {
35
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
36
};
37
/*Fin calendrier*/
38
 
324 richard 39
</script>
40
</head>
41
<body>
42
 
43
<?php
44
include("password_generator.jsc");
508 richard 45
 
324 richard 46
echo "<TABLE width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
47
echo "<tr><th>$l_frame_top</th></tr>";
48
?>
49
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
50
height="2"></td></tr>
51
</TABLE>
52
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
53
	<tr bgcolor="#666666"><td>
54
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
55
		<tr><td valign="middle" align="left">
56
<center>
57
<table border=0 width=550 cellpadding=1 cellspacing=1>
58
<tr valign=top>
59
<td width=340></td>
60
<td bgcolor="black" width=200>
61
	<table border=0 width=100% cellpadding=2 cellspacing=0>
62
	<tr bgcolor="#907030" align=right valign=top><th>
63
	<font color="white"><? echo "$l_frame"; ?></font>
64
	</th></tr>
65
	</table>
66
</td></tr>
67
<tr bgcolor="black" valign=top><td colspan=2>
68
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
508 richard 69
	<tr><td>   
324 richard 70
<?php
508 richard 71
function sec_imp($time)
72
	/*Formatage des secondes avant l'impression*/
73
    {
74
	$heure=0;$minute=0;$seconde=0;
75
	$heure = floor($time/3600);
76
    	$reste = $time%3600;
77
    	if ($heure!=0) $result = $heure.' H ';
78
	$minute = floor($reste/60);
79
    	if ($minute!=0) $result = $result.$minute.' min ';
80
	$seconde = $reste%60;
81
    	if ($seconde!=0) $result = $result.$seconde.' s ';
82
   	return $result;
83
    }
84
 
324 richard 85
if ($create == 1){
86
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
87
		include("../lib/$config[general_lib_type]/user_info.php");
88
	if ($user_exists != "no"){
89
		echo <<<EOM
90
<b><i>$login</i> $l_user_exist</b>
91
EOM;
92
	}
93
	else{
94
		if (is_file("../lib/$config[general_lib_type]/create_user.php"))
95
			include("../lib/$config[general_lib_type]/create_user.php");
508 richard 96
		/*  Petit traitement pré-impression
97
			pour la lisibilité */
98
		/*Gestion des cas sans limitation*/
99
		if ($sto_imp=='' && $mds_imp=='' && $mms_imp==''){
100
			/*Recherche de l'existence d'un groupe et récupération des attributs le cas échéant*/
101
			if ($group!=''){
102
				$saved_login = $login;
103
				$login = $group;
104
				if (is_file("../lib/sql/group_info.php"))
105
					include("../lib/sql/group_info.php");
106
				$login = $saved_login;
107
				/* formatage des secondes sous le format H min s*/
108
				$sto_imp=sec_imp($sto_imp);
109
				$mds_imp=sec_imp($mds_imp);
110
				$mds_imp=sec_imp($mds_imp);
111
			} else {
112
				/*Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/
113
				$sto_imp=$v_illimit;
114
				$mds_imp=$v_illimit;
115
				$mms_imp=$v_illimit;
116
			}
117
		}else{
118
		/* formatage des secondes sous le format H min s*/
119
		$sto_imp=sec_imp($sto_imp);
120
		$mds_imp=sec_imp($mds_imp);
121
		$mms_imp=sec_imp($mms_imp);
122
		}
123
		/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/
124
		$Expiration=date("d - m - Y",strtotime($Expiration));
125
 
126
		//Appel du ticket d'impression , passage en paramètres des étiquettes et des valeurs à afficher
127
		echo'	<form name="impression" method="post" action="ticket_user.php" target=_blank>
128
					<input type="hidden" name="l_title_imp" value="'.$l_title_imp.'">
129
					<input type="hidden" name="l_login_imp" value="'.$l_login_imp.'">
130
					<input type="hidden" name="l_password_imp" value="'.$l_password_imp.'"> 
131
					<input type="hidden" name="l_session_timeout_imp" value="'.$l_session_timeout_imp.'">
132
					<input type="hidden" name="l_max_daily_session_imp" value="'.$l_max_daily_session_imp.'">
133
					<input type="hidden" name="l_max_monthly_session_imp" value="'.$l_max_monthly_session_imp.'"> 
134
					<input type="hidden" name="l_expiration_imp" value="'.$l_expiration_imp.'">
135
					<input type="hidden" name="log_imp" value="'.$login.'">
136
					<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
137
					<input type="hidden" name="sto_imp" value="'.$sto_imp.'">
138
					<input type="hidden" name="mds_imp" value="'.$mds_imp.'">
139
					<input type="hidden" name="mms_imp" value="'.$mms_imp.'">
140
					<input type="hidden" name="exp_imp" value="'.$Expiration.'">
141
				</form>';
142
		echo'	<script type="text/javascript"> document.forms["impression"].submit();</script>';
143
		//fin ticket impression
324 richard 144
		require("../lib/defaults.php");
145
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
146
			include("../lib/$config[general_lib_type]/user_info.php");
147
	}
148
}
149
?>
150
   <form name="newuser" method=post>
151
      <input type=hidden name=create value="0">
152
      <input type=hidden name=show value="0">
508 richard 153
	  <input type=hidden name=langue_imp value='fr'>
324 richard 154
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
155
<?php
156
	echo <<<EOM
157
	<tr>
508 richard 158
		<td class="etiquette" colspan=$colspan>
324 richard 159
		$l_login
160
		</td><td>
161
		<input type=text name="login" value="$login" size=35>
162
		</td>
163
	</tr>
164
	<tr>
508 richard 165
		<td class="etiquette" colspan=$colspan>
324 richard 166
		$l_password
167
		</td><td>
168
		<input type=password name="passwd" size=35>
508 richard 169
		<br /><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
324 richard 170
		<input type="text" value="" name="pwdgene" size=20 readonly>
171
		</td>
172
	</tr>
173
EOM;
174
	if ($config[general_lib_type] == 'sql'){
175
		if (isset($member_groups))
176
			$selected[$member_groups[0]] = 'selected';
177
		echo <<<EOM
178
	<tr>
508 richard 179
		<td class="etiquette" colspan=$colspan>
324 richard 180
		$l_group
181
		</td><td>
182
EOM;
183
		include_once("../lib/$config[general_lib_type]/group_info.php");
184
		if (isset($existing_groups)){
185
			echo "<select name=\"Fgroup\">";
186
			echo "<option value=\"\">";
187
			foreach ($member_groups as $group)
188
				echo "<option value=\"$group\" $selected[$group]>$group\n";
189
			echo " </select>";
190
			}
191
		else echo "$l_group_empty";
192
	echo "</td></tr>";
193
	}
194
	if ($config[general_lib_type] == 'ldap' ||
195
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
196
		echo <<<EOM
197
	<tr>
508 richard 198
		<td class="etiquette" colspan=$colspan>
324 richard 199
		$l_name
200
		</td><td>
201
		<input type=text name="Fcn" value="$cn" size=35>
202
		</td>
203
	</tr>
204
	<tr>
508 richard 205
		<td class="etiquette" colspan=$colspan>
324 richard 206
		$l_email
207
		</td><td>
208
		<input type=text name="Fmail" value="$mail" size=35>
209
		</td>
210
	</tr>
508 richard 211
<!-- Mettre en commentaire les champs qui ne sont pas nécessaire, chaque champ est entre les balises <tr> et </tr> -->
212
<!--
324 richard 213
	<tr>
508 richard 214
		<td class="etiquette" colspan=$colspan>
324 richard 215
		Service
216
		</td><td>
217
		<input type=text name="Fou" value="$ou" size=35>
218
		</td>
219
	</tr>
220
	<tr>
508 richard 221
		<td class="etiquette" colspan=$colspan>
324 richard 222
		Nro TPH personnel
223
		</td><td>
224
		<input type=text name="Fhomephone" value="$homephone" size=35>
225
		</td>
226
	</tr>
227
	<tr>
508 richard 228
		<td class="etiquette" colspan=$colspan>
324 richard 229
		Nro TPH bureau
230
		</td><td>
231
		<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
232
		</td>
233
	</tr>
234
	<tr>
508 richard 235
		<td class="etiquette" colspan=$colspan>
324 richard 236
		Nro TPH mobile
237
		</td><td>
238
		<input type=text name="Fmobile" value="$mobile" size=35>
239
		</td>
508 richard 240
	</tr> 
241
-->
324 richard 242
EOM;
243
	}
244
	foreach($show_attrs as $key => $desc){
245
		$name = $attrmap["$key"];
246
		if ($name == 'none')
247
			continue;
248
		$oper_name = $name . '_op';
249
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
508 richard 250
		/*
251
		Gestion d'un mode simple ou d'un mode avancé
252
		Définition du mode avancé: les attributs concernant la gestion des octets, de la bande passante
253
		*/
254
		switch ($key)
255
		{
256
			case 'ChilliSpot-Max-Input-Octets' :
257
			case 'ChilliSpot-Max-Output-Octets' :
258
			case 'ChilliSpot-Max-Total-Octets' :
259
			case 'ChilliSpot-Bandwidth-Max-Up' :
260
			case 'ChilliSpot-Bandwidth-Max-Down' :
261
			case 'WISPr-Redirection-URL' :
262
				$advanced=0; //<-- Valeur à mettre à '1' pour avoir toutes les fonctionnalités
263
				break;
264
			default:
265
				$advanced=1;
266
				break;
267
		}
268
		if ($advanced){
324 richard 269
		print <<<EOM
508 richard 270
			<tr>
271
				<td class="etiquette">
272
					$desc
273
				</td>
324 richard 274
EOM;
508 richard 275
		}
276
		if ($show_ops && $advanced){
277
			switch ($key){
278
				case 'Simultaneous-Use' : 
279
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
280
					break;
281
				case 'Login-Time' : 
282
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
283
					break;
284
				case 'Expiration' :
285
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
286
					break;
287
				case 'Session-Timeout' :
288
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
289
					break;
290
				case 'Max-Daily-Session' :
291
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
292
					break;
293
				case 'Max-Weekly-Session' :
294
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
295
					break;
296
				case 'Max-Monthly-Session' :
297
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
298
					break;
299
				case 'ChilliSpot-Max-Input-Octets' :
300
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
301
					break;
302
				case 'ChilliSpot-Max-Output-Octets' :
303
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
304
					break;
305
				case 'ChilliSpot-Max-Total-Octets' :
306
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
307
					break;
308
				case 'ChilliSpot-Bandwidth-Max-Up' :
309
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
310
					break;
311
				case 'ChilliSpot-Bandwidth-Max-Down' :
312
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
313
					break;
314
				case 'WISPr-Redirection-URL' :
315
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
316
					break;
317
				default :
318
					print <<<EOM
319
					<td>
320
						<select name=$oper_name>
321
							<option $selected[$op_eq] value="=">=
322
							<option $selected[$op_set] value=":=">:=
323
							<option $selected[$op_add] value="+=">+=
324
							<option $selected[$op_eq2] value="==">==
325
							<option $selected[$op_ne] value="!=">!=
326
							<option $selected[$op_gt] value=">">&gt;
327
							<option $selected[$op_ge] value=">=">&gt;=
328
							<option $selected[$op_lt] value="<">&lt;
329
							<option $selected[$op_le] value="<=">&lt;=
330
							<option $selected[$op_regeq] value="=~">=~
331
							<option $selected[$op_regne] value="!~">!~
332
							<option $selected[$op_exst] value="=*">=*
333
							<option $selected[$op_nexst] value="!*">!*
334
						</select>
335
					</td>
324 richard 336
EOM;
508 richard 337
					break;
338
			}
324 richard 339
		}
508 richard 340
/* 
341
Ajout du pré-remplissage de cellule
342
du choix d'unité (pour les durées limites de session,journée et de mois) 
343
et d'un calendrier pour la date d'expiration
344
Sauf dans le cas de la visualisation
345
*/
346
		if ($advanced){echo "<td>";}
347
		if ($create==0 ){
348
			switch ($name){
349
				case 'Simultaneous-Use' :
350
					/*Pré-remplissage avec la valeur '1' pour empécher plusieurs connexions silmutanées*/
351
					$val=1;//<--cette valeur correspond au nombre de session simultanée en commentant cette ligne la valeur n'est plus pré-remplie
352
					echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
353
					break;
354
				/*
355
				Choix de l'unité heures, minutes ou secondes 
356
				pour les durées limites de session,journée et de mois	
357
				*/	
358
				case 'Session-Timeout' :
359
				case 'Max-Daily-Session' :
360
				case 'Max-Monthly-Session' :
361
					/*valeur d'origine de durée limite */
362
					echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
363
					/* Choix d'unité*/
364
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
365
							<option value=\"s\" selected>s</option>
366
							<option value=\"m\" >m</option>
367
							<option value=\"H\" >H</option>
368
						</select>";
369
					break;
370
				case 'Expiration' :
371
					/*Pré-remplissage avec la date du lendemain*/
372
					$val=date("d F Y",strtotime("+1 day"));//<--en commentant cette ligne la valeur n'est plus pré-remplie
373
					/*Ajout du calendrier pour choisir la date*/
374
					echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
375
					break;
376
				default :
377
					if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
378
					break;
379
			}
380
		}else{
381
		/*Pas de gestion de remplissage lors de la visualisation*/
382
			if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
383
 
384
/*fin Ajout*/
385
		}
386
	}
387
if (create==0){
388
	print <<<EOM
389
	<tr>
390
		<td class="etiquette" colspan=$colspan>
391
			$l_lang_ticket
392
		</td>
393
		<td width=35>
324 richard 394
EOM;
508 richard 395
/*Choix de la langue du ticket d'impression*/
396
	echo" <select name=\"$langue_imp\" onchange=\"lang_imp(this,'newuser')\">
397
			<option value=\"fr\" selected>Fran&ccedil;ais</option>
398
			<option value=\"en\" >English</option>
399
			<option value=\"nl\" >Nederlandse</option>
400
			<option value=\"de\" >Deutsch</option>
401
			<option value=\"es\" >Espa&ntilde;ol</option>
402
			<option value=\"it\" >Italiano</option>
403
		</select></td></tr>";	
324 richard 404
	}
405
echo "</table><BR>";
406
if ($create == 1)
407
	echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
408
	else{
508 richard 409
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl('newuser');\">";
410
	}
324 richard 411
?>
412
</form>
508 richard 413
 
324 richard 414
	</td></tr>
415
</table>
416
</tr>
417
</table>
418
</TD></TR>
419
</TABLE>
420
</td></tr>
421
</TABLE>
422
</body>
423
</html>