Subversion Repositories ALCASAR

Rev

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