Subversion Repositories ALCASAR

Rev

Rev 2512 | Rev 2565 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

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