Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
1 root 1
<?php
2
require('/etc/freeradius-web/config.php');
3
require('../lib/attrshow.php');
4
require('../lib/defaults.php');
5
$extra_text = '';
6
if ($user_type != 'group'){
7
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
8
		include("../lib/$config[general_lib_type]/user_info.php");
9
	if ($config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){
10
		$extra_text = "<br><font size=-2><i>(le groupe auquel apartient l'usager est surlign&eacute;)</i></font>";
11
		$saved_login = $login;
12
		$login = '';
13
		if (is_file("../lib/sql/group_info.php"))
14
			include("../lib/sql/group_info.php");
15
		$login = $saved_login;
16
	}
17
}
18
else{
19
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
20
		include("../lib/$config[general_lib_type]/group_info.php");
21
}
22
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
23
	$colspan=2;
24
	$show_ops = 1;
25
	include("../lib/operators.php");
26
}
27
else{
28
	$show_ops = 0;
29
	$colspan=1;
30
}
31
 
32
 
33
echo <<<EOM
34
<html>
35
<head>
36
EOM;
37
 
38
if ($user_type != 'group'){
39
	echo " <title>subscription configuration for $login ($cn)</title>\n";
40
	$util = "usagers";}
41
else{
42
	echo " <title>subscription configuration for $login</title>\n";
43
	$util = "groupes";}
44
?>
45
 
46
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
47
<link rel="stylesheet" href="/css/style.css">
48
<script language="javascript" type="text/javascript">
49
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
50
function password(size)
51
  {
52
  var pass=''
53
  while(pass.length < size)
54
  {
55
    pass+=chars.charAt(Math.round(Math.random() * (chars.length)))
56
  }
57
  document.edituser.passwd.value=pass
58
  document.edituser.pwdgene.value=pass
59
}
60
</script>
61
</head>
62
<body>
63
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
64
	<tr><th>Gestion des <?php echo $util?></th></tr>
65
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
66
height="2"></td></tr>
67
</TABLE>
68
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
69
	<tr><td valign="middle" align="left">
70
	<center>
71
	<table border=0 width=550 cellpadding=0 cellspacing=0>
72
		<tr valign=top>
73
		<!--<td align=center><img src="images/title2.gif"></td>-->
74
		</tr>
75
	</table>
76
	<table border=0 width=400 cellpadding=0 cellspacing=2>
77
<?php
78
if ($user_type != 'group')
79
	{
80
	include("../html/user_toolbar.html.php");
81
	$titre="de l'usager";
82
	}
83
else
84
	{
85
	include("../html/group_toolbar.html.php");
86
	$titre="du groupe";
87
	}
88
print <<<EOM
89
</table>
90
<br>
91
<table border=0 width=540 cellpadding=1 cellspacing=1>
92
<tr valign=top>
93
<td width=75%>&nbsp;</td>
94
<td bgcolor="black" width=25% align=right>
95
	<table border=0 width="200" cellpadding=2 cellspacing=0>
96
	<tr bgcolor="#907030" align=center valign=top><th>
97
	<font color="white">Attributs $titre : $login</font>&nbsp;
98
	</th></tr>
99
	</table>
100
</td></tr>
101
<tr bgcolor="black" valign=top><td colspan=2>
102
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
103
	<tr><td>
104
EOM;
105
 
106
if ($change == 1){
107
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
108
		include("../lib/$config[general_lib_type]/change_attrs.php");
109
	if ($user_type != 'group'){
110
		if ($config[general_show_user_password] != 'no' && $passwd != '' 
111
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
112
			include("../lib/$config[general_lib_type]/change_passwd.php");
113
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
114
			include("../lib/$config[general_lib_type]/user_info.php");
115
		if ($group_change && $config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){
116
			include("../lib/sql/group_change.php");
117
			include("../lib/defaults.php");
118
		}
119
	}
120
	else{
121
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
122
			include("../lib/$config[general_lib_type]/group_info.php");
123
	}
124
}
125
else if ($badusers == 1){
126
	if (is_file("../lib/add_badusers.php"))
127
		include("../lib/add_badusers.php");
128
}
129
 
130
?>
131
   <form name="edituser" method=post>
132
      <input type=hidden name=login value=<?php print $login ?>>
133
      <input type=hidden name=user_type value=<?php print $user_type ?>>
134
      <input type=hidden name=change value="0">
135
      <input type=hidden name=add value="0">
136
      <input type=hidden name=badusers value="0">
137
      <input type=hidden name=group_change value="0">
138
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
139
<?php
140
if ($user_type != 'group' && $config[general_show_user_password] != 'no'){
141
	echo <<<EOM
142
<tr>
143
<td align=right colspan=$colspan bgcolor="#d0ddb0">
144
Nouveau mot de passe<br>
145
EOM;
146
if ($user_password_exists == 'yes')
147
	echo "<font size=-2>Le mot de passe <font color=\"green\"><b>existe</b></font></font>\n";
148
else
149
	echo "<font size=-2>Le mot de passe <font color=\"red\"><b> n'existe pas</b></font></font>\n";
150
	echo <<<EOM
151
</td>
152
<td>
153
<input type=password name=passwd value="" size=40>
154
<br /><input type="button" value="g&eacute;n&eacute;rer" onclick="password(8)">
155
<input type="text" value="" name="pwdgene" size=20 readonly>
156
</td>
157
</tr>
158
EOM;
159
}
160
	foreach($show_attrs as $key => $desc){
161
		$name = $attrmap["$key"];
162
		$generic = $attrmap[generic]["$key"];
163
		if ($name == 'none')
164
			continue;
165
		unset($vals);
166
		unset($selected);
167
		unset($ops);
168
		$def_added = 0;
169
		if ($item_vals["$key"][count]){
170
			for($i=0;$i<$item_vals["$key"][count];$i++){
171
				$vals[] = $item_vals["$key"][$i];
172
				$ops[] = $item_vals["$key"][operator][$i];
173
			}
174
		}
175
		else{
176
			if ($default_vals["$key"][count]){
177
				for($i=0;$i<$default_vals["$key"][count];$i++){
178
					$vals[] = $default_vals["$key"][$i];
179
					$ops[] = $default_vals["$key"][operator][$i];
180
				}
181
			}
182
			else{
183
				$vals[] = '';
184
				$ops[] = '=';
185
			}
186
			$def_added = 1;
187
		}
188
		if ($generic == 'generic' && $def_added == 0){
189
			for($i=0;$i<$default_vals["$key"][count];$i++){
190
				$vals[] = $default_vals["$key"][$i];
191
				$ops[] = $default_vals["$key"][operator][$i];
192
			}
193
		}	
194
		if ($add && $name == $add_attr){
195
			$vals[] = $default_vals["$key"][0];
196
			$ops[] = ($default_vals["$key"][operator][0] != '') ? $default_vals["$key"][operator][0] : '=';
197
		}
198
 
199
		$i = 0;
200
		foreach($vals as $val){
201
			$name1 = $name . $i;
202
			$val = ereg_replace('"','&quot;',$val);
203
			$oper_name = $name1 . '_op';
204
			$oper = $ops[$i];
205
			$selected[$oper] = 'selected';
206
			$i++;
207
			print <<<EOM
208
<tr>
209
<td align=right bgcolor="#d0ddb0">
210
EOM;
211
			$desc = addslashes($desc);
212
			eval("\$desc = \"$desc\";");
213
			$desc = stripslashes($desc);
214
			if ($i == 1)
215
				echo "$desc\n";
216
			else
217
				echo "$desc ($i)\n";
218
			print <<<EOM
219
</td>
220
EOM;
221
			if ($show_ops){
222
				switch ($key)
223
					{
224
					case 'Simultaneous-Use' : 
113 richard 225
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 226
						break;
227
					case 'Login-Time' : 
113 richard 228
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 229
						break;
230
					case 'Expiration' :
113 richard 231
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 232
						break;
233
					case 'Session-Timeout' :
113 richard 234
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 235
						break;
236
					case 'Max-Daily-Session' :
113 richard 237
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 238
						break;
239
					case 'Max-Weekly-Session' :
113 richard 240
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 241
						break;
242
					case 'Max-Monthly-Session' :
113 richard 243
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
1 root 244
						break;
113 richard 245
					case 'ChilliSpot-Max-Input-Octets' :
246
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
247
						break;
248
					case 'ChilliSpot-Max-Output-Octets' :
249
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
250
						break;
251
					case 'ChilliSpot-Max-Total-Octets' :
252
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
253
						break;
254
					case 'ChilliSpot-Bandwidth-Max-Up' :
255
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
256
						break;
257
					case 'ChilliSpot-Bandwidth-Max-Down' :
258
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
259
						break;
260
					case 'WISPr-Redirection-URL' :
261
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
262
						break;
1 root 263
					default :
264
						print <<<EOM
265
<td>
266
<select name=$oper_name>
267
<option $selected[$op_eq] value="=">=
268
<option $selected[$op_set] value=":=">:=
269
<option $selected[$op_add] value="+=">+=
270
<option $selected[$op_eq2] value="==">==
271
<option $selected[$op_ne] value="!=">!=
272
<option $selected[$op_gt] value=">">&gt;
273
<option $selected[$op_ge] value=">=">&gt;=
274
<option $selected[$op_lt] value="<">&lt;
275
<option $selected[$op_le] value="<=">&lt;=
276
<option $selected[$op_regeq] value="=~">=~
277
<option $selected[$op_regne] value="!~">!~
278
<option $selected[$op_exst] value="=*">=*
279
<option $selected[$op_nexst] value="!*">!*
280
</select>
281
</td>
113 richard 282
<td><input type=text name="$name1" value="$val" size=40></td>
1 root 283
EOM;
284
						break;
285
					}
286
				}
287
			print <<<EOM
288
</tr>
289
EOM;
290
		}
291
	}
292
?>
293
<!--
294
<tr>
295
<td align=right colspan=<?php print $colspan ?> bgcolor="#d0ddb0">
296
Ajouter un attribut
297
</td>
298
<td>
299
<select name="add_attr" OnChange="this.form.add.value=1;this.form.submit()">
300
<?php
301
foreach ($show_attrs as $key => $desc){
302
	$name = $attrmap["$key"];
303
	print <<<EOM
304
<option value="$name">$desc
305
EOM;
306
}
307
?>
308
</select>
309
</td>
310
</tr>
311
-->
312
<?php
313
if ($user_type != 'group'){
314
	echo <<<EOM
315
<tr>
316
<td align=right colspan=$colspan bgcolor="#d0ddb0">
317
Membre de $extra_text
318
</td>
319
<td>
320
EOM;
321
if (isset($member_groups)){
322
	echo "<select size=5 name=\"edited_groups[]\" multiple OnChange=\"this.form.group_change.value=1\">";
323
	if ($config[sql_show_all_groups] == 'true'){
324
		foreach ($existing_groups as $group => $count){
325
			if ($member_groups[$group] == $group)
326
				echo "<option selected value=\"$group\">$group\n";
327
			else
328
				echo "<option value=\"$group\">$group\n";
329
			}
330
		}else{
331
		foreach ($member_groups as $group)
332
			echo "<option value=\"$group\">$group\n";
333
		}
334
		echo "</select></td></tr>";
335
	}
336
	else{
337
		echo "aucun group</td></tr>";
338
	}
339
} 
340
echo "</table><br>";
341
echo "<input type=submit class=button value=Change OnClick=\"this.form.change.value=1\">";
342
//if ($user_type != 'group'){
343
//	echo <<<EOM
344
//<br><br>
345
//<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
346
//<a href="help/badusers_help.html" target=bu_help onclick=window.open("help/badusers_help.html","bu_help","width=600,height=210,toolbar=no,scrollbars=no,resizable=yes") title="BADUSERS Help Page"><font color="blue">&lt;--Help</font></a>
347
//EOM;
348
//}
349
?>
350
</form>
351
</td></tr>
352
</table>
353
</tr>
354
</table>
355
</td></tr>
356
</TABLE>
357
</body>
358
</html>