Subversion Repositories ALCASAR

Rev

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