Subversion Repositories ALCASAR

Rev

Rev 2349 | Rev 2394 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
324 richard 1
<?php
2319 tom.houday 2
# $Id: user_edit.php 2392 2017-08-25 15:28:12Z tom.houdayer $
3
 
899 richard 4
//gestion de la langue
5
if (is_file("../lib/langues.php"))
6
	include("../lib/langues.php");
2006 raphael.pi 7
 
2319 tom.houday 8
//update Filter-Id for protocol filtering
9
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id0']))
10
{
11
	$upId = (int)$_POST['Filter-Proto'];
12
	$downId = (int)$_POST['Filter-Id0'];
13
	$upId = $upId+$downId;
14
	$upId = str_pad($upId, 8, '0', STR_PAD_LEFT);
15
	$_POST['Filter-Id0'] = $upId;
16
}
1881 raphael.pi 17
 
2341 tom.houday 18
require('/etc/freeradius-web/config.php');
19
require('../lib/attrshow.php');
20
require('../lib/defaults.php');
21
require("../lib/operators.php");
22
 
23
if(!isset($change)) $change = 0;
24
if(!isset($user_type)) $user_type = 'user';
25
if(!isset($badusers)) $badusers = 0;
26
if(!isset($cn)) $cn = '';
27
 
324 richard 28
if ($user_type != 'group'){
29
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
30
		include("../lib/$config[general_lib_type]/user_info.php");
1805 clement.si 31
	if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
324 richard 32
		$saved_login = $login;
33
		$login = '';
2339 tom.houday 34
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
35
			include("../lib/$config[general_lib_type]/group_info.php");
324 richard 36
		$login = $saved_login;
37
	}
38
}
39
else{
40
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
41
		include("../lib/$config[general_lib_type]/group_info.php");
42
}
2319 tom.houday 43
if (false && /* Hide operator column */ $config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true') {
44
	$colspan = 2;
324 richard 45
	$show_ops = 1;
2319 tom.houday 46
} else {
324 richard 47
	$show_ops = 0;
2319 tom.houday 48
	$colspan = 1;
324 richard 49
}
901 richard 50
?>
2319 tom.houday 51
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
324 richard 52
<html>
53
<head>
911 richard 54
<title>Users & groups edition</title>
1805 clement.si 55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
324 richard 56
<link rel="stylesheet" href="/css/style.css">
2339 tom.houday 57
<script type="text/javascript" src="/js/fonctions.js"></script>
324 richard 58
<script language="javascript" type="text/javascript">
59
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
60
function password(size)
61
  {
62
  var pass=''
63
  while(pass.length < size)
64
  {
65
    pass+=chars.charAt(Math.round(Math.random() * (chars.length)))
66
  }
67
  document.edituser.passwd.value=pass
68
  document.edituser.pwdgene.value=pass
69
}
70
</script>
1566 richard 71
<script type="text/javascript" src="/js/epoch_classes.js"></script>
72
<script language="javascript" type="text/javascript">
2319 tom.houday 73
	// Insertion du calendrier
1805 clement.si 74
	var dp_cal;
2319 tom.houday 75
	window.onload = function () {
76
		dp_cal = new Epoch('epoch_popup', 'popup', document.getElementById('popup_container'));
77
	};
1566 richard 78
</script>
2319 tom.houday 79
<script type="text/javascript">
80
	function showAdvancedFields(show) {
81
		var form = document.forms['edituser'];
82
		var btn_show = document.getElementById('show-advanced-fields');
83
		var btn_hide = document.getElementById('hide-advanced-fields');
1566 richard 84
 
2319 tom.houday 85
		if (show) {
86
			btn_hide.style.display = null;
87
			btn_show.style.display = 'none';
88
			form.className += ' hide-advanced-fields';
89
		} else {
90
			btn_show.style.display = null;
91
			btn_hide.style.display = 'none';
92
			form.className = form.className.replace(' hide-advanced-fields', '');
93
 
94
		}
95
	}
96
</script>
97
<style type="text/css">
98
	.hide-advanced-fields .advanced-field {
99
		display: none;
100
	}
101
</style>
324 richard 102
</head>
103
<body>
104
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
2319 tom.houday 105
	<tr><th><?= (($user_type !== 'group') ? $l_users_managment : $l_groups_managment) ?></th></tr>
1805 clement.si 106
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
324 richard 107
height="2"></td></tr>
108
</TABLE>
109
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
110
	<tr><td valign="middle" align="left">
111
	<center>
925 richard 112
	<table border=0 width=640 cellpadding=0 cellspacing=2>
324 richard 113
<?php
1805 clement.si 114
if ($user_type != 'group'){
324 richard 115
	include("../html/user_toolbar.html.php");
901 richard 116
	$titre=$l_user;
1805 clement.si 117
}else{
324 richard 118
	include("../html/group_toolbar.html.php");
901 richard 119
	$titre=$l_group;
1805 clement.si 120
}
324 richard 121
print <<<EOM
122
</table>
123
<br>
925 richard 124
<table border=0 width=620 cellpadding=1 cellspacing=1>
324 richard 125
<tr valign=top>
925 richard 126
<td width=400></td>
127
<td bgcolor="black">
128
	<table border=0 width=100% cellpadding=2 cellspacing=0>
324 richard 129
	<tr bgcolor="#907030" align=center valign=top><th>
910 richard 130
	<font color="white">$titre : $login ($cn)</font>
324 richard 131
	</th></tr>
132
	</table>
133
</td></tr>
2319 tom.houday 134
<tr bgcolor="black" valign=top><td colspan="2">
324 richard 135
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
136
	<tr><td>
137
EOM;
1805 clement.si 138
 
2341 tom.houday 139
if ($change == 1) {
324 richard 140
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
141
		include("../lib/$config[general_lib_type]/change_attrs.php");
142
	if ($user_type != 'group'){
1805 clement.si 143
		if ($config['general_show_user_password'] != 'no' && $passwd != ''
324 richard 144
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
145
			include("../lib/$config[general_lib_type]/change_passwd.php");
146
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
147
			include("../lib/$config[general_lib_type]/user_info.php");
1805 clement.si 148
		if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
2339 tom.houday 149
			include("../lib/$config[general_lib_type]/group_change.php");
324 richard 150
			include("../lib/defaults.php");
151
		}
2392 tom.houday 152
		// Disconnecting user for re-authentication
153
		$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$login.'") {print $1}'));
2349 tom.houday 154
		if (!empty($mac)) {
2392 tom.houday 155
			exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
156
			if ($login === $mac) {	// Reconnect allowed MAC
157
				exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
158
			}
2349 tom.houday 159
		}
324 richard 160
	}
161
	else{
162
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
163
			include("../lib/$config[general_lib_type]/group_info.php");
2392 tom.houday 164
		// Disconnecting all users from the selected group for re-authentication
165
		if (isset($group_members)) {
166
			foreach ($group_members as $g_member => $member) {
167
				$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
2349 tom.houday 168
				if (!empty($mac)) {
2392 tom.houday 169
					exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
170
					if ($member === $mac) {	// Reconnect allowed MAC
171
						exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
172
					}
2349 tom.houday 173
				}
1377 richard 174
			}
175
		}
324 richard 176
	}
177
}
178
else if ($badusers == 1){
179
	if (is_file("../lib/add_badusers.php"))
180
		include("../lib/add_badusers.php");
181
}
1805 clement.si 182
 
1882 raphael.pi 183
//si l'utilisateur fait parti d'un groupe, on charge les attributs du groupe, pour les afficher ensuite.
2319 tom.houday 184
if(isset($member_groups) && ($user_type != 'group')) {
185
	$group = array_values($member_groups)[0];
186
	$login_saved = $login;
187
	$login = array_values($member_groups)[0];
2339 tom.houday 188
	include("../lib/$config[general_lib_type]/group_info.php");
2319 tom.houday 189
	$login = $login_saved;
190
 
191
	foreach ($show_attrs as $key => $desc) {
1882 raphael.pi 192
		$name = $attrmap["$key"];
193
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
194
		if ($name == 'none')
195
			continue;
196
		unset($vals);
197
		unset($selected);
198
		unset($ops);
199
		$def_added = 0;
2319 tom.houday 200
		if (isset($item_vals["$key"]['count']) && $item_vals["$key"]['count']) {
1882 raphael.pi 201
			for($i=0;$i<$item_vals["$key"]['count'];$i++){
202
				$vals[] = $item_vals["$key"][$i];
203
				$ops[] = $item_vals["$key"]['operator'][$i];
204
			}
2319 tom.houday 205
		} else {
206
			if (isset($default_vals["$key"]['count']) && $default_vals["$key"]['count']) {
207
				for ($i=0;$i<$default_vals["$key"]['count'];$i++) {
1882 raphael.pi 208
					$vals[] = $default_vals["$key"][$i];
209
					$ops[] = $default_vals["$key"]['operator'][$i];
210
				}
2319 tom.houday 211
			} else {
1882 raphael.pi 212
				$vals[] = '';
213
				$ops[] = '=';
214
			}
215
			$def_added = 1;
216
		}
2319 tom.houday 217
		if ($generic == 'generic' && $def_added == 0) {
1882 raphael.pi 218
			for($i=0;$i<$default_vals["$key"]['count'];$i++){
219
				$vals[] = $default_vals["$key"][$i];
220
				$ops[] = $default_vals["$key"]['operator'][$i];
221
			}
222
		}
223
		if (isset($add) && $add && $name == $add_attr){
224
			$vals[] = $default_vals["$key"][0];
225
			$ops[] = ($default_vals["$key"]['operator'][0] != '') ? $default_vals["$key"]['operator'][0] : '=';
226
		}
227
 
228
		$i = 0;
2319 tom.houday 229
		foreach ($vals as $val) {
1882 raphael.pi 230
			$name1 = $name . $i;
231
			$val = preg_replace('/\"/','&quot;',$val);
232
			$oper_name = $name1 . '_op';
233
			$oper = $ops[$i];
234
			$selected[$oper] = 'selected';
235
			$i++;
2319 tom.houday 236
 
237
			switch ($key)
238
				{
239
				case 'Simultaneous-Use' :
240
					$grp_simuse = $val;
241
					break;
242
				case 'Login-Time' :
243
					$grp_logtime = $val;
244
					break;
245
				case 'Expiration' :
246
					$grp_exp = $val;
247
					break;
248
				case 'Max-All-Session' :
249
					$grp_maxall = $val;
250
					break;
251
				case 'Session-Timeout' :
252
					$grp_sesstim = $val;
253
					break;
254
				case 'Max-Daily-Session' :
255
					$grp_maxday = $val;
256
					break;
257
				case 'Max-Weekly-Session' :
258
					$grp_maxweek = $val;
259
					break;
260
				case 'Max-Monthly-Session' :
261
					$grp_maxmonth = $val;
262
					break;
263
				case 'ChilliSpot-Max-Input-Octets' :
264
					$grp_maxio = $val;
265
					break;
266
				case 'ChilliSpot-Max-Output-Octets' :
267
					$grp_maxoo = $val;
268
					break;
269
				case 'ChilliSpot-Max-Total-Octets' :
270
					$grp_maxto = $val;
271
					break;
272
				case 'ChilliSpot-Bandwidth-Max-Up' :
273
					$grp_bwup = $val;
274
					break;
275
				case 'ChilliSpot-Bandwidth-Max-Down' :
276
					$grp_bwdown = $val;
277
					break;
278
				case 'WISPr-Redirection-URL' :
279
					$grp_redir = $val;
280
					break;
281
				case 'Filter-Id' :
2340 tom.houday 282
					if (empty($val)) {
283
						$val = '00000000'; // Set no filters if value is not set
284
					}
285
 
2319 tom.houday 286
					if ($val[5] === '1') {
287
						$grp_filter = $l_filtering_havp_wl;
288
					} else if ($val[6] === '1') {
289
						$grp_filter = $l_filtering_havp_bl;
290
					} else if ($val[7] === '1') {
291
						$grp_filter = $l_filtering_havp;
292
					} else {
293
						$grp_filter = $l_filtering_none;
1882 raphael.pi 294
					}
1883 raphael.pi 295
 
2319 tom.houday 296
					if ($val[2] === '1') {
297
						$grp_proto = $l_proto_3;
298
					} else if ($val[1] === '1') {
299
						$grp_proto = $l_proto_2;
300
					} else if ($val[0] === '1') {
301
						$grp_proto = $l_proto_1;
302
					} else {
303
						$grp_proto = $l_proto_0;
304
					}
305
 
306
					break;
307
			}
1882 raphael.pi 308
		}
309
	}
310
 
2319 tom.houday 311
	/*on charge les attributs utilisateurs afin de montrer les groupes disponibles*/
312
	if ($user_type != 'group') {
1883 raphael.pi 313
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
314
			include("../lib/$config[general_lib_type]/user_info.php");
315
		if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
316
			$saved_login = $login;
317
			$login = '';
2339 tom.houday 318
			if (is_file("../lib/$config[general_lib_type]/group_info.php"))
319
				include("../lib/$config[general_lib_type]/group_info.php");
1883 raphael.pi 320
			$login = $saved_login;
321
		}
1882 raphael.pi 322
	}
2319 tom.houday 323
}
324 richard 324
?>
2319 tom.houday 325
   <form name="edituser" method="post" class="">
326
      <input type="hidden" name="login" value="<?= $login ?>">
327
      <input type="hidden" name="user_type" value="<?= $user_type ?>">
328
      <input type="hidden" name="change" value="0">
329
      <input type="hidden" name="add" value="0">
330
      <input type="hidden" name="badusers" value="0">
331
      <input type="hidden" name="group_change" value="0">
332
	<table border="1" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding="2" cellspacing="0" bgcolor="#ffffe0" valign="top">
324 richard 333
<?php
2319 tom.houday 334
if (($user_type !== 'group') && (isset($member_groups))) {
335
	echo <<<EOM
336
	<tr>
337
		<td colspan="$colspan"></td>
338
		<td>$l_group_desc</td>
339
		<td>$l_user_desc</td>
340
	</tr>
1883 raphael.pi 341
EOM;
342
}
2319 tom.houday 343
if ($user_type != 'group' && $config['general_show_user_password'] != 'no') {
1883 raphael.pi 344
 
2319 tom.houday 345
 
346
	echo <<<EOM
347
	<tr>
348
	<td align=right colspan="$colspan" bgcolor="#d0ddb0">
349
	$l_new_password<br>
350
	</td>
324 richard 351
EOM;
1883 raphael.pi 352
 
2319 tom.houday 353
	if(isset($member_groups)){
354
		echo <<<EOM
355
		<td bgcolor="#BEBEBE">
356
		<br/>
357
		</td>
1883 raphael.pi 358
EOM;
2319 tom.houday 359
	}
1883 raphael.pi 360
 
361
 
2319 tom.houday 362
	echo <<<EOM
363
	<td>
2339 tom.houday 364
	<input type="password" name="passwd" value="" size="20">
2319 tom.houday 365
	<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
2339 tom.houday 366
	<input type="text" value="" name="pwdgene" size="10" readonly>
2319 tom.houday 367
	</td>
368
	</tr>
324 richard 369
EOM;
370
}
1881 raphael.pi 371
 
324 richard 372
	foreach($show_attrs as $key => $desc){
373
		$name = $attrmap["$key"];
1805 clement.si 374
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
324 richard 375
		if ($name == 'none')
376
			continue;
377
		unset($vals);
378
		unset($selected);
379
		unset($ops);
380
		$def_added = 0;
1805 clement.si 381
		if (isset($item_vals["$key"]['count']) && $item_vals["$key"]['count']){
382
			for($i=0;$i<$item_vals["$key"]['count'];$i++){
324 richard 383
				$vals[] = $item_vals["$key"][$i];
1805 clement.si 384
				$ops[] = $item_vals["$key"]['operator'][$i];
324 richard 385
			}
2319 tom.houday 386
		} else {
1805 clement.si 387
			if (isset($default_vals["$key"]['count']) && $default_vals["$key"]['count']){
388
				for($i=0;$i<$default_vals["$key"]['count'];$i++){
324 richard 389
					$vals[] = $default_vals["$key"][$i];
1805 clement.si 390
					$ops[] = $default_vals["$key"]['operator'][$i];
324 richard 391
				}
392
			}
393
			else{
394
				$vals[] = '';
395
				$ops[] = '=';
396
			}
397
			$def_added = 1;
398
		}
399
		if ($generic == 'generic' && $def_added == 0){
1805 clement.si 400
			for($i=0;$i<$default_vals["$key"]['count'];$i++){
324 richard 401
				$vals[] = $default_vals["$key"][$i];
1805 clement.si 402
				$ops[] = $default_vals["$key"]['operator'][$i];
324 richard 403
			}
1805 clement.si 404
		}
405
		if (isset($add) && $add && $name == $add_attr){
324 richard 406
			$vals[] = $default_vals["$key"][0];
1805 clement.si 407
			$ops[] = ($default_vals["$key"]['operator'][0] != '') ? $default_vals["$key"]['operator'][0] : '=';
324 richard 408
		}
409
 
410
		$i = 0;
2319 tom.houday 411
		foreach($vals as $val) {
324 richard 412
			$name1 = $name . $i;
1805 clement.si 413
			$val = preg_replace('/\"/','&quot;',$val);
324 richard 414
			$oper_name = $name1 . '_op';
415
			$oper = $ops[$i];
416
			$selected[$oper] = 'selected';
417
			$i++;
2319 tom.houday 418
			switch ($key)
419
			{
420
					// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
421
				case 'Simultaneous-Use' :
422
					$advanced = false;
423
					$help_link = "help/simultaneous_use_help.html";
424
					$desc = $l_simultaneous_use;
425
					break;
426
				case 'Max-All-Session' :
427
					$advanced = false;
428
					$help_link = "help/max_all_session_help.html";
429
					$desc = $l_max_all_session;
430
					break;
431
				case 'Session-Timeout' :
432
					$advanced = true;
433
					$help_link = "help/session_timeout_help.html";
434
					$desc = $l_session_timeout;
435
					break;
436
				case 'Max-Daily-Session' :
437
					$advanced = true;
438
					$help_link = "help/session_timeout_help.html";
439
					$desc = $l_daily_timeout;
440
					break;
441
				case 'Max-Monthly-Session' :
442
					$advanced = true;
443
					$help_link = "help/session_timeout_help.html";
444
					$desc = $l_monthly_timeout;
445
					break;
446
				case 'Login-Time' :
447
					$advanced = true;
448
					$help_link = "help/login_time_help.html";
449
					$desc = $l_login_time;
450
					break;
451
				case 'Expiration' :
452
					$advanced = false;
453
					$help_link = "help/expiration_help.html";
454
					$desc = $l_expiration;
455
					break;
456
				case 'ChilliSpot-Max-Input-Octets' :
457
					$advanced = true;
458
					$help_link = "help/chillispot_max_input_octets_help.html";
459
					$desc = $l_max_input_octets;
460
					break;
461
				case 'ChilliSpot-Max-Output-Octets' :
462
					$advanced = true;
463
					$help_link = "help/chillispot_max_output_octets_help.html";
464
					$desc = $l_max_output_octets;
465
					break;
466
				case 'ChilliSpot-Max-Total-Octets' :
467
					$advanced = true;
468
					$help_link = "help/chillispot_max_total_octets_help.html";
469
					$desc = $l_max_total_octets;
470
					break;
471
				case 'ChilliSpot-Bandwidth-Max-Up' :
472
					$advanced = true;
473
					$help_link = "help/chillispot_bandwidth_max_up_help.html";
474
					$desc = $l_max_bandwidth_up;
475
					break;
476
				case 'ChilliSpot-Bandwidth-Max-Down' :
477
					$advanced = true;
478
					$help_link = "help/chillispot_bandwidth_max_down_help.html";
479
					$desc = $l_max_bandwidth_down;
480
					break;
481
				case 'WISPr-Redirection-URL' :
482
					$advanced = true;
483
					$help_link = "help/wispr_redirection_url_help.html";
484
					$desc = $l_wispr_redirection;
485
					break;
486
				case 'Filter-Id' :
487
					$advanced = false;
488
					$help_link = "help/filtering_help.html";
489
					$desc = $l_filtering;
490
					break;
491
				default:
492
					$advanced = true;
493
					break;
494
			}
495
 
496
			$advancedField = ($advanced) ? ' class="advanced-field"' : '';
497
 
498
			if ($show_ops) {
499
				print <<<EOM
500
					<tr$advancedField>
501
					<td class="etiquette">
502
					<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>
503
					</td>
324 richard 504
EOM;
1805 clement.si 505
				if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
2319 tom.houday 506
				switch ($key){
1805 clement.si 507
					case 'Simultaneous-Use' :
2319 tom.houday 508
					case 'Max-All-Session' :
509
					case 'Max-Daily-Session' :
510
					case 'Max-Weekly-Session' :
511
					case 'Max-Monthly-Session' :
512
					case 'Login-Time' :
513
					case 'Expiration' :
514
					case 'Filter-Id' :
515
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=</option></select></td>";
516
						break;
517
					case 'Session-Timeout' :
518
					case 'ChilliSpot-Max-Input-Octets' :
519
					case 'ChilliSpot-Max-Output-Octets' :
520
					case 'ChilliSpot-Max-Total-Octets' :
521
					case 'ChilliSpot-Bandwidth-Max-Up' :
522
					case 'ChilliSpot-Bandwidth-Max-Down' :
523
					case 'WISPr-Redirection-URL' :
524
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\"=\">=</option></select></td>";
525
						break;
526
					default :
527
						print <<<EOM
528
							<td>
529
								<select name=\"$oper_name\">
530
									<option $selected[$op_eq] value="=">=</option>
531
									<option $selected[$op_set] value=":=">:=</option>
532
									<option $selected[$op_add] value="+=">+=</option>
533
									<option $selected[$op_eq2] value="==">==</option>
534
									<option $selected[$op_ne] value="!=">!=</option>
535
									<option $selected[$op_gt] value=">">&gt;</option>
536
									<option $selected[$op_ge] value=">=">&gt;=</option>
537
									<option $selected[$op_lt] value="<">&lt;</option>
538
									<option $selected[$op_le] value="<=">&lt;=</option>
539
									<option $selected[$op_regeq] value="=~">=~</option>
540
									<option $selected[$op_regne] value="!~">!~</option>
541
									<option $selected[$op_exst] value="=*">=*</option>
542
									<option $selected[$op_nexst] value="!*">!*</option>
543
								</select>
544
							</td>
545
EOM;
546
						break;
547
				}
548
			} else {
549
				print <<<EOM
550
					<tr$advancedField>
551
					<td class="etiquette" colspan="$colspan">
552
					<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>
553
EOM;
554
				switch ($key) {
555
					case 'Simultaneous-Use' :
556
					case 'Max-All-Session' :
557
					case 'Max-Daily-Session' :
558
					case 'Max-Weekly-Session' :
559
					case 'Max-Monthly-Session' :
1805 clement.si 560
					case 'Login-Time' :
2319 tom.houday 561
					case 'Expiration' :
562
					case 'Filter-Id' :
563
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
564
						break;
565
					case 'Session-Timeout' :
566
					case 'ChilliSpot-Max-Input-Octets' :
567
					case 'ChilliSpot-Max-Output-Octets' :
568
					case 'ChilliSpot-Max-Total-Octets' :
569
					case 'ChilliSpot-Bandwidth-Max-Up' :
570
					case 'ChilliSpot-Bandwidth-Max-Down' :
571
					case 'WISPr-Redirection-URL' :
572
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\"=\">";
573
						break;
574
					default :
575
						print <<<EOM
576
							<select name=\"$oper_name\">
577
								<option $selected[$op_eq] value="=">=</option>
578
								<option $selected[$op_set] value=":=">:=</option>
579
								<option $selected[$op_add] value="+=">+=</option>
580
								<option $selected[$op_eq2] value="==">==</option>
581
								<option $selected[$op_ne] value="!=">!=</option>
582
								<option $selected[$op_gt] value=">">&gt;</option>
583
								<option $selected[$op_ge] value=">=">&gt;=</option>
584
								<option $selected[$op_lt] value="<">&lt;</option>
585
								<option $selected[$op_le] value="<=">&lt;=</option>
586
								<option $selected[$op_regeq] value="=~">=~</option>
587
								<option $selected[$op_regne] value="!~">!~</option>
588
								<option $selected[$op_exst] value="=*">=*</option>
589
								<option $selected[$op_nexst] value="!*">!*</option>
590
							</select>
591
EOM;
592
						break;
593
				}
594
				echo '</td>';
595
			}
596
 
597
			if (isset($member_groups) && $user_type !== 'group') {
598
				echo '<td bgcolor="#BEBEBE">';
2341 tom.houday 599
				switch ($key){
2319 tom.houday 600
					case 'Simultaneous-Use' :
601
						echo "$grp_simuse";
602
						break;
603
					case 'Login-Time' :
604
						echo "$grp_logtime";
605
						break;
324 richard 606
					case 'Expiration' :
2319 tom.houday 607
						echo "$grp_exp";
324 richard 608
						break;
886 stephane 609
					case 'Max-All-Session' :
2319 tom.houday 610
						echo "$grp_maxall";
886 stephane 611
						break;
324 richard 612
					case 'Session-Timeout' :
2319 tom.houday 613
						echo "$grp_sesstim";
324 richard 614
						break;
615
					case 'Max-Daily-Session' :
2319 tom.houday 616
						echo "$grp_maxday";
324 richard 617
						break;
618
					case 'Max-Weekly-Session' :
2319 tom.houday 619
						echo "$grp_maxweek";
324 richard 620
						break;
621
					case 'Max-Monthly-Session' :
2319 tom.houday 622
						echo "$grp_maxmonth";
324 richard 623
						break;
624
					case 'ChilliSpot-Max-Input-Octets' :
2319 tom.houday 625
						echo "$grp_maxio";
324 richard 626
						break;
627
					case 'ChilliSpot-Max-Output-Octets' :
2319 tom.houday 628
						echo "$grp_maxoo";
324 richard 629
						break;
630
					case 'ChilliSpot-Max-Total-Octets' :
2319 tom.houday 631
						echo "$grp_maxto";
324 richard 632
						break;
633
					case 'ChilliSpot-Bandwidth-Max-Up' :
2319 tom.houday 634
						echo "$grp_bwup";
324 richard 635
						break;
636
					case 'ChilliSpot-Bandwidth-Max-Down' :
2319 tom.houday 637
						echo "$grp_bwdown";
324 richard 638
						break;
639
					case 'WISPr-Redirection-URL' :
2319 tom.houday 640
						echo "$grp_redir";
324 richard 641
						break;
1377 richard 642
					case 'Filter-Id' :
2319 tom.houday 643
						echo "$grp_filter";
1377 richard 644
						break;
324 richard 645
					default :
646
						break;
2319 tom.houday 647
				}
648
				echo '</td>';
649
			}
650
 
651
			echo '<td>';
2341 tom.houday 652
			switch ($key) {
2319 tom.houday 653
				/*
654
				Choix de l'unité jour, heures, minutes ou secondes
655
				pour les durées limites max, de session,de journée et de mois
656
				*/
657
				case 'Session-Timeout' :
658
				case 'Max-Daily-Session' :
659
					/*valeur d'origine de durée limite */
2341 tom.houday 660
					echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
2319 tom.houday 661
					/* Choix d'unité*/
2341 tom.houday 662
					echo" <select onchange=\"temps(this,'$name1','edituser')\">
2319 tom.houday 663
							<option value=\"s\" selected>s</option>
664
							<option value=\"m\" >m</option>
665
							<option value=\"H\" >H</option>
666
						</select>";
667
					break;
668
				case 'Max-Monthly-Session' :
669
				case 'Max-All-Session' :
670
					/*valeur d'origine de durée limite */
2341 tom.houday 671
					echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
2319 tom.houday 672
					/* Choix d'unité*/
2341 tom.houday 673
					echo" <select onchange=\"temps(this,'$name1','edituser')\">
2319 tom.houday 674
							<option value=\"s\" selected>s</option>
675
							<option value=\"m\" >m</option>
676
							<option value=\"H\" >H</option>
677
							<option value=\"J\" >J</option>
678
						</select>";
679
					break;
680
				case 'Expiration' :
681
					/*Ajout du calendrier pour choisir la date*/
2341 tom.houday 682
					echo"<input id=\"popup_container\" type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
2319 tom.houday 683
					break;
684
				case 'Filter-Id' :
2340 tom.houday 685
					if (empty($val)) {
686
						$val = '00000000'; // Set no filters if value is not set
687
					}
688
 
2319 tom.houday 689
					if ($val[5] === '1') {
690
						$selected = 'havp_wl';
691
					} else if ($val[6] === '1') {
692
						$selected = 'havp_bl';
693
					} else if ($val[7] === '1') {
694
						$selected = 'havp';
695
					} else {
696
						$selected = 'not_filtered';
324 richard 697
					}
2341 tom.houday 698
					echo "<select name=\"$name1\">";
699
					echo "<option value=\"00000000\"".(($selected === 'not_filtered') ? ' selected' : '').">$l_filtering_none</option>";
2319 tom.houday 700
					echo "<option value=\"00000001\"".(($selected === 'havp') ? ' selected' : '').">$l_filtering_havp</option>";
701
					echo "<option value=\"00000011\"".(($selected === 'havp_bl') ? ' selected' : '').">$l_filtering_havp_bl</option>";
702
					echo "<option value=\"00000101\"".(($selected === 'havp_wl') ? ' selected' : '').">$l_filtering_havp_wl</option>";
703
					echo "</select>";
704
					break;
705
				default :
2341 tom.houday 706
					echo "<input type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
2319 tom.houday 707
					break;
708
			}
709
			echo '</td>';
324 richard 710
		}
711
	}
2006 raphael.pi 712
 
713
/*protocole filter*/
714
print <<<EOM
715
<tr>
2319 tom.houday 716
<td class="etiquette" colspan="$colspan">
717
	<a href="help/protocols_help.html" target=help onclick="window.open('help/protocols_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_proto</font></a>
2006 raphael.pi 718
</td>
719
EOM;
2319 tom.houday 720
if(isset($member_groups) && $user_type != 'group') {
721
	echo "<td bgcolor=\"#BEBEBE\">$grp_proto</td>";
2006 raphael.pi 722
}
2319 tom.houday 723
 
724
if ($val[2] === '1') {
725
	$selected = 'proto_3';
726
} else if ($val[1] === '1') {
727
	$selected = 'proto_2';
728
} else if ($val[0] === '1') {
729
	$selected = 'proto_1';
730
} else {
731
	$selected = 'proto_0';
732
}
2006 raphael.pi 733
echo "<td width=20>";
2319 tom.houday 734
echo "<select name='Filter-Proto'>
735
	<option value=\"00000000\"".(($selected === 'proto_0') ? ' selected' : '').">$l_proto_0</option>
736
	<option value=\"10000000\"".(($selected === 'proto_1') ? ' selected' : '').">$l_proto_1</option>
737
	<option value=\"01000000\"".(($selected === 'proto_2') ? ' selected' : '').">$l_proto_2</option>
738
	<option value=\"00100000\"".(($selected === 'proto_3') ? ' selected' : '').">$l_proto_3</option>
2006 raphael.pi 739
	</select></td>
2319 tom.houday 740
</tr>";
2006 raphael.pi 741
 
742
 
2319 tom.houday 743
if ($user_type != 'group') {
324 richard 744
	echo <<<EOM
2319 tom.houday 745
	<tr>
746
	<td align=right colspan="$colspan" bgcolor="#d0ddb0">
747
	$l_group_member<br><font size=-2><i>($l_main_group)</i></font>
748
	</td>
324 richard 749
EOM;
2319 tom.houday 750
if (isset($member_groups)) {
751
	echo '<td colspan="2">';
752
} else {
753
	echo '<td>';
754
}
1831 raphael.pi 755
 
756
 
1838 raphael.pi 757
	if (isset($existing_groups)){
2319 tom.houday 758
		echo '<select size="5" name="edited_groups[]"  OnChange="this.form.group_change.value=1">';
759
		if ($config['sql_show_all_groups'] == 'true') {
760
			foreach ($existing_groups as $group => $count) {
761
				if (isset($member_groups[$group]) && ($member_groups[$group] == $group))
762
					echo "<option selected value=\"$group\">$group\n";
763
				else if(isset($member_groups[0]) && ($member_groups[0] == $group))
764
					echo "<option selected value=\"$group\">$group\n";
765
				else
766
					echo "<option value=\"$group\">$group\n";
767
			}
768
		} else {
769
			foreach ($member_groups as $group)
324 richard 770
				echo "<option value=\"$group\">$group\n";
771
		}
2319 tom.houday 772
		echo "</select>";
324 richard 773
	}
774
	else{
2319 tom.houday 775
		echo "<i>$l_no_group</i>";
324 richard 776
	}
2319 tom.houday 777
 
778
	echo "</td></tr>";
1805 clement.si 779
}
324 richard 780
echo "</table><br>";
910 richard 781
echo "<input type=submit class=button value=$l_change OnClick=\"this.form.change.value=1\">";
2319 tom.houday 782
echo "<button type=\"button\" id =\"show-advanced-fields\" onclick=\"showAdvancedFields(true)\" style=\"float: right;\">$l_simple_menu</button>";
783
echo "<button type=\"button\" id =\"hide-advanced-fields\" onclick=\"showAdvancedFields(false)\" style=\"float: right; display: none;\">$l_advanced_menu</button>";
324 richard 784
//if ($user_type != 'group'){
785
//	echo <<<EOM
786
//<br><br>
787
//<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
788
//<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">&lt;--Help</font></a>
789
//EOM;
790
//}
791
?>
792
</form>
793
</td></tr>
794
</table>
2319 tom.houday 795
</td></tr>
324 richard 796
</table>
2319 tom.houday 797
</center>
324 richard 798
</td></tr>
799
</TABLE>
800
</body>
801
</html>