Subversion Repositories ALCASAR

Rev

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