Subversion Repositories ALCASAR

Rev

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

Rev 2653 Rev 2655
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: user_edit.php 2653 2018-11-04 02:05:54Z tom.houdayer $
2
# $Id: user_edit.php 2655 2018-11-04 02:18:38Z tom.houdayer $
3
 
3
 
4
//gestion de la langue
4
//gestion de la langue
5
if (is_file("../lib/langues.php"))
5
if (is_file("../lib/langues.php"))
6
	include("../lib/langues.php");
6
	include("../lib/langues.php");
7
 
7
 
Line 112... Line 112...
112
	<table border=0 width=640 cellpadding=0 cellspacing=2>
112
	<table border=0 width=640 cellpadding=0 cellspacing=2>
113
<?php
113
<?php
114
if ($user_type != 'group'){
114
if ($user_type != 'group'){
115
	include("../html/user_toolbar.html.php");
115
	include("../html/user_toolbar.html.php");
116
	$titre=$l_user;
116
	$titre=$l_user;
-
 
117
	$cnName = " ($cn)";
117
}else{
118
}else{
118
	include("../html/group_toolbar.html.php");
119
	include("../html/group_toolbar.html.php");
119
	$titre=$l_group;
120
	$titre=$l_group;
-
 
121
	$cnName = '';
120
}
122
}
121
print <<<EOM
123
print <<<EOM
122
</table>
124
</table>
123
<br>
125
<br>
124
<table border=0 width=620 cellpadding=1 cellspacing=1>
126
<table border=0 width=620 cellpadding=1 cellspacing=1>
125
<tr valign=top>
127
<tr valign=top>
126
<td width=400></td>
128
<td width=400></td>
127
<td bgcolor="black">
129
<td bgcolor="black">
128
	<table border=0 width=100% cellpadding=2 cellspacing=0>
130
	<table border=0 width=100% cellpadding=2 cellspacing=0>
129
	<tr bgcolor="#907030" align=center valign=top><th>
131
	<tr bgcolor="#907030" align=center valign=top><th>
130
	<font color="white">$titre : $login ($cn)</font>
132
	<font color="white">$titre : $login$cnName</font>
131
	</th></tr>
133
	</th></tr>
132
	</table>
134
	</table>
133
</td></tr>
135
</td></tr>
134
<tr bgcolor="black" valign=top><td colspan="2">
136
<tr bgcolor="black" valign=top><td colspan="2">
135
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
137
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
136
	<tr><td>
138
	<tr><td>
137
EOM;
139
EOM;
138
 
140
 
139
if ($change == 1) {
141
if ($change == 1) {
140
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
-
 
141
		include("../lib/$config[general_lib_type]/change_attrs.php");
-
 
142
	if ($user_type != 'group'){
142
	if ($user_type != 'group'){
-
 
143
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
-
 
144
			include("../lib/$config[general_lib_type]/user_info.php");
-
 
145
 
-
 
146
		// Disconnecting user for re-authentication
-
 
147
		$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$login.'") {print $1}'));
-
 
148
		if (!empty($mac)) {
-
 
149
			exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
-
 
150
		}
-
 
151
 
-
 
152
		if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
-
 
153
			include("../lib/$config[general_lib_type]/change_attrs.php");
143
		if ($config['general_show_user_password'] != 'no' && $passwd != ''
154
		if ($config['general_show_user_password'] != 'no' && $passwd != ''
144
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
155
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
145
			include("../lib/$config[general_lib_type]/change_passwd.php");
156
			include("../lib/$config[general_lib_type]/change_passwd.php");
146
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
-
 
147
			include("../lib/$config[general_lib_type]/user_info.php");
-
 
148
		if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
157
		if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
149
			include("../lib/$config[general_lib_type]/group_change.php");
158
			include("../lib/$config[general_lib_type]/group_change.php");
150
			include("../lib/defaults.php");
159
			include("../lib/defaults.php");
151
		}
160
		}
-
 
161
 
152
		// Disconnecting user for re-authentication
162
		// Reconnect allowed MAC
153
		$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$login.'") {print $1}'));
-
 
154
		if (!empty($mac)) {
163
		if (!empty($mac) && ($login === $mac)) {
155
			exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
-
 
156
			if ($login === $mac) {	// Reconnect allowed MAC
-
 
157
				exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
164
			exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
158
			}
-
 
159
		}
165
		}
160
	}
166
	}
161
	else{
167
	else{
162
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
168
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
163
			include("../lib/$config[general_lib_type]/group_info.php");
169
			include("../lib/$config[general_lib_type]/group_info.php");
-
 
170
 
164
		// Disconnecting all users from the selected group for re-authentication
171
		// Disconnecting all users from the selected group for re-authentication
165
		if (isset($group_members)) {
172
		if (isset($group_members)) {
-
 
173
			$group_macs = [];
166
			foreach ($group_members as $g_member => $member) {
174
			foreach ($group_members as $g_member => $member) {
167
				$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
175
				$mac = exec('sudo /usr/sbin/chilli_query list | awk '.escapeshellarg('($5 == 1) && ($6 == "'.$member.'") {print $1}'));
168
				if (!empty($mac)) {
176
				if (!empty($mac)) {
169
					exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
177
					exec('sudo /usr/sbin/chilli_query logout mac '.escapeshellarg($mac));
170
					if ($member === $mac) {	// Reconnect allowed MAC
178
					if ($member === $mac) {
171
						exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
179
						$group_macs[] = $mac;
172
					}
180
					}
173
				}
181
				}
174
			}
182
			}
175
		}
183
		}
-
 
184
 
-
 
185
		if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
-
 
186
			include("../lib/$config[general_lib_type]/change_attrs.php");
-
 
187
 
-
 
188
		// Reconnect allowed MAC from the selected group
-
 
189
		foreach ($group_macs as $mac) {
-
 
190
			exec('sudo /usr/sbin/chilli_query login mac '.escapeshellarg($mac).' username '.escapeshellarg($mac)." password 'password'");
-
 
191
		}
176
	}
192
	}
177
}
193
}
178
else if ($badusers == 1){
194
else if ($badusers == 1){
179
	if (is_file("../lib/add_badusers.php"))
195
	if (is_file("../lib/add_badusers.php"))
180
		include("../lib/add_badusers.php");
196
		include("../lib/add_badusers.php");