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
901 richard 85
<b><i>$login</i> $l_already_exist</b>
324 richard 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");
901 richard 91
		/*  Petit traitement pré-impression pour la lisibilité */
92
		/*  Récupération des attributs du groupe le cas échéant */
93
		if ($group!=''){
94
			$saved_login = $login;
95
			$login = $group;
96
			if (is_file("../lib/sql/group_info.php"))
97
				include("../lib/sql/group_info.php");
98
			$login = $saved_login;}
99
		/*  Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/
100
		/*  et formatage des secondes sous le format Heure min ses*/
101
		if ($sto_imp==''){ $sto_imp=$v_illimit;}
102
			else { $sto_imp=sec_imp($sto_imp);}
103
		if ($mas_imp==''){ $mas_imp=$v_illimit;}
104
			else { $mas_imp=sec_imp($mas_imp);}
105
		if ($mds_imp==''){ $mds_imp=$v_illimit;}
106
			else { $mds_imp=sec_imp($mds_imp);}
107
		if ($mms_imp==''){ $mms_imp=$v_illimit;}
108
			else { $mms_imp=sec_imp($mms_imp);}
508 richard 109
		/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/
901 richard 110
		if ($Expiration!=''){ $Expiration=date("d - m - Y",strtotime($Expiration));}
111
			else { $Expiration=$v_without;}
508 richard 112
		//Appel du ticket d'impression , passage en paramètres des étiquettes et des valeurs à afficher
113
		echo'	<form name="impression" method="post" action="ticket_user.php" target=_blank>
114
					<input type="hidden" name="l_title_imp" value="'.$l_title_imp.'">
115
					<input type="hidden" name="l_login_imp" value="'.$l_login_imp.'">
116
					<input type="hidden" name="l_password_imp" value="'.$l_password_imp.'"> 
886 stephane 117
					<input type="hidden" name="l_max_all_session_imp" value="'.$l_max_all_session_imp.'">
508 richard 118
					<input type="hidden" name="l_session_timeout_imp" value="'.$l_session_timeout_imp.'">
119
					<input type="hidden" name="l_max_daily_session_imp" value="'.$l_max_daily_session_imp.'">
120
					<input type="hidden" name="l_max_monthly_session_imp" value="'.$l_max_monthly_session_imp.'"> 
121
					<input type="hidden" name="l_expiration_imp" value="'.$l_expiration_imp.'">
122
					<input type="hidden" name="log_imp" value="'.$login.'">
123
					<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
124
					<input type="hidden" name="sto_imp" value="'.$sto_imp.'">
901 richard 125
					<input type="hidden" name="mas_imp" value="'.$mas_imp.'">
508 richard 126
					<input type="hidden" name="mds_imp" value="'.$mds_imp.'">
127
					<input type="hidden" name="mms_imp" value="'.$mms_imp.'">
128
					<input type="hidden" name="exp_imp" value="'.$Expiration.'">
129
				</form>';
130
		echo'	<script type="text/javascript"> document.forms["impression"].submit();</script>';
131
		//fin ticket impression
324 richard 132
		require("../lib/defaults.php");
133
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
134
			include("../lib/$config[general_lib_type]/user_info.php");
135
	}
136
}
137
?>
138
   <form name="newuser" method=post>
139
      <input type=hidden name=create value="0">
140
      <input type=hidden name=show value="0">
508 richard 141
	  <input type=hidden name=langue_imp value='fr'>
324 richard 142
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
143
<?php
144
	echo <<<EOM
145
	<tr>
508 richard 146
		<td class="etiquette" colspan=$colspan>
324 richard 147
		$l_login
148
		</td><td>
149
		<input type=text name="login" value="$login" size=35>
150
		</td>
151
	</tr>
152
	<tr>
508 richard 153
		<td class="etiquette" colspan=$colspan>
324 richard 154
		$l_password
155
		</td><td>
156
		<input type=password name="passwd" size=35>
508 richard 157
		<br /><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
324 richard 158
		<input type="text" value="" name="pwdgene" size=20 readonly>
159
		</td>
160
	</tr>
161
EOM;
162
	if ($config[general_lib_type] == 'sql'){
163
		if (isset($member_groups))
164
			$selected[$member_groups[0]] = 'selected';
165
		echo <<<EOM
166
	<tr>
508 richard 167
		<td class="etiquette" colspan=$colspan>
324 richard 168
		$l_group
169
		</td><td>
170
EOM;
171
		include_once("../lib/$config[general_lib_type]/group_info.php");
172
		if (isset($existing_groups)){
173
			echo "<select name=\"Fgroup\">";
514 richard 174
			echo "<option value=\"\" selected>";
324 richard 175
			foreach ($member_groups as $group)
514 richard 176
				echo "<option value=\"$group\">$group\n";
324 richard 177
			echo " </select>";
178
			}
179
		else echo "$l_group_empty";
180
	echo "</td></tr>";
181
	}
182
	if ($config[general_lib_type] == 'ldap' ||
183
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
184
		echo <<<EOM
185
	<tr>
508 richard 186
		<td class="etiquette" colspan=$colspan>
324 richard 187
		$l_name
188
		</td><td>
189
		<input type=text name="Fcn" value="$cn" size=35>
190
		</td>
191
	</tr>
192
	<tr>
508 richard 193
		<td class="etiquette" colspan=$colspan>
324 richard 194
		$l_email
195
		</td><td>
196
		<input type=text name="Fmail" value="$mail" size=35>
197
		</td>
198
	</tr>
508 richard 199
<!-- Mettre en commentaire les champs qui ne sont pas nécessaire, chaque champ est entre les balises <tr> et </tr> -->
200
<!--
324 richard 201
	<tr>
508 richard 202
		<td class="etiquette" colspan=$colspan>
324 richard 203
		Service
204
		</td><td>
205
		<input type=text name="Fou" value="$ou" size=35>
206
		</td>
207
	</tr>
208
	<tr>
508 richard 209
		<td class="etiquette" colspan=$colspan>
324 richard 210
		Nro TPH personnel
211
		</td><td>
212
		<input type=text name="Fhomephone" value="$homephone" size=35>
213
		</td>
214
	</tr>
215
	<tr>
508 richard 216
		<td class="etiquette" colspan=$colspan>
324 richard 217
		Nro TPH bureau
218
		</td><td>
219
		<input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
220
		</td>
221
	</tr>
222
	<tr>
508 richard 223
		<td class="etiquette" colspan=$colspan>
324 richard 224
		Nro TPH mobile
225
		</td><td>
226
		<input type=text name="Fmobile" value="$mobile" size=35>
227
		</td>
508 richard 228
	</tr> 
229
-->
324 richard 230
EOM;
231
	}
232
	foreach($show_attrs as $key => $desc){
233
		$name = $attrmap["$key"];
234
		if ($name == 'none')
235
			continue;
236
		$oper_name = $name . '_op';
237
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
508 richard 238
		switch ($key)
239
		{
901 richard 240
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) 
899 richard 241
			case 'Simultaneous-Use' : 
242
				$advanced=1;
243
				$help_link="help/simultaneous_use_help.html";
244
				$desc=$l_simultaneous_use;
245
				break;
246
			case 'Max-All-Session' :
247
				$advanced=1;
248
				$help_link="help/max_all_session_help.html";
249
				$desc=$l_max_all_session;
250
				break;
251
			case 'Session-Timeout' : 
252
				$advanced=1;
253
				$help_link="help/session_timeout_help.html";
254
				$desc=$l_session_timeout;
255
				break;
256
			case 'Max-Daily-Session' :
257
				$advanced=1;
258
				$help_link="help/session_timeout_help.html";
259
				$desc=$l_daily_timeout;
260
				break;
261
			case 'Max-Monthly-Session' :
262
				$advanced=1;
263
				$help_link="help/session_timeout_help.html";
264
				$desc=$l_monthly_timeout;
265
				break;
266
			case 'Login-Time' : 
267
				$advanced=1;
268
				$help_link="help/login_time_help.html";
269
				$desc=$l_login_time;
270
				break;
271
			case 'Expiration' :
272
				$advanced=1;
273
				$help_link="help/expiration_help.html";
274
				$desc=$l_expiration;
275
				break;
508 richard 276
			case 'ChilliSpot-Max-Input-Octets' :
899 richard 277
				$advanced=1;
278
				$help_link="help/chillispot_max_input_octets_help.html";
279
				$desc=$l_max_input_octets;
280
				break;
508 richard 281
			case 'ChilliSpot-Max-Output-Octets' :
899 richard 282
				$advanced=1;
283
				$help_link="help/chillispot_max_output_octets_help.html";
284
				$desc=$l_max_output_octets;
285
				break;
508 richard 286
			case 'ChilliSpot-Max-Total-Octets' :
899 richard 287
				$advanced=1;
288
				$help_link="help/chillispot_max_total_octets_help.html";
289
				$desc=$l_max_total_octets;
290
				break;
508 richard 291
			case 'ChilliSpot-Bandwidth-Max-Up' :
899 richard 292
				$advanced=1;
293
				$help_link="help/chillispot_bandwidth_max_up_help.html";
294
				$desc=$l_max_bandwidth_up;
295
				break;
508 richard 296
			case 'ChilliSpot-Bandwidth-Max-Down' :
899 richard 297
				$advanced=1;
298
				$help_link="help/chillispot_bandwidth_max_down_help.html";
299
				$desc=$l_max_bandwidth_down;
300
				break;
508 richard 301
			case 'WISPr-Redirection-URL' :
899 richard 302
				$advanced=1;
303
				$help_link="help/wispr_redirection_url_help.html";
304
				$desc=$l_wispr_redirection;
508 richard 305
				break;
306
			default:
307
				$advanced=1;
308
				break;
309
		}
514 richard 310
		if ($show_ops && $advanced){
324 richard 311
		print <<<EOM
508 richard 312
			<tr>
899 richard 313
			<td class="etiquette">
314
			<a href="$help_link" target=help onclick=window.open("$help_link","help","width=600,height=250,toolbar=no,scrollbars=no,resizable=yes") title="$l_click_for_help"><font color="blue">$desc</font></a>
315
			</td>
324 richard 316
EOM;
508 richard 317
			switch ($key){
318
				case 'Simultaneous-Use' : 
886 stephane 319
				case 'Max-All-Session' :
508 richard 320
				case 'Max-Daily-Session' :
321
				case 'Max-Weekly-Session' :
322
				case 'Max-Monthly-Session' :
899 richard 323
				case 'Login-Time' : 
324
				case 'Expiration' :
508 richard 325
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
326
					break;
899 richard 327
				case 'Session-Timeout' :
508 richard 328
				case 'ChilliSpot-Max-Input-Octets' :
329
				case 'ChilliSpot-Max-Output-Octets' :
330
				case 'ChilliSpot-Max-Total-Octets' :
331
				case 'ChilliSpot-Bandwidth-Max-Up' :
332
				case 'ChilliSpot-Bandwidth-Max-Down' :
333
				case 'WISPr-Redirection-URL' :
334
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
335
					break;
336
				default :
337
					print <<<EOM
338
					<td>
339
						<select name=$oper_name>
340
							<option $selected[$op_eq] value="=">=
341
							<option $selected[$op_set] value=":=">:=
342
							<option $selected[$op_add] value="+=">+=
343
							<option $selected[$op_eq2] value="==">==
344
							<option $selected[$op_ne] value="!=">!=
345
							<option $selected[$op_gt] value=">">&gt;
346
							<option $selected[$op_ge] value=">=">&gt;=
347
							<option $selected[$op_lt] value="<">&lt;
348
							<option $selected[$op_le] value="<=">&lt;=
349
							<option $selected[$op_regeq] value="=~">=~
350
							<option $selected[$op_regne] value="!~">!~
351
							<option $selected[$op_exst] value="=*">=*
352
							<option $selected[$op_nexst] value="!*">!*
353
						</select>
354
					</td>
324 richard 355
EOM;
508 richard 356
					break;
357
			}
324 richard 358
		}
508 richard 359
/* 
901 richard 360
Ajout du choix d'unité (pour les durées limites de session,journée et de mois) 
508 richard 361
et d'un calendrier pour la date d'expiration
362
Sauf dans le cas de la visualisation
363
*/
364
		if ($advanced){echo "<td>";}
365
		if ($create==0 ){
366
			switch ($name){
367
				/*
368
				Choix de l'unité heures, minutes ou secondes 
369
				pour les durées limites de session,journée et de mois	
370
				*/	
371
				case 'Session-Timeout' :
372
				case 'Max-Daily-Session' :
373
				case 'Max-Monthly-Session' :
899 richard 374
				case 'Max-All-Session' :
508 richard 375
					/*valeur d'origine de durée limite */
376
					echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
377
					/* Choix d'unité*/
378
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
379
							<option value=\"s\" selected>s</option>
380
							<option value=\"m\" >m</option>
381
							<option value=\"H\" >H</option>
382
						</select>";
383
					break;
384
				case 'Expiration' :
385
					/*Pré-remplissage avec la date du lendemain*/
899 richard 386
					//$val=date("d F Y",strtotime("+1 day"));// utilisée pour le voucher uniquement
508 richard 387
					/*Ajout du calendrier pour choisir la date*/
388
					echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
389
					break;
390
				default :
391
					if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
392
					break;
393
			}
394
		}else{
395
		/*Pas de gestion de remplissage lors de la visualisation*/
396
			if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
397
 
398
/*fin Ajout*/
399
		}
400
	}
401
if (create==0){
402
	print <<<EOM
403
	<tr>
404
		<td class="etiquette" colspan=$colspan>
405
			$l_lang_ticket
406
		</td>
407
		<td width=35>
324 richard 408
EOM;
508 richard 409
/*Choix de la langue du ticket d'impression*/
410
	echo" <select name=\"$langue_imp\" onchange=\"lang_imp(this,'newuser')\">
411
			<option value=\"fr\" selected>Fran&ccedil;ais</option>
412
			<option value=\"en\" >English</option>
413
			<option value=\"nl\" >Nederlandse</option>
414
			<option value=\"de\" >Deutsch</option>
415
			<option value=\"es\" >Espa&ntilde;ol</option>
416
			<option value=\"it\" >Italiano</option>
417
		</select></td></tr>";	
324 richard 418
	}
419
echo "</table><BR>";
420
if ($create == 1)
901 richard 421
	echo "<input type=submit class=button value=\"$l_show_profile\" OnClick=\"this.form.show.value=1\">";
324 richard 422
	else{
901 richard 423
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newuser');\">";
508 richard 424
	}
324 richard 425
?>
426
</form>
508 richard 427
 
324 richard 428
	</td></tr>
429
</table>
430
</tr>
431
</table>
432
</TD></TR>
433
</TABLE>
434
</td></tr>
435
</TABLE>
436
</body>
437
</html>