Subversion Repositories ALCASAR

Rev

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