Subversion Repositories ALCASAR

Rev

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