Subversion Repositories ALCASAR

Rev

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