Rev 899 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log
<?php
require('/etc/freeradius-web/config.php');
require('../lib/attrshow.php');
require('../lib/defaults.php');
$extra_text = '';
if ($user_type != 'group'){
if (is_file("../lib/$config[general_lib_type]/user_info.php"))
include("../lib/$config[general_lib_type]/user_info.php");
if ($config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){
$extra_text = "<br><font size=-2><i>(le groupe auquel apartient l'usager est surligné)</i></font>";
$saved_login = $login;
$login = '';
if (is_file("../lib/sql/group_info.php"))
include("../lib/sql/group_info.php");
$login = $saved_login;
}
}
else{
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
include("../lib/$config[general_lib_type]/group_info.php");
}
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
$colspan=2;
$show_ops = 1;
include("../lib/operators.php");
}
else{
$show_ops = 0;
$colspan=1;
}
echo <<<EOM
<html>
<head>
EOM;
if ($user_type != 'group'){
echo " <title>subscription configuration for $login ($cn)</title>\n";
$util = "usagers";}
else{
echo " <title>subscription configuration for $login</title>\n";
$util = "groupes";}
?>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
<link rel="stylesheet" href="/css/style.css">
<script language="javascript" type="text/javascript">
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
function password(size)
{
var pass=''
while(pass.length < size)
{
pass+=chars.charAt(Math.round(Math.random() * (chars.length)))
}
document.edituser.passwd.value=pass
document.edituser.pwdgene.value=pass
}
</script>
</head>
<body>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th>Gestion des <?php echo $util?></th></tr>
<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
height="2"></td></tr>
</TABLE>
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
<tr><td valign="middle" align="left">
<center>
<table border=0 width=550 cellpadding=0 cellspacing=0>
<tr valign=top>
<!--<td align=center><img src="images/title2.gif"></td>-->
</tr>
</table>
<table border=0 width=400 cellpadding=0 cellspacing=2>
<?php
if ($user_type != 'group')
{
include("../html/user_toolbar.html.php");
$titre="de l'usager";
}
else
{
include("../html/group_toolbar.html.php");
$titre="du groupe";
}
print <<<EOM
</table>
<br>
<table border=0 width=540 cellpadding=1 cellspacing=1>
<tr valign=top>
<td width=75%> </td>
<td bgcolor="black" width=25% align=right>
<table border=0 width="200" cellpadding=2 cellspacing=0>
<tr bgcolor="#907030" align=center valign=top><th>
<font color="white">Attributs $titre : $login</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>
EOM;
if ($change == 1){
if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
include("../lib/$config[general_lib_type]/change_attrs.php");
if ($user_type != 'group'){
if ($config[general_show_user_password] != 'no' && $passwd != ''
&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
include("../lib/$config[general_lib_type]/change_passwd.php");
if (is_file("../lib/$config[general_lib_type]/user_info.php"))
include("../lib/$config[general_lib_type]/user_info.php");
if ($group_change && $config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){
include("../lib/sql/group_change.php");
include("../lib/defaults.php");
}
}
else{
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
include("../lib/$config[general_lib_type]/group_info.php");
}
}
else if ($badusers == 1){
if (is_file("../lib/add_badusers.php"))
include("../lib/add_badusers.php");
}
?>
<form name="edituser" method=post>
<input type=hidden name=login value=<?php print $login ?>>
<input type=hidden name=user_type value=<?php print $user_type ?>>
<input type=hidden name=change value="0">
<input type=hidden name=add value="0">
<input type=hidden name=badusers value="0">
<input type=hidden name=group_change value="0">
<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
<?php
if ($user_type != 'group' && $config[general_show_user_password] != 'no'){
echo <<<EOM
<tr>
<td align=right colspan=$colspan bgcolor="#d0ddb0">
Nouveau mot de passe<br>
EOM;
if ($user_password_exists == 'yes')
echo "<font size=-2>Le mot de passe <font color=\"green\"><b>existe</b></font></font>\n";
else
echo "<font size=-2>Le mot de passe <font color=\"red\"><b> n'existe pas</b></font></font>\n";
echo <<<EOM
</td>
<td>
<input type=password name=passwd value="" size=40>
<br /><input type="button" value="générer" onclick="password(8)">
<input type="text" value="" name="pwdgene" size=20 readonly>
</td>
</tr>
EOM;
}
foreach($show_attrs as $key => $desc){
$name = $attrmap["$key"];
$generic = $attrmap[generic]["$key"];
if ($name == 'none')
continue;
unset($vals);
unset($selected);
unset($ops);
$def_added = 0;
if ($item_vals["$key"][count]){
for($i=0;$i<$item_vals["$key"][count];$i++){
$vals[] = $item_vals["$key"][$i];
$ops[] = $item_vals["$key"][operator][$i];
}
}
else{
if ($default_vals["$key"][count]){
for($i=0;$i<$default_vals["$key"][count];$i++){
$vals[] = $default_vals["$key"][$i];
$ops[] = $default_vals["$key"][operator][$i];
}
}
else{
$vals[] = '';
$ops[] = '=';
}
$def_added = 1;
}
if ($generic == 'generic' && $def_added == 0){
for($i=0;$i<$default_vals["$key"][count];$i++){
$vals[] = $default_vals["$key"][$i];
$ops[] = $default_vals["$key"][operator][$i];
}
}
if ($add && $name == $add_attr){
$vals[] = $default_vals["$key"][0];
$ops[] = ($default_vals["$key"][operator][0] != '') ? $default_vals["$key"][operator][0] : '=';
}
$i = 0;
foreach($vals as $val){
$name1 = $name . $i;
$val = ereg_replace('"','"',$val);
$oper_name = $name1 . '_op';
$oper = $ops[$i];
$selected[$oper] = 'selected';
$i++;
print <<<EOM
<tr>
<td align=right bgcolor="#d0ddb0">
EOM;
$desc = addslashes($desc);
eval("\$desc = \"$desc\";");
$desc = stripslashes($desc);
if ($i == 1)
echo "$desc\n";
else
echo "$desc ($i)\n";
echo "</td>";
if ($show_ops){
switch ($key)
{
case 'Simultaneous-Use' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'Login-Time' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'Expiration' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'Session-Timeout' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'Max-Daily-Session' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'Max-Weekly-Session' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'Max-Monthly-Session' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'ChilliSpot-Max-Input-Octets' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'ChilliSpot-Max-Output-Octets' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'ChilliSpot-Max-Total-Octets' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'ChilliSpot-Bandwidth-Max-Up' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'ChilliSpot-Bandwidth-Max-Down' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
break;
case 'WISPr-Redirection-URL' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
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>
<td><input type=text name="$name1" value="$val" size=40></td>
EOM;
break;
}
}
print <<<EOM
</tr>
EOM;
}
}
if ($user_type != 'group'){
echo <<<EOM
<tr>
<td align=right colspan=$colspan bgcolor="#d0ddb0">
Membre de $extra_text
</td>
<td>
EOM;
if (isset($member_groups)){
echo "<select size=5 name=\"edited_groups[]\" multiple OnChange=\"this.form.group_change.value=1\">";
if ($config[sql_show_all_groups] == 'true'){
foreach ($existing_groups as $group => $count){
if ($member_groups[$group] == $group)
echo "<option selected value=\"$group\">$group\n";
else
echo "<option value=\"$group\">$group\n";
}
}else{
foreach ($member_groups as $group)
echo "<option value=\"$group\">$group\n";
}
echo "</select></td></tr>";
}
else{
echo "aucun group</td></tr>";
}
}
echo "</table><br>";
echo "<input type=submit class=button value=Change OnClick=\"this.form.change.value=1\">";
//if ($user_type != 'group'){
// echo <<<EOM
//<br><br>
//<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
//<a href="help/badusers_help.html" target=bu_help onclick=window.open("help/badusers_help.html","bu_help","width=600,height=210,toolbar=no,scrollbars=no,resizable=yes") title="BADUSERS Help Page"><font color="blue"><--Help</font></a>
//EOM;
//}
?>
</form>
</td></tr>
</table>
</tr>
</table>
</td></tr>
</TABLE>
</body>
</html>