Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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