Rev 2501 | Rev 2510 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log
<?php
# $Id: user_edit.php 2505 2018-03-11 13:41:00Z tom.houdayer $
//gestion de la langue
if (is_file("../lib/langues.php"))
include("../lib/langues.php");
// Update Alcasar-Status-Page-Must-Stay-Open
if ((isset($_POST['Alcasar-Status-Page-Must-Stay-Open0'])) && ($_POST['Alcasar-Status-Page-Must-Stay-Open0'] === '2')) {
$_POST['Idle-Timeout0'] = '600'; // 10 minutes
} else {
$_POST['Idle-Timeout0'] = '';
}
$_POST['Idle-Timeout0_op'] = '=';
require('/etc/freeradius-web/config.php');
require('../lib/attrshow.php');
require('../lib/defaults.php');
require("../lib/operators.php");
if(!isset($change)) $change = 0;
if(!isset($user_type)) $user_type = 'user';
if(!isset($badusers)) $badusers = 0;
if(!isset($cn)) $cn = '';
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/$config[general_lib_type]/group_info.php"))
include("../lib/$config[general_lib_type]/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 (false && /* Hide operator column */ $config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true') {
$colspan = 2;
$show_ops = 1;
} else {
$show_ops = 0;
$colspan = 1;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Users & groups edition</title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
<link rel="stylesheet" href="/css/style.css">
<script type="text/javascript" src="/js/fonctions.js"></script>
<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>
<script type="text/javascript" src="/js/epoch_classes.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'));
};
</script>
<script type="text/javascript">
function showAdvancedFields(show) {
var form = document.forms['edituser'];
var btn_show = document.getElementById('show-advanced-fields');
var btn_hide = document.getElementById('hide-advanced-fields');
if (show) {
btn_hide.style.display = null;
btn_show.style.display = 'none';
form.className += ' hide-advanced-fields';
} else {
btn_show.style.display = null;
btn_hide.style.display = 'none';
form.className = form.className.replace(' hide-advanced-fields', '');
}
}
</script>
<style type="text/css">
.hide-advanced-fields .advanced-field {
display: none;
}
</style>
</head>
<body>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><th><?= (($user_type !== 'group') ? $l_users_managment : $l_groups_managment) ?></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=640 cellpadding=0 cellspacing=2>
<?php
if ($user_type != 'group'){
include("../html/user_toolbar.html.php");
$titre=$l_user;
}else{
include("../html/group_toolbar.html.php");
$titre=$l_group;
}
print <<<EOM
</table>
<br>
<table border=0 width=620 cellpadding=1 cellspacing=1>
<tr valign=top>
<td width=400></td>
<td bgcolor="black">
<table border=0 width=100% cellpadding=2 cellspacing=0>
<tr bgcolor="#907030" align=center valign=top><th>
<font color="white">$titre : $login ($cn)</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/$config[general_lib_type]/group_change.php");
include("../lib/defaults.php");
}
// Disconnecting user for re-authentication
$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$login.'") {print $1}'));
if (!empty($mac)) {
exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
if ($login === $mac) { // Reconnect allowed MAC
exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
}
}
}
else{
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
include("../lib/$config[general_lib_type]/group_info.php");
// Disconnecting all users from the selected group for re-authentication
if (isset($group_members)) {
foreach ($group_members as $g_member => $member) {
$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
if (!empty($mac)) {
exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
if ($member === $mac) { // Reconnect allowed MAC
exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
}
}
}
}
}
}
else if ($badusers == 1){
if (is_file("../lib/add_badusers.php"))
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) && ($user_type != 'group')) {
$group = array_values($member_groups)[0];
$login_saved = $login;
$login = array_values($member_groups)[0];
include("../lib/$config[general_lib_type]/group_info.php");
$login = $login_saved;
foreach ($show_attrs as $key => $desc) {
if ($key === 'Idle-Timeout') continue;
$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('/\"/','"',$val);
$oper_name = $name1 . '_op';
$oper = $ops[$i];
$selected[$oper] = 'selected';
$i++;
switch ($key)
{
case 'Simultaneous-Use' :
$grp_simuse = $val;
break;
case 'Login-Time' :
$grp_logtime = $val;
break;
case 'Expiration' :
$grp_exp = $val;
break;
case 'Max-All-Session' :
$grp_maxall = $val;
break;
case 'Session-Timeout' :
$grp_sesstim = $val;
break;
case 'Max-Daily-Session' :
$grp_maxday = $val;
break;
case 'Max-Weekly-Session' :
$grp_maxweek = $val;
break;
case 'Max-Monthly-Session' :
$grp_maxmonth = $val;
break;
case 'ChilliSpot-Max-Input-Octets' :
$grp_maxio = $val;
break;
case 'ChilliSpot-Max-Output-Octets' :
$grp_maxoo = $val;
break;
case 'ChilliSpot-Max-Total-Octets' :
$grp_maxto = $val;
break;
case 'ChilliSpot-Bandwidth-Max-Up' :
$grp_bwup = $val;
break;
case 'ChilliSpot-Bandwidth-Max-Down' :
$grp_bwdown = $val;
break;
case 'WISPr-Redirection-URL' :
$grp_redir = $val;
break;
case 'Alcasar-Filter' :
if ($val === '4') {
$grp_filter = $l_filtering_havp_wl;
} else if ($val === '3') {
$grp_filter = $l_filtering_havp_bl;
} else if ($val === '2') {
$grp_filter = $l_filtering_havp;
} else if ($val === '1') {
$grp_filter = $l_filtering_none;
} else {
$grp_filter = '';
}
break;
case 'Alcasar-Protocols-Filter' :
if ($val === '4') {
$grp_filterProto = $l_proto_3;
} else if ($val === '3') {
$grp_filterProto = $l_proto_2;
} else if ($val === '2') {
$grp_filterProto = $l_proto_1;
} else if ($val === '1') {
$grp_filterProto = $l_proto_0;
} else {
$grp_filterProto = '';
}
break;
case 'Alcasar-Status-Page-Must-Stay-Open' :
if ($val === '2') {
$grp_statusOpenRequired = $l_no;
} else if ($val === '1') {
$grp_statusOpenRequired = $l_yes;
} else {
$grp_statusOpenRequired = '';
}
break;
}
}
}
/*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/$config[general_lib_type]/group_info.php"))
include("../lib/$config[general_lib_type]/group_info.php");
$login = $saved_login;
}
}
}
?>
<form name="edituser" method="post" class="">
<input type="hidden" name="login" value="<?= $login ?>">
<input type="hidden" name="user_type" value="<?= $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') && (isset($member_groups))) {
echo <<<EOM
<tr>
<td colspan="$colspan"></td>
<td>$l_group_desc</td>
<td>$l_user_desc</td>
</tr>
EOM;
}
if ($user_type != 'group' && $config['general_show_user_password'] != 'no') {
echo <<<EOM
<tr>
<td align=right colspan="$colspan" bgcolor="#d0ddb0">
$l_new_password<br>
</td>
EOM;
if(isset($member_groups)){
echo <<<EOM
<td bgcolor="#BEBEBE">
<br/>
</td>
EOM;
}
echo <<<EOM
<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>
EOM;
}
foreach($show_attrs as $key => $desc){
if ($key === 'Idle-Timeout') continue;
$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('/\"/','"',$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 = false;
$help_link = "help/simultaneous_use_help.html";
$desc = $l_simultaneous_use;
break;
case 'Max-All-Session' :
$advanced = false;
$help_link = "help/max_all_session_help.html";
$desc = $l_max_all_session;
break;
case 'Session-Timeout' :
$advanced = true;
$help_link = "help/session_timeout_help.html";
$desc = $l_session_timeout;
break;
case 'Max-Daily-Session' :
$advanced = true;
$help_link = "help/session_timeout_help.html";
$desc = $l_daily_timeout;
break;
case 'Max-Monthly-Session' :
$advanced = true;
$help_link = "help/session_timeout_help.html";
$desc = $l_monthly_timeout;
break;
case 'Login-Time' :
$advanced = true;
$help_link = "help/login_time_help.html";
$desc = $l_login_time;
break;
case 'Expiration' :
$advanced = false;
$help_link = "help/expiration_help.html";
$desc = $l_expiration;
break;
case 'ChilliSpot-Max-Input-Octets' :
$advanced = true;
$help_link = "help/chillispot_max_input_octets_help.html";
$desc = $l_max_input_octets;
break;
case 'ChilliSpot-Max-Output-Octets' :
$advanced = true;
$help_link = "help/chillispot_max_output_octets_help.html";
$desc = $l_max_output_octets;
break;
case 'ChilliSpot-Max-Total-Octets' :
$advanced = true;
$help_link = "help/chillispot_max_total_octets_help.html";
$desc = $l_max_total_octets;
break;
case 'ChilliSpot-Bandwidth-Max-Up' :
$advanced = true;
$help_link = "help/chillispot_bandwidth_max_up_help.html";
$desc = $l_max_bandwidth_up;
break;
case 'ChilliSpot-Bandwidth-Max-Down' :
$advanced = true;
$help_link = "help/chillispot_bandwidth_max_down_help.html";
$desc = $l_max_bandwidth_down;
break;
case 'WISPr-Redirection-URL' :
$advanced = true;
$help_link = "help/wispr_redirection_url_help.html";
$desc = $l_wispr_redirection;
break;
case 'Alcasar-Filter' :
$advanced = false;
$help_link = "help/filtering_help.html";
$desc = $l_filtering;
break;
case 'Alcasar-Protocols-Filter' :
$advanced = false;
$help_link = "help/protocols_help.html";
$desc = $l_proto;
break;
case 'Alcasar-Status-Page-Must-Stay-Open' :
$advanced = false;
$help_link = "help/statusOpenRequired_help.html";
$desc = $l_statusOpenRequired;
break;
default:
$advanced = true;
break;
}
$advancedField = ($advanced) ? ' class="advanced-field"' : '';
if ($show_ops) {
print <<<EOM
<tr$advancedField>
<td class="etiquette">
<a href="$help_link" target="help" onclick="window.open('$help_link','help','width=600,height=350,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$desc</font></a>
</td>
EOM;
if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
switch ($key){
case 'Simultaneous-Use' :
case 'Max-All-Session' :
case 'Max-Daily-Session' :
case 'Max-Weekly-Session' :
case 'Max-Monthly-Session' :
case 'Login-Time' :
case 'Expiration' :
echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=</option></select></td>";
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' :
case 'Alcasar-Filter' :
case 'Alcasar-Protocols-Filter' :
case 'Alcasar-Status-Page-Must-Stay-Open' :
echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\"=\">=</option></select></td>";
break;
default :
print <<<EOM
<td>
<select name=\"$oper_name\">
<option $selected[$op_eq] value="=">=</option>
<option $selected[$op_set] value=":=">:=</option>
<option $selected[$op_add] value="+=">+=</option>
<option $selected[$op_eq2] value="==">==</option>
<option $selected[$op_ne] value="!=">!=</option>
<option $selected[$op_gt] value=">">></option>
<option $selected[$op_ge] value=">=">>=</option>
<option $selected[$op_lt] value="<"><</option>
<option $selected[$op_le] value="<="><=</option>
<option $selected[$op_regeq] value="=~">=~</option>
<option $selected[$op_regne] value="!~">!~</option>
<option $selected[$op_exst] value="=*">=*</option>
<option $selected[$op_nexst] value="!*">!*</option>
</select>
</td>
EOM;
break;
}
} else {
print <<<EOM
<tr$advancedField>
<td class="etiquette" colspan="$colspan">
<a href="$help_link" target="help" onclick="window.open('$help_link','help','width=600,height=350,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$desc</font></a>
EOM;
switch ($key) {
case 'Simultaneous-Use' :
case 'Max-All-Session' :
case 'Max-Daily-Session' :
case 'Max-Weekly-Session' :
case 'Max-Monthly-Session' :
case 'Login-Time' :
case 'Expiration' :
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' :
case 'Alcasar-Filter' :
case 'Alcasar-Protocols-Filter' :
case 'Alcasar-Status-Page-Must-Stay-Open' :
echo "<input type=\"hidden\" name=\"$oper_name\" value=\"=\">";
break;
default :
print <<<EOM
<select name=\"$oper_name\">
<option $selected[$op_eq] value="=">=</option>
<option $selected[$op_set] value=":=">:=</option>
<option $selected[$op_add] value="+=">+=</option>
<option $selected[$op_eq2] value="==">==</option>
<option $selected[$op_ne] value="!=">!=</option>
<option $selected[$op_gt] value=">">></option>
<option $selected[$op_ge] value=">=">>=</option>
<option $selected[$op_lt] value="<"><</option>
<option $selected[$op_le] value="<="><=</option>
<option $selected[$op_regeq] value="=~">=~</option>
<option $selected[$op_regne] value="!~">!~</option>
<option $selected[$op_exst] value="=*">=*</option>
<option $selected[$op_nexst] value="!*">!*</option>
</select>
EOM;
break;
}
echo '</td>';
}
if (isset($member_groups) && $user_type !== 'group') {
echo '<td bgcolor="#BEBEBE">';
switch ($key){
case 'Simultaneous-Use' :
echo "$grp_simuse";
break;
case 'Login-Time' :
echo "$grp_logtime";
break;
case 'Expiration' :
echo "$grp_exp";
break;
case 'Max-All-Session' :
echo "$grp_maxall";
break;
case 'Session-Timeout' :
echo "$grp_sesstim";
break;
case 'Max-Daily-Session' :
echo "$grp_maxday";
break;
case 'Max-Weekly-Session' :
echo "$grp_maxweek";
break;
case 'Max-Monthly-Session' :
echo "$grp_maxmonth";
break;
case 'ChilliSpot-Max-Input-Octets' :
echo "$grp_maxio";
break;
case 'ChilliSpot-Max-Output-Octets' :
echo "$grp_maxoo";
break;
case 'ChilliSpot-Max-Total-Octets' :
echo "$grp_maxto";
break;
case 'ChilliSpot-Bandwidth-Max-Up' :
echo "$grp_bwup";
break;
case 'ChilliSpot-Bandwidth-Max-Down' :
echo "$grp_bwdown";
break;
case 'WISPr-Redirection-URL' :
echo "$grp_redir";
break;
case 'Alcasar-Filter' :
echo "$grp_filter";
break;
case 'Alcasar-Protocols-Filter' :
echo "$grp_filterProto";
break;
case 'Alcasar-Status-Page-Must-Stay-Open' :
echo "$grp_statusOpenRequired";
break;
default :
break;
}
echo '</td>';
}
echo '<td>';
switch ($key) {
/*
Choix de l'unité jour, heures, minutes ou secondes
pour les durées limites max, de session,de journée et de mois
*/
case 'Session-Timeout' :
case 'Max-Daily-Session' :
/*valeur d'origine de durée limite */
echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
/* Choix d'unité*/
echo" <select onchange=\"temps(this,'$name1','edituser')\">
<option value=\"s\" selected>s</option>
<option value=\"m\" >m</option>
<option value=\"H\" >H</option>
</select>";
break;
case 'Max-Monthly-Session' :
case 'Max-All-Session' :
/*valeur d'origine de durée limite */
echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
/* Choix d'unité*/
echo" <select onchange=\"temps(this,'$name1','edituser')\">
<option value=\"s\" selected>s</option>
<option value=\"m\" >m</option>
<option value=\"H\" >H</option>
<option value=\"J\" >J</option>
</select>";
break;
case 'Expiration' :
/*Ajout du calendrier pour choisir la date*/
echo"<input id=\"popup_container\" type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
break;
case 'Alcasar-Filter' :
echo "<select name=\"$name1\">";
echo "<option value=\"\"".(($val === '') ? ' selected' : '')."></option>";
echo "<option value=\"1\"".(($val === '1') ? ' selected' : '').">$l_filtering_none</option>";
echo "<option value=\"2\"".(($val === '2') ? ' selected' : '').">$l_filtering_havp</option>";
echo "<option value=\"3\"".(($val === '3') ? ' selected' : '').">$l_filtering_havp_bl</option>";
echo "<option value=\"4\"".(($val === '4') ? ' selected' : '').">$l_filtering_havp_wl</option>";
echo "</select>";
break;
case 'Alcasar-Protocols-Filter' :
echo "<select name=\"$name1\">";
echo "<option value=\"\"".(($val === '') ? ' selected' : '')."></option>";
echo "<option value=\"1\"".(($val === '1') ? ' selected' : '').">$l_proto_0</option>";
echo "<option value=\"2\"".(($val === '2') ? ' selected' : '').">$l_proto_1</option>";
echo "<option value=\"3\"".(($val === '3') ? ' selected' : '').">$l_proto_2</option>";
echo "<option value=\"4\"".(($val === '4') ? ' selected' : '').">$l_proto_3</option>";
echo "</select>";
break;
case 'Alcasar-Status-Page-Must-Stay-Open' :
echo "<label><input type=\"radio\" name=\"$name1\" value=\"\"".(($val !== '2') ? ' checked' : '').">$l_yes</label>
<label><input type=\"radio\" name=\"$name1\" value=\"2\"".(($val === '2') ? ' checked' : '').">$l_no</label>";
break;
default :
echo "<input type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
break;
}
echo '</td>';
}
}
if ($user_type != 'group') {
echo <<<EOM
<tr>
<td align=right colspan="$colspan" bgcolor="#d0ddb0">
$l_group_member<br><font size=-2><i>($l_main_group)</i></font>
</td>
EOM;
if (isset($member_groups)) {
echo '<td colspan="2">';
} else {
echo '<td>';
}
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') {
foreach ($existing_groups as $group => $count) {
if (isset($member_groups[$group]) && ($member_groups[$group] == $group))
echo "<option selected value=\"$group\">$group\n";
else if(isset($member_groups[0]) && ($member_groups[0] == $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>";
}
else{
echo "<i>$l_no_group</i>";
}
echo "</td></tr>";
}
echo "</table><br>";
echo "<input type=submit class=button value=$l_change OnClick=\"this.form.change.value=1\">";
echo "<button type=\"button\" id =\"show-advanced-fields\" onclick=\"showAdvancedFields(true)\" style=\"float: right;\">$l_simple_menu</button>";
echo "<button type=\"button\" id =\"hide-advanced-fields\" onclick=\"showAdvancedFields(false)\" style=\"float: right; display: none;\">$l_advanced_menu</button>";
//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>
</td></tr>
</table>
</center>
</td></tr>
</TABLE>
</body>
</html>