Subversion Repositories ALCASAR

Rev

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