Subversion Repositories ALCASAR

Rev

Rev 508 | Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
324 richard 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
}
13
else {
14
  $l_title = "Create a group";
15
  $l_frame_top = "Groups admin";
16
  $l_frame = "Groups admin";
17
  $l_group_create = "Create a group";
18
}
19
require('/etc/freeradius-web/config.php');
20
if ($show == 1){
21
	header("Location: group_admin.php?login=$login");
22
	exit;
23
}
24
 
25
if ($config[general_lib_type] != 'sql'){
26
	echo <<<EOM
27
<title>$l_title</title>
28
<meta http-equiv="Content-Type" content="text/html; charset=$config[general_charset]">
29
<link rel="stylesheet" href="style.css">
30
</head>
31
<body>
32
<center>
33
<b>This page is only available if you are using sql as general library type</b>
34
</body>
35
</html>
36
EOM;
37
        exit();
38
}
39
 
40
require('../lib/attrshow.php');
41
require('../lib/defaults.php');
42
require("../lib/$config[general_lib_type]/group_info.php");
43
 
44
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
45
	$colspan=2;
46
	$show_ops=1;
47
}else{
48
	$show_ops = 0;
49
	$colspan=1;
50
}
51
echo "<html><head><title>$l_title</title>";
52
 
53
?>
54
 
55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
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>
69
</head>
70
<body>
71
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
72
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
73
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
74
height="2"></td></tr>
75
</TABLE>
76
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
77
	<tr bgcolor="#666666"><td>
78
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
79
		<tr><td valign="middle" align="left">
80
<center>
81
<table border=0 width=550 cellpadding=1 cellspacing=1>
82
<tr valign=top>
83
<td width=340></td>
84
<td bgcolor="black" width=200>
85
	<table border=0 width=100% cellpadding=2 cellspacing=0>
86
	<tr bgcolor="#907030" align=right valign=top><th>
87
	<font color="white"><? echo "$l_group_create"; ?></font>
88
	</th></tr>
89
	</table>
90
</td></tr>
91
<tr bgcolor="black" valign=top><td colspan=2>
92
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
93
	<tr><td>
94
 
95
<?php
96
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
97
	include("../lib/$config[general_lib_type]/group_info.php");
98
if ($create == 1){
99
	if ($group_exists != "no"){
100
		echo <<<EOM
101
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
102
EOM;
103
	}
104
	else{
105
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
106
			include("../lib/$config[general_lib_type]/create_group.php");
107
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
108
			include("../lib/$config[general_lib_type]/group_info.php");
109
	}
110
}
111
?>
112
   <form name="newgroup" method=post>
113
      <input type=hidden name=create value="0">
114
      <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>
116
<?php
117
	echo <<<EOM
118
	<tr>
119
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
120
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
121
		</td><td>
122
EOM;
123
		if (!isset($existing_groups))
124
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
125
		else{
126
			echo "<select name=\"existing_groups\">\n";	
127
			foreach ($existing_groups as $group => $count)
128
				echo "<option value=\"$group\">$group\n";
129
			echo "</select>\n";
130
		}
131
	echo <<<EOM
132
		</td>
133
	</tr>
134
	<tr>
135
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
136
		Nom du groupe
137
		</td><td>
138
		<input type=text name="login" value="$login" size=35>
139
		</td>
140
	</tr>
141
	<tr>
142
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
143
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
144
		</td><td>
145
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
146
		</td>
147
	</tr>
148
 
149
EOM;
150
	foreach($show_attrs as $key => $desc){
151
		$name = $attrmap["$key"];
152
		if ($name == 'none')
153
			continue;
154
		$oper_name = $name . '_op';
155
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
156
		print <<<EOM
157
<tr>
158
<td align=right bgcolor="#d0ddb0">
159
$desc
160
</td>
161
EOM;
162
 
163
		if ($show_ops){
164
				switch ($key)
165
					{
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' :
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;
205
					default :
206
						print <<<EOM
207
<td>
208
<select name=$oper_name>
209
<option $selected[$op_eq] value="=">=
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="!~">!~
220
<option $selected[$op_exst] value="=*">=*
221
<option $selected[$op_nexst] value="!*">!*
222
</select>
223
</td>
224
EOM;
225
						break;
226
					}
227
		}
228
		print <<<EOM
229
<td>
230
<input type=text name="$name" value="$val" size=35>
231
</td>
232
</tr>
233
EOM;
234
	}
235
echo "</table><BR>";
236
if ($create == 1)
237
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
238
	else
239
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"return formControl();\">";
240
?>
241
<br><br>
242
</form>
243
	</td></tr>
244
</table>
245
</tr>
246
</table>
247
</TD></TR>
248
</TABLE>
249
</td></tr>
250
</TABLE>
251
</body>
252
</html>