Subversion Repositories ALCASAR

Rev

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