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