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