Subversion Repositories ALCASAR

Rev

Rev 1895 | Rev 2319 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
324 richard 1
<?php
508 richard 2
 
2006 raphael.pi 3
//update Filter-Id for protocol filtering
4
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id']))
5
{
6
	$upId = (int)$_POST['Filter-Proto'];
7
	$downId = (int)$_POST['Filter-Id'];
8
	$upId = $upId+$downId;
9
	$upId = str_pad($upId, 8, '0', STR_PAD_LEFT);
10
	$_POST['Filter-Id'] = $upId;
11
}
12
 
1805 clement.si 13
if (!isset ($create)) $create=0;
14
if (!isset ($login)) $login='';
15
if (!isset ($selected)) $selected=array();
16
 
17
/*if(!isset($selected))
18
{
19
	$selected['username'] = '';
20
	$selected['name'] = '';
21
	$selected['department'] = '';
22
	$selected['radius'] = '';
23
	$selected['Expiration'] = '';
24
	$selected['Max-All-Session'] = '';
25
	$selected['Session-Timeout'] = '';
26
	$selected['Max-Daily-Session'] = '';
27
	$selected['Max-Monthly-Session'] = '';
28
	$selected['Simultaneous-Use'] = '';
29
	$selected['Login-Time'] = '';
30
	$selected['ChilliSpot-Max-Input-Octets'] = '';
31
	$selected['ChilliSpot-Max-Total-Octets'] = '';
32
	$selected['ChilliSpot-Bandwidth-Max-Up'] = '';
33
	$selected['ChilliSpot-Bandwidth-Max-Down'] = '';
34
	$selected['ChilliSpot-Max-Output-Octets'] = '';
35
	$selected['WISPr-Redirection-URL'] = '';
36
}*/
37
 
508 richard 38
//Gestion de la langue
39
if (is_file("../lib/langues.php"))
40
	include("../lib/langues.php");
324 richard 41
require('/etc/freeradius-web/config.php');
42
 
1805 clement.si 43
if ($config['general_lib_type'] != 'sql'){
324 richard 44
	echo <<<EOM
45
<title>$l_title</title>
1840 raphael.pi 46
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
324 richard 47
<link rel="stylesheet" href="style.css">
48
</head>
49
<body>
50
<center>
51
<b>This page is only available if you are using sql as general library type</b>
52
</body>
53
</html>
54
EOM;
55
        exit();
56
}
57
 
58
require('../lib/attrshow.php');
59
require('../lib/defaults.php');
60
require("../lib/$config[general_lib_type]/group_info.php");
61
 
1805 clement.si 62
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){
324 richard 63
	$colspan=2;
64
	$show_ops=1;
1805 clement.si 65
	include_once("../lib/operators.php");
66
	if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
324 richard 67
}else{
68
	$show_ops = 0;
69
	$colspan=1;
70
}
71
?>
72
 
911 richard 73
<html><head><title>New group</title>
1840 raphael.pi 74
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
324 richard 75
<link rel="stylesheet" href="/css/style.css">
508 richard 76
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
509 richard 77
<script type="text/javascript" src="/js/epoch_classes.js"></script>
78
<script type="text/javascript" src="/js/fonctions.js"></script>
324 richard 79
<script language="javascript" type="text/javascript">
508 richard 80
/*Insertion du calendrier*/
1805 clement.si 81
	var dp_cal;
508 richard 82
window.onload = function () {
83
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
84
};
85
/*Fin calendrier*/
324 richard 86
</script>
87
</head>
88
<body>
89
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
911 richard 90
	<tr><th><? echo "$l_groups_managment"; ?></th></tr>
1805 clement.si 91
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
324 richard 92
height="2"></td></tr>
93
</TABLE>
94
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
95
	<tr bgcolor="#666666"><td>
96
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
97
		<tr><td valign="middle" align="left">
98
<center>
1377 richard 99
<table border=0 width=750 cellpadding=1 cellspacing=1>
324 richard 100
<tr valign=top>
101
<td width=340></td>
102
<td bgcolor="black" width=200>
103
	<table border=0 width=100% cellpadding=2 cellspacing=0>
104
	<tr bgcolor="#907030" align=right valign=top><th>
105
	<font color="white"><? echo "$l_group_create"; ?></font>
106
	</th></tr>
107
	</table>
108
</td></tr>
109
<tr bgcolor="black" valign=top><td colspan=2>
110
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
111
	<tr><td>
1805 clement.si 112
 
324 richard 113
<?php
114
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
115
	include("../lib/$config[general_lib_type]/group_info.php");
116
if ($create == 1){
117
	if ($group_exists != "no"){
118
		echo <<<EOM
907 richard 119
<b><i>$login</i> $l_already_exist</b>
324 richard 120
EOM;
121
	}
122
	else{
123
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
124
			include("../lib/$config[general_lib_type]/create_group.php");
125
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
126
			include("../lib/$config[general_lib_type]/group_info.php");
127
	}
128
}
1377 richard 129
if ($create == 0){
324 richard 130
?>
131
   <form name="newgroup" method=post>
132
      <input type=hidden name=create value="0">
133
      <input type=hidden name=show value="0">
134
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
135
<?php
136
	echo <<<EOM
137
	<tr>
508 richard 138
		<td class="etiquette" colspan=$colspan>
907 richard 139
		$l_created_groups
324 richard 140
		</td><td>
141
EOM;
142
		if (!isset($existing_groups))
907 richard 143
			echo "<b>$l_group_empty</b>\n";
324 richard 144
		else{
1805 clement.si 145
			echo "<select name=\"existing_groups\">\n";
324 richard 146
			foreach ($existing_groups as $group => $count)
147
				echo "<option value=\"$group\">$group\n";
148
			echo "</select>\n";
149
		}
150
	echo <<<EOM
151
		</td>
152
	</tr>
153
	<tr>
508 richard 154
		<td class="etiquette" colspan=$colspan>
907 richard 155
		$l_group_name
324 richard 156
		</td><td>
157
		<input type=text name="login" value="$login" size=35>
158
		</td>
159
	</tr>
160
	<tr>
508 richard 161
		<td class="etiquette" colspan=$colspan>
907 richard 162
		$l_group_members
324 richard 163
		</td><td>
1377 richard 164
		<textarea name=members cols="50" wrap="PHYSICAL" rows=5></textarea>
324 richard 165
		</td>
166
	</tr>
1805 clement.si 167
 
324 richard 168
EOM;
169
	foreach($show_attrs as $key => $desc){
170
		$name = $attrmap["$key"];
171
		if ($name == 'none')
172
			continue;
173
		$oper_name = $name . '_op';
1805 clement.si 174
		if(isset($item_vals["$key"][0]) && $item_vals["$key"][0] != ''){
175
			$val = $item_vals["$key"][0];
176
		} else if(isset($default_vals["$key"][0])) {
177
			$val = $default_vals["$key"][0];
178
		} else {
179
			$val = '';
180
		}
508 richard 181
		switch ($key)
182
		{
1805 clement.si 183
		// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
184
			case 'Simultaneous-Use' :
907 richard 185
				$advanced=1;
186
				$help_link="help/simultaneous_use_help.html";
187
				$desc=$l_simultaneous_use;
188
				break;
189
			case 'Max-All-Session' :
190
				$advanced=1;
191
				$help_link="help/max_all_session_help.html";
192
				$desc=$l_max_all_session;
193
				break;
1805 clement.si 194
			case 'Session-Timeout' :
907 richard 195
				$advanced=1;
196
				$help_link="help/session_timeout_help.html";
197
				$desc=$l_session_timeout;
198
				break;
199
			case 'Max-Daily-Session' :
200
				$advanced=1;
201
				$help_link="help/session_timeout_help.html";
202
				$desc=$l_daily_timeout;
203
				break;
204
			case 'Max-Monthly-Session' :
205
				$advanced=1;
206
				$help_link="help/session_timeout_help.html";
207
				$desc=$l_monthly_timeout;
208
				break;
1805 clement.si 209
			case 'Login-Time' :
907 richard 210
				$advanced=1;
211
				$help_link="help/login_time_help.html";
212
				$desc=$l_login_time;
213
				break;
214
			case 'Expiration' :
215
				$advanced=1;
216
				$help_link="help/expiration_help.html";
217
				$desc=$l_expiration;
218
				break;
508 richard 219
			case 'ChilliSpot-Max-Input-Octets' :
907 richard 220
				$advanced=1;
221
				$help_link="help/chillispot_max_input_octets_help.html";
222
				$desc=$l_max_input_octets;
223
				break;
508 richard 224
			case 'ChilliSpot-Max-Output-Octets' :
907 richard 225
				$advanced=1;
226
				$help_link="help/chillispot_max_output_octets_help.html";
227
				$desc=$l_max_output_octets;
228
				break;
508 richard 229
			case 'ChilliSpot-Max-Total-Octets' :
907 richard 230
				$advanced=1;
231
				$help_link="help/chillispot_max_total_octets_help.html";
232
				$desc=$l_max_total_octets;
233
				break;
508 richard 234
			case 'ChilliSpot-Bandwidth-Max-Up' :
907 richard 235
				$advanced=1;
236
				$help_link="help/chillispot_bandwidth_max_up_help.html";
237
				$desc=$l_max_bandwidth_up;
238
				break;
508 richard 239
			case 'ChilliSpot-Bandwidth-Max-Down' :
907 richard 240
				$advanced=1;
241
				$help_link="help/chillispot_bandwidth_max_down_help.html";
242
				$desc=$l_max_bandwidth_down;
243
				break;
508 richard 244
			case 'WISPr-Redirection-URL' :
907 richard 245
				$advanced=1;
246
				$help_link="help/wispr_redirection_url_help.html";
247
				$desc=$l_wispr_redirection;
508 richard 248
				break;
1377 richard 249
			case 'Filter-Id' :
250
				$advanced=1;
251
				$help_link="help/filtering_help.html";
252
				$desc=$l_filtering;
253
				break;
508 richard 254
			default:
255
				$advanced=1;
256
				break;
257
		}
907 richard 258
//		if ($advanced){
259
//			print <<<EOM
260
//			<tr>
261
//				<td class="etiquette">
262
//				$desc
263
//				</td>
264
//EOM;
265
//		}
266
		if ($show_ops && $advanced){
267
		print <<<EOM
508 richard 268
			<tr>
907 richard 269
			<td class="etiquette">
270
			<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>
271
			</td>
324 richard 272
EOM;
907 richard 273
			switch ($key){
1805 clement.si 274
				case 'Simultaneous-Use' :
890 stephane 275
				case 'Max-All-Session' :
508 richard 276
				case 'Max-Daily-Session' :
277
				case 'Max-Weekly-Session' :
278
				case 'Max-Monthly-Session' :
1805 clement.si 279
				case 'Login-Time' :
907 richard 280
				case 'Expiration' :
508 richard 281
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
282
					break;
1377 richard 283
				case 'Filter-Id' :
284
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
285
					break;
907 richard 286
				case 'Session-Timeout' :
508 richard 287
				case 'ChilliSpot-Max-Input-Octets' :
288
				case 'ChilliSpot-Max-Output-Octets' :
289
				case 'ChilliSpot-Max-Total-Octets' :
290
				case 'ChilliSpot-Bandwidth-Max-Up' :
291
				case 'ChilliSpot-Bandwidth-Max-Down' :
292
				case 'WISPr-Redirection-URL' :
293
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
294
					break;
295
				default :
296
					print <<<EOM
297
					<td>
907 richard 298
						<select name=$oper_name>
299
							<option $selected[$op_eq] value="=">=
300
							<option $selected[$op_set] value=":=">:=
301
							<option $selected[$op_add] value="+=">+=
302
							<option $selected[$op_eq2] value="==">==
303
							<option $selected[$op_ne] value="!=">!=
304
							<option $selected[$op_gt] value=">">&gt;
305
							<option $selected[$op_ge] value=">=">&gt;=
306
							<option $selected[$op_lt] value="<">&lt;
307
							<option $selected[$op_le] value="<=">&lt;=
308
							<option $selected[$op_regeq] value="=~">=~
309
							<option $selected[$op_regne] value="!~">!~
310
							<option $selected[$op_exst] value="=*">=*
311
							<option $selected[$op_nexst] value="!*">!*
312
						</select>
508 richard 313
					</td>
324 richard 314
EOM;
508 richard 315
					break;
316
			}
324 richard 317
		}
1805 clement.si 318
 
319
/*
320
Ajout du choix d'unité (pour les durées limites de session, journée et de mois)
508 richard 321
et d'un calendrier pour la date d'expiration
322
Sauf dans le cas de la visualisation
323
*/
324
	if ($advanced){echo "<td>";}
325
	if ($create==0 ){
326
		switch ($name){
327
			/*
1805 clement.si 328
			Choix de l'unité heures, minutes ou secondes
329
			pour les durées limites de session,journée et de mois
330
			*/
508 richard 331
			case 'Session-Timeout' :
332
			case 'Max-Daily-Session' :
333
			case 'Max-Monthly-Session' :
907 richard 334
			case 'Max-All-Session' :
508 richard 335
				/*valeur d'origine de durée limite */
336
				echo"<input id =\"$name\" type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
337
				/* Choix d'unité*/
338
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
339
						<option value=\"s\" selected>s</option>
340
						<option value=\"m\" >m</option>
341
						<option value=\"H\" >H</option>
342
					</select>";
343
				break;
344
			case 'Expiration' :
345
				/*Ajout du calendrier pour choisir la date*/
346
				echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
347
				break;
1377 richard 348
			case 'Filter-Id' :
349
				echo "<select name='Filter-Id'>";
1895 raphael.pi 350
				echo "<option value=\"00000000\">$l_filtering_none</option>";
1377 richard 351
				echo "<option value=\"00000001\">$l_filtering_havp</option>";
352
				echo "<option value=\"00000011\">$l_filtering_havp_bl</option>";
353
				echo "<option value=\"00000101\">$l_filtering_havp_wl</option>";
354
				echo "</select>";
355
				break;
508 richard 356
			default :
357
				if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
358
				break;
359
			}
324 richard 360
	}
508 richard 361
/*fin Ajout*/
362
}
2006 raphael.pi 363
 
364
/*protocole filter*/
365
print <<<EOM
366
<tr>
367
	<td class="etiquette" colspan=$colspan>
368
		$l_proto
369
	</td>
370
	<td width=20>
371
EOM;
372
/*Choix de la langue du ticket d'impression*/
373
echo" <select name='Filter-Proto'>
374
		<option value=\"00000000\" selected>$l_proto_0</option>
375
		<option value=\"10000000\" >$l_proto_1</option>
376
		<option value=\"01000000\" >$l_proto_2</option>
377
		<option value=\"00100000\" >$l_proto_3</option>
378
	</select></td></tr>";
379
 
380
 
324 richard 381
echo "</table><BR>";
1377 richard 382
}
324 richard 383
if ($create == 1)
1377 richard 384
	echo "<br/><center><a href=\"group_admin.php?login=$login\">$l_show_profile</a></center>";
385
else
907 richard 386
	echo "<input type=submit class=button value=\"$l_create\" OnClick=\"return formControl('newgroup');\">";
324 richard 387
?>
388
<br><br>
389
</form>
390
	</td></tr>
391
</table>
392
</tr>
393
</table>
394
</TD></TR>
395
</TABLE>
396
</td></tr>
397
</TABLE>
398
</body>
399
</html>