Subversion Repositories ALCASAR

Rev

Rev 2341 | Rev 2392 | 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 2349 2017-07-22 12:20:21Z 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
		}
1377 richard 152
		# Disconnecting user for re-authentication
2349 tom.houday 153
		$mac = exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg(" $login ")." | awk '{print $1}'");
154
		if (!empty($mac)) {
155
			exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($mac));
156
		}
324 richard 157
	}
158
	else{
159
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
160
			include("../lib/$config[general_lib_type]/group_info.php");
1377 richard 161
		# Disconnecting all users from the selected group for re-authentication
162
		if (isset($group_members)){
163
			foreach ($group_members as $g_member => $member){
2349 tom.houday 164
				$mac = exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg(" $member ")." | awk '{print $1}'");
165
				if (!empty($mac)) {
166
					exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($mac));
167
				}
1377 richard 168
			}
169
		}
324 richard 170
	}
171
}
172
else if ($badusers == 1){
173
	if (is_file("../lib/add_badusers.php"))
174
		include("../lib/add_badusers.php");
175
}
1805 clement.si 176
 
1882 raphael.pi 177
//si l'utilisateur fait parti d'un groupe, on charge les attributs du groupe, pour les afficher ensuite.
2319 tom.houday 178
if(isset($member_groups) && ($user_type != 'group')) {
179
	$group = array_values($member_groups)[0];
180
	$login_saved = $login;
181
	$login = array_values($member_groups)[0];
2339 tom.houday 182
	include("../lib/$config[general_lib_type]/group_info.php");
2319 tom.houday 183
	$login = $login_saved;
184
 
185
	foreach ($show_attrs as $key => $desc) {
1882 raphael.pi 186
		$name = $attrmap["$key"];
187
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
188
		if ($name == 'none')
189
			continue;
190
		unset($vals);
191
		unset($selected);
192
		unset($ops);
193
		$def_added = 0;
2319 tom.houday 194
		if (isset($item_vals["$key"]['count']) && $item_vals["$key"]['count']) {
1882 raphael.pi 195
			for($i=0;$i<$item_vals["$key"]['count'];$i++){
196
				$vals[] = $item_vals["$key"][$i];
197
				$ops[] = $item_vals["$key"]['operator'][$i];
198
			}
2319 tom.houday 199
		} else {
200
			if (isset($default_vals["$key"]['count']) && $default_vals["$key"]['count']) {
201
				for ($i=0;$i<$default_vals["$key"]['count'];$i++) {
1882 raphael.pi 202
					$vals[] = $default_vals["$key"][$i];
203
					$ops[] = $default_vals["$key"]['operator'][$i];
204
				}
2319 tom.houday 205
			} else {
1882 raphael.pi 206
				$vals[] = '';
207
				$ops[] = '=';
208
			}
209
			$def_added = 1;
210
		}
2319 tom.houday 211
		if ($generic == 'generic' && $def_added == 0) {
1882 raphael.pi 212
			for($i=0;$i<$default_vals["$key"]['count'];$i++){
213
				$vals[] = $default_vals["$key"][$i];
214
				$ops[] = $default_vals["$key"]['operator'][$i];
215
			}
216
		}
217
		if (isset($add) && $add && $name == $add_attr){
218
			$vals[] = $default_vals["$key"][0];
219
			$ops[] = ($default_vals["$key"]['operator'][0] != '') ? $default_vals["$key"]['operator'][0] : '=';
220
		}
221
 
222
		$i = 0;
2319 tom.houday 223
		foreach ($vals as $val) {
1882 raphael.pi 224
			$name1 = $name . $i;
225
			$val = preg_replace('/\"/','&quot;',$val);
226
			$oper_name = $name1 . '_op';
227
			$oper = $ops[$i];
228
			$selected[$oper] = 'selected';
229
			$i++;
2319 tom.houday 230
 
231
			switch ($key)
232
				{
233
				case 'Simultaneous-Use' :
234
					$grp_simuse = $val;
235
					break;
236
				case 'Login-Time' :
237
					$grp_logtime = $val;
238
					break;
239
				case 'Expiration' :
240
					$grp_exp = $val;
241
					break;
242
				case 'Max-All-Session' :
243
					$grp_maxall = $val;
244
					break;
245
				case 'Session-Timeout' :
246
					$grp_sesstim = $val;
247
					break;
248
				case 'Max-Daily-Session' :
249
					$grp_maxday = $val;
250
					break;
251
				case 'Max-Weekly-Session' :
252
					$grp_maxweek = $val;
253
					break;
254
				case 'Max-Monthly-Session' :
255
					$grp_maxmonth = $val;
256
					break;
257
				case 'ChilliSpot-Max-Input-Octets' :
258
					$grp_maxio = $val;
259
					break;
260
				case 'ChilliSpot-Max-Output-Octets' :
261
					$grp_maxoo = $val;
262
					break;
263
				case 'ChilliSpot-Max-Total-Octets' :
264
					$grp_maxto = $val;
265
					break;
266
				case 'ChilliSpot-Bandwidth-Max-Up' :
267
					$grp_bwup = $val;
268
					break;
269
				case 'ChilliSpot-Bandwidth-Max-Down' :
270
					$grp_bwdown = $val;
271
					break;
272
				case 'WISPr-Redirection-URL' :
273
					$grp_redir = $val;
274
					break;
275
				case 'Filter-Id' :
2340 tom.houday 276
					if (empty($val)) {
277
						$val = '00000000'; // Set no filters if value is not set
278
					}
279
 
2319 tom.houday 280
					if ($val[5] === '1') {
281
						$grp_filter = $l_filtering_havp_wl;
282
					} else if ($val[6] === '1') {
283
						$grp_filter = $l_filtering_havp_bl;
284
					} else if ($val[7] === '1') {
285
						$grp_filter = $l_filtering_havp;
286
					} else {
287
						$grp_filter = $l_filtering_none;
1882 raphael.pi 288
					}
1883 raphael.pi 289
 
2319 tom.houday 290
					if ($val[2] === '1') {
291
						$grp_proto = $l_proto_3;
292
					} else if ($val[1] === '1') {
293
						$grp_proto = $l_proto_2;
294
					} else if ($val[0] === '1') {
295
						$grp_proto = $l_proto_1;
296
					} else {
297
						$grp_proto = $l_proto_0;
298
					}
299
 
300
					break;
301
			}
1882 raphael.pi 302
		}
303
	}
304
 
2319 tom.houday 305
	/*on charge les attributs utilisateurs afin de montrer les groupes disponibles*/
306
	if ($user_type != 'group') {
1883 raphael.pi 307
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
308
			include("../lib/$config[general_lib_type]/user_info.php");
309
		if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
310
			$saved_login = $login;
311
			$login = '';
2339 tom.houday 312
			if (is_file("../lib/$config[general_lib_type]/group_info.php"))
313
				include("../lib/$config[general_lib_type]/group_info.php");
1883 raphael.pi 314
			$login = $saved_login;
315
		}
1882 raphael.pi 316
	}
2319 tom.houday 317
}
324 richard 318
?>
2319 tom.houday 319
   <form name="edituser" method="post" class="">
320
      <input type="hidden" name="login" value="<?= $login ?>">
321
      <input type="hidden" name="user_type" value="<?= $user_type ?>">
322
      <input type="hidden" name="change" value="0">
323
      <input type="hidden" name="add" value="0">
324
      <input type="hidden" name="badusers" value="0">
325
      <input type="hidden" name="group_change" value="0">
326
	<table border="1" bordercolordark="#ffffe0" bordercolorlight="#000000" width="100%" cellpadding="2" cellspacing="0" bgcolor="#ffffe0" valign="top">
324 richard 327
<?php
2319 tom.houday 328
if (($user_type !== 'group') && (isset($member_groups))) {
329
	echo <<<EOM
330
	<tr>
331
		<td colspan="$colspan"></td>
332
		<td>$l_group_desc</td>
333
		<td>$l_user_desc</td>
334
	</tr>
1883 raphael.pi 335
EOM;
336
}
2319 tom.houday 337
if ($user_type != 'group' && $config['general_show_user_password'] != 'no') {
1883 raphael.pi 338
 
2319 tom.houday 339
 
340
	echo <<<EOM
341
	<tr>
342
	<td align=right colspan="$colspan" bgcolor="#d0ddb0">
343
	$l_new_password<br>
344
	</td>
324 richard 345
EOM;
1883 raphael.pi 346
 
2319 tom.houday 347
	if(isset($member_groups)){
348
		echo <<<EOM
349
		<td bgcolor="#BEBEBE">
350
		<br/>
351
		</td>
1883 raphael.pi 352
EOM;
2319 tom.houday 353
	}
1883 raphael.pi 354
 
355
 
2319 tom.houday 356
	echo <<<EOM
357
	<td>
2339 tom.houday 358
	<input type="password" name="passwd" value="" size="20">
2319 tom.houday 359
	<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
2339 tom.houday 360
	<input type="text" value="" name="pwdgene" size="10" readonly>
2319 tom.houday 361
	</td>
362
	</tr>
324 richard 363
EOM;
364
}
1881 raphael.pi 365
 
324 richard 366
	foreach($show_attrs as $key => $desc){
367
		$name = $attrmap["$key"];
1805 clement.si 368
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
324 richard 369
		if ($name == 'none')
370
			continue;
371
		unset($vals);
372
		unset($selected);
373
		unset($ops);
374
		$def_added = 0;
1805 clement.si 375
		if (isset($item_vals["$key"]['count']) && $item_vals["$key"]['count']){
376
			for($i=0;$i<$item_vals["$key"]['count'];$i++){
324 richard 377
				$vals[] = $item_vals["$key"][$i];
1805 clement.si 378
				$ops[] = $item_vals["$key"]['operator'][$i];
324 richard 379
			}
2319 tom.houday 380
		} else {
1805 clement.si 381
			if (isset($default_vals["$key"]['count']) && $default_vals["$key"]['count']){
382
				for($i=0;$i<$default_vals["$key"]['count'];$i++){
324 richard 383
					$vals[] = $default_vals["$key"][$i];
1805 clement.si 384
					$ops[] = $default_vals["$key"]['operator'][$i];
324 richard 385
				}
386
			}
387
			else{
388
				$vals[] = '';
389
				$ops[] = '=';
390
			}
391
			$def_added = 1;
392
		}
393
		if ($generic == 'generic' && $def_added == 0){
1805 clement.si 394
			for($i=0;$i<$default_vals["$key"]['count'];$i++){
324 richard 395
				$vals[] = $default_vals["$key"][$i];
1805 clement.si 396
				$ops[] = $default_vals["$key"]['operator'][$i];
324 richard 397
			}
1805 clement.si 398
		}
399
		if (isset($add) && $add && $name == $add_attr){
324 richard 400
			$vals[] = $default_vals["$key"][0];
1805 clement.si 401
			$ops[] = ($default_vals["$key"]['operator'][0] != '') ? $default_vals["$key"]['operator'][0] : '=';
324 richard 402
		}
403
 
404
		$i = 0;
2319 tom.houday 405
		foreach($vals as $val) {
324 richard 406
			$name1 = $name . $i;
1805 clement.si 407
			$val = preg_replace('/\"/','&quot;',$val);
324 richard 408
			$oper_name = $name1 . '_op';
409
			$oper = $ops[$i];
410
			$selected[$oper] = 'selected';
411
			$i++;
2319 tom.houday 412
			switch ($key)
413
			{
414
					// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
415
				case 'Simultaneous-Use' :
416
					$advanced = false;
417
					$help_link = "help/simultaneous_use_help.html";
418
					$desc = $l_simultaneous_use;
419
					break;
420
				case 'Max-All-Session' :
421
					$advanced = false;
422
					$help_link = "help/max_all_session_help.html";
423
					$desc = $l_max_all_session;
424
					break;
425
				case 'Session-Timeout' :
426
					$advanced = true;
427
					$help_link = "help/session_timeout_help.html";
428
					$desc = $l_session_timeout;
429
					break;
430
				case 'Max-Daily-Session' :
431
					$advanced = true;
432
					$help_link = "help/session_timeout_help.html";
433
					$desc = $l_daily_timeout;
434
					break;
435
				case 'Max-Monthly-Session' :
436
					$advanced = true;
437
					$help_link = "help/session_timeout_help.html";
438
					$desc = $l_monthly_timeout;
439
					break;
440
				case 'Login-Time' :
441
					$advanced = true;
442
					$help_link = "help/login_time_help.html";
443
					$desc = $l_login_time;
444
					break;
445
				case 'Expiration' :
446
					$advanced = false;
447
					$help_link = "help/expiration_help.html";
448
					$desc = $l_expiration;
449
					break;
450
				case 'ChilliSpot-Max-Input-Octets' :
451
					$advanced = true;
452
					$help_link = "help/chillispot_max_input_octets_help.html";
453
					$desc = $l_max_input_octets;
454
					break;
455
				case 'ChilliSpot-Max-Output-Octets' :
456
					$advanced = true;
457
					$help_link = "help/chillispot_max_output_octets_help.html";
458
					$desc = $l_max_output_octets;
459
					break;
460
				case 'ChilliSpot-Max-Total-Octets' :
461
					$advanced = true;
462
					$help_link = "help/chillispot_max_total_octets_help.html";
463
					$desc = $l_max_total_octets;
464
					break;
465
				case 'ChilliSpot-Bandwidth-Max-Up' :
466
					$advanced = true;
467
					$help_link = "help/chillispot_bandwidth_max_up_help.html";
468
					$desc = $l_max_bandwidth_up;
469
					break;
470
				case 'ChilliSpot-Bandwidth-Max-Down' :
471
					$advanced = true;
472
					$help_link = "help/chillispot_bandwidth_max_down_help.html";
473
					$desc = $l_max_bandwidth_down;
474
					break;
475
				case 'WISPr-Redirection-URL' :
476
					$advanced = true;
477
					$help_link = "help/wispr_redirection_url_help.html";
478
					$desc = $l_wispr_redirection;
479
					break;
480
				case 'Filter-Id' :
481
					$advanced = false;
482
					$help_link = "help/filtering_help.html";
483
					$desc = $l_filtering;
484
					break;
485
				default:
486
					$advanced = true;
487
					break;
488
			}
489
 
490
			$advancedField = ($advanced) ? ' class="advanced-field"' : '';
491
 
492
			if ($show_ops) {
493
				print <<<EOM
494
					<tr$advancedField>
495
					<td class="etiquette">
496
					<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>
497
					</td>
324 richard 498
EOM;
1805 clement.si 499
				if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
2319 tom.houday 500
				switch ($key){
1805 clement.si 501
					case 'Simultaneous-Use' :
2319 tom.houday 502
					case 'Max-All-Session' :
503
					case 'Max-Daily-Session' :
504
					case 'Max-Weekly-Session' :
505
					case 'Max-Monthly-Session' :
506
					case 'Login-Time' :
507
					case 'Expiration' :
508
					case 'Filter-Id' :
509
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=</option></select></td>";
510
						break;
511
					case 'Session-Timeout' :
512
					case 'ChilliSpot-Max-Input-Octets' :
513
					case 'ChilliSpot-Max-Output-Octets' :
514
					case 'ChilliSpot-Max-Total-Octets' :
515
					case 'ChilliSpot-Bandwidth-Max-Up' :
516
					case 'ChilliSpot-Bandwidth-Max-Down' :
517
					case 'WISPr-Redirection-URL' :
518
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\"=\">=</option></select></td>";
519
						break;
520
					default :
521
						print <<<EOM
522
							<td>
523
								<select name=\"$oper_name\">
524
									<option $selected[$op_eq] value="=">=</option>
525
									<option $selected[$op_set] value=":=">:=</option>
526
									<option $selected[$op_add] value="+=">+=</option>
527
									<option $selected[$op_eq2] value="==">==</option>
528
									<option $selected[$op_ne] value="!=">!=</option>
529
									<option $selected[$op_gt] value=">">&gt;</option>
530
									<option $selected[$op_ge] value=">=">&gt;=</option>
531
									<option $selected[$op_lt] value="<">&lt;</option>
532
									<option $selected[$op_le] value="<=">&lt;=</option>
533
									<option $selected[$op_regeq] value="=~">=~</option>
534
									<option $selected[$op_regne] value="!~">!~</option>
535
									<option $selected[$op_exst] value="=*">=*</option>
536
									<option $selected[$op_nexst] value="!*">!*</option>
537
								</select>
538
							</td>
539
EOM;
540
						break;
541
				}
542
			} else {
543
				print <<<EOM
544
					<tr$advancedField>
545
					<td class="etiquette" colspan="$colspan">
546
					<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>
547
EOM;
548
				switch ($key) {
549
					case 'Simultaneous-Use' :
550
					case 'Max-All-Session' :
551
					case 'Max-Daily-Session' :
552
					case 'Max-Weekly-Session' :
553
					case 'Max-Monthly-Session' :
1805 clement.si 554
					case 'Login-Time' :
2319 tom.houday 555
					case 'Expiration' :
556
					case 'Filter-Id' :
557
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
558
						break;
559
					case 'Session-Timeout' :
560
					case 'ChilliSpot-Max-Input-Octets' :
561
					case 'ChilliSpot-Max-Output-Octets' :
562
					case 'ChilliSpot-Max-Total-Octets' :
563
					case 'ChilliSpot-Bandwidth-Max-Up' :
564
					case 'ChilliSpot-Bandwidth-Max-Down' :
565
					case 'WISPr-Redirection-URL' :
566
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\"=\">";
567
						break;
568
					default :
569
						print <<<EOM
570
							<select name=\"$oper_name\">
571
								<option $selected[$op_eq] value="=">=</option>
572
								<option $selected[$op_set] value=":=">:=</option>
573
								<option $selected[$op_add] value="+=">+=</option>
574
								<option $selected[$op_eq2] value="==">==</option>
575
								<option $selected[$op_ne] value="!=">!=</option>
576
								<option $selected[$op_gt] value=">">&gt;</option>
577
								<option $selected[$op_ge] value=">=">&gt;=</option>
578
								<option $selected[$op_lt] value="<">&lt;</option>
579
								<option $selected[$op_le] value="<=">&lt;=</option>
580
								<option $selected[$op_regeq] value="=~">=~</option>
581
								<option $selected[$op_regne] value="!~">!~</option>
582
								<option $selected[$op_exst] value="=*">=*</option>
583
								<option $selected[$op_nexst] value="!*">!*</option>
584
							</select>
585
EOM;
586
						break;
587
				}
588
				echo '</td>';
589
			}
590
 
591
			if (isset($member_groups) && $user_type !== 'group') {
592
				echo '<td bgcolor="#BEBEBE">';
2341 tom.houday 593
				switch ($key){
2319 tom.houday 594
					case 'Simultaneous-Use' :
595
						echo "$grp_simuse";
596
						break;
597
					case 'Login-Time' :
598
						echo "$grp_logtime";
599
						break;
324 richard 600
					case 'Expiration' :
2319 tom.houday 601
						echo "$grp_exp";
324 richard 602
						break;
886 stephane 603
					case 'Max-All-Session' :
2319 tom.houday 604
						echo "$grp_maxall";
886 stephane 605
						break;
324 richard 606
					case 'Session-Timeout' :
2319 tom.houday 607
						echo "$grp_sesstim";
324 richard 608
						break;
609
					case 'Max-Daily-Session' :
2319 tom.houday 610
						echo "$grp_maxday";
324 richard 611
						break;
612
					case 'Max-Weekly-Session' :
2319 tom.houday 613
						echo "$grp_maxweek";
324 richard 614
						break;
615
					case 'Max-Monthly-Session' :
2319 tom.houday 616
						echo "$grp_maxmonth";
324 richard 617
						break;
618
					case 'ChilliSpot-Max-Input-Octets' :
2319 tom.houday 619
						echo "$grp_maxio";
324 richard 620
						break;
621
					case 'ChilliSpot-Max-Output-Octets' :
2319 tom.houday 622
						echo "$grp_maxoo";
324 richard 623
						break;
624
					case 'ChilliSpot-Max-Total-Octets' :
2319 tom.houday 625
						echo "$grp_maxto";
324 richard 626
						break;
627
					case 'ChilliSpot-Bandwidth-Max-Up' :
2319 tom.houday 628
						echo "$grp_bwup";
324 richard 629
						break;
630
					case 'ChilliSpot-Bandwidth-Max-Down' :
2319 tom.houday 631
						echo "$grp_bwdown";
324 richard 632
						break;
633
					case 'WISPr-Redirection-URL' :
2319 tom.houday 634
						echo "$grp_redir";
324 richard 635
						break;
1377 richard 636
					case 'Filter-Id' :
2319 tom.houday 637
						echo "$grp_filter";
1377 richard 638
						break;
324 richard 639
					default :
640
						break;
2319 tom.houday 641
				}
642
				echo '</td>';
643
			}
644
 
645
			echo '<td>';
2341 tom.houday 646
			switch ($key) {
2319 tom.houday 647
				/*
648
				Choix de l'unité jour, heures, minutes ou secondes
649
				pour les durées limites max, de session,de journée et de mois
650
				*/
651
				case 'Session-Timeout' :
652
				case 'Max-Daily-Session' :
653
					/*valeur d'origine de durée limite */
2341 tom.houday 654
					echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
2319 tom.houday 655
					/* Choix d'unité*/
2341 tom.houday 656
					echo" <select onchange=\"temps(this,'$name1','edituser')\">
2319 tom.houday 657
							<option value=\"s\" selected>s</option>
658
							<option value=\"m\" >m</option>
659
							<option value=\"H\" >H</option>
660
						</select>";
661
					break;
662
				case 'Max-Monthly-Session' :
663
				case 'Max-All-Session' :
664
					/*valeur d'origine de durée limite */
2341 tom.houday 665
					echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
2319 tom.houday 666
					/* Choix d'unité*/
2341 tom.houday 667
					echo" <select onchange=\"temps(this,'$name1','edituser')\">
2319 tom.houday 668
							<option value=\"s\" selected>s</option>
669
							<option value=\"m\" >m</option>
670
							<option value=\"H\" >H</option>
671
							<option value=\"J\" >J</option>
672
						</select>";
673
					break;
674
				case 'Expiration' :
675
					/*Ajout du calendrier pour choisir la date*/
2341 tom.houday 676
					echo"<input id=\"popup_container\" type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
2319 tom.houday 677
					break;
678
				case 'Filter-Id' :
2340 tom.houday 679
					if (empty($val)) {
680
						$val = '00000000'; // Set no filters if value is not set
681
					}
682
 
2319 tom.houday 683
					if ($val[5] === '1') {
684
						$selected = 'havp_wl';
685
					} else if ($val[6] === '1') {
686
						$selected = 'havp_bl';
687
					} else if ($val[7] === '1') {
688
						$selected = 'havp';
689
					} else {
690
						$selected = 'not_filtered';
324 richard 691
					}
2341 tom.houday 692
					echo "<select name=\"$name1\">";
693
					echo "<option value=\"00000000\"".(($selected === 'not_filtered') ? ' selected' : '').">$l_filtering_none</option>";
2319 tom.houday 694
					echo "<option value=\"00000001\"".(($selected === 'havp') ? ' selected' : '').">$l_filtering_havp</option>";
695
					echo "<option value=\"00000011\"".(($selected === 'havp_bl') ? ' selected' : '').">$l_filtering_havp_bl</option>";
696
					echo "<option value=\"00000101\"".(($selected === 'havp_wl') ? ' selected' : '').">$l_filtering_havp_wl</option>";
697
					echo "</select>";
698
					break;
699
				default :
2341 tom.houday 700
					echo "<input type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
2319 tom.houday 701
					break;
702
			}
703
			echo '</td>';
324 richard 704
		}
705
	}
2006 raphael.pi 706
 
707
/*protocole filter*/
708
print <<<EOM
709
<tr>
2319 tom.houday 710
<td class="etiquette" colspan="$colspan">
711
	<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 712
</td>
713
EOM;
2319 tom.houday 714
if(isset($member_groups) && $user_type != 'group') {
715
	echo "<td bgcolor=\"#BEBEBE\">$grp_proto</td>";
2006 raphael.pi 716
}
2319 tom.houday 717
 
718
if ($val[2] === '1') {
719
	$selected = 'proto_3';
720
} else if ($val[1] === '1') {
721
	$selected = 'proto_2';
722
} else if ($val[0] === '1') {
723
	$selected = 'proto_1';
724
} else {
725
	$selected = 'proto_0';
726
}
2006 raphael.pi 727
echo "<td width=20>";
2319 tom.houday 728
echo "<select name='Filter-Proto'>
729
	<option value=\"00000000\"".(($selected === 'proto_0') ? ' selected' : '').">$l_proto_0</option>
730
	<option value=\"10000000\"".(($selected === 'proto_1') ? ' selected' : '').">$l_proto_1</option>
731
	<option value=\"01000000\"".(($selected === 'proto_2') ? ' selected' : '').">$l_proto_2</option>
732
	<option value=\"00100000\"".(($selected === 'proto_3') ? ' selected' : '').">$l_proto_3</option>
2006 raphael.pi 733
	</select></td>
2319 tom.houday 734
</tr>";
2006 raphael.pi 735
 
736
 
2319 tom.houday 737
if ($user_type != 'group') {
324 richard 738
	echo <<<EOM
2319 tom.houday 739
	<tr>
740
	<td align=right colspan="$colspan" bgcolor="#d0ddb0">
741
	$l_group_member<br><font size=-2><i>($l_main_group)</i></font>
742
	</td>
324 richard 743
EOM;
2319 tom.houday 744
if (isset($member_groups)) {
745
	echo '<td colspan="2">';
746
} else {
747
	echo '<td>';
748
}
1831 raphael.pi 749
 
750
 
1838 raphael.pi 751
	if (isset($existing_groups)){
2319 tom.houday 752
		echo '<select size="5" name="edited_groups[]"  OnChange="this.form.group_change.value=1">';
753
		if ($config['sql_show_all_groups'] == 'true') {
754
			foreach ($existing_groups as $group => $count) {
755
				if (isset($member_groups[$group]) && ($member_groups[$group] == $group))
756
					echo "<option selected value=\"$group\">$group\n";
757
				else if(isset($member_groups[0]) && ($member_groups[0] == $group))
758
					echo "<option selected value=\"$group\">$group\n";
759
				else
760
					echo "<option value=\"$group\">$group\n";
761
			}
762
		} else {
763
			foreach ($member_groups as $group)
324 richard 764
				echo "<option value=\"$group\">$group\n";
765
		}
2319 tom.houday 766
		echo "</select>";
324 richard 767
	}
768
	else{
2319 tom.houday 769
		echo "<i>$l_no_group</i>";
324 richard 770
	}
2319 tom.houday 771
 
772
	echo "</td></tr>";
1805 clement.si 773
}
324 richard 774
echo "</table><br>";
910 richard 775
echo "<input type=submit class=button value=$l_change OnClick=\"this.form.change.value=1\">";
2319 tom.houday 776
echo "<button type=\"button\" id =\"show-advanced-fields\" onclick=\"showAdvancedFields(true)\" style=\"float: right;\">$l_simple_menu</button>";
777
echo "<button type=\"button\" id =\"hide-advanced-fields\" onclick=\"showAdvancedFields(false)\" style=\"float: right; display: none;\">$l_advanced_menu</button>";
324 richard 778
//if ($user_type != 'group'){
779
//	echo <<<EOM
780
//<br><br>
781
//<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
782
//<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>
783
//EOM;
784
//}
785
?>
786
</form>
787
</td></tr>
788
</table>
2319 tom.houday 789
</td></tr>
324 richard 790
</table>
2319 tom.houday 791
</center>
324 richard 792
</td></tr>
793
</TABLE>
794
</body>
795
</html>