Subversion Repositories ALCASAR

Rev

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