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