Subversion Repositories ALCASAR

Rev

Rev 2501 | Rev 2510 | 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 2505 2018-03-11 13:41:00Z 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;
508 richard 223
			case 'ChilliSpot-Max-Input-Octets' :
2319 tom.houday 224
				$advanced = true;
225
				$help_link = "help/chillispot_max_input_octets_help.html";
226
				$desc = $l_max_input_octets;
907 richard 227
				break;
508 richard 228
			case 'ChilliSpot-Max-Output-Octets' :
2319 tom.houday 229
				$advanced = true;
230
				$help_link = "help/chillispot_max_output_octets_help.html";
231
				$desc = $l_max_output_octets;
907 richard 232
				break;
508 richard 233
			case 'ChilliSpot-Max-Total-Octets' :
2319 tom.houday 234
				$advanced = true;
235
				$help_link = "help/chillispot_max_total_octets_help.html";
236
				$desc = $l_max_total_octets;
907 richard 237
				break;
508 richard 238
			case 'ChilliSpot-Bandwidth-Max-Up' :
2319 tom.houday 239
				$advanced = true;
240
				$help_link = "help/chillispot_bandwidth_max_up_help.html";
241
				$desc = $l_max_bandwidth_up;
907 richard 242
				break;
508 richard 243
			case 'ChilliSpot-Bandwidth-Max-Down' :
2319 tom.houday 244
				$advanced = true;
245
				$help_link = "help/chillispot_bandwidth_max_down_help.html";
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;
508 richard 268
			default:
2319 tom.houday 269
				$advanced = true;
508 richard 270
				break;
271
		}
2319 tom.houday 272
 
273
		$advancedField = ($advanced) ? ' class="advanced-field"' : '';
274
 
275
		if ($show_ops){
907 richard 276
		print <<<EOM
2319 tom.houday 277
			<tr$advancedField>
907 richard 278
			<td class="etiquette">
2319 tom.houday 279
			<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 280
			</td>
324 richard 281
EOM;
2319 tom.houday 282
			switch ($key) {
1805 clement.si 283
				case 'Simultaneous-Use' :
890 stephane 284
				case 'Max-All-Session' :
508 richard 285
				case 'Max-Daily-Session' :
286
				case 'Max-Weekly-Session' :
287
				case 'Max-Monthly-Session' :
1805 clement.si 288
				case 'Login-Time' :
907 richard 289
				case 'Expiration' :
2319 tom.houday 290
					echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=";
508 richard 291
					break;
907 richard 292
				case 'Session-Timeout' :
508 richard 293
				case 'ChilliSpot-Max-Input-Octets' :
294
				case 'ChilliSpot-Max-Output-Octets' :
295
				case 'ChilliSpot-Max-Total-Octets' :
296
				case 'ChilliSpot-Bandwidth-Max-Up' :
297
				case 'ChilliSpot-Bandwidth-Max-Down' :
298
				case 'WISPr-Redirection-URL' :
2501 tom.houday 299
				case 'Alcasar-Filter' :
2505 tom.houday 300
				case 'Alcasar-Protocols-Filter' :
301
				case 'Alcasar-Status-Page-Must-Stay-Open' :
2319 tom.houday 302
					echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\"=\">=";
508 richard 303
					break;
304
				default :
305
					print <<<EOM
306
					<td>
2319 tom.houday 307
						<select name=\"$oper_name\">
907 richard 308
							<option $selected[$op_eq] value="=">=
309
							<option $selected[$op_set] value=":=">:=
310
							<option $selected[$op_add] value="+=">+=
311
							<option $selected[$op_eq2] value="==">==
312
							<option $selected[$op_ne] value="!=">!=
313
							<option $selected[$op_gt] value=">">&gt;
314
							<option $selected[$op_ge] value=">=">&gt;=
315
							<option $selected[$op_lt] value="<">&lt;
316
							<option $selected[$op_le] value="<=">&lt;=
317
							<option $selected[$op_regeq] value="=~">=~
318
							<option $selected[$op_regne] value="!~">!~
319
							<option $selected[$op_exst] value="=*">=*
320
							<option $selected[$op_nexst] value="!*">!*
321
						</select>
508 richard 322
					</td>
324 richard 323
EOM;
508 richard 324
					break;
325
			}
2319 tom.houday 326
		} else {
327
			print <<<EOM
328
				<tr$advancedField>
329
				<td class="etiquette" colspan="$colspan">
330
				<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>
331
EOM;
332
			switch ($key) {
333
				case 'Simultaneous-Use' :
334
				case 'Max-All-Session' :
335
				case 'Max-Daily-Session' :
336
				case 'Max-Weekly-Session' :
337
				case 'Max-Monthly-Session' :
338
				case 'Login-Time' :
339
				case 'Expiration' :
2501 tom.houday 340
				case 'Alcasar-Filter' :
2505 tom.houday 341
				case 'Alcasar-Protocols-Filter' :
342
				case 'Alcasar-Status-Page-Must-Stay-Open' :
2319 tom.houday 343
					echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
344
					break;
345
				case 'Session-Timeout' :
346
				case 'ChilliSpot-Max-Input-Octets' :
347
				case 'ChilliSpot-Max-Output-Octets' :
348
				case 'ChilliSpot-Max-Total-Octets' :
349
				case 'ChilliSpot-Bandwidth-Max-Up' :
350
				case 'ChilliSpot-Bandwidth-Max-Down' :
351
				case 'WISPr-Redirection-URL' :
352
					echo "<input type=\"hidden\" name=\"$oper_name\" value=\"=\">";
353
					break;
354
				default :
355
					print <<<EOM
356
						<select name=\"$oper_name\">
357
							<option $selected[$op_eq] value="=">=</option>
358
							<option $selected[$op_set] value=":=">:=</option>
359
							<option $selected[$op_add] value="+=">+=</option>
360
							<option $selected[$op_eq2] value="==">==</option>
361
							<option $selected[$op_ne] value="!=">!=</option>
362
							<option $selected[$op_gt] value=">">&gt;</option>
363
							<option $selected[$op_ge] value=">=">&gt;=</option>
364
							<option $selected[$op_lt] value="<">&lt;</option>
365
							<option $selected[$op_le] value="<=">&lt;=</option>
366
							<option $selected[$op_regeq] value="=~">=~</option>
367
							<option $selected[$op_regne] value="!~">!~</option>
368
							<option $selected[$op_exst] value="=*">=*</option>
369
							<option $selected[$op_nexst] value="!*">!*</option>
370
						</select>
371
EOM;
372
					break;
373
			}
374
			echo '</td>';
324 richard 375
		}
1805 clement.si 376
 
377
/*
378
Ajout du choix d'unité (pour les durées limites de session, journée et de mois)
508 richard 379
et d'un calendrier pour la date d'expiration
380
Sauf dans le cas de la visualisation
381
*/
2319 tom.houday 382
	echo '<td>';
383
	if ($create == 0) {
508 richard 384
		switch ($name){
385
			/*
2319 tom.houday 386
			Choix de l'unité jour, heures, minutes ou secondes
387
			pour les durées limites max, de session,de journée et de mois
1805 clement.si 388
			*/
508 richard 389
			case 'Session-Timeout' :
390
			case 'Max-Daily-Session' :
2319 tom.houday 391
				/*valeur d'origine de durée limite */
392
				echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
393
				/* Choix d'unité*/
2321 tom.houday 394
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
2319 tom.houday 395
						<option value=\"s\" selected>s</option>
396
						<option value=\"m\" >m</option>
397
						<option value=\"H\" >H</option>
398
					</select>";
399
				break;
508 richard 400
			case 'Max-Monthly-Session' :
907 richard 401
			case 'Max-All-Session' :
508 richard 402
				/*valeur d'origine de durée limite */
2319 tom.houday 403
				echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
508 richard 404
				/* Choix d'unité*/
2321 tom.houday 405
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
508 richard 406
						<option value=\"s\" selected>s</option>
407
						<option value=\"m\" >m</option>
408
						<option value=\"H\" >H</option>
2319 tom.houday 409
						<option value=\"J\" >J</option>
508 richard 410
					</select>";
411
				break;
412
			case 'Expiration' :
413
				/*Ajout du calendrier pour choisir la date*/
2319 tom.houday 414
				echo"<input id=\"popup_container\" type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
508 richard 415
				break;
2501 tom.houday 416
			case 'Alcasar-Filter' :
417
				echo "<select name=\"$name\">";
418
				echo "<option value=\"\"></option>";
419
				echo "<option value=\"1\">$l_filtering_none</option>";
420
				echo "<option value=\"2\">$l_filtering_havp</option>";
421
				echo "<option value=\"3\">$l_filtering_havp_bl</option>";
422
				echo "<option value=\"4\">$l_filtering_havp_wl</option>";
1377 richard 423
				echo "</select>";
424
				break;
2505 tom.houday 425
			case 'Alcasar-Protocols-Filter' :
2501 tom.houday 426
				echo "<select name=\"$name\">";
427
				echo "<option value=\"\"></option>";
428
				echo "<option value=\"1\">$l_proto_0</option>";
429
				echo "<option value=\"2\">$l_proto_1</option>";
430
				echo "<option value=\"3\">$l_proto_2</option>";
431
				echo "<option value=\"4\">$l_proto_3</option>";
432
				echo "</select>";
433
				break;
2505 tom.houday 434
			case 'Alcasar-Status-Page-Must-Stay-Open' :
2501 tom.houday 435
				echo "<label><input type=\"radio\" name=\"$name\" value=\"\" checked>$l_yes</label>
436
					<label><input type=\"radio\" name=\"$name\" value=\"2\">$l_no</label>";
437
				break;
508 richard 438
			default :
2319 tom.houday 439
				echo "<input type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
508 richard 440
				break;
2319 tom.houday 441
		}
324 richard 442
	}
508 richard 443
/*fin Ajout*/
444
}
2006 raphael.pi 445
 
324 richard 446
echo "</table><BR>";
2394 tom.houday 447
 
1377 richard 448
}
324 richard 449
if ($create == 1)
1377 richard 450
	echo "<br/><center><a href=\"group_admin.php?login=$login\">$l_show_profile</a></center>";
2383 tom.houday 451
else {
907 richard 452
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newgroup');\">";
2319 tom.houday 453
	echo "<button type=\"button\" id =\"show-advanced-fields\" onclick=\"showAdvancedFields(true)\" style=\"float: right;\">$l_simple_menu</button>";
454
	echo "<button type=\"button\" id =\"hide-advanced-fields\" onclick=\"showAdvancedFields(false)\" style=\"float: right; display: none;\">$l_advanced_menu</button>";
2383 tom.houday 455
}
324 richard 456
?>
457
<br><br>
458
</form>
459
	</td></tr>
460
</table>
461
</tr>
462
</table>
2319 tom.houday 463
</center>
324 richard 464
</TD></TR>
465
</TABLE>
466
</td></tr>
467
</TABLE>
468
</body>
469
</html>