Subversion Repositories ALCASAR

Rev

Rev 324 | Rev 509 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 324 Rev 508
1
<?php
1
<?php
2
# Choice of language
-
 
3
$Language = 'en';
-
 
4
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
-
 
5
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
-
 
6
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
-
 
7
if($Language == 'fr'){
-
 
8
  $l_title = "Cr&eacute;ation d'un groupe";
-
 
9
  $l_frame_top = "Gestion des groupes";
-
 
10
  $l_frame = "Gestion des groupes";
-
 
11
  $l_group_create = "Cr&eacute;er un groupe";
-
 
12
}
2
 
13
else {
-
 
14
  $l_title = "Create a group";
3
//Gestion de la langue
15
  $l_frame_top = "Groups admin";
4
$origine='group_new';
16
  $l_frame = "Groups admin";
5
if (is_file("../lib/langues.php"))
17
  $l_group_create = "Create a group";
6
	include("../lib/langues.php");
18
}
7
	
19
require('/etc/freeradius-web/config.php');
8
require('/etc/freeradius-web/config.php');
20
if ($show == 1){
9
if ($show == 1){
21
	header("Location: group_admin.php?login=$login");
10
	header("Location: group_admin.php?login=$login");
22
	exit;
11
	exit;
23
}
12
}
24
 
13
 
25
if ($config[general_lib_type] != 'sql'){
14
if ($config[general_lib_type] != 'sql'){
26
	echo <<<EOM
15
	echo <<<EOM
27
<title>$l_title</title>
16
<title>$l_title</title>
28
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
17
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
29
<link rel="stylesheet" href="style.css">
18
<link rel="stylesheet" href="style.css">
30
</head>
19
</head>
31
<body>
20
<body>
32
<center>
21
<center>
33
<b>This page is only available if you are using sql as general library type</b>
22
<b>This page is only available if you are using sql as general library type</b>
34
</body>
23
</body>
35
</html>
24
</html>
36
EOM;
25
EOM;
37
        exit();
26
        exit();
38
}
27
}
39
 
28
 
40
require('../lib/attrshow.php');
29
require('../lib/attrshow.php');
41
require('../lib/defaults.php');
30
require('../lib/defaults.php');
42
require("../lib/$config[general_lib_type]/group_info.php");
31
require("../lib/$config[general_lib_type]/group_info.php");
43
 
32
 
44
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
33
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
45
	$colspan=2;
34
	$colspan=2;
46
	$show_ops=1;
35
	$show_ops=1;
47
}else{
36
}else{
48
	$show_ops = 0;
37
	$show_ops = 0;
49
	$colspan=1;
38
	$colspan=1;
50
}
39
}
51
echo "<html><head><title>$l_title</title>";
40
echo "<html><head><title>$l_title</title>";
52
 
41
 
53
?>
42
?>
54
 
43
 
55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
44
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
56
<link rel="stylesheet" href="/css/style.css">
45
<link rel="stylesheet" href="/css/style.css">
-
 
46
<link rel="stylesheet" type="text/css" href="/css/epoch_styles.css" />
-
 
47
<script type="text/javascript" src="/javascript/epoch_classes.js"></script>
-
 
48
<script type="text/javascript" src="/javascript/fonctions.js"></script>
57
<script language="javascript" type="text/javascript">
49
<script language="javascript" type="text/javascript">
58
function formControl(){
50
/*Insertion du calendrier*/
59
	var myregex = /[\S]+/gi; //un ou plusieurs caractères non blanc" (tous les caractères sauf espace, retour chariot, tabulation, saut de ligne, saut de page).
-
 
60
	if (myregex.test(document.newgroup.login.value)){
-
 
61
		document.newgroup.create.value=1;
-
 
62
		return true;
51
	var dp_cal;      
63
	} else {
52
window.onload = function () {
64
		alert("Nom du groupe invalide.");//non internationnalisé
53
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
65
		return false;
-
 
66
	}
-
 
67
}
54
};
-
 
55
/*Fin calendrier*/
68
</script>
56
</script>
69
</head>
57
</head>
70
<body>
58
<body>
71
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
59
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
72
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
60
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
73
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
61
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
74
height="2"></td></tr>
62
height="2"></td></tr>
75
</TABLE>
63
</TABLE>
76
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
64
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
77
	<tr bgcolor="#666666"><td>
65
	<tr bgcolor="#666666"><td>
78
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
66
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
79
		<tr><td valign="middle" align="left">
67
		<tr><td valign="middle" align="left">
80
<center>
68
<center>
81
<table border=0 width=550 cellpadding=1 cellspacing=1>
69
<table border=0 width=550 cellpadding=1 cellspacing=1>
82
<tr valign=top>
70
<tr valign=top>
83
<td width=340></td>
71
<td width=340></td>
84
<td bgcolor="black" width=200>
72
<td bgcolor="black" width=200>
85
	<table border=0 width=100% cellpadding=2 cellspacing=0>
73
	<table border=0 width=100% cellpadding=2 cellspacing=0>
86
	<tr bgcolor="#907030" align=right valign=top><th>
74
	<tr bgcolor="#907030" align=right valign=top><th>
87
	<font color="white"><? echo "$l_group_create"; ?></font>
75
	<font color="white"><? echo "$l_group_create"; ?></font>
88
	</th></tr>
76
	</th></tr>
89
	</table>
77
	</table>
90
</td></tr>
78
</td></tr>
91
<tr bgcolor="black" valign=top><td colspan=2>
79
<tr bgcolor="black" valign=top><td colspan=2>
92
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
80
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
93
	<tr><td>
81
	<tr><td>
94
   
82
   
95
<?php
83
<?php
96
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
84
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
97
	include("../lib/$config[general_lib_type]/group_info.php");
85
	include("../lib/$config[general_lib_type]/group_info.php");
98
if ($create == 1){
86
if ($create == 1){
99
	if ($group_exists != "no"){
87
	if ($group_exists != "no"){
100
		echo <<<EOM
88
		echo <<<EOM
101
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
89
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
102
EOM;
90
EOM;
103
	}
91
	}
104
	else{
92
	else{
105
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
93
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
106
			include("../lib/$config[general_lib_type]/create_group.php");
94
			include("../lib/$config[general_lib_type]/create_group.php");
107
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
95
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
108
			include("../lib/$config[general_lib_type]/group_info.php");
96
			include("../lib/$config[general_lib_type]/group_info.php");
109
	}
97
	}
110
}
98
}
111
?>
99
?>
112
   <form name="newgroup" method=post>
100
   <form name="newgroup" method=post>
113
      <input type=hidden name=create value="0">
101
      <input type=hidden name=create value="0">
114
      <input type=hidden name=show value="0">
102
      <input type=hidden name=show value="0">
115
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
103
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
116
<?php
104
<?php
117
	echo <<<EOM
105
	echo <<<EOM
118
	<tr>
106
	<tr>
119
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
107
		<td class="etiquette" colspan=$colspan>
120
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
108
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
121
		</td><td>
109
		</td><td>
122
EOM;
110
EOM;
123
		if (!isset($existing_groups))
111
		if (!isset($existing_groups))
124
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
112
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
125
		else{
113
		else{
126
			echo "<select name=\"existing_groups\">\n";	
114
			echo "<select name=\"existing_groups\">\n";	
127
			foreach ($existing_groups as $group => $count)
115
			foreach ($existing_groups as $group => $count)
128
				echo "<option value=\"$group\">$group\n";
116
				echo "<option value=\"$group\">$group\n";
129
			echo "</select>\n";
117
			echo "</select>\n";
130
		}
118
		}
131
	echo <<<EOM
119
	echo <<<EOM
132
		</td>
120
		</td>
133
	</tr>
121
	</tr>
134
	<tr>
122
	<tr>
135
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
123
		<td class="etiquette" colspan=$colspan>
136
		Nom du groupe
124
		Nom du groupe
137
		</td><td>
125
		</td><td>
138
		<input type=text name="login" value="$login" size=35>
126
		<input type=text name="login" value="$login" size=35>
139
		</td>
127
		</td>
140
	</tr>
128
	</tr>
141
	<tr>
129
	<tr>
142
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
130
		<td class="etiquette" colspan=$colspan>
143
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
131
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
144
		</td><td>
132
		</td><td>
145
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
133
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
146
		</td>
134
		</td>
147
	</tr>
135
	</tr>
148
		
136
		
149
EOM;
137
EOM;
150
	foreach($show_attrs as $key => $desc){
138
	foreach($show_attrs as $key => $desc){
151
		$name = $attrmap["$key"];
139
		$name = $attrmap["$key"];
152
		if ($name == 'none')
140
		if ($name == 'none')
153
			continue;
141
			continue;
154
		$oper_name = $name . '_op';
142
		$oper_name = $name . '_op';
155
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
143
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
156
		print <<<EOM
-
 
157
<tr>
144
		/*
158
<td align=right bgcolor="#d0ddb0">
145
		Gestion d'un mode simple ou d'un mode avancé
159
$desc
-
 
160
</td>
-
 
-
 
146
		Définition du mode avancé les attributs concernant la gestion des octets, de la bande passante
161
EOM;
147
		*/
162
 
-
 
163
		if ($show_ops){
-
 
164
				switch ($key)
148
		switch ($key)
165
					{
149
		{
166
					case 'Simultaneous-Use' : 
-
 
167
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
168
						break;
-
 
169
					case 'Login-Time' : 
-
 
170
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
171
						break;
-
 
172
					case 'Expiration' :
-
 
173
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
174
						break;
-
 
175
					case 'Session-Timeout' :
-
 
176
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
177
						break;
-
 
178
					case 'Max-Daily-Session' :
-
 
179
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
180
						break;
-
 
181
					case 'Max-Weekly-Session' :
-
 
182
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
183
						break;
-
 
184
					case 'Max-Monthly-Session' :
-
 
185
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
186
						break;
-
 
187
					case 'ChilliSpot-Max-Input-Octets' :
150
			case 'ChilliSpot-Max-Input-Octets' :
188
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
189
						break;
-
 
190
					case 'ChilliSpot-Max-Output-Octets' :
151
			case 'ChilliSpot-Max-Output-Octets' :
191
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
192
						break;
-
 
193
					case 'ChilliSpot-Max-Total-Octets' :
152
			case 'ChilliSpot-Max-Total-Octets' :
194
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
195
						break;
-
 
196
					case 'ChilliSpot-Bandwidth-Max-Up' :
153
			case 'ChilliSpot-Bandwidth-Max-Up' :
197
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
198
						break;
-
 
199
					case 'ChilliSpot-Bandwidth-Max-Down' :
154
			case 'ChilliSpot-Bandwidth-Max-Down' :
200
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
201
						break;
-
 
202
					case 'WISPr-Redirection-URL' :
155
			case 'WISPr-Redirection-URL' :
203
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
156
				$advanced=0; //<-- Valeur à mettre à '1' pour avoir toute les fonctionnalités
204
						break;
157
				break;
205
					default :
158
			default:
206
						print <<<EOM
159
				$advanced=1;
-
 
160
				break;
207
<td>
161
		}
208
<select name=$oper_name>
162
		if ($advanced){
209
<option $selected[$op_eq] value="=">=
163
			print <<<EOM
210
<option $selected[$op_set] value=":=">:=
-
 
211
<option $selected[$op_add] value="+=">+=
-
 
212
<option $selected[$op_eq2] value="==">==
-
 
213
<option $selected[$op_ne] value="!=">!=
-
 
214
<option $selected[$op_gt] value=">">&gt;
-
 
215
<option $selected[$op_ge] value=">=">&gt;=
-
 
216
<option $selected[$op_lt] value="<">&lt;
-
 
217
<option $selected[$op_le] value="<=">&lt;=
-
 
218
<option $selected[$op_regeq] value="=~">=~
-
 
219
<option $selected[$op_regne] value="!~">!~
164
			<tr>
220
<option $selected[$op_exst] value="=*">=*
165
				<td class="etiquette">
221
<option $selected[$op_nexst] value="!*">!*
-
 
222
</select>
166
				$desc
223
</td>
167
				</td>
224
EOM;
168
EOM;
225
						break;
-
 
226
					}
-
 
227
		}
169
		}
-
 
170
		if ($show_ops && $advanced){
-
 
171
			switch ($key)
-
 
172
			{
-
 
173
				case 'Simultaneous-Use' : 
-
 
174
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
175
					break;
-
 
176
				case 'Login-Time' : 
-
 
177
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
178
					break;
-
 
179
				case 'Expiration' :
-
 
180
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
181
					break;
-
 
182
				case 'Session-Timeout' :
-
 
183
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
184
					break;
-
 
185
				case 'Max-Daily-Session' :
-
 
186
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
187
					break;
-
 
188
				case 'Max-Weekly-Session' :
-
 
189
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
190
					break;
-
 
191
				case 'Max-Monthly-Session' :
-
 
192
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
-
 
193
					break;
-
 
194
				case 'ChilliSpot-Max-Input-Octets' :
-
 
195
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
196
					break;
-
 
197
				case 'ChilliSpot-Max-Output-Octets' :
-
 
198
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
199
					break;
-
 
200
				case 'ChilliSpot-Max-Total-Octets' :
-
 
201
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
202
					break;
-
 
203
				case 'ChilliSpot-Bandwidth-Max-Up' :
-
 
204
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
205
					break;
-
 
206
				case 'ChilliSpot-Bandwidth-Max-Down' :
-
 
207
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
208
					break;
-
 
209
				case 'WISPr-Redirection-URL' :
-
 
210
					echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
211
					break;
-
 
212
				default :
228
		print <<<EOM
213
					print <<<EOM
229
<td>
214
					<td>
-
 
215
					<select name=$oper_name>
-
 
216
					<option $selected[$op_eq] value="=">=
-
 
217
					<option $selected[$op_set] value=":=">:=
-
 
218
					<option $selected[$op_add] value="+=">+=
-
 
219
					<option $selected[$op_eq2] value="==">==
-
 
220
					<option $selected[$op_ne] value="!=">!=
-
 
221
					<option $selected[$op_gt] value=">">&gt;
-
 
222
					<option $selected[$op_ge] value=">=">&gt;=
-
 
223
					<option $selected[$op_lt] value="<">&lt;
230
<input type=text name="$name" value="$val" size=35>
224
					<option $selected[$op_le] value="<=">&lt;=
-
 
225
					<option $selected[$op_regeq] value="=~">=~
-
 
226
					<option $selected[$op_regne] value="!~">!~
-
 
227
					<option $selected[$op_exst] value="=*">=*
-
 
228
					<option $selected[$op_nexst] value="!*">!*
231
</td>
229
					</select>
232
</tr>
230
					</td>
233
EOM;
231
EOM;
-
 
232
					break;
-
 
233
			}
-
 
234
		}
-
 
235
/* 
-
 
236
Ajout du choix d'unité (pour les durées limites de session, journée et de mois) 
-
 
237
et d'un calendrier pour la date d'expiration
-
 
238
Sauf dans le cas de la visualisation
-
 
239
*/
-
 
240
	if ($advanced){echo "<td>";}
-
 
241
	if ($create==0 ){
-
 
242
		switch ($name){
-
 
243
			/*
-
 
244
			Choix de l'unité heures, minutes ou secondes 
-
 
245
			pour les durées limites de session,journée et de mois	
-
 
246
			*/	
-
 
247
			case 'Session-Timeout' :
-
 
248
			case 'Max-Daily-Session' :
-
 
249
			case 'Max-Monthly-Session' :
-
 
250
				/*valeur d'origine de durée limite */
-
 
251
				echo"<input id =\"$name\" type=text name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=28>";
-
 
252
				/* Choix d'unité*/
-
 
253
				echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newgroup')\">
-
 
254
						<option value=\"s\" selected>s</option>
-
 
255
						<option value=\"m\" >m</option>
-
 
256
						<option value=\"H\" >H</option>
-
 
257
					</select>";
-
 
258
				break;
-
 
259
			case 'Expiration' :
-
 
260
				/*Ajout du calendrier pour choisir la date*/
-
 
261
				echo"<input id=\"popup_container\" type=text name=\"$name\" value=\"$val\" size=35>";
-
 
262
				break;
-
 
263
			default :
-
 
264
				if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
-
 
265
				break;
-
 
266
			}
-
 
267
	}else{
-
 
268
		/*Pas de gestion de remplissage lors de la visualisation*/
-
 
269
		if ($advanced) echo"<input type=text name=\"$name\" value=\"$val\" size=35>";
234
	}
270
	}
-
 
271
/*fin Ajout*/
-
 
272
}
235
echo "</table><BR>";
273
echo "</table><BR>";
236
if ($create == 1)
274
if ($create == 1)
237
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
275
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
238
	else
276
	else
239
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl();\">";
277
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl('newgroup');\">";
240
?>
278
?>
241
<br><br>
279
<br><br>
242
</form>
280
</form>
243
	</td></tr>
281
	</td></tr>
244
</table>
282
</table>
245
</tr>
283
</tr>
246
</table>
284
</table>
247
</TD></TR>
285
</TD></TR>
248
</TABLE>
286
</TABLE>
249
</td></tr>
287
</td></tr>
250
</TABLE>
288
</TABLE>
251
</body>
289
</body>
252
</html>
290
</html>
253
 
291