Subversion Repositories ALCASAR

Rev

Rev 1566 | Rev 1831 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 1566 Rev 1805
Line 3... Line 3...
3
if (is_file("../lib/langues.php"))
3
if (is_file("../lib/langues.php"))
4
	include("../lib/langues.php");
4
	include("../lib/langues.php");
5
require('/etc/freeradius-web/config.php');
5
require('/etc/freeradius-web/config.php');
6
require('../lib/attrshow.php');
6
require('../lib/attrshow.php');
7
require('../lib/defaults.php');
7
require('../lib/defaults.php');
-
 
8
 
-
 
9
if(!isset($change)) $change = 0;
-
 
10
if(!isset($user_type)) $user_type = 'user';
-
 
11
if(!isset($badusers)) $badusers = 0;
-
 
12
if(!isset($cn)) $cn = '';
-
 
13
 
8
if ($user_type != 'group'){
14
if ($user_type != 'group'){
9
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
15
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
10
		include("../lib/$config[general_lib_type]/user_info.php");
16
		include("../lib/$config[general_lib_type]/user_info.php");
11
	if ($config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){
17
	if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
12
		$saved_login = $login;
18
		$saved_login = $login;
13
		$login = '';
19
		$login = '';
14
		if (is_file("../lib/sql/group_info.php"))
20
		if (is_file("../lib/sql/group_info.php"))
15
			include("../lib/sql/group_info.php");
21
			include("../lib/sql/group_info.php");
16
		$login = $saved_login;
22
		$login = $saved_login;
Line 18... Line 24...
18
}
24
}
19
else{
25
else{
20
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
26
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
21
		include("../lib/$config[general_lib_type]/group_info.php");
27
		include("../lib/$config[general_lib_type]/group_info.php");
22
}
28
}
23
if ($config[general_lib_type] == 'sql' && $config[sql_use_operators] == 'true'){
29
if ($config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true'){
24
	$colspan=2;
30
	$colspan=2;
25
	$show_ops = 1;
31
	$show_ops = 1;
26
	include("../lib/operators.php");
32
	include("../lib/operators.php");
27
}
33
}
28
else{
34
else{
Line 31... Line 37...
31
}
37
}
32
?>
38
?>
33
<html>
39
<html>
34
<head>
40
<head>
35
<title>Users & groups edition</title>
41
<title>Users & groups edition</title>
36
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config[general_charset]?>">
42
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
37
<link rel="stylesheet" href="/css/style.css">
43
<link rel="stylesheet" href="/css/style.css">
38
<script language="javascript" type="text/javascript">
44
<script language="javascript" type="text/javascript">
39
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
45
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
40
function password(size)
46
function password(size)
41
  {
47
  {
Line 49... Line 55...
49
}
55
}
50
</script>
56
</script>
51
<script type="text/javascript" src="/js/epoch_classes.js"></script>
57
<script type="text/javascript" src="/js/epoch_classes.js"></script>
52
<script language="javascript" type="text/javascript">
58
<script language="javascript" type="text/javascript">
53
/*Insertion du calendrier */
59
/*Insertion du calendrier */
54
	var dp_cal;      
60
	var dp_cal;
55
window.onload = function () {
61
window.onload = function () {
56
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
62
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
57
};
63
};
58
</script>
64
</script>
59
 
65
 
60
</head>
66
</head>
61
<body>
67
<body>
62
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
68
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0">
63
	<tr><th>
69
	<tr><th>
64
<?php
70
<?php
65
if ($user_type != 'group'){ echo "$l_users_managment";} else{ echo "$l_groups_managment";}
71
if($user_type != 'group'){ echo "$l_users_managment";} else{ echo "$l_groups_managment";}
66
?>
72
?>
67
	</th></tr>
73
	</th></tr>
68
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1" 
74
	<tr bgcolor="#FFCC66"><td><img src="/images/pix.gif" width="1"
69
height="2"></td></tr>
75
height="2"></td></tr>
70
</TABLE>
76
</TABLE>
71
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
77
<TABLE width="100%" border=1 cellspacing=0 cellpadding=1>
72
	<tr><td valign="middle" align="left">
78
	<tr><td valign="middle" align="left">
73
	<center>
79
	<center>
74
	<table border=0 width=640 cellpadding=0 cellspacing=2>
80
	<table border=0 width=640 cellpadding=0 cellspacing=2>
75
<?php
81
<?php
76
if ($user_type != 'group')
82
if ($user_type != 'group'){
77
	{
-
 
78
	include("../html/user_toolbar.html.php");
83
	include("../html/user_toolbar.html.php");
79
	$titre=$l_user;
84
	$titre=$l_user;
80
	}
-
 
81
else
85
}else{
82
	{
-
 
83
	include("../html/group_toolbar.html.php");
86
	include("../html/group_toolbar.html.php");
84
	$titre=$l_group;
87
	$titre=$l_group;
85
	}
88
}
86
print <<<EOM
89
print <<<EOM
87
</table>
90
</table>
88
<br>
91
<br>
89
<table border=0 width=620 cellpadding=1 cellspacing=1>
92
<table border=0 width=620 cellpadding=1 cellspacing=1>
90
<tr valign=top>
93
<tr valign=top>
Line 98... Line 101...
98
</td></tr>
101
</td></tr>
99
<tr bgcolor="black" valign=top><td colspan=2>
102
<tr bgcolor="black" valign=top><td colspan=2>
100
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
103
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
101
	<tr><td>
104
	<tr><td>
102
EOM;
105
EOM;
103
   
106
 
104
if ($change == 1){
107
if ($change == 1){
105
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
108
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
106
		include("../lib/$config[general_lib_type]/change_attrs.php");
109
		include("../lib/$config[general_lib_type]/change_attrs.php");
107
	if ($user_type != 'group'){
110
	if ($user_type != 'group'){
108
		if ($config[general_show_user_password] != 'no' && $passwd != '' 
111
		if ($config['general_show_user_password'] != 'no' && $passwd != ''
109
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
112
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
110
			include("../lib/$config[general_lib_type]/change_passwd.php");
113
			include("../lib/$config[general_lib_type]/change_passwd.php");
111
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
114
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
112
			include("../lib/$config[general_lib_type]/user_info.php");
115
			include("../lib/$config[general_lib_type]/user_info.php");
113
		if ($group_change && $config[general_lib_type] == 'sql' && $config[sql_show_all_groups] == 'true'){
116
		if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
114
			include("../lib/sql/group_change.php");
117
			include("../lib/sql/group_change.php");
115
			include("../lib/defaults.php");
118
			include("../lib/defaults.php");
116
		}
119
		}
117
		# Disconnecting user for re-authentication
120
		# Disconnecting user for re-authentication
118
		$mac=exec("sudo /usr/sbin/chilli_query list | grep \" $login \" | awk '{print $1}'");
121
		$mac=exec("sudo /usr/sbin/chilli_query list | grep \" $login \" | awk '{print $1}'");
Line 132... Line 135...
132
}
135
}
133
else if ($badusers == 1){
136
else if ($badusers == 1){
134
	if (is_file("../lib/add_badusers.php"))
137
	if (is_file("../lib/add_badusers.php"))
135
		include("../lib/add_badusers.php");
138
		include("../lib/add_badusers.php");
136
}
139
}
137
	
140
 
138
?>
141
?>
139
   <form name="edituser" method=post>
142
   <form name="edituser" method=post>
140
      <input type=hidden name=login value=<?php print $login ?>>
143
      <input type=hidden name=login value=<?php print $login ?>>
141
      <input type=hidden name=user_type value=<?php print $user_type ?>>
144
      <input type=hidden name=user_type value=<?php print $user_type ?>>
142
      <input type=hidden name=change value="0">
145
      <input type=hidden name=change value="0">
143
      <input type=hidden name=add value="0">
146
      <input type=hidden name=add value="0">
144
      <input type=hidden name=badusers value="0">
147
      <input type=hidden name=badusers value="0">
145
      <input type=hidden name=group_change value="0">
148
      <input type=hidden name=group_change value="0">
146
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
149
	<table border=1 bordercolordark=#ffffe0 bordercolorlight=#000000 width=100% cellpadding=2 cellspacing=0 bgcolor="#ffffe0" valign=top>
147
<?php
150
<?php
148
if ($user_type != 'group' && $config[general_show_user_password] != 'no'){
151
if ($user_type != 'group' && $config['general_show_user_password'] != 'no'){
149
	echo <<<EOM
152
	echo <<<EOM
150
<tr>
153
<tr>
151
<td align=right colspan=$colspan bgcolor="#d0ddb0">
154
<td align=right colspan=$colspan bgcolor="#d0ddb0">
152
$l_new_password<br>
155
$l_new_password<br>
153
EOM;
156
EOM;
Line 161... Line 164...
161
</tr>
164
</tr>
162
EOM;
165
EOM;
163
}
166
}
164
	foreach($show_attrs as $key => $desc){
167
	foreach($show_attrs as $key => $desc){
165
		$name = $attrmap["$key"];
168
		$name = $attrmap["$key"];
166
		$generic = $attrmap[generic]["$key"];
169
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
167
		if ($name == 'none')
170
		if ($name == 'none')
168
			continue;
171
			continue;
169
		unset($vals);
172
		unset($vals);
170
		unset($selected);
173
		unset($selected);
171
		unset($ops);
174
		unset($ops);
172
		$def_added = 0;
175
		$def_added = 0;
173
		if ($item_vals["$key"][count]){
176
		if (isset($item_vals["$key"]['count']) && $item_vals["$key"]['count']){
174
			for($i=0;$i<$item_vals["$key"][count];$i++){
177
			for($i=0;$i<$item_vals["$key"]['count'];$i++){
175
				$vals[] = $item_vals["$key"][$i];
178
				$vals[] = $item_vals["$key"][$i];
176
				$ops[] = $item_vals["$key"][operator][$i];
179
				$ops[] = $item_vals["$key"]['operator'][$i];
177
			}
180
			}
178
		}
181
		}
179
		else{
182
		else{
180
			if ($default_vals["$key"][count]){
183
			if (isset($default_vals["$key"]['count']) && $default_vals["$key"]['count']){
181
				for($i=0;$i<$default_vals["$key"][count];$i++){
184
				for($i=0;$i<$default_vals["$key"]['count'];$i++){
182
					$vals[] = $default_vals["$key"][$i];
185
					$vals[] = $default_vals["$key"][$i];
183
					$ops[] = $default_vals["$key"][operator][$i];
186
					$ops[] = $default_vals["$key"]['operator'][$i];
184
				}
187
				}
185
			}
188
			}
186
			else{
189
			else{
187
				$vals[] = '';
190
				$vals[] = '';
188
				$ops[] = '=';
191
				$ops[] = '=';
189
			}
192
			}
190
			$def_added = 1;
193
			$def_added = 1;
191
		}
194
		}
192
		if ($generic == 'generic' && $def_added == 0){
195
		if ($generic == 'generic' && $def_added == 0){
193
			for($i=0;$i<$default_vals["$key"][count];$i++){
196
			for($i=0;$i<$default_vals["$key"]['count'];$i++){
194
				$vals[] = $default_vals["$key"][$i];
197
				$vals[] = $default_vals["$key"][$i];
195
				$ops[] = $default_vals["$key"][operator][$i];
198
				$ops[] = $default_vals["$key"]['operator'][$i];
196
			}
199
			}
197
		}	
200
		}
198
		if ($add && $name == $add_attr){
201
		if (isset($add) && $add && $name == $add_attr){
199
			$vals[] = $default_vals["$key"][0];
202
			$vals[] = $default_vals["$key"][0];
200
			$ops[] = ($default_vals["$key"][operator][0] != '') ? $default_vals["$key"][operator][0] : '=';
203
			$ops[] = ($default_vals["$key"]['operator'][0] != '') ? $default_vals["$key"]['operator'][0] : '=';
201
		}
204
		}
202
 
205
 
203
		$i = 0;
206
		$i = 0;
204
		foreach($vals as $val){
207
		foreach($vals as $val){
205
			$name1 = $name . $i;
208
			$name1 = $name . $i;
206
			$val = ereg_replace('"','&quot;',$val);
209
			$val = preg_replace('/\"/','&quot;',$val);
207
			$oper_name = $name1 . '_op';
210
			$oper_name = $name1 . '_op';
208
			$oper = $ops[$i];
211
			$oper = $ops[$i];
209
			$selected[$oper] = 'selected';
212
			$selected[$oper] = 'selected';
210
			$i++;
213
			$i++;
211
		switch ($key)
214
		switch ($key)
212
		{
215
		{
213
				// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.) 
216
				// $advanced = 1 : champs de saisie amélioré (calendrier, convertisseur, etc.)
214
			case 'Simultaneous-Use' : 
217
			case 'Simultaneous-Use' :
215
				$advanced=1;
218
				$advanced=1;
216
				$help_link="help/simultaneous_use_help.html";
219
				$help_link="help/simultaneous_use_help.html";
217
				$desc=$l_simultaneous_use;
220
				$desc=$l_simultaneous_use;
218
				break;
221
				break;
219
			case 'Max-All-Session' :
222
			case 'Max-All-Session' :
220
				$advanced=1;
223
				$advanced=1;
221
				$help_link="help/max_all_session_help.html";
224
				$help_link="help/max_all_session_help.html";
222
				$desc=$l_max_all_session;
225
				$desc=$l_max_all_session;
223
				break;
226
				break;
224
			case 'Session-Timeout' : 
227
			case 'Session-Timeout' :
225
				$advanced=1;
228
				$advanced=1;
226
				$help_link="help/session_timeout_help.html";
229
				$help_link="help/session_timeout_help.html";
227
				$desc=$l_session_timeout;
230
				$desc=$l_session_timeout;
228
				break;
231
				break;
229
			case 'Max-Daily-Session' :
232
			case 'Max-Daily-Session' :
Line 234... Line 237...
234
			case 'Max-Monthly-Session' :
237
			case 'Max-Monthly-Session' :
235
				$advanced=1;
238
				$advanced=1;
236
				$help_link="help/session_timeout_help.html";
239
				$help_link="help/session_timeout_help.html";
237
				$desc=$l_monthly_timeout;
240
				$desc=$l_monthly_timeout;
238
				break;
241
				break;
239
			case 'Login-Time' : 
242
			case 'Login-Time' :
240
				$advanced=1;
243
				$advanced=1;
241
				$help_link="help/login_time_help.html";
244
				$help_link="help/login_time_help.html";
242
				$desc=$l_login_time;
245
				$desc=$l_login_time;
243
				break;
246
				break;
244
			case 'Expiration' :
247
			case 'Expiration' :
Line 289... Line 292...
289
			<tr>
292
			<tr>
290
			<td class="etiquette">
293
			<td class="etiquette">
291
			<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>
294
			<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>
292
EOM;
295
EOM;
293
			if ($show_ops){
296
			if ($show_ops){
-
 
297
				if(!isset($selected[$op_eq])) $selected[$op_eq] = '';
294
				switch ($key)
298
				switch ($key)
295
					{
299
					{
296
					case 'Simultaneous-Use' : 
300
					case 'Simultaneous-Use' :
297
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></td>";
301
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></td>";
298
						break;
302
						break;
299
					case 'Login-Time' : 
303
					case 'Login-Time' :
300
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></td>";
304
						echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20></td>";
301
						break;
305
						break;
302
					case 'Expiration' :
306
					case 'Expiration' :
303
						if($login == "sms" && $user_type == 'group'){
307
						if($login == "sms" && $user_type == 'group'){
304
							echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20 disabled></td>";
308
							echo "<td><select name=$oper_name><option $selected[$op_eq] value=\":=\">:=</td><td><input type=text name=\"$name1\" value=\"$val\" size=20 disabled></td>";
Line 393... Line 397...
393
</td>
397
</td>
394
<td>
398
<td>
395
EOM;
399
EOM;
396
if (isset($member_groups)){
400
if (isset($member_groups)){
397
	echo "<select size=5 name=\"edited_groups[]\" multiple OnChange=\"this.form.group_change.value=1\">";
401
	echo "<select size=5 name=\"edited_groups[]\" multiple OnChange=\"this.form.group_change.value=1\">";
398
	if ($config[sql_show_all_groups] == 'true'){
402
	if ($config['sql_show_all_groups'] == 'true'){
399
		foreach ($existing_groups as $group => $count){
403
		foreach ($existing_groups as $group => $count){
400
			if ($member_groups[$group] == $group)
404
			if ($member_groups[$group] == $group)
401
				echo "<option selected value=\"$group\">$group\n";
405
				echo "<option selected value=\"$group\">$group\n";
402
			else
406
			else
403
				echo "<option value=\"$group\">$group\n";
407
				echo "<option value=\"$group\">$group\n";
Line 409... Line 413...
409
		echo "</select></td></tr>";
413
		echo "</select></td></tr>";
410
	}
414
	}
411
	else{
415
	else{
412
		echo "aucun group</td></tr>";
416
		echo "aucun group</td></tr>";
413
	}
417
	}
414
} 
418
}
415
echo "</table><br>";
419
echo "</table><br>";
416
echo "<input type=submit class=button value=$l_change OnClick=\"this.form.change.value=1\">";
420
echo "<input type=submit class=button value=$l_change OnClick=\"this.form.change.value=1\">";
417
//if ($user_type != 'group'){
421
//if ($user_type != 'group'){
418
//	echo <<<EOM
422
//	echo <<<EOM
419
//<br><br>
423
//<br><br>