Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1881 → Rev 1882

/web/acc/manager/htdocs/user_edit.php
139,6 → 139,263
include("../lib/add_badusers.php");
}
 
 
 
 
//si l'utilisateur fait parti d'un groupe, on charge les attributs du groupe, pour les afficher ensuite.
if(isset($member_groups[0]))
{
echo "<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor=\"#ffffe0\" valign=top>";
$group = $member_groups[0];
$login_saved = $login;
$login = $member_groups[0];
include("../lib/sql/group_info.php");
$login = $login_saved;
echo "<tr>
<td align=right colspan=$colspan bgcolor=\"#d0ddb0\">
$l_new_password<br>
</td>
<td>
<input type=password name=passwd value="" size=20>
<br /><input type=\"button\" value=\"$l_passwd_gen\" onclick=\"password(8)\">
<input type=\"text\" value=\"\" name=\"pwdgene\" size=10 readonly>
</td>
</tr>";
foreach($show_attrs as $key => $desc){
$name = $attrmap["$key"];
$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
if ($name == 'none')
continue;
unset($vals);
unset($selected);
unset($ops);
$def_added = 0;
if (isset($item_vals["$key"]['count']) && $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 (isset($default_vals["$key"]['count']) && $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 (isset($add) && $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 = preg_replace('/\"/','&quot;',$val);
$oper_name = $name1 . '_op';
$oper = $ops[$i];
$selected[$oper] = 'selected';
$i++;
switch ($key)
{
// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
case 'Simultaneous-Use' :
$advanced=1;
$help_link="help/simultaneous_use_help.html";
$desc=$l_simultaneous_use;
break;
case 'Max-All-Session' :
$advanced=1;
$help_link="help/max_all_session_help.html";
$desc=$l_max_all_session;
break;
case 'Session-Timeout' :
$advanced=1;
$help_link="help/session_timeout_help.html";
$desc=$l_session_timeout;
break;
case 'Max-Daily-Session' :
$advanced=1;
$help_link="help/session_timeout_help.html";
$desc=$l_daily_timeout;
break;
case 'Max-Monthly-Session' :
$advanced=1;
$help_link="help/session_timeout_help.html";
$desc=$l_monthly_timeout;
break;
case 'Login-Time' :
$advanced=1;
$help_link="help/login_time_help.html";
$desc=$l_login_time;
break;
case 'Expiration' :
$advanced=1;
$help_link="help/expiration_help.html";
$desc=$l_expiration;
break;
case 'ChilliSpot-Max-Input-Octets' :
$advanced=1;
$help_link="help/chillispot_max_input_octets_help.html";
$desc=$l_max_input_octets;
break;
case 'ChilliSpot-Max-Output-Octets' :
$advanced=1;
$help_link="help/chillispot_max_output_octets_help.html";
$desc=$l_max_output_octets;
break;
case 'ChilliSpot-Max-Total-Octets' :
$advanced=1;
$help_link="help/chillispot_max_total_octets_help.html";
$desc=$l_max_total_octets;
break;
case 'ChilliSpot-Bandwidth-Max-Up' :
$advanced=1;
$help_link="help/chillispot_bandwidth_max_up_help.html";
$desc=$l_max_bandwidth_up;
break;
case 'ChilliSpot-Bandwidth-Max-Down' :
$advanced=1;
$help_link="help/chillispot_bandwidth_max_down_help.html";
$desc=$l_max_bandwidth_down;
break;
case 'WISPr-Redirection-URL' :
$advanced=1;
$help_link="help/wispr_redirection_url_help.html";
$desc=$l_wispr_redirection;
break;
case 'Filter-Id' :
$advanced=1;
$help_link="help/filtering_help.html";
$desc=$l_filtering;
break;
default:
$advanced=1;
break;
}
print <<<EOM
<tr>
<td class="etiquette">
<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>
EOM;
if ($show_ops){
if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
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=20></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=20></td>";
break;
case 'Expiration' :
if($login == "sms" && $user_type == 'group'){
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20 disabled></td>";
} else {
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input id=\"popup_container\" type=text name=\"$name1\" value=\"$val\" size=20></td>";
}
break;
case 'Max-All-Session' :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></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=20></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=20></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=20></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=20></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=20></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=20></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=20></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=20></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=20></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=20></td>";
break;
case 'Filter-Id' :
switch($val)
{
case "00000001":
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><select name=\"$name1\"><option value=\"00000000\">$l_filtering_none</option><option value=\"00000001\" selected=\"selected\">$l_filtering_havp</option><option value=\"00000011\">$l_filtering_havp_bl</option><option value=\"00000101\">$l_filtering_havp_wl</option></select></td>";
break;
case "00000011":
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><select name=\"$name1\"><option value=\"00000000\">$l_filtering_none</option><option value=\"00000001\">$l_filtering_havp</option><option value=\"00000011\" selected=\"selected\">$l_filtering_havp_bl</option><option value=\"00000101\">$l_filtering_havp_wl</option></select></td>";
break;
case "00000101":
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><select name=\"$name1\"><option value=\"00000000\">$l_filtering_none</option><option value=\"00000001\">$l_filtering_havp</option><option value=\"00000011\">$l_filtering_havp_bl</option><option value=\"00000101\" selected=\"selected\">$l_filtering_havp_wl</option></select></td>";
break;
default :
echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><select name=\"$name1\"><option value=\"00000000\" selected=\"selected\">$l_filtering_none</option><option value=\"00000001\">$l_filtering_havp</option><option value=\"00000011\">$l_filtering_havp_bl</option><option value=\"00000101\">$l_filtering_havp_wl</option></select></td>";
break;
}
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=">">&gt;
<option $selected[$op_ge] value=">=">&gt;=
<option $selected[$op_lt] value="<">&lt;
<option $selected[$op_le] value="<=">&lt;=
<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=20></td>
EOM;
break;
}
}
print <<<EOM
</tr>
EOM;
}
}
 
}
 
 
?>
<form name="edituser" method=post>
<input type=hidden name=login value=<?php print $login ?>>
165,17 → 422,19
</tr>
EOM;
}
//si l'utilisateur fait parti d'un groupe, on charge les attributs du groupe, pour les afficher ensuite.
if(isset($member_groups[0]))
{
$group = $member_groups[0];
$login_saved = $login;
$login = $member_groups[0];
include("../lib/sql/group_info.php");
$login = $login_saved;
 
/*on charge les attributs utilisateurs afin de montrer les groupes disponibles*/
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'){
$saved_login = $login;
$login = '';
if (is_file("../lib/sql/group_info.php"))
include("../lib/sql/group_info.php");
$login = $saved_login;
}
}
 
foreach($show_attrs as $key => $desc){
$name = $attrmap["$key"];
412,20 → 671,6
EOM;
 
 
 
/*on charge les attributs utilisateurs afin de montrer les groupes disponibles*/
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'){
$saved_login = $login;
$login = '';
if (is_file("../lib/sql/group_info.php"))
include("../lib/sql/group_info.php");
$login = $saved_login;
}
}
 
if (isset($existing_groups)){
echo "<select size=5 name=\"edited_groups[]\" OnChange=\"this.form.group_change.value=1\">";
if ($config['sql_show_all_groups'] == 'true'){
/web/acc/manager/lib/sql/change_attrs.php
79,20 → 79,23
continue;
// if value differs from the sql value then update
else{
if (isset($item_vals["$key"][$j])){
if (isset($item_vals["$key"][$j]) && (isset($old_val) && $old_val !='') || $sql_attr=='Filter-Id'){
$old_val = $item_vals["$key"][$j];
$old_val = da_sql_escape_string($link, $old_val);
$res = da_sql_query($link,$config,
"UPDATE $table SET value = '$val' WHERE $query_key = '$login' AND
attribute = '$sql_attr' AND value = '$old_val';");
if (!$res || !da_sql_affected_rows($link,$res,$config))
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
}
if(isset($val) && $val != ''){
else{
$res = da_sql_query($link,$config,
"INSERT INTO $table ($query_key,attribute,value $text2)
VALUES ('$login','$sql_attr','$val' $op_val2);");
if (!$res || !da_sql_affected_rows($link,$res,$config))
echo "<b>Change failed for attribute $key: " . da_sql_error($link,$config) . "</b><br>\n";
}
}
}
}
}
/web/acc/manager/lib/sql/defaults.php
53,7 → 53,8
$tmp["$attr"]['operator'][]="$oper";
}
$tmp["$attr"][]="$val";
$tmp["$attr"]['count']++;
if(isset($tmp["$attr"]['count']))
$tmp["$attr"]['count']++;
}
$res = da_sql_query($link,$config,
"SELECT attribute,value $op FROM $config[sql_groupreply_table]