514 |
richard |
1 |
<?php
|
|
|
2 |
// ticket d'impression (thank's to Geoffroy MUSITELLI)
|
|
|
3 |
//gestion de la langue
|
|
|
4 |
$origine='user_new';
|
|
|
5 |
if (is_file("../lib/langues.php"))
|
|
|
6 |
include("../lib/langues.php");
|
|
|
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">
|
|
|
28 |
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
|
|
|
29 |
<script type="text/javascript" src="/js/epoch_classes.js"></script>
|
|
|
30 |
<script type="text/javascript" src="/js/fonctions.js"></script>
|
|
|
31 |
<script language="javascript" type="text/javascript">
|
|
|
32 |
|
|
|
33 |
/*Insertion du calendrier */
|
|
|
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 |
|
|
|
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>
|
514 |
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>
|
616 |
richard |
58 |
<font color="white"><?php echo "$l_frame"; ?></font>
|
514 |
richard |
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>
|
|
|
64 |
<tr><td>
|
|
|
65 |
<?php
|
|
|
66 |
function sec_imp($time)
|
|
|
67 |
/* Formatage des secondes avant l'impression */
|
|
|
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 |
|
|
|
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");
|
|
|
91 |
/* Petit traitement pré-impression pour la lisibilité */
|
|
|
92 |
/* Gestion des cas sans limitation */
|
|
|
93 |
if ($sto_imp=='' && $mds_imp=='' && $mms_imp==''){
|
|
|
94 |
/*Recherche de l'existence d'un groupe et récupération des attributs le cas échéant*/
|
|
|
95 |
if ($group!=''){
|
|
|
96 |
$saved_login = $login;
|
|
|
97 |
$login = $group;
|
|
|
98 |
if (is_file("../lib/sql/group_info.php"))
|
|
|
99 |
include("../lib/sql/group_info.php");
|
|
|
100 |
$login = $saved_login;
|
|
|
101 |
/* formatage des secondes sous le format H min s*/
|
|
|
102 |
$sto_imp=sec_imp($sto_imp);
|
|
|
103 |
$mds_imp=sec_imp($mds_imp);
|
683 |
stephane |
104 |
$mms_imp=sec_imp($mms_imp);
|
514 |
richard |
105 |
} else {
|
|
|
106 |
/*Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/
|
|
|
107 |
$sto_imp=$v_illimit;
|
|
|
108 |
$mds_imp=$v_illimit;
|
|
|
109 |
$mms_imp=$v_illimit;
|
|
|
110 |
}
|
|
|
111 |
}else{
|
|
|
112 |
/* formatage des secondes sous le format H min s*/
|
|
|
113 |
$sto_imp=sec_imp($sto_imp);
|
|
|
114 |
$mds_imp=sec_imp($mds_imp);
|
|
|
115 |
$mms_imp=sec_imp($mms_imp);
|
|
|
116 |
}
|
|
|
117 |
/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/
|
584 |
richard |
118 |
if ($Expiration!=''){
|
|
|
119 |
$Expiration=date("d - m - Y",strtotime($Expiration));
|
|
|
120 |
} else {
|
|
|
121 |
$Expiration=$v_illimit;
|
|
|
122 |
}
|
514 |
richard |
123 |
//Appel du ticket d'impression , passage en paramètres des étiquettes et des valeurs à afficher
|
|
|
124 |
echo' <form name="impression" method="post" action="ticket_user.php" target=_blank>
|
|
|
125 |
<input type="hidden" name="l_title_imp" value="'.$l_title_imp.'">
|
|
|
126 |
<input type="hidden" name="l_login_imp" value="'.$l_login_imp.'">
|
|
|
127 |
<input type="hidden" name="l_password_imp" value="'.$l_password_imp.'">
|
|
|
128 |
<input type="hidden" name="l_session_timeout_imp" value="'.$l_session_timeout_imp.'">
|
|
|
129 |
<input type="hidden" name="l_max_daily_session_imp" value="'.$l_max_daily_session_imp.'">
|
|
|
130 |
<input type="hidden" name="l_max_monthly_session_imp" value="'.$l_max_monthly_session_imp.'">
|
|
|
131 |
<input type="hidden" name="l_expiration_imp" value="'.$l_expiration_imp.'">
|
|
|
132 |
<input type="hidden" name="log_imp" value="'.$login.'">
|
|
|
133 |
<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
|
|
|
134 |
<input type="hidden" name="sto_imp" value="'.$sto_imp.'">
|
|
|
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>
|
|
|
152 |
<?php
|
|
|
153 |
echo <<<EOM
|
|
|
154 |
<tr>
|
|
|
155 |
<td class="etiquette" colspan=$colspan>
|
|
|
156 |
$l_login
|
|
|
157 |
</td><td>
|
|
|
158 |
<input type=text name="login" value="$login" size=35>
|
|
|
159 |
</td>
|
|
|
160 |
</tr>
|
|
|
161 |
<tr>
|
|
|
162 |
<td class="etiquette" colspan=$colspan>
|
|
|
163 |
$l_password
|
|
|
164 |
</td><td>
|
|
|
165 |
<input type=password name="passwd" size=35>
|
|
|
166 |
<br><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
|
|
|
167 |
<input type="text" value="" name="pwdgene" size=20 readonly>
|
|
|
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>
|
|
|
198 |
<input type=text name="Fcn" value="$cn" size=35>
|
|
|
199 |
</td>
|
|
|
200 |
</tr>
|
|
|
201 |
<tr>
|
|
|
202 |
<td class="etiquette" colspan=$colspan>
|
|
|
203 |
$l_email
|
|
|
204 |
</td><td>
|
|
|
205 |
<input type=text name="Fmail" value="$mail" size=35>
|
|
|
206 |
</td>
|
|
|
207 |
</tr>
|
|
|
208 |
EOM;
|
|
|
209 |
// Déplacer la ligne "EOM;" et décommenter en fonction des champs à afficher
|
|
|
210 |
// <tr>
|
|
|
211 |
// <td class="etiquette" colspan=$colspan>
|
|
|
212 |
// Service
|
|
|
213 |
// </td><td>
|
|
|
214 |
// <input type=text name="Fou" value="$ou" size=35>
|
|
|
215 |
// </td>
|
|
|
216 |
// </tr>
|
|
|
217 |
// <tr>
|
|
|
218 |
// <td class="etiquette" colspan=$colspan>
|
|
|
219 |
// Nro TPH personnel
|
|
|
220 |
// </td><td>
|
|
|
221 |
// <input type=text name="Fhomephone" value="$homephone" size=35>
|
|
|
222 |
// </td>
|
|
|
223 |
// </tr>
|
|
|
224 |
// <tr>
|
|
|
225 |
// <td class="etiquette" colspan=$colspan>
|
|
|
226 |
// Nro TPH bureau
|
|
|
227 |
// </td><td>
|
|
|
228 |
// <input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
|
|
|
229 |
// </td>
|
|
|
230 |
// </tr>
|
|
|
231 |
// <tr>
|
|
|
232 |
// <td class="etiquette" colspan=$colspan>
|
|
|
233 |
// Nro TPH mobile
|
|
|
234 |
// </td><td>
|
|
|
235 |
// <input type=text name="Fmobile" value="$mobile" size=35>
|
|
|
236 |
// </td>
|
|
|
237 |
// </tr>
|
|
|
238 |
}
|
|
|
239 |
foreach($show_attrs as $key => $desc){
|
|
|
240 |
$name = $attrmap["$key"];
|
|
|
241 |
if ($name == 'none')
|
|
|
242 |
continue;
|
|
|
243 |
$oper_name = $name . '_op';
|
|
|
244 |
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
|
|
|
245 |
/*
|
|
|
246 |
Gestion d'un mode simple ou d'un mode avancé
|
|
|
247 |
Définition du mode avancé: les attributs concernant la gestion des octets, de la bande passante
|
|
|
248 |
*/
|
|
|
249 |
switch ($key)
|
|
|
250 |
{
|
|
|
251 |
case 'ChilliSpot-Max-Input-Octets' :
|
|
|
252 |
case 'ChilliSpot-Max-Output-Octets' :
|
|
|
253 |
case 'ChilliSpot-Max-Total-Octets' :
|
|
|
254 |
case 'ChilliSpot-Bandwidth-Max-Up' :
|
|
|
255 |
case 'ChilliSpot-Bandwidth-Max-Down' :
|
|
|
256 |
case 'WISPr-Redirection-URL' :
|
|
|
257 |
case 'Login-Time' :
|
|
|
258 |
case 'Max-Monthly-Session' :
|
|
|
259 |
$advanced=0; //<-- Valeur à mettre à '1' pour avoir toutes les fonctionnalités
|
|
|
260 |
break;
|
|
|
261 |
default:
|
|
|
262 |
$advanced=1;
|
|
|
263 |
break;
|
|
|
264 |
}
|
|
|
265 |
if ($show_ops && $advanced){
|
|
|
266 |
print <<<EOM
|
|
|
267 |
<tr>
|
|
|
268 |
<td class="etiquette" colspan=$colspan>
|
|
|
269 |
$desc
|
|
|
270 |
</td>
|
|
|
271 |
EOM;
|
|
|
272 |
switch ($key){
|
|
|
273 |
case 'Simultaneous-Use' :
|
|
|
274 |
case 'Expiration' :
|
|
|
275 |
case 'Max-Daily-Session' :
|
|
|
276 |
case 'Max-Weekly-Session' :
|
|
|
277 |
echo "<input type=\"hidden\" name=$oper_name value=\":=\">";
|
|
|
278 |
break;
|
|
|
279 |
case 'Session-Timeout' :
|
|
|
280 |
case 'ChilliSpot-Max-Input-Octets' :
|
|
|
281 |
case 'ChilliSpot-Max-Output-Octets' :
|
|
|
282 |
case 'ChilliSpot-Max-Total-Octets' :
|
|
|
283 |
case 'ChilliSpot-Bandwidth-Max-Up' :
|
|
|
284 |
case 'ChilliSpot-Bandwidth-Max-Down' :
|
|
|
285 |
case 'WISPr-Redirection-URL' :
|
|
|
286 |
echo "<input type=\"hidden\" name=$oper_name value=\"=\">";
|
|
|
287 |
break;
|
|
|
288 |
default :
|
|
|
289 |
print <<<EOM
|
|
|
290 |
<td>
|
|
|
291 |
<select name=$oper_name>
|
|
|
292 |
<option $selected[$op_eq] value="=">=
|
|
|
293 |
<option $selected[$op_set] value=":=">:=
|
|
|
294 |
<option $selected[$op_add] value="+=">+=
|
|
|
295 |
<option $selected[$op_eq2] value="==">==
|
|
|
296 |
<option $selected[$op_ne] value="!=">!=
|
|
|
297 |
<option $selected[$op_gt] value=">">>
|
|
|
298 |
<option $selected[$op_ge] value=">=">>=
|
|
|
299 |
<option $selected[$op_lt] value="<"><
|
|
|
300 |
<option $selected[$op_le] value="<="><=
|
|
|
301 |
<option $selected[$op_regeq] value="=~">=~
|
|
|
302 |
<option $selected[$op_regne] value="!~">!~
|
|
|
303 |
<option $selected[$op_exst] value="=*">=*
|
|
|
304 |
<option $selected[$op_nexst] value="!*">!*
|
|
|
305 |
</select>
|
|
|
306 |
</td>
|
|
|
307 |
EOM;
|
|
|
308 |
break;
|
|
|
309 |
}
|
|
|
310 |
}
|
|
|
311 |
/*
|
|
|
312 |
Ajout du pré-remplissage de cellule
|
|
|
313 |
du choix d'unité (pour les durées limites de session,journée et de mois)
|
|
|
314 |
et d'un calendrier pour la date d'expiration
|
|
|
315 |
Sauf dans le cas de la visualisation
|
|
|
316 |
*/
|
|
|
317 |
if ($advanced){echo "<td>";}
|
|
|
318 |
if ($create==0 && $advanced){
|
|
|
319 |
switch ($name){
|
|
|
320 |
case 'Simultaneous-Use' :
|
|
|
321 |
/*Pré-remplissage avec la valeur '1' pour empécher plusieurs connexions silmutanées*/
|
|
|
322 |
$val=1;//<--cette valeur correspond au nombre de session simultanée en commentant cette ligne la valeur n'est plus pré-remplie
|
|
|
323 |
echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
|
|
|
324 |
break;
|
|
|
325 |
/*
|
|
|
326 |
Choix de l'unité heures, minutes ou secondes
|
|
|
327 |
pour les durées limites de session,journée et de mois
|
|
|
328 |
*/
|
|
|
329 |
case 'Session-Timeout' :
|
|
|
330 |
case 'Max-Daily-Session' :
|
|
|
331 |
case 'Max-Monthly-Session' :
|
|
|
332 |
/*valeur d'origine de durée limite */
|
|
|
333 |
echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
|
|
|
334 |
/* Choix d'unité*/
|
|
|
335 |
echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
|
|
|
336 |
<option value=\"s\" selected>s</option>
|
|
|
337 |
<option value=\"m\" >m</option>
|
|
|
338 |
<option value=\"H\" >H</option>
|
|
|
339 |
</select>";
|
|
|
340 |
break;
|
|
|
341 |
case 'Expiration' :
|
|
|
342 |
/*Pré-remplissage avec la date du lendemain*/
|
|
|
343 |
$val=date("d F Y",strtotime("+1 day"));//<--en commentant cette ligne la valeur n'est plus pré-remplie
|
|
|
344 |
/*Ajout du calendrier pour choisir la date*/
|
|
|
345 |
echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
|
|
|
346 |
break;
|
|
|
347 |
default :
|
|
|
348 |
if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
|
|
|
349 |
break;
|
|
|
350 |
}
|
|
|
351 |
}else{
|
|
|
352 |
/*Pas de gestion de remplissage lors de la visualisation*/
|
|
|
353 |
if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
|
|
|
354 |
|
|
|
355 |
/*fin Ajout*/
|
|
|
356 |
}
|
|
|
357 |
}
|
|
|
358 |
if (create==0){
|
|
|
359 |
print <<<EOM
|
|
|
360 |
<tr>
|
|
|
361 |
<td class="etiquette" colspan=$colspan>
|
|
|
362 |
$l_lang_ticket
|
|
|
363 |
</td>
|
|
|
364 |
<td width=35>
|
|
|
365 |
EOM;
|
|
|
366 |
/*Choix de la langue du ticket d'impression*/
|
|
|
367 |
echo" <select name=\"$langue_imp\" onchange=\"lang_imp(this,'newuser')\">
|
|
|
368 |
<option value=\"fr\" selected>Français</option>
|
|
|
369 |
<option value=\"en\" >English</option>
|
|
|
370 |
<option value=\"nl\" >Nederlandse</option>
|
|
|
371 |
<option value=\"de\" >Deutsch</option>
|
|
|
372 |
<option value=\"es\" >Español</option>
|
|
|
373 |
<option value=\"it\" >Italiano</option>
|
|
|
374 |
</select></td></tr>";
|
|
|
375 |
}
|
|
|
376 |
echo "</table><BR>";
|
|
|
377 |
if ($create == 1)
|
|
|
378 |
echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
|
|
|
379 |
else{
|
|
|
380 |
echo "<input type=submit class=button value=\"Créer\" OnClick=\"return formControl('newuser');\">";
|
|
|
381 |
}
|
|
|
382 |
?>
|
|
|
383 |
</form>
|
|
|
384 |
|
|
|
385 |
</td></tr>
|
|
|
386 |
</table>
|
|
|
387 |
</tr>
|
|
|
388 |
</table>
|
|
|
389 |
</TD></TR>
|
|
|
390 |
</TABLE>
|
|
|
391 |
</td></tr>
|
|
|
392 |
</TABLE>
|
|
|
393 |
</body>
|
|
|
394 |
</html>
|