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;}
913 richard 111
		//Appel du ticket d'impression , passage en paramètres des valeurs à afficher
514 richard 112
		echo'	<form name="impression" method="post" action="ticket_user.php" target=_blank>
913 richard 113
					<input type="hidden" name="langue_imp" value="'.$langue_imp.'">
514 richard 114
					<input type="hidden" name="log_imp" value="'.$login.'">
115
					<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
116
					<input type="hidden" name="sto_imp" value="'.$sto_imp.'">
901 richard 117
					<input type="hidden" name="mas_imp" value="'.$mas_imp.'">
514 richard 118
					<input type="hidden" name="mds_imp" value="'.$mds_imp.'">
119
					<input type="hidden" name="mms_imp" value="'.$mms_imp.'">
120
					<input type="hidden" name="exp_imp" value="'.$Expiration.'">
121
				</form>';
122
		echo'	<script type="text/javascript"> document.forms["impression"].submit();</script>';
123
		//fin ticket impression
124
		require("../lib/defaults.php");
125
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
126
			include("../lib/$config[general_lib_type]/user_info.php");
127
	}
128
}
129
?>
130
   <form name="newuser" method=post>
131
      <input type=hidden name=create value="0">
132
      <input type=hidden name=show value="0">
133
	  <input type=hidden name=langue_imp value='fr'>
134
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
135
<?php
136
	echo <<<EOM
137
	<tr>
138
		<td class="etiquette" colspan=$colspan>
139
		$l_login
140
		</td><td>
141
		<input type=text name="login" value="$login" size=35>
142
		</td>
143
	</tr>
144
	<tr>
145
		<td class="etiquette" colspan=$colspan>
146
		$l_password
147
		</td><td>
148
		<input type=password name="passwd" size=35>
149
		<br><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
150
		<input type="text" value="" name="pwdgene" size=20 readonly>
151
		</td>
152
	</tr>
153
EOM;
154
	if ($config[general_lib_type] == 'sql'){
155
		if (isset($member_groups))
156
			$selected[$member_groups[0]] = 'selected';
157
		echo <<<EOM
158
	<tr>
159
		<td class="etiquette" colspan=$colspan>
160
		$l_group
161
		</td><td>
162
EOM;
163
		include_once("../lib/$config[general_lib_type]/group_info.php");
164
		if (isset($existing_groups)){
165
			echo "<select name=\"Fgroup\">";
166
			echo "<option value=\"\" selected>";
167
			foreach ($member_groups as $group)
168
				echo "<option value=\"$group\">$group\n";
169
			echo " </select>";
170
			}
171
		else echo "$l_group_empty";
172
	echo "</td></tr>";
173
	}
174
	if ($config[general_lib_type] == 'ldap' ||
175
	($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
176
		echo <<<EOM
177
	<tr>
178
		<td class="etiquette" colspan=$colspan>
179
		$l_name
180
		</td><td>
181
		<input type=text name="Fcn" value="$cn" size=35>
182
		</td>
183
	</tr>
184
	<tr>
185
		<td class="etiquette" colspan=$colspan>
186
		$l_email
187
		</td><td>
188
		<input type=text name="Fmail" value="$mail" size=35>
189
		</td>
190
	</tr>
191
EOM;
192
	}
193
	foreach($show_attrs as $key => $desc){
194
		$name = $attrmap["$key"];
195
		if ($name == 'none')
196
			continue;
197
		$oper_name = $name . '_op';
198
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
199
		/*
200
		Gestion d'un mode simple ou d'un mode avancé
201
		Définition du mode avancé: les attributs concernant la gestion des octets, de la bande passante
202
		*/
203
		switch ($key)
204
		{
205
			case 'ChilliSpot-Max-Input-Octets' :
206
			case 'ChilliSpot-Max-Output-Octets' :
207
			case 'ChilliSpot-Max-Total-Octets' :
208
			case 'ChilliSpot-Bandwidth-Max-Up' :
209
			case 'ChilliSpot-Bandwidth-Max-Down' :
210
			case 'WISPr-Redirection-URL' :
211
			case 'Login-Time' : 
896 richard 212
			case 'Session-Timeout' :
213
			case 'Max-Daily-Session' :
514 richard 214
			case 'Max-Monthly-Session' :
896 richard 215
				$advanced=0; //<-- attribut non-affiché
514 richard 216
				break;
896 richard 217
			case 'Simultaneous-Use' : 
218
				$advanced=1;
899 richard 219
				$help_link="help/simultaneous_use_help.html";
896 richard 220
				$desc=$l_simultaneous_use;
221
				break;
222
			case 'Max-All-Session' :
223
				$advanced=1;
899 richard 224
				$help_link="help/max_all_session_help.html";
896 richard 225
				$desc=$l_max_all_session;
226
				break;
227
			case 'Expiration' :
228
				$advanced=1;
899 richard 229
				$help_link="help/expiration_help.html";
896 richard 230
				$desc=$l_expiration;
231
				break;
514 richard 232
			default:
233
				$advanced=1;
234
				break;
235
		}
236
		if ($show_ops && $advanced){
237
		print <<<EOM
238
			<tr>
899 richard 239
			<td class="etiquette" colspan=$colspan>
240
			<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>
241
			</td>
514 richard 242
EOM;
243
			switch ($key){
244
				case 'Simultaneous-Use' : 
886 stephane 245
				case 'Max-All-Session' :
514 richard 246
				case 'Max-Daily-Session' :
247
				case 'Max-Weekly-Session' :
901 richard 248
				case 'Max-Monthly-Session' :
249
				case 'Login-Time' : 
250
				case 'Expiration' :
514 richard 251
					echo "<input type=\"hidden\" name=$oper_name value=\":=\">";
252
					break;
253
				case 'Session-Timeout' :
254
				case 'ChilliSpot-Max-Input-Octets' :
255
				case 'ChilliSpot-Max-Output-Octets' :
256
				case 'ChilliSpot-Max-Total-Octets' :
257
				case 'ChilliSpot-Bandwidth-Max-Up' :
258
				case 'ChilliSpot-Bandwidth-Max-Down' :
259
				case 'WISPr-Redirection-URL' :
260
					echo "<input type=\"hidden\" name=$oper_name value=\"=\">";
261
					break;
262
				default :
263
					print <<<EOM
264
					<td>
265
						<select name=$oper_name>
266
							<option $selected[$op_eq] value="=">=
267
							<option $selected[$op_set] value=":=">:=
268
							<option $selected[$op_add] value="+=">+=
269
							<option $selected[$op_eq2] value="==">==
270
							<option $selected[$op_ne] value="!=">!=
271
							<option $selected[$op_gt] value=">">&gt;
272
							<option $selected[$op_ge] value=">=">&gt;=
273
							<option $selected[$op_lt] value="<">&lt;
274
							<option $selected[$op_le] value="<=">&lt;=
275
							<option $selected[$op_regeq] value="=~">=~
276
							<option $selected[$op_regne] value="!~">!~
277
							<option $selected[$op_exst] value="=*">=*
278
							<option $selected[$op_nexst] value="!*">!*
279
						</select>
280
					</td>
281
EOM;
282
					break;
283
			}
284
		}
285
/* 
286
Ajout du pré-remplissage de cellule
287
du choix d'unité (pour les durées limites de session,journée et de mois) 
288
et d'un calendrier pour la date d'expiration
289
Sauf dans le cas de la visualisation
290
*/
291
		if ($advanced){echo "<td>";}
292
		if ($create==0 && $advanced){
293
			switch ($name){
294
				case 'Simultaneous-Use' :
295
					/*Pré-remplissage avec la valeur '1' pour empécher plusieurs connexions silmutanées*/
296
					$val=1;//<--cette valeur correspond au nombre de session simultanée en commentant cette ligne la valeur n'est plus pré-remplie
297
					echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
298
					break;
299
				/*
300
				Choix de l'unité heures, minutes ou secondes 
301
				pour les durées limites de session,journée et de mois	
302
				*/	
303
				case 'Session-Timeout' :
886 stephane 304
				case 'Max-All-Session' :
514 richard 305
				case 'Max-Daily-Session' :
306
				case 'Max-Monthly-Session' :
307
					/*valeur d'origine de durée limite */
308
					echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
309
					/* Choix d'unité*/
310
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
311
							<option value=\"s\" selected>s</option>
312
							<option value=\"m\" >m</option>
313
							<option value=\"H\" >H</option>
314
						</select>";
315
					break;
316
				case 'Expiration' :
317
					/*Pré-remplissage avec la date du lendemain*/
318
					$val=date("d F Y",strtotime("+1 day"));//<--en commentant cette ligne la valeur n'est plus pré-remplie
319
					/*Ajout du calendrier pour choisir la date*/
320
					echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
321
					break;
322
				default :
323
					if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
324
					break;
325
			}
326
		}else{
327
		/*Pas de gestion de remplissage lors de la visualisation*/
328
			if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
329
 
330
/*fin Ajout*/
331
		}
332
	}
333
if (create==0){
334
	print <<<EOM
335
	<tr>
336
		<td class="etiquette" colspan=$colspan>
337
			$l_lang_ticket
338
		</td>
339
		<td width=35>
340
EOM;
341
/*Choix de la langue du ticket d'impression*/
342
	echo" <select name=\"$langue_imp\" onchange=\"lang_imp(this,'newuser')\">
343
			<option value=\"fr\" selected>Fran&ccedil;ais</option>
344
			<option value=\"en\" >English</option>
345
			<option value=\"nl\" >Nederlandse</option>
346
			<option value=\"de\" >Deutsch</option>
347
			<option value=\"es\" >Espa&ntilde;ol</option>
348
			<option value=\"it\" >Italiano</option>
349
		</select></td></tr>";	
350
	}
351
echo "</table><BR>";
352
if ($create == 1)
901 richard 353
	echo "<input type=submit class=button value=\"$l_show_profile\" OnClick=\"this.form.show.value=1\">";
514 richard 354
	else{
901 richard 355
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newuser');\">";
514 richard 356
	}
357
?>
358
</form>
911 richard 359
</td></tr>
514 richard 360
</table>
911 richard 361
</td></tr>
514 richard 362
</TABLE>
363
</td></tr>
364
</TABLE>
365
</body>
366
</html>