Subversion Repositories ALCASAR

Rev

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

Rev Author Line No. Line
324 richard 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
			echo "</td>";
219
			if ($show_ops){
220
				switch ($key)
221
					{
222
					case 'Simultaneous-Use' : 
223
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
224
						break;
225
					case 'Login-Time' : 
226
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
227
						break;
228
					case 'Expiration' :
229
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
230
						break;
886 stephane 231
					case 'Max-All-Session' :
232
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
233
						break;
324 richard 234
					case 'Session-Timeout' :
235
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
236
						break;
237
					case 'Max-Daily-Session' :
238
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
239
						break;
240
					case 'Max-Weekly-Session' :
241
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
242
						break;
243
					case 'Max-Monthly-Session' :
244
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
245
						break;
246
					case 'ChilliSpot-Max-Input-Octets' :
247
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
248
						break;
249
					case 'ChilliSpot-Max-Output-Octets' :
250
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
251
						break;
252
					case 'ChilliSpot-Max-Total-Octets' :
253
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
254
						break;
255
					case 'ChilliSpot-Bandwidth-Max-Up' :
256
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
257
						break;
258
					case 'ChilliSpot-Bandwidth-Max-Down' :
259
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
260
						break;
261
					case 'WISPr-Redirection-URL' :
262
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\"=\">=</td><td><input type=text name=\"$name1\" value=\"$val\" size=40></td>";
263
						break;
264
					default :
265
						print <<<EOM
266
<td>
267
<select name=$oper_name>
268
<option $selected[$op_eq] value="=">=
269
<option $selected[$op_set] value=":=">:=
270
<option $selected[$op_add] value="+=">+=
271
<option $selected[$op_eq2] value="==">==
272
<option $selected[$op_ne] value="!=">!=
273
<option $selected[$op_gt] value=">">&gt;
274
<option $selected[$op_ge] value=">=">&gt;=
275
<option $selected[$op_lt] value="<">&lt;
276
<option $selected[$op_le] value="<=">&lt;=
277
<option $selected[$op_regeq] value="=~">=~
278
<option $selected[$op_regne] value="!~">!~
279
<option $selected[$op_exst] value="=*">=*
280
<option $selected[$op_nexst] value="!*">!*
281
</select>
282
</td>
283
<td><input type=text name="$name1" value="$val" size=40></td>
284
EOM;
285
						break;
286
					}
287
				}
288
			print <<<EOM
289
</tr>
290
EOM;
291
		}
292
	}
293
if ($user_type != 'group'){
294
	echo <<<EOM
295
<tr>
296
<td align=right colspan=$colspan bgcolor="#d0ddb0">
297
Membre de $extra_text
298
</td>
299
<td>
300
EOM;
301
if (isset($member_groups)){
302
	echo "<select size=5 name=\"edited_groups[]\" multiple OnChange=\"this.form.group_change.value=1\">";
303
	if ($config[sql_show_all_groups] == 'true'){
304
		foreach ($existing_groups as $group => $count){
305
			if ($member_groups[$group] == $group)
306
				echo "<option selected value=\"$group\">$group\n";
307
			else
308
				echo "<option value=\"$group\">$group\n";
309
			}
310
		}else{
311
		foreach ($member_groups as $group)
312
			echo "<option value=\"$group\">$group\n";
313
		}
314
		echo "</select></td></tr>";
315
	}
316
	else{
317
		echo "aucun group</td></tr>";
318
	}
319
} 
320
echo "</table><br>";
321
echo "<input type=submit class=button value=Change OnClick=\"this.form.change.value=1\">";
322
//if ($user_type != 'group'){
323
//	echo <<<EOM
324
//<br><br>
325
//<input type=submit class=button value="Add to Badusers" OnClick="this.form.badusers.value=1">
326
//<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>
327
//EOM;
328
//}
329
?>
330
</form>
331
</td></tr>
332
</table>
333
</tr>
334
</table>
335
</td></tr>
336
</TABLE>
337
</body>
338
</html>