Subversion Repositories ALCASAR

Rev

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

Rev 40 Rev 113
1
<?php
1
<?php
2
# Choice of language
2
# Choice of language
3
$Language = 'en';
3
$Language = 'en';
4
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
4
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])){
5
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
5
  $Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
6
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
6
  $Language = strtolower(substr(chop($Langue[0]),0,2)); }
7
if($Language == 'fr'){
7
if($Language == 'fr'){
8
  $l_title = "Cr&eacute;ation d'un groupe";
8
  $l_title = "Cr&eacute;ation d'un groupe";
9
  $l_frame_top = "Gestion des groupes";
9
  $l_frame_top = "Gestion des groupes";
10
  $l_frame = "Gestion des groupes";
10
  $l_frame = "Gestion des groupes";
11
  $l_group_create = "Cr&eacute;er un groupe";
11
  $l_group_create = "Cr&eacute;er un groupe";
12
}
12
}
13
else {
13
else {
14
  $l_title = "Create a group";
14
  $l_title = "Create a group";
15
  $l_frame_top = "Groups admin";
15
  $l_frame_top = "Groups admin";
16
  $l_frame = "Groups admin";
16
  $l_frame = "Groups admin";
17
  $l_group_create = "Create a group";
17
  $l_group_create = "Create a group";
18
}
18
}
19
require('/etc/freeradius-web/config.php');
19
require('/etc/freeradius-web/config.php');
20
if ($show == 1){
20
if ($show == 1){
21
	header("Location: group_admin.php?login=$login");
21
	header("Location: group_admin.php?login=$login");
22
	exit;
22
	exit;
23
}
23
}
24
 
24
 
25
if ($config[general_lib_type] != 'sql'){
25
if ($config[general_lib_type] != 'sql'){
26
	echo <<<EOM
26
	echo <<<EOM
27
<title>$l_title</title>
27
<title>$l_title</title>
28
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
28
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
29
<link rel="stylesheet" href="style.css">
29
<link rel="stylesheet" href="style.css">
30
</head>
30
</head>
31
<body>
31
<body>
32
<center>
32
<center>
33
<b>This page is only available if you are using sql as general library type</b>
33
<b>This page is only available if you are using sql as general library type</b>
34
</body>
34
</body>
35
</html>
35
</html>
36
EOM;
36
EOM;
37
        exit();
37
        exit();
38
}
38
}
39
 
39
 
40
require('../lib/attrshow.php');
40
require('../lib/attrshow.php');
41
require('../lib/defaults.php');
41
require('../lib/defaults.php');
42
require("../lib/$config[general_lib_type]/group_info.php");
42
require("../lib/$config[general_lib_type]/group_info.php");
43
 
43
 
44
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
44
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
45
	$colspan=2;
45
	$colspan=2;
46
	$show_ops=1;
46
	$show_ops=1;
47
}else{
47
}else{
48
	$show_ops = 0;
48
	$show_ops = 0;
49
	$colspan=1;
49
	$colspan=1;
50
}
50
}
51
echo "<html><head><title>$l_title</title>";
51
echo "<html><head><title>$l_title</title>";
52
 
52
 
53
?>
53
?>
54
 
54
 
55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
56
<link rel="stylesheet" href="/css/style.css">
56
<link rel="stylesheet" href="/css/style.css">
-
 
57
<script language="javascript" type="text/javascript">
-
 
58
function formControl(){
-
 
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;
-
 
63
	} else {
-
 
64
		alert("Nom du groupe invalide.");//non internationnalisé
-
 
65
		return false;
-
 
66
	}
-
 
67
}
-
 
68
</script>
57
</head>
69
</head>
58
<body>
70
<body>
59
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
71
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
60
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
72
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
61
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
73
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
62
height="2"></td></tr>
74
height="2"></td></tr>
63
</TABLE>
75
</TABLE>
64
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
76
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
65
	<tr bgcolor="#666666"><td>
77
	<tr bgcolor="#666666"><td>
66
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
78
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
67
		<tr><td valign="middle" align="left">
79
		<tr><td valign="middle" align="left">
68
<center>
80
<center>
69
<table border=0 width=550 cellpadding=1 cellspacing=1>
81
<table border=0 width=550 cellpadding=1 cellspacing=1>
70
<tr valign=top>
82
<tr valign=top>
71
<td width=340></td>
83
<td width=340></td>
72
<td bgcolor="black" width=200>
84
<td bgcolor="black" width=200>
73
	<table border=0 width=100% cellpadding=2 cellspacing=0>
85
	<table border=0 width=100% cellpadding=2 cellspacing=0>
74
	<tr bgcolor="#907030" align=right valign=top><th>
86
	<tr bgcolor="#907030" align=right valign=top><th>
75
	<font color="white"><? echo "$l_group_create"; ?></font>
87
	<font color="white"><? echo "$l_group_create"; ?></font>
76
	</th></tr>
88
	</th></tr>
77
	</table>
89
	</table>
78
</td></tr>
90
</td></tr>
79
<tr bgcolor="black" valign=top><td colspan=2>
91
<tr bgcolor="black" valign=top><td colspan=2>
80
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
92
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
81
	<tr><td>
93
	<tr><td>
82
   
94
   
83
<?php
95
<?php
84
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
96
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
85
	include("../lib/$config[general_lib_type]/group_info.php");
97
	include("../lib/$config[general_lib_type]/group_info.php");
86
if ($create == 1){
98
if ($create == 1){
87
	if ($group_exists != "no"){
99
	if ($group_exists != "no"){
88
		echo <<<EOM
100
		echo <<<EOM
89
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
101
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
90
EOM;
102
EOM;
91
	}
103
	}
92
	else{
104
	else{
93
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
105
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
94
			include("../lib/$config[general_lib_type]/create_group.php");
106
			include("../lib/$config[general_lib_type]/create_group.php");
95
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
107
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
96
			include("../lib/$config[general_lib_type]/group_info.php");
108
			include("../lib/$config[general_lib_type]/group_info.php");
97
	}
109
	}
98
}
110
}
99
?>
111
?>
100
   <form method=post>
112
   <form name="newgroup" method=post>
101
      <input type=hidden name=create value="0">
113
      <input type=hidden name=create value="0">
102
      <input type=hidden name=show value="0">
114
      <input type=hidden name=show value="0">
103
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
115
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
104
<?php
116
<?php
105
	echo <<<EOM
117
	echo <<<EOM
106
	<tr>
118
	<tr>
107
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
119
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
108
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
120
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
109
		</td><td>
121
		</td><td>
110
EOM;
122
EOM;
111
		if (!isset($existing_groups))
123
		if (!isset($existing_groups))
112
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
124
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
113
		else{
125
		else{
114
			echo "<select name=\"existing_groups\">\n";	
126
			echo "<select name=\"existing_groups\">\n";	
115
			foreach ($existing_groups as $group => $count)
127
			foreach ($existing_groups as $group => $count)
116
				echo "<option value=\"$group\">$group\n";
128
				echo "<option value=\"$group\">$group\n";
117
			echo "</select>\n";
129
			echo "</select>\n";
118
		}
130
		}
119
	echo <<<EOM
131
	echo <<<EOM
120
		</td>
132
		</td>
121
	</tr>
133
	</tr>
122
	<tr>
134
	<tr>
123
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
135
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
124
		Nom du groupe
136
		Nom du groupe
125
		</td><td>
137
		</td><td>
126
		<input type=text name="login" value="$login" size=35>
138
		<input type=text name="login" value="$login" size=35>
127
		</td>
139
		</td>
128
	</tr>
140
	</tr>
129
	<tr>
141
	<tr>
130
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
142
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
131
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
143
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
132
		</td><td>
144
		</td><td>
133
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
145
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
134
		</td>
146
		</td>
135
	</tr>
147
	</tr>
136
		
148
		
137
EOM;
149
EOM;
138
	foreach($show_attrs as $key => $desc){
150
	foreach($show_attrs as $key => $desc){
139
		$name = $attrmap["$key"];
151
		$name = $attrmap["$key"];
140
		if ($name == 'none')
152
		if ($name == 'none')
141
			continue;
153
			continue;
142
		$oper_name = $name . '_op';
154
		$oper_name = $name . '_op';
143
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
155
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
144
		print <<<EOM
156
		print <<<EOM
145
<tr>
157
<tr>
146
<td align=right bgcolor="#d0ddb0">
158
<td align=right bgcolor="#d0ddb0">
147
$desc
159
$desc
148
</td>
160
</td>
149
EOM;
161
EOM;
150
 
162
 
151
		if ($show_ops){
163
		if ($show_ops){
152
				switch ($key)
164
				switch ($key)
153
					{
165
					{
154
					case 'Simultaneous-Use' : 
166
					case 'Simultaneous-Use' : 
155
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
167
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
156
						break;
168
						break;
157
					case 'Login-Time' : 
169
					case 'Login-Time' : 
158
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
170
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
159
						break;
171
						break;
160
					case 'Expiration' :
172
					case 'Expiration' :
161
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
173
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
162
						break;
174
						break;
163
					case 'Session-Timeout' :
175
					case 'Session-Timeout' :
164
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
176
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
165
						break;
177
						break;
166
					case 'Max-Daily-Session' :
178
					case 'Max-Daily-Session' :
167
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
179
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
168
						break;
180
						break;
169
					case 'Max-Weekly-Session' :
181
					case 'Max-Weekly-Session' :
170
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
182
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
171
						break;
183
						break;
172
					case 'Max-Monthly-Session' :
184
					case 'Max-Monthly-Session' :
173
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
185
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
174
						break;
186
						break;
-
 
187
					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' :
-
 
191
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
192
						break;
-
 
193
					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' :
-
 
197
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
198
						break;
-
 
199
					case 'ChilliSpot-Bandwidth-Max-Down' :
-
 
200
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
201
						break;
-
 
202
					case 'WISPr-Redirection-URL' :
-
 
203
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
-
 
204
						break;
175
					default :
205
					default :
176
						print <<<EOM
206
						print <<<EOM
177
<td>
207
<td>
178
<select name=$oper_name>
208
<select name=$oper_name>
179
<option $selected[$op_eq] value="=">=
209
<option $selected[$op_eq] value="=">=
180
<option $selected[$op_set] value=":=">:=
210
<option $selected[$op_set] value=":=">:=
181
<option $selected[$op_add] value="+=">+=
211
<option $selected[$op_add] value="+=">+=
182
<option $selected[$op_eq2] value="==">==
212
<option $selected[$op_eq2] value="==">==
183
<option $selected[$op_ne] value="!=">!=
213
<option $selected[$op_ne] value="!=">!=
184
<option $selected[$op_gt] value=">">&gt;
214
<option $selected[$op_gt] value=">">&gt;
185
<option $selected[$op_ge] value=">=">&gt;=
215
<option $selected[$op_ge] value=">=">&gt;=
186
<option $selected[$op_lt] value="<">&lt;
216
<option $selected[$op_lt] value="<">&lt;
187
<option $selected[$op_le] value="<=">&lt;=
217
<option $selected[$op_le] value="<=">&lt;=
188
<option $selected[$op_regeq] value="=~">=~
218
<option $selected[$op_regeq] value="=~">=~
189
<option $selected[$op_regne] value="!~">!~
219
<option $selected[$op_regne] value="!~">!~
190
<option $selected[$op_exst] value="=*">=*
220
<option $selected[$op_exst] value="=*">=*
191
<option $selected[$op_nexst] value="!*">!*
221
<option $selected[$op_nexst] value="!*">!*
192
</select>
222
</select>
193
</td>
223
</td>
194
EOM;
224
EOM;
195
						break;
225
						break;
196
					}
226
					}
197
		}
227
		}
198
		print <<<EOM
228
		print <<<EOM
199
<td>
229
<td>
200
<input type=text name="$name" value="$val" size=35>
230
<input type=text name="$name" value="$val" size=35>
201
</td>
231
</td>
202
</tr>
232
</tr>
203
EOM;
233
EOM;
204
	}
234
	}
205
echo "</table><BR>";
235
echo "</table><BR>";
206
if ($create == 1)
236
if ($create == 1)
207
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
237
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
208
	else
238
	else
209
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"this.form.create.value=1\">";
239
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl();\">";
210
?>
240
?>
211
<br><br>
241
<br><br>
212
</form>
242
</form>
213
	</td></tr>
243
	</td></tr>
214
</table>
244
</table>
215
</tr>
245
</tr>
216
</table>
246
</table>
217
</TD></TR>
247
</TD></TR>
218
</TABLE>
248
</TABLE>
219
</td></tr>
249
</td></tr>
220
</TABLE>
250
</TABLE>
221
</body>
251
</body>
222
</html>
252
</html>
223
 
253