Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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