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);
683 stephane 105
				$mms_imp=sec_imp($mms_imp);
508 richard 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.'"> 
886 stephane 129
					<input type="hidden" name="l_max_all_session_imp" value="'.$l_max_all_session_imp.'">
508 richard 130
					<input type="hidden" name="l_session_timeout_imp" value="'.$l_session_timeout_imp.'">
131
					<input type="hidden" name="l_max_daily_session_imp" value="'.$l_max_daily_session_imp.'">
132
					<input type="hidden" name="l_max_monthly_session_imp" value="'.$l_max_monthly_session_imp.'"> 
133
					<input type="hidden" name="l_expiration_imp" value="'.$l_expiration_imp.'">
134
					<input type="hidden" name="log_imp" value="'.$login.'">
135
					<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
136
					<input type="hidden" name="sto_imp" value="'.$sto_imp.'">
137
					<input type="hidden" name="mds_imp" value="'.$mds_imp.'">
138
					<input type="hidden" name="mms_imp" value="'.$mms_imp.'">
139
					<input type="hidden" name="exp_imp" value="'.$Expiration.'">
140
				</form>';
141
		echo'	<script type="text/javascript"> document.forms["impression"].submit();</script>';
142
		//fin ticket impression
324 richard 143
		require("../lib/defaults.php");
144
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
145
			include("../lib/$config[general_lib_type]/user_info.php");
146
	}
147
}
148
?>
149
   <form name="newuser" method=post>
150
      <input type=hidden name=create value="0">
151
      <input type=hidden name=show value="0">
508 richard 152
	  <input type=hidden name=langue_imp value='fr'>
324 richard 153
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
154
<?php
155
	echo <<<EOM
156
	<tr>
508 richard 157
		<td class="etiquette" colspan=$colspan>
324 richard 158
		$l_login
159
		</td><td>
160
		<input type=text name="login" value="$login" size=35>
161
		</td>
162
	</tr>
163
	<tr>
508 richard 164
		<td class="etiquette" colspan=$colspan>
324 richard 165
		$l_password
166
		</td><td>
167
		<input type=password name="passwd" size=35>
508 richard 168
		<br /><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
324 richard 169
		<input type="text" value="" name="pwdgene" size=20 readonly>
170
		</td>
171
	</tr>
172
EOM;
173
	if ($config[general_lib_type] == 'sql'){
174
		if (isset($member_groups))
175
			$selected[$member_groups[0]] = 'selected';
176
		echo <<<EOM
177
	<tr>
508 richard 178
		<td class="etiquette" colspan=$colspan>
324 richard 179
		$l_group
180
		</td><td>
181
EOM;
182
		include_once("../lib/$config[general_lib_type]/group_info.php");
183
		if (isset($existing_groups)){
184
			echo "<select name=\"Fgroup\">";
514 richard 185
			echo "<option value=\"\" selected>";
324 richard 186
			foreach ($member_groups as $group)
514 richard 187
				echo "<option value=\"$group\">$group\n";
324 richard 188
			echo " </select>";
189
			}
190
		else echo "$l_group_empty";
191
	echo "</td></tr>";
192
	}
193
	if ($config[general_lib_type] == 'ldap' ||
194
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
195
		echo <<<EOM
196
	<tr>
508 richard 197
		<td class="etiquette" colspan=$colspan>
324 richard 198
		$l_name
199
		</td><td>
200
		<input type=text name="Fcn" value="$cn" size=35>
201
		</td>
202
	</tr>
203
	<tr>
508 richard 204
		<td class="etiquette" colspan=$colspan>
324 richard 205
		$l_email
206
		</td><td>
207
		<input type=text name="Fmail" value="$mail" size=35>
208
		</td>
209
	</tr>
508 richard 210
<!-- Mettre en commentaire les champs qui ne sont pas nécessaire, chaque champ est entre les balises <tr> et </tr> -->
211
<!--
324 richard 212
	<tr>
508 richard 213
		<td class="etiquette" colspan=$colspan>
324 richard 214
		Service
215
		</td><td>
216
		<input type=text name="Fou" value="$ou" size=35>
217
		</td>
218
	</tr>
219
	<tr>
508 richard 220
		<td class="etiquette" colspan=$colspan>
324 richard 221
		Nro TPH personnel
222
		</td><td>
223
		<input type=text name="Fhomephone" value="$homephone" size=35>
224
		</td>
225
	</tr>
226
	<tr>
508 richard 227
		<td class="etiquette" colspan=$colspan>
324 richard 228
		Nro TPH bureau
229
		</td><td>
230
		<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
231
		</td>
232
	</tr>
233
	<tr>
508 richard 234
		<td class="etiquette" colspan=$colspan>
324 richard 235
		Nro TPH mobile
236
		</td><td>
237
		<input type=text name="Fmobile" value="$mobile" size=35>
238
		</td>
508 richard 239
	</tr> 
240
-->
324 richard 241
EOM;
242
	}
243
	foreach($show_attrs as $key => $desc){
244
		$name = $attrmap["$key"];
245
		if ($name == 'none')
246
			continue;
247
		$oper_name = $name . '_op';
248
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
508 richard 249
		/*
250
		Gestion d'un mode simple ou d'un mode avancé
251
		Définition du mode avancé: les attributs concernant la gestion des octets, de la bande passante
252
		*/
253
		switch ($key)
254
		{
255
			case 'ChilliSpot-Max-Input-Octets' :
256
			case 'ChilliSpot-Max-Output-Octets' :
257
			case 'ChilliSpot-Max-Total-Octets' :
258
			case 'ChilliSpot-Bandwidth-Max-Up' :
259
			case 'ChilliSpot-Bandwidth-Max-Down' :
260
			case 'WISPr-Redirection-URL' :
632 richard 261
				$advanced=1; //<-- Valeur à mettre à '0' pour limiter les fonctionnalités
508 richard 262
				break;
263
			default:
264
				$advanced=1;
265
				break;
266
		}
514 richard 267
		if ($show_ops && $advanced){
324 richard 268
		print <<<EOM
508 richard 269
			<tr>
270
				<td class="etiquette">
271
					$desc
272
				</td>
324 richard 273
EOM;
508 richard 274
			switch ($key){
275
				case 'Simultaneous-Use' : 
276
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
277
					break;
278
				case 'Login-Time' : 
279
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
280
					break;
281
				case 'Expiration' :
282
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
283
					break;
886 stephane 284
				case 'Max-All-Session' :
285
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
286
					break;
508 richard 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
				/*
350
				Choix de l'unité heures, minutes ou secondes 
351
				pour les durées limites de session,journée et de mois	
352
				*/	
353
				case 'Session-Timeout' :
354
				case 'Max-Daily-Session' :
355
				case 'Max-Monthly-Session' :
356
					/*valeur d'origine de durée limite */
357
					echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
358
					/* Choix d'unité*/
359
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
360
							<option value=\"s\" selected>s</option>
361
							<option value=\"m\" >m</option>
362
							<option value=\"H\" >H</option>
363
						</select>";
364
					break;
365
				case 'Expiration' :
366
					/*Pré-remplissage avec la date du lendemain*/
514 richard 367
					//$val=date("d F Y",strtotime("+1 day"));//<--en commentant cette ligne la valeur n'est plus pré-remplie
508 richard 368
					/*Ajout du calendrier pour choisir la date*/
369
					echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
370
					break;
371
				default :
372
					if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
373
					break;
374
			}
375
		}else{
376
		/*Pas de gestion de remplissage lors de la visualisation*/
377
			if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
378
 
379
/*fin Ajout*/
380
		}
381
	}
382
if (create==0){
383
	print <<<EOM
384
	<tr>
385
		<td class="etiquette" colspan=$colspan>
386
			$l_lang_ticket
387
		</td>
388
		<td width=35>
324 richard 389
EOM;
508 richard 390
/*Choix de la langue du ticket d'impression*/
391
	echo" <select name=\"$langue_imp\" onchange=\"lang_imp(this,'newuser')\">
392
			<option value=\"fr\" selected>Fran&ccedil;ais</option>
393
			<option value=\"en\" >English</option>
394
			<option value=\"nl\" >Nederlandse</option>
395
			<option value=\"de\" >Deutsch</option>
396
			<option value=\"es\" >Espa&ntilde;ol</option>
397
			<option value=\"it\" >Italiano</option>
398
		</select></td></tr>";	
324 richard 399
	}
400
echo "</table><BR>";
401
if ($create == 1)
402
	echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
403
	else{
508 richard 404
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl('newuser');\">";
405
	}
324 richard 406
?>
407
</form>
508 richard 408
 
324 richard 409
	</td></tr>
410
</table>
411
</tr>
412
</table>
413
</TD></TR>
414
</TABLE>
415
</td></tr>
416
</TABLE>
417
</body>
418
</html>