Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
1 root 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
</head>
58
<body>
59
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
60
	<tr><th><? echo "$l_frame_top"; ?></th></tr>
61
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
62
height="2"></td></tr>
63
</TABLE>
64
<TABLE width="100%" border=0 cellspacing=0 cellpadding=1>
65
	<tr bgcolor="#666666"><td>
66
	<TABLE width="100%" border=0 cellspacing=0 cellpadding=2>
67
		<tr><td valign="middle" align="left">
68
<center>
69
<table border=0 width=550 cellpadding=1 cellspacing=1>
70
<tr valign=top>
71
<td width=340></td>
72
<td bgcolor="black" width=200>
73
	<table border=0 width=100% cellpadding=2 cellspacing=0>
74
	<tr bgcolor="#907030" align=right valign=top><th>
75
	<font color="white"><? echo "$l_group_create"; ?></font>
76
	</th></tr>
77
	</table>
78
</td></tr>
79
<tr bgcolor="black" valign=top><td colspan=2>
80
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
81
	<tr><td>
82
 
83
<?php
84
if (is_file("../lib/$config[general_lib_type]/group_info.php"))
85
	include("../lib/$config[general_lib_type]/group_info.php");
86
if ($create == 1){
87
	if ($group_exists != "no"){
88
		echo <<<EOM
89
<b>Le groupe <i>$login</i> existe d&eacute;j&agrave;.</b>
90
EOM;
91
	}
92
	else{
93
		if (is_file("../lib/$config[general_lib_type]/create_group.php"))
94
			include("../lib/$config[general_lib_type]/create_group.php");
95
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
96
			include("../lib/$config[general_lib_type]/group_info.php");
97
	}
98
}
99
?>
100
   <form method=post>
101
      <input type=hidden name=create value="0">
102
      <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>
104
<?php
105
	echo <<<EOM
106
	<tr>
107
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
108
		Groupe(s) d&eacute;j&agrave; cr&eacute;&eacute;(s)
109
		</td><td>
110
EOM;
111
		if (!isset($existing_groups))
112
			echo "<b>Aucun groupe d&eacute;j&agrave; cr&eacute;&eacute;</b>\n";
113
		else{
114
			echo "<select name=\"existing_groups\">\n";	
115
			foreach ($existing_groups as $group => $count)
116
				echo "<option value=\"$group\">$group\n";
117
			echo "</select>\n";
118
		}
119
	echo <<<EOM
120
		</td>
121
	</tr>
122
	<tr>
123
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
124
		Nom du groupe
125
		</td><td>
126
		<input type=text name="login" value="$login" size=35>
127
		</td>
128
	</tr>
129
	<tr>
130
		<td align=right colspan=$colspan bgcolor="#d0ddb0">
131
		Membres du groupe : s&eacute;par&eacute;s par un espace ou un 'retour chariot'.
132
		</td><td>
133
		<textarea name=members cols="15" wrap="PHYSICAL" rows=5></textarea>
134
		</td>
135
	</tr>
136
 
137
EOM;
138
	foreach($show_attrs as $key => $desc){
139
		$name = $attrmap["$key"];
140
		if ($name == 'none')
141
			continue;
142
		$oper_name = $name . '_op';
143
		$val = ($item_vals["$key"][0] != "") ? $item_vals["$key"][0] : $default_vals["$key"][0];
144
		print <<<EOM
145
<tr>
146
<td align=right bgcolor="#d0ddb0">
147
$desc
148
</td>
149
EOM;
150
 
151
		if ($show_ops){
152
				switch ($key)
153
					{
154
					case 'Simultaneous-Use' : 
155
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
156
						break;
157
					case 'Login-Time' : 
158
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
159
						break;
160
					case 'Expiration' :
161
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
162
						break;
163
					case 'Session-Timeout' :
164
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=";
165
						break;
166
					case 'Max-Daily-Session' :
167
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
168
						break;
169
					case 'Max-Weekly-Session' :
170
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
171
						break;
172
					case 'Max-Monthly-Session' :
173
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=";
174
						break;
175
					default :
176
						print <<<EOM
177
<td>
178
<select name=$oper_name>
179
<option $selected[$op_eq] value="=">=
180
<option $selected[$op_set] value=":=">:=
181
<option $selected[$op_add] value="+=">+=
182
<option $selected[$op_eq2] value="==">==
183
<option $selected[$op_ne] value="!=">!=
184
<option $selected[$op_gt] value=">">&gt;
185
<option $selected[$op_ge] value=">=">&gt;=
186
<option $selected[$op_lt] value="<">&lt;
187
<option $selected[$op_le] value="<=">&lt;=
188
<option $selected[$op_regeq] value="=~">=~
189
<option $selected[$op_regne] value="!~">!~
190
<option $selected[$op_exst] value="=*">=*
191
<option $selected[$op_nexst] value="!*">!*
192
</select>
193
</td>
194
EOM;
195
						break;
196
					}
197
		}
198
		print <<<EOM
199
<td>
200
<input type=text name="$name" value="$val" size=35>
201
</td>
202
</tr>
203
EOM;
204
	}
205
echo "</table><BR>";
206
if ($create == 1)
207
	echo "<input type=submit class=button value=\"Afficher le groupe\" OnClick=\"this.form.show.value=1\">";
208
	else
209
	echo "<input type=submit class=button value=\"Cr&eacute;er\" OnClick=\"this.form.create.value=1\">";
210
?>
211
<br><br>
212
</form>
213
	</td></tr>
214
</table>
215
</tr>
216
</table>
217
</TD></TR>
218
</TABLE>
219
</td></tr>
220
</TABLE>
221
</body>
222
</html>