Subversion Repositories ALCASAR

Rev

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

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