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