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