Subversion Repositories ALCASAR

Rev

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