Subversion Repositories ALCASAR

Rev

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