Subversion Repositories ALCASAR

Rev

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