Subversion Repositories ALCASAR

Rev

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