Subversion Repositories ALCASAR

Rev

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