Subversion Repositories ALCASAR

Rev

Rev 3170 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 3170 Rev 3173
1
<?php
1
<?php
2
# $Id: group_new.php 3170 2024-02-22 17:28:40Z rexy $
2
# $Id: group_new.php 3173 2024-02-23 18:38:01Z rexy $
3
 
3
 
4
//Gestion de la langue
4
//Gestion de la langue
5
if (is_file("../lib/langues.php"))
5
if (is_file("../lib/langues.php"))
6
	include("../lib/langues.php");
6
	include("../lib/langues.php");
7
 
7
 
8
// Update Alcasar-Status-Page-Must-Stay-Open --> TO TEST (Idle-Timeout)
8
// Update Alcasar-Status-Page-Must-Stay-Open --> TO TEST (Idle-Timeout)
9
//if ((isset($_POST['Alcasar-Status-Page-Must-Stay-Open'])) && ($_POST['Alcasar-Status-Page-Must-Stay-Open'] === '2')) {
9
//if ((isset($_POST['Alcasar-Status-Page-Must-Stay-Open'])) && ($_POST['Alcasar-Status-Page-Must-Stay-Open'] === '2')) {
10
//	$_POST['Idle-Timeout'] = '600'; // 10 minutes
10
//	$_POST['Idle-Timeout'] = '600'; // 10 minutes
11
//} else {
11
//} else {
12
//	$_POST['Idle-Timeout'] = '';
12
//	$_POST['Idle-Timeout'] = '';
13
//}
13
//}
14
//$_POST['Idle-Timeout_op'] = '=';
14
//$_POST['Idle-Timeout_op'] = '=';
15
 
15
 
16
require('/etc/freeradius-web/config.php');
16
require('/etc/freeradius-web/config.php');
17
 
17
 
18
if (!isset ($create)) $create=0;
18
if (!isset ($create)) $create=0;
19
if (!isset ($login)) $login='';
19
if (!isset ($login)) $login='';
20
if (!isset ($selected)) $selected=array();
20
if (!isset ($selected)) $selected=array();
21
 
21
 
22
require('../lib/attrshow.php');
22
require('../lib/attrshow.php');
23
require('../lib/defaults.php');
23
require('../lib/defaults.php');
24
require("../lib/$config[general_lib_type]/group_info.php");
24
require("../lib/$config[general_lib_type]/group_info.php");
25
 
25
 
26
if ($config['general_lib_type'] != 'sql'){
26
if ($config['general_lib_type'] != 'sql'){
27
	echo <<<EOM
27
	echo <<<EOM
28
<title>$l_title</title>
28
<title>$l_title</title>
29
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
29
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
30
<link rel="stylesheet" href="/css/acc.css">
30
<link rel="stylesheet" href="/css/acc.css">
31
</head>
31
</head>
32
<body>
32
<body>
33
<center>
33
<center>
34
<b>This page is only available if you are using sql as general library type</b>
34
<b>This page is only available if you are using sql as general library type</b>
35
</body>
35
</body>
36
</html>
36
</html>
37
EOM;
37
EOM;
38
        exit();
38
        exit();
39
}
39
}
40
 
40
 
41
 
41
 
42
if (false && /* Hide operator column */ $config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){
42
if (false && /* Hide operator column */ $config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){
43
	$colspan=2;
43
	$colspan=2;
44
	$show_ops=1;
44
	$show_ops=1;
45
	include_once("../lib/operators.php");
45
	include_once("../lib/operators.php");
46
	if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
46
	if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
47
}else{
47
}else{
48
	$show_ops = 0;
48
	$show_ops = 0;
49
	$colspan=1;
49
	$colspan=1;
50
}
50
}
51
?>
51
?>
52
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
52
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
53
<html><head><title>New group</title>
53
<html><head><title>New group</title>
54
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
54
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
55
<link rel="stylesheet" href="/css/jquery-ui.min.css">
55
<link rel="stylesheet" href="/css/jquery-ui.min.css">
56
<link rel="stylesheet" href="/css/acc.css">
56
<link rel="stylesheet" href="/css/acc.css">
57
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
57
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
58
<script type="text/javascript" src="/js/epoch_classes.js"></script>
58
<script type="text/javascript" src="/js/epoch_classes.js"></script>
59
<script type="text/javascript" src="/js/fonctions.js"></script>
59
<script type="text/javascript" src="/js/fonctions.js"></script>
60
<script language="javascript" type="text/javascript">
60
<script language="javascript" type="text/javascript">
61
/*Insertion du calendrier*/
61
/*Insertion du calendrier*/
62
	var dp_cal;
62
	var dp_cal;
63
window.onload = function () {
63
window.onload = function () {
64
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
64
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
65
};
65
};
66
/*Fin calendrier*/
66
/*Fin calendrier*/
67
</script>
67
</script>
68
<script type="text/javascript">
68
<script type="text/javascript">
69
	function showAdvancedFields(show) {
69
	function showAdvancedFields(show) {
70
		var form = document.forms['newgroup'];
70
		var form = document.forms['newgroup'];
71
		var btn_show = document.getElementById('show-advanced-fields');
71
		var btn_show = document.getElementById('show-advanced-fields');
72
		var btn_hide = document.getElementById('hide-advanced-fields');
72
		var btn_hide = document.getElementById('hide-advanced-fields');
73
 
73
 
74
		if (show) {
74
		if (show) {
75
			btn_hide.style.display = null;
75
			btn_hide.style.display = null;
76
			btn_show.style.display = 'none';
76
			btn_show.style.display = 'none';
77
			form.className += ' hide-advanced-fields';
77
			form.className += ' hide-advanced-fields';
78
		} else {
78
		} else {
79
			btn_show.style.display = null;
79
			btn_show.style.display = null;
80
			btn_hide.style.display = 'none';
80
			btn_hide.style.display = 'none';
81
			form.className = form.className.replace(' hide-advanced-fields', '');
81
			form.className = form.className.replace(' hide-advanced-fields', '');
82
 
82
 
83
		}
83
		}
84
	}
84
	}
85
</script>
85
</script>
86
<style type="text/css">
86
<style type="text/css">
87
	.hide-advanced-fields .advanced-field {
87
	.hide-advanced-fields .advanced-field {
88
		display: none;
88
		display: none;
89
	}
89
	}
90
</style>
90
</style>
91
</head>
91
</head>
92
<body>
92
<body>
93
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
93
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
94
	<tr><th><? echo "$l_groups_managment"; ?></th></tr>
94
	<tr><th><? echo "$l_groups_managment"; ?></th></tr>
95
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
95
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
96
height="2"></td></tr>
96
height="2"></td></tr>
97
</TABLE>
97
</TABLE>
98
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
98
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
99
	<tr bgcolor="#666666"><td>
99
	<tr bgcolor="#666666"><td>
100
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
100
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
101
		<tr><td valign="middle" align="left">
101
		<tr><td valign="middle" align="left">
102
<center>
102
<center>
103
<table border=0 width=750 cellpadding=1 cellspacing=1>
103
<table border=0 width=750 cellpadding=1 cellspacing=1>
104
<tr valign=top>
104
<tr valign=top>
105
<td width=340></td>
105
<td width=340></td>
106
<td bgcolor="black" width=200>
106
<td bgcolor="black" width=200>
107
	<table border=0 width=100% cellpadding=2 cellspacing=0>
107
	<table border=0 width=100% cellpadding=2 cellspacing=0>
108
	<tr bgcolor="#907030" align=right valign=top><th>
108
	<tr bgcolor="#907030" align=right valign=top><th>
109
	<font color="white"><? echo "$l_group_create"; ?></font>
109
	<font color="white"><? echo "$l_group_create"; ?></font>
110
	</th></tr>
110
	</th></tr>
111
	</table>
111
	</table>
112
</td></tr>
112
</td></tr>
113
<tr bgcolor="black" valign=top><td colspan=2>
113
<tr bgcolor="black" valign=top><td colspan=2>
114
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
114
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
115
	<tr><td>
115
	<tr><td>
116
 
116
 
117
<?php
117
<?php
118
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
118
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
119
	include("../lib/$config[general_lib_type]/group_info.php");
119
	include("../lib/$config[general_lib_type]/group_info.php");
120
if ($create == 1){
120
if ($create == 1){
121
	if ($group_exists != "no"){
121
	if ($group_exists != "no"){
122
		echo <<<EOM
122
		echo <<<EOM
123
<b><i>$login</i> $l_already_exist</b>
123
<b><i>$login</i> $l_already_exist</b>
124
EOM;
124
EOM;
125
	}
125
	}
126
	else{
126
	else{
127
		$Members = preg_split("/[\n\s]+/",$members,-1,PREG_SPLIT_NO_EMPTY);
127
		$Members = preg_split("/[\n\s]+/",$members,-1,PREG_SPLIT_NO_EMPTY);
128
		$group_macs = [];
128
		$group_macs = [];
129
		if (!empty($Members)){
129
		if (!empty($Members)){
130
			foreach ($Members as $member){
130
			foreach ($Members as $member){
131
				$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
131
				$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
132
				if (!empty($mac)) {
132
				if (!empty($mac)) {
133
					exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
133
					exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
134
					if ($member === $mac) {
134
					if ($member === $mac) {
135
						$group_macs[] = $mac;
135
						$group_macs[] = $mac;
136
					}
136
					}
137
				}
137
				}
138
			}
138
			}
139
		}
139
		}
140
 
140
 
141
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
141
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
142
			include("../lib/$config[general_lib_type]/create_group.php");
142
			include("../lib/$config[general_lib_type]/create_group.php");
143
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
143
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
144
			include("../lib/$config[general_lib_type]/group_info.php");
144
			include("../lib/$config[general_lib_type]/group_info.php");
145
 
145
 
146
		// Reconnect allowed MAC from the selected group
146
		// Reconnect allowed MAC from the selected group
147
		foreach ($group_macs as $mac) {
147
		foreach ($group_macs as $mac) {
148
			exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
148
			exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
149
		}
149
		}
150
	}
150
	}
151
}
151
}
152
if ($create == 0){
152
if ($create == 0){
153
?>
153
?>
154
   <form name="newgroup" method="post" class="">
154
   <form name="newgroup" method="post" class="">
155
      <input type="hidden" name="create" value="0">
155
      <input type="hidden" name="create" value="0">
156
      <input type="hidden" name="show" value="0">
156
      <input type="hidden" name="show" value="0">
157
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
157
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
158
<?php
158
<?php
159
	echo <<<EOM
159
	echo <<<EOM
160
	<tr>
160
	<tr>
161
		<td class="etiquette" colspan=$colspan>
161
		<td class="etiquette" colspan=$colspan>
162
		$l_created_groups
162
		$l_created_groups
163
		</td><td>
163
		</td><td>
164
EOM;
164
EOM;
165
		if (!isset($existing_groups))
165
		if (!isset($existing_groups))
166
			echo "<b>$l_group_empty</b>\n";
166
			echo "<b>$l_group_empty</b>\n";
167
		else{
167
		else{
168
			echo "<select name=\"existing_groups\">\n";
168
			echo "<select name=\"existing_groups\">\n";
169
			foreach ($existing_groups as $group => $count)
169
			foreach ($existing_groups as $group => $count)
170
				echo "<option value=\"$group\">$group\n";
170
				echo "<option value=\"$group\">$group\n";
171
			echo "</select>\n";
171
			echo "</select>\n";
172
		}
172
		}
173
	echo <<<EOM
173
	echo <<<EOM
174
		</td>
174
		</td>
175
	</tr>
175
	</tr>
176
	<tr>
176
	<tr>
177
		<td class="etiquette" colspan=$colspan>
177
		<td class="etiquette" colspan=$colspan>
178
		$l_group_name
178
		$l_group_name
179
		</td><td>
179
		</td><td>
180
		<input type=text name="login" value="$login" size=35>
180
		<input type=text name="login" value="$login" size=35>
181
		</td>
181
		</td>
182
	</tr>
182
	</tr>
183
	<tr>
183
	<tr>
184
		<td class="etiquette" colspan=$colspan>
184
		<td class="etiquette" colspan=$colspan>
185
		$l_group_members
185
		$l_group_members
186
		</td><td>
186
		</td><td>
187
		<textarea name=members cols="50" wrap="PHYSICAL" rows=5></textarea>
187
		<textarea name=members cols="50" wrap="PHYSICAL" rows=5></textarea>
188
		</td>
188
		</td>
189
	</tr>
189
	</tr>
190
 
190
 
191
EOM;
191
EOM;
192
	foreach($show_attrs as $key => $desc){
192
	foreach ($show_attrs as $key => $desc){
193
		if ($key === 'Idle-Timeout') continue;
193
		if ($key === 'Idle-Timeout') continue;
194
		$name = $attrmap["$key"];
194
		$name = $attrmap["$key"];
195
		if ($name == 'none')
195
		if ($name == 'none')
196
			continue;
196
			continue;
197
		$oper_name = $name . '_op';
197
		$oper_name = $name . '_op';
198
		if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != ''){
198
		if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != ''){
199
			$val = $item_vals["$key"][0];
199
			$val = $item_vals["$key"][0];
200
		} else if(isset($default_vals["$key"][0])) {
200
		} else if(isset($default_vals["$key"][0])) {
201
			$val = $default_vals["$key"][0];
201
			$val = $default_vals["$key"][0];
202
		} else {
202
		} else {
203
			$val = '';
203
			$val = '';
204
		}
204
		}
205
		switch ($key)
205
		switch ($key)
206
		{
206
		{
207
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
207
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
208
			case 'Simultaneous-Use' :
208
			case 'Simultaneous-Use' :
209
				$advanced = false;
209
				$advanced = false;
210
				$help_link = "help/simultaneous_use_help.html";
210
				$help_link = "help/simultaneous_use_help.html";
211
				$desc = $l_simultaneous_use;
211
				$desc = $l_simultaneous_use;
212
				break;
212
				break;
213
			case 'Max-All-Session' :
213
			case 'Max-All-Session' :
214
				$advanced = true;
214
				$advanced = true;
215
				$help_link = "help/max_all_session_help.html";
215
				$help_link = "help/max_all_session_help.html";
216
				$desc = $l_max_all_session;
216
				$desc = $l_max_all_session;
217
				break;
217
				break;
218
			case 'Session-Timeout' :
218
			case 'Session-Timeout' :
219
				$advanced = true;
219
				$advanced = true;
220
				$help_link = "help/session_timeout_help.html";
220
				$help_link = "help/session_timeout_help.html";
221
				$desc = $l_session_timeout;
221
				$desc = $l_session_timeout;
222
				break;
222
				break;
223
			case 'Max-Daily-Session' :
223
			case 'Max-Daily-Session' :
224
				$advanced = true;
224
				$advanced = true;
225
				$help_link = "help/session_timeout_help.html";
225
				$help_link = "help/session_timeout_help.html";
226
				$desc = $l_daily_timeout;
226
				$desc = $l_daily_timeout;
227
				break;
227
				break;
228
			case 'Max-Monthly-Session' :
228
			case 'Max-Monthly-Session' :
229
				$advanced = true;
229
				$advanced = true;
230
				$help_link = "help/session_timeout_help.html";
230
				$help_link = "help/session_timeout_help.html";
231
				$desc = $l_monthly_timeout;
231
				$desc = $l_monthly_timeout;
232
				break;
232
				break;
233
			case 'Login-Time' :
233
			case 'Login-Time' :
234
				$advanced = true;
234
				$advanced = true;
235
				$help_link = "help/login_time_help.html";
235
				$help_link = "help/login_time_help.html";
236
				$desc = $l_login_time;
236
				$desc = $l_login_time;
237
				break;
237
				break;
238
			case 'Expiration' :
238
			case 'Expiration' :
239
				$advanced = false;
239
				$advanced = false;
240
				$help_link = "help/expiration_help.html";
240
				$help_link = "help/expiration_help.html";
241
				$desc = $l_expiration;
241
				$desc = $l_expiration;
242
				break;
242
				break;
243
			case 'CoovaChilli-Max-Input-Octets' :
243
			case 'CoovaChilli-Max-Input-Octets' :
244
				$advanced = true;
244
				$advanced = true;
245
				$help_link = "help/coovachilli_max_input_octets_help.html";
245
				$help_link = "help/coovachilli_max_input_octets_help.html";
246
				$desc = $l_max_input_octets;
246
				$desc = $l_max_input_octets;
247
				break;
247
				break;
248
			case 'CoovaChilli-Max-Output-Octets' :
248
			case 'CoovaChilli-Max-Output-Octets' :
249
				$advanced = true;
249
				$advanced = true;
250
				$help_link = "help/coovachilli_max_output_octets_help.html";
250
				$help_link = "help/coovachilli_max_output_octets_help.html";
251
				$desc = $l_max_output_octets;
251
				$desc = $l_max_output_octets;
252
				break;
252
				break;
253
			case 'CoovaChilli-Max-Total-Octets' :
253
			case 'CoovaChilli-Max-Total-Octets' :
254
				$advanced = true;
254
				$advanced = true;
255
				$help_link = "help/coovachilli_max_total_octets_help.html";
255
				$help_link = "help/coovachilli_max_total_octets_help.html";
256
				$desc = $l_max_total_octets;
256
				$desc = $l_max_total_octets;
257
				break;
257
				break;
258
			case 'CoovaChilli-Max-Total-Octets-Daily' :
258
			case 'CoovaChilli-Max-Total-Octets-Daily' :
259
				$advanced = true;
259
				$advanced = true;
260
				$help_link = "help/coovachilli_max_total_octets_help.html";
260
				$help_link = "help/coovachilli_max_total_octets_help.html";
261
				$desc = $l_max_total_octets_daily;
261
				$desc = $l_max_total_octets_daily;
262
				break;
262
				break;
263
			case 'CoovaChilli-Max-Total-Octets-Monthly' :
263
			case 'CoovaChilli-Max-Total-Octets-Monthly' :
264
				$advanced = true;
264
				$advanced = true;
265
				$help_link = "help/coovachilli_max_total_octets_help.html";
265
				$help_link = "help/coovachilli_max_total_octets_help.html";
266
				$desc = $l_max_total_octets_monthly;
266
				$desc = $l_max_total_octets_monthly;
267
				break;
267
				break;
268
			case 'CoovaChilli-Bandwidth-Max-Up' :
268
			case 'CoovaChilli-Bandwidth-Max-Up' :
269
				$advanced = true;
269
				$advanced = true;
270
				$help_link = "help/coovachilli_bandwidth_max_up_help.html";
270
				$help_link = "help/coovachilli_bandwidth_max_up_help.html";
271
				$desc = $l_max_bandwidth_up;
271
				$desc = $l_max_bandwidth_up;
272
				break;
272
				break;
273
			case 'CoovaChilli-Bandwidth-Max-Down' :
273
			case 'CoovaChilli-Bandwidth-Max-Down' :
274
				$advanced = true;
274
				$advanced = true;
275
				$help_link = "help/coovachilli_bandwidth_max_down_help.html";
275
				$help_link = "help/coovachilli_bandwidth_max_down_help.html";
276
				$desc = $l_max_bandwidth_down;
276
				$desc = $l_max_bandwidth_down;
277
				break;
277
				break;
278
			case 'WISPr-Redirection-URL' :
278
			case 'WISPr-Redirection-URL' :
279
				$advanced = true;
279
				$advanced = true;
280
				$help_link = "help/wispr_redirection_url_help.html";
280
				$help_link = "help/wispr_redirection_url_help.html";
281
				$desc = $l_wispr_redirection;
281
				$desc = $l_wispr_redirection;
282
				break;
282
				break;
283
			case 'Alcasar-Filter' :
283
			case 'Alcasar-Filter' :
284
				$advanced = false;
284
				$advanced = false;
285
				$help_link = "help/filtering_help.html";
285
				$help_link = "help/filtering_help.html";
286
				$desc = $l_filtering;
286
				$desc = $l_filtering;
287
				break;
287
				break;
288
			case 'Alcasar-Protocols-Filter' :
288
			case 'Alcasar-Protocols-Filter' :
289
				$advanced = false;
289
				$advanced = false;
290
				$help_link = "help/protocols_help.html";
290
				$help_link = "help/protocols_help.html";
291
				$desc = $l_proto;
291
				$desc = $l_proto;
292
				break;
292
				break;
293
			case 'Alcasar-Status-Page-Must-Stay-Open' :
293
			case 'Alcasar-Status-Page-Must-Stay-Open' :
294
				$advanced = false;
294
				$advanced = false;
295
				$help_link = "help/statusOpenRequired_help.html";
295
				$help_link = "help/statusOpenRequired_help.html";
296
				$desc = $l_statusOpenRequired;
296
				$desc = $l_statusOpenRequired;
297
				break;
297
				break;
298
			case 'Alcasar-Expire-After' :
298
			case 'Alcasar-Expire-After' :
299
				$advanced = true;
299
				$advanced = true;
300
				$help_link = "help/expire_after_help.html";
300
				$help_link = "help/expire_after_help.html";
301
				$desc = $l_expire_after;
301
				$desc = $l_expire_after;
302
				break;
302
				break;
303
			default:
303
			default:
304
				$advanced = true;
304
				$advanced = true;
305
				break;
305
				break;
306
		}
306
		}
307
 
307
 
308
		$advancedField = ($advanced) ? ' class="advanced-field"' : '';
308
		$advancedField = ($advanced) ? ' class="advanced-field"' : '';
309
 
309
 
310
		if ($show_ops){
310
		if ($show_ops){
311
		print <<<EOM
311
		print <<<EOM
312
			<tr$advancedField>
312
			<tr$advancedField>
313
			<td class="etiquette">
313
			<td class="etiquette">
314
			<a href="$help_link" target=help onclick="window.open('$help_link','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$desc</font></a>
314
			<a href="$help_link" target=help onclick="window.open('$help_link','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$desc</font></a>
315
			</td>
315
			</td>
316
EOM;
316
EOM;
317
			switch ($key) {
317
			switch ($key) {
318
				case 'Simultaneous-Use' :
318
				case 'Simultaneous-Use' :
319
				case 'Max-All-Session' :
319
				case 'Max-All-Session' :
320
				case 'Max-Daily-Session' :
320
				case 'Max-Daily-Session' :
321
				case 'Max-Weekly-Session' :
321
				case 'Max-Weekly-Session' :
322
				case 'Max-Monthly-Session' :
322
				case 'Max-Monthly-Session' :
323
				case 'Login-Time' :
323
				case 'Login-Time' :
324
				case 'Expiration' :
324
				case 'Expiration' :
325
				case 'Alcasar-Expire-After' :
325
				case 'Alcasar-Expire-After' :
326
				case 'CoovaChilli-Max-Total-Octets-Daily' :
326
				case 'CoovaChilli-Max-Total-Octets-Daily' :
327
				case 'CoovaChilli-Max-Total-Octets-Monthly' :
327
				case 'CoovaChilli-Max-Total-Octets-Monthly' :
328
				case 'CoovaChilli-Max-Total-Octets' :
328
				case 'CoovaChilli-Max-Total-Octets' :
329
					echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=";
329
					echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=";
330
					break;
330
					break;
331
				case 'Session-Timeout' :
331
				case 'Session-Timeout' :
332
				case 'CoovaChilli-Max-Input-Octets' :
332
				case 'CoovaChilli-Max-Input-Octets' :
333
				case 'CoovaChilli-Max-Output-Octets' :
333
				case 'CoovaChilli-Max-Output-Octets' :
334
				case 'CoovaChilli-Bandwidth-Max-Up' :
334
				case 'CoovaChilli-Bandwidth-Max-Up' :
335
				case 'CoovaChilli-Bandwidth-Max-Down' :
335
				case 'CoovaChilli-Bandwidth-Max-Down' :
336
				case 'WISPr-Redirection-URL' :
336
				case 'WISPr-Redirection-URL' :
337
				case 'Alcasar-Filter' :
337
				case 'Alcasar-Filter' :
338
				case 'Alcasar-Protocols-Filter' :
338
				case 'Alcasar-Protocols-Filter' :
339
				case 'Alcasar-Status-Page-Must-Stay-Open' :
339
				case 'Alcasar-Status-Page-Must-Stay-Open' :
340
					echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\"=\">=";
340
					echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\"=\">=";
341
					break;
341
					break;
342
				default :
342
				default :
343
					print <<<EOM
343
					print <<<EOM
344
					<td>
344
					<td>
345
						<select name=\"$oper_name\">
345
						<select name=\"$oper_name\">
346
							<option $selected[$op_eq] value="=">=
346
							<option $selected[$op_eq] value="=">=
347
							<option $selected[$op_set] value=":=">:=
347
							<option $selected[$op_set] value=":=">:=
348
							<option $selected[$op_add] value="+=">+=
348
							<option $selected[$op_add] value="+=">+=
349
							<option $selected[$op_eq2] value="==">==
349
							<option $selected[$op_eq2] value="==">==
350
							<option $selected[$op_ne] value="!=">!=
350
							<option $selected[$op_ne] value="!=">!=
351
							<option $selected[$op_gt] value=">">&gt;
351
							<option $selected[$op_gt] value=">">&gt;
352
							<option $selected[$op_ge] value=">=">&gt;=
352
							<option $selected[$op_ge] value=">=">&gt;=
353
							<option $selected[$op_lt] value="<">&lt;
353
							<option $selected[$op_lt] value="<">&lt;
354
							<option $selected[$op_le] value="<=">&lt;=
354
							<option $selected[$op_le] value="<=">&lt;=
355
							<option $selected[$op_regeq] value="=~">=~
355
							<option $selected[$op_regeq] value="=~">=~
356
							<option $selected[$op_regne] value="!~">!~
356
							<option $selected[$op_regne] value="!~">!~
357
							<option $selected[$op_exst] value="=*">=*
357
							<option $selected[$op_exst] value="=*">=*
358
							<option $selected[$op_nexst] value="!*">!*
358
							<option $selected[$op_nexst] value="!*">!*
359
						</select>
359
						</select>
360
					</td>
360
					</td>
361
EOM;
361
EOM;
362
					break;
362
					break;
363
			}
363
			}
364
		} else {
364
		} else {
365
			print <<<EOM
365
			print <<<EOM
366
				<tr$advancedField>
366
				<tr$advancedField>
367
				<td class="etiquette" colspan="$colspan">
367
				<td class="etiquette" colspan="$colspan">
368
				<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>
368
				<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>
369
EOM;
369
EOM;
370
			switch ($key) {
370
			switch ($key) {
371
				case 'Simultaneous-Use' :
371
				case 'Simultaneous-Use' :
372
				case 'Max-All-Session' :
372
				case 'Max-All-Session' :
373
				case 'Max-Daily-Session' :
373
				case 'Max-Daily-Session' :
374
				case 'Max-Weekly-Session' :
374
				case 'Max-Weekly-Session' :
375
				case 'Max-Monthly-Session' :
375
				case 'Max-Monthly-Session' :
376
				case 'Login-Time' :
376
				case 'Login-Time' :
377
				case 'Expiration' :
377
				case 'Expiration' :
378
				case 'Alcasar-Expire-After' :
378
				case 'Alcasar-Expire-After' :
379
				case 'CoovaChilli-Max-Total-Octets-Daily' :
379
				case 'CoovaChilli-Max-Total-Octets-Daily' :
380
				case 'CoovaChilli-Max-Total-Octets-Monthly' :
380
				case 'CoovaChilli-Max-Total-Octets-Monthly' :
381
				case 'CoovaChilli-Max-Total-Octets' :
381
				case 'CoovaChilli-Max-Total-Octets' :
382
					echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
382
					echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
383
					break;
383
					break;
384
				case 'Session-Timeout' :
384
				case 'Session-Timeout' :
385
				case 'CoovaChilli-Max-Input-Octets' :
385
				case 'CoovaChilli-Max-Input-Octets' :
386
				case 'CoovaChilli-Max-Output-Octets' :
386
				case 'CoovaChilli-Max-Output-Octets' :
387
				case 'CoovaChilli-Bandwidth-Max-Up' :
387
				case 'CoovaChilli-Bandwidth-Max-Up' :
388
				case 'CoovaChilli-Bandwidth-Max-Down' :
388
				case 'CoovaChilli-Bandwidth-Max-Down' :
389
				case 'WISPr-Redirection-URL' :
389
				case 'WISPr-Redirection-URL' :
390
				case 'Alcasar-Filter' :
390
				case 'Alcasar-Filter' :
391
				case 'Alcasar-Protocols-Filter' :
391
				case 'Alcasar-Protocols-Filter' :
392
				case 'Alcasar-Status-Page-Must-Stay-Open' :
392
				case 'Alcasar-Status-Page-Must-Stay-Open' :
393
					echo "<input type=\"hidden\" name=\"$oper_name\" value=\"=\">";
393
					echo "<input type=\"hidden\" name=\"$oper_name\" value=\"=\">";
394
					break;
394
					break;
395
				default :
395
				default :
396
					print <<<EOM
396
					print <<<EOM
397
						<select name=\"$oper_name\">
397
						<select name=\"$oper_name\">
398
							<option $selected[$op_eq] value="=">=</option>
398
							<option $selected[$op_eq] value="=">=</option>
399
							<option $selected[$op_set] value=":=">:=</option>
399
							<option $selected[$op_set] value=":=">:=</option>
400
							<option $selected[$op_add] value="+=">+=</option>
400
							<option $selected[$op_add] value="+=">+=</option>
401
							<option $selected[$op_eq2] value="==">==</option>
401
							<option $selected[$op_eq2] value="==">==</option>
402
							<option $selected[$op_ne] value="!=">!=</option>
402
							<option $selected[$op_ne] value="!=">!=</option>
403
							<option $selected[$op_gt] value=">">&gt;</option>
403
							<option $selected[$op_gt] value=">">&gt;</option>
404
							<option $selected[$op_ge] value=">=">&gt;=</option>
404
							<option $selected[$op_ge] value=">=">&gt;=</option>
405
							<option $selected[$op_lt] value="<">&lt;</option>
405
							<option $selected[$op_lt] value="<">&lt;</option>
406
							<option $selected[$op_le] value="<=">&lt;=</option>
406
							<option $selected[$op_le] value="<=">&lt;=</option>
407
							<option $selected[$op_regeq] value="=~">=~</option>
407
							<option $selected[$op_regeq] value="=~">=~</option>
408
							<option $selected[$op_regne] value="!~">!~</option>
408
							<option $selected[$op_regne] value="!~">!~</option>
409
							<option $selected[$op_exst] value="=*">=*</option>
409
							<option $selected[$op_exst] value="=*">=*</option>
410
							<option $selected[$op_nexst] value="!*">!*</option>
410
							<option $selected[$op_nexst] value="!*">!*</option>
411
						</select>
411
						</select>
412
EOM;
412
EOM;
413
					break;
413
					break;
414
			}
414
			}
415
			echo '</td>';
415
			echo '</td>';
416
		}
416
		}
417
 
417
 
418
/*
418
/*
419
Ajout du choix d'unité (pour les durées limites de session, journée et de mois)
419
Ajout du choix d'unité (pour les durées limites de session, journée et de mois)
420
et d'un calendrier pour la date d'expiration
420
et d'un calendrier pour la date d'expiration
421
Sauf dans le cas de la visualisation
421
Sauf dans le cas de la visualisation
422
*/
422
*/
423
	echo '<td>';
423
	echo '<td>';
424
	if ($create == 0) {
424
	if ($create == 0) {
425
		switch ($name){
425
		switch ($name){
426
			/*
426
			/*
427
			Choix de l'unité jour, heures, minutes ou secondes
427
			Choix de l'unité jour, heures, minutes ou secondes
428
			pour les durées limites max, de session,de journée et de mois
428
			pour les durées limites max, de session,de journée et de mois
429
			*/
429
			*/
430
			case 'Session-Timeout' :
430
			case 'Session-Timeout' :
431
			case 'Max-Daily-Session' :
431
			case 'Max-Daily-Session' :
432
				/*valeur d'origine de durée limite */
432
				/*valeur d'origine de durée limite */
433
				echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
433
				echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
434
				/* Choix d'unité*/
434
				/* Choix d'unité*/
435
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
435
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
436
						<option value=\"s\" selected>s</option>
436
						<option value=\"s\" selected>s</option>
437
						<option value=\"m\" >m</option>
437
						<option value=\"m\" >m</option>
438
						<option value=\"H\" >H</option>
438
						<option value=\"H\" >H</option>
439
					</select>";
439
					</select>";
440
				break;
440
				break;
441
			case 'Max-Monthly-Session' :
441
			case 'Max-Monthly-Session' :
442
			case 'Max-All-Session' :
442
			case 'Max-All-Session' :
443
			case 'Alcasar-Expire-After' :
443
			case 'Alcasar-Expire-After' :
444
				/*valeur d'origine de durée limite */
444
				/*valeur d'origine de durée limite */
445
				echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
445
				echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
446
				/* Choix d'unité*/
446
				/* Choix d'unité*/
447
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
447
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
448
						<option value=\"s\" selected>s</option>
448
						<option value=\"s\" selected>s</option>
449
						<option value=\"m\" >m</option>
449
						<option value=\"m\" >m</option>
450
						<option value=\"H\" >H</option>
450
						<option value=\"H\" >H</option>
451
						<option value=\"J\" >J</option>
451
						<option value=\"J\" >J</option>
452
					</select>";
452
					</select>";
453
				break;
453
				break;
454
			case 'Expiration' :
454
			case 'Expiration' :
455
				/*Ajout du calendrier pour choisir la date*/
455
				/*Ajout du calendrier pour choisir la date*/
456
				echo"<input id=\"popup_container\" type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
456
				echo"<input id=\"popup_container\" type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
457
				break;
457
				break;
458
			case 'Alcasar-Filter' :
458
			case 'Alcasar-Filter' :
459
				echo "<select name=\"$name\">";
459
				echo "<select name=\"$name\">";
460
				echo "<option value=\"\"></option>";
460
				echo "<option value=\"\"></option>";
461
				echo "<option value=\"1\">$l_filtering_none</option>";
461
				echo "<option value=\"1\">$l_filtering_none</option>";
462
				/*echo "<option value=\"2\">$l_filtering_av</option>";*/
462
				/*echo "<option value=\"2\">$l_filtering_av</option>";*/
463
				echo "<option value=\"3\">$l_filtering_av_bl</option>";
463
				echo "<option value=\"3\">$l_filtering_av_bl</option>";
464
				echo "<option value=\"4\">$l_filtering_av_wl</option>";
464
				echo "<option value=\"4\">$l_filtering_av_wl</option>";
465
				echo "</select>";
465
				echo "</select>";
466
				break;
466
				break;
467
			case 'Alcasar-Protocols-Filter' :
467
			case 'Alcasar-Protocols-Filter' :
468
				echo "<select name=\"$name\">";
468
				echo "<select name=\"$name\">";
469
				echo "<option value=\"\"></option>";
469
				echo "<option value=\"\"></option>";
470
				echo "<option value=\"1\">$l_proto_0</option>";
470
				echo "<option value=\"1\">$l_proto_0</option>";
471
				echo "<option value=\"2\">$l_proto_1</option>";
471
				echo "<option value=\"2\">$l_proto_1</option>";
472
				echo "<option value=\"3\">$l_proto_2</option>";
472
				echo "<option value=\"3\">$l_proto_2</option>";
473
				echo "<option value=\"4\">$l_proto_3</option>";
473
				echo "<option value=\"4\">$l_proto_3</option>";
474
				echo "</select>";
474
				echo "</select>";
475
				break;
475
				break;
476
			case 'Alcasar-Status-Page-Must-Stay-Open' :
476
			case 'Alcasar-Status-Page-Must-Stay-Open' :
477
				echo "<select name=\"$name\">";
477
				echo "<select name=\"$name\">";
478
				echo "<option value=\"\"></option>";
478
				echo "<option value=\"\"></option>";
479
				echo "<option value=\"1\">$l_no</option>";
479
				echo "<option value=\"1\">$l_no</option>";
480
				echo "<option value=\"2\">$l_yes</option>";
480
				echo "<option value=\"2\">$l_yes</option>";
481
				echo "</select>";
481
				echo "</select>";
482
				break;
482
				break;
483
			case 'Login-Time':
483
			case 'Login-Time':
484
				echo "<input type=\"text\" name=\"$name\" id=\"$name\" value=\"$val\" size=\"20\">";
484
				echo "<input type=\"text\" name=\"$name\" id=\"$name\" value=\"$val\" size=\"20\">";
485
				echo "<a id=\"login-time-calendar\" href=\"#\"><img alt=\"schedule\" src=\"images/calendar.png\"/></a>";
485
				echo "<a id=\"login-time-calendar\" href=\"#\"><img alt=\"schedule\" src=\"images/calendar.png\"/></a>";
486
				echo '<div id="login-time-dialog" title="Weekly period"><div id="login-time-schedule"></div></div>';
486
				echo '<div id="login-time-dialog" title="Weekly period"><div id="login-time-schedule"></div></div>';
487
				break;
487
				break;
488
			default :
488
			default :
489
				echo "<input type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
489
				echo "<input type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
490
				break;
490
				break;
491
		}
491
		}
492
	}
492
	}
493
/*fin Ajout*/
493
/*fin Ajout*/
494
}
494
}
495
 
495
 
496
echo "</table><BR>";
496
echo "</table><BR>";
497
 
497
 
498
}
498
}
499
if ($create == 1)
499
if ($create == 1)
500
	echo "<br/><center><a href=\"group_admin.php?login=$login\">$l_show_profile</a></center>";
500
	echo "<br/><center><a href=\"group_admin.php?login=$login\">$l_show_profile</a></center>";
501
else {
501
else {
502
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newgroup');\">";
502
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newgroup');\">";
503
	echo "<button type=\"button\" id =\"show-advanced-fields\" onclick=\"showAdvancedFields(true)\" style=\"float: right;\">$l_simple_menu</button>";
503
	echo "<button type=\"button\" id =\"show-advanced-fields\" onclick=\"showAdvancedFields(true)\" style=\"float: right;\">$l_simple_menu</button>";
504
	echo "<button type=\"button\" id =\"hide-advanced-fields\" onclick=\"showAdvancedFields(false)\" style=\"float: right; display: none;\">$l_advanced_menu</button>";
504
	echo "<button type=\"button\" id =\"hide-advanced-fields\" onclick=\"showAdvancedFields(false)\" style=\"float: right; display: none;\">$l_advanced_menu</button>";
505
}
505
}
506
?>
506
?>
507
<br><br>
507
<br><br>
508
</form>
508
</form>
509
	</td></tr>
509
	</td></tr>
510
</table>
510
</table>
511
</tr>
511
</tr>
512
</table>
512
</table>
513
</center>
513
</center>
514
</TD></TR>
514
</TD></TR>
515
</TABLE>
515
</TABLE>
516
</td></tr>
516
</td></tr>
517
</TABLE>
517
</TABLE>
518
<script type="text/javascript" src="/js/jquery.min.js"></script>
518
<script type="text/javascript" src="/js/jquery.min.js"></script>
519
<script type="text/javascript" src="/js/jquery-ui.min.js"></script>
519
<script type="text/javascript" src="/js/jquery-ui.min.js"></script>
520
<script type="text/javascript" src="/js/schedule.js"></script>
520
<script type="text/javascript" src="/js/schedule.js"></script>
521
<script type="text/javascript" src="/js/login-time.js"></script>
521
<script type="text/javascript" src="/js/login-time.js"></script>
522
</body>
522
</body>
523
</html>
523
</html>
524
 
524