Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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