Rev 584 | Blame | Last modification | View Log
<?php
// ticket d'impression (thank's to Geoffroy MUSITELLI)
//gestion de la langue
$origine='user_new';
if (is_file("../lib/langues.php"))
include("../lib/langues.php");
require('/etc/freeradius-web/config.php');
if ($show == 1){
header("Location: user_admin.php?login=$login");
exit;
}
require('../lib/attrshow.php');
require('../lib/defaults.php');
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
$colspan=2;
$show_ops=1;
}else{
$show_ops = 0;
$colspan=1;
}
echo "<html><head><title>$l_title</title>";
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
<link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
<script type="text/javascript" src="/js/epoch_classes.js"></script>
<script type="text/javascript" src="/js/fonctions.js"></script>
<script language="javascript" type="text/javascript">
/*Insertion du calendrier */
var dp_cal;
window.onload = function () {
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
};
/*Fin calendrier*/
</script>
</head>
<body>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><?php echo"$l_frame_top"; ?></th></tr>
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
<tr bgcolor="#666666"><td>
<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
<tr><td valign="middle" align="left">
<center>
<table border=0 width=550 cellpadding=1 cellspacing=1>
<tr valign=top>
<td width=340></td>
<td bgcolor="black" width=200>
<table border=0 width=100% cellpadding=2 cellspacing=0>
<tr bgcolor="#907030" align=right valign=top><th>
<font color="white"><?php echo "$l_frame"; ?></font>
</th></tr>
</table>
</td></tr>
<tr bgcolor="black" valign=top><td colspan=2>
<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
<tr><td>
<?php
function sec_imp($time)
/* Formatage des secondes avant l'impression */
{
$heure=0;$minute=0;$seconde=0;
$heure = floor($time/3600);
$reste = $time%3600;
if ($heure!=0) $result = $heure.' H ';
$minute = floor($reste/60);
if ($minute!=0) $result = $result.$minute.' min ';
$seconde = $reste%60;
if ($seconde!=0) $result = $result.$seconde.' s ';
return $result;
}
if ($create == 1){
if (is_file("../lib/$config[general_lib_type]/user_info.php"))
include("../lib/$config[general_lib_type]/user_info.php");
if ($user_exists != "no"){
echo <<<EOM
<b><i>$login</i> $l_user_exist</b>
EOM;
}
else{
if (is_file("../lib/$config[general_lib_type]/create_user.php"))
include("../lib/$config[general_lib_type]/create_user.php");
/* Petit traitement pré-impression pour la lisibilité */
/* Gestion des cas sans limitation */
if ($sto_imp=='' && $mds_imp=='' && $mms_imp==''){
/*Recherche de l'existence d'un groupe et récupération des attributs le cas échéant*/
if ($group!=''){
$saved_login = $login;
$login = $group;
if (is_file("../lib/sql/group_info.php"))
include("../lib/sql/group_info.php");
$login = $saved_login;
/* formatage des secondes sous le format H min s*/
$sto_imp=sec_imp($sto_imp);
$mds_imp=sec_imp($mds_imp);
$mds_imp=sec_imp($mds_imp);
} else {
/*Si les valeurs de durée sont vide remplissage avec la valeur 'Illimitée'*/
$sto_imp=$v_illimit;
$mds_imp=$v_illimit;
$mms_imp=$v_illimit;
}
}else{
/* formatage des secondes sous le format H min s*/
$sto_imp=sec_imp($sto_imp);
$mds_imp=sec_imp($mds_imp);
$mms_imp=sec_imp($mms_imp);
}
/*Formatage de la date afin d'être lisible dans toute les langues 'jj mm yyyy'*/
if ($Expiration!=''){
$Expiration=date("d - m - Y",strtotime($Expiration));
} else {
$Expiration=$v_illimit;
}
//Appel du ticket d'impression , passage en paramètres des étiquettes et des valeurs à afficher
echo' <form name="impression" method="post" action="ticket_user.php" target=_blank>
<input type="hidden" name="l_title_imp" value="'.$l_title_imp.'">
<input type="hidden" name="l_login_imp" value="'.$l_login_imp.'">
<input type="hidden" name="l_password_imp" value="'.$l_password_imp.'">
<input type="hidden" name="l_session_timeout_imp" value="'.$l_session_timeout_imp.'">
<input type="hidden" name="l_max_daily_session_imp" value="'.$l_max_daily_session_imp.'">
<input type="hidden" name="l_max_monthly_session_imp" value="'.$l_max_monthly_session_imp.'">
<input type="hidden" name="l_expiration_imp" value="'.$l_expiration_imp.'">
<input type="hidden" name="log_imp" value="'.$login.'">
<input type="hidden" name="passwd_imp" value="'.$passwd_imp.'">
<input type="hidden" name="sto_imp" value="'.$sto_imp.'">
<input type="hidden" name="mds_imp" value="'.$mds_imp.'">
<input type="hidden" name="mms_imp" value="'.$mms_imp.'">
<input type="hidden" name="exp_imp" value="'.$Expiration.'">
</form>';
echo' <script type="text/javascript"> document.forms["impression"].submit();</script>';
//fin ticket impression
require("../lib/defaults.php");
if (is_file("../lib/$config[general_lib_type]/user_info.php"))
include("../lib/$config[general_lib_type]/user_info.php");
}
}
?>
<form name="newuser" method=post>
<input type=hidden name=create value="0">
<input type=hidden name=show value="0">
<input type=hidden name=langue_imp value='fr'>
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
<?php
echo <<<EOM
<tr>
<td class="etiquette" colspan=$colspan>
$l_login
</td><td>
<input type=text name="login" value="$login" size=35>
</td>
</tr>
<tr>
<td class="etiquette" colspan=$colspan>
$l_password
</td><td>
<input type=password name="passwd" size=35>
<br><input type="button" value="$l_passwd_gen" onclick="password(8,'newuser')">
<input type="text" value="" name="pwdgene" size=20 readonly>
</td>
</tr>
EOM;
if ($config[general_lib_type] == 'sql'){
if (isset($member_groups))
$selected[$member_groups[0]] = 'selected';
echo <<<EOM
<tr>
<td class="etiquette" colspan=$colspan>
$l_group
</td><td>
EOM;
include_once("../lib/$config[general_lib_type]/group_info.php");
if (isset($existing_groups)){
echo "<select name=\"Fgroup\">";
echo "<option value=\"\" selected>";
foreach ($member_groups as $group)
echo "<option value=\"$group\">$group\n";
echo " </select>";
}
else echo "$l_group_empty";
echo "</td></tr>";
}
if ($config[general_lib_type] == 'ldap' ||
($config[general_lib_type] == 'sql' && $config[sql_use_user_info_table] == 'true')){
echo <<<EOM
<tr>
<td class="etiquette" colspan=$colspan>
$l_name
</td><td>
<input type=text name="Fcn" value="$cn" size=35>
</td>
</tr>
<tr>
<td class="etiquette" colspan=$colspan>
$l_email
</td><td>
<input type=text name="Fmail" value="$mail" size=35>
</td>
</tr>
EOM;
// Déplacer la ligne "EOM;" et décommenter en fonction des champs à afficher
// <tr>
// <td class="etiquette" colspan=$colspan>
// Service
// </td><td>
// <input type=text name="Fou" value="$ou" size=35>
// </td>
// </tr>
// <tr>
// <td class="etiquette" colspan=$colspan>
// Nro TPH personnel
// </td><td>
// <input type=text name="Fhomephone" value="$homephone" size=35>
// </td>
// </tr>
// <tr>
// <td class="etiquette" colspan=$colspan>
// Nro TPH bureau
// </td><td>
// <input type=text name="Ftelephonenumber" value="$telephonenumber" size=35>
// </td>
// </tr>
// <tr>
// <td class="etiquette" colspan=$colspan>
// Nro TPH mobile
// </td><td>
// <input type=text name="Fmobile" value="$mobile" size=35>
// </td>
// </tr>
}
foreach($show_attrs as $key => $desc){
$name = $attrmap["$key"];
if ($name == 'none')
continue;
$oper_name = $name . '_op';
$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
/*
Gestion d'un mode simple ou d'un mode avancé
Définition du mode avancé: les attributs concernant la gestion des octets, de la bande passante
*/
switch ($key)
{
case 'ChilliSpot-Max-Input-Octets' :
case 'ChilliSpot-Max-Output-Octets' :
case 'ChilliSpot-Max-Total-Octets' :
case 'ChilliSpot-Bandwidth-Max-Up' :
case 'ChilliSpot-Bandwidth-Max-Down' :
case 'WISPr-Redirection-URL' :
case 'Login-Time' :
case 'Max-Monthly-Session' :
$advanced=0; //<-- Valeur à mettre à '1' pour avoir toutes les fonctionnalités
break;
default:
$advanced=1;
break;
}
if ($show_ops && $advanced){
print <<<EOM
<tr>
<td class="etiquette" colspan=$colspan>
$desc
</td>
EOM;
switch ($key){
case 'Simultaneous-Use' :
case 'Expiration' :
case 'Max-Daily-Session' :
case 'Max-Weekly-Session' :
echo "<input type=\"hidden\" name=$oper_name value=\":=\">";
break;
case 'Session-Timeout' :
case 'ChilliSpot-Max-Input-Octets' :
case 'ChilliSpot-Max-Output-Octets' :
case 'ChilliSpot-Max-Total-Octets' :
case 'ChilliSpot-Bandwidth-Max-Up' :
case 'ChilliSpot-Bandwidth-Max-Down' :
case 'WISPr-Redirection-URL' :
echo "<input type=\"hidden\" name=$oper_name value=\"=\">";
break;
default :
print <<<EOM
<td>
<select name=$oper_name>
<option $selected[$op_eq] value="=">=
<option $selected[$op_set] value=":=">:=
<option $selected[$op_add] value="+=">+=
<option $selected[$op_eq2] value="==">==
<option $selected[$op_ne] value="!=">!=
<option $selected[$op_gt] value=">">>
<option $selected[$op_ge] value=">=">>=
<option $selected[$op_lt] value="<"><
<option $selected[$op_le] value="<="><=
<option $selected[$op_regeq] value="=~">=~
<option $selected[$op_regne] value="!~">!~
<option $selected[$op_exst] value="=*">=*
<option $selected[$op_nexst] value="!*">!*
</select>
</td>
EOM;
break;
}
}
/*
Ajout du pré-remplissage de cellule
du choix d'unité (pour les durées limites de session,journée et de mois)
et d'un calendrier pour la date d'expiration
Sauf dans le cas de la visualisation
*/
if ($advanced){echo "<td>";}
if ($create==0 && $advanced){
switch ($name){
case 'Simultaneous-Use' :
/*Pré-remplissage avec la valeur '1' pour empécher plusieurs connexions silmutanées*/
$val=1;//<--cette valeur correspond au nombre de session simultanée en commentant cette ligne la valeur n'est plus pré-remplie
echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
break;
/*
Choix de l'unité heures, minutes ou secondes
pour les durées limites de session,journée et de mois
*/
case 'Session-Timeout' :
case 'Max-Daily-Session' :
case 'Max-Monthly-Session' :
/*valeur d'origine de durée limite */
echo"<input type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
/* Choix d'unité*/
echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
<option value=\"s\" selected>s</option>
<option value=\"m\" >m</option>
<option value=\"H\" >H</option>
</select>";
break;
case 'Expiration' :
/*Pré-remplissage avec la date du lendemain*/
$val=date("d F Y",strtotime("+1 day"));//<--en commentant cette ligne la valeur n'est plus pré-remplie
/*Ajout du calendrier pour choisir la date*/
echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
break;
default :
if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
break;
}
}else{
/*Pas de gestion de remplissage lors de la visualisation*/
if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
/*fin Ajout*/
}
}
if (create==0){
print <<<EOM
<tr>
<td class="etiquette" colspan=$colspan>
$l_lang_ticket
</td>
<td width=35>
EOM;
/*Choix de la langue du ticket d'impression*/
echo" <select name=\"$langue_imp\" onchange=\"lang_imp(this,'newuser')\">
<option value=\"fr\" selected>Français</option>
<option value=\"en\" >English</option>
<option value=\"nl\" >Nederlandse</option>
<option value=\"de\" >Deutsch</option>
<option value=\"es\" >Español</option>
<option value=\"it\" >Italiano</option>
</select></td></tr>";
}
echo "</table><BR>";
if ($create == 1)
echo "<input type=submit class=button value=\"Afficher le profil de l'utilisateur\" OnClick=\"this.form.show.value=1\">";
else{
echo "<input type=submit class=button value=\"Créer\" OnClick=\"return formControl('newuser');\">";
}
?>
</form>
</td></tr>
</table>
</tr>
</table>
</TD></TR>
</TABLE>
</td></tr>
</TABLE>
</body>
</html>