Subversion Repositories ALCASAR

Rev

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