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