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