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