Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

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