Subversion Repositories ALCASAR

Rev

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