Subversion Repositories ALCASAR

Rev

Rev 1566 | Rev 1831 | Go to most recent revision | Show entire file | Regard 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 71... Line 77...
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>
Line 103... Line 106...
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 143... Line 146...
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)
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;
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";