Subversion Repositories ALCASAR

Rev

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

Rev 2319 Rev 2339
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: user_edit.php 2319 2017-07-04 23:21:40Z tom.houdayer $
2
# $Id: user_edit.php 2339 2017-07-21 17:52:51Z 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 28... Line 28...
28
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
28
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
29
		include("../lib/$config[general_lib_type]/user_info.php");
29
		include("../lib/$config[general_lib_type]/user_info.php");
30
	if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
30
	if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
31
		$saved_login = $login;
31
		$saved_login = $login;
32
		$login = '';
32
		$login = '';
33
		if (is_file("../lib/sql/group_info.php"))
33
		if (is_file("../lib/$config[general_lib_type]/group_info.php"))
34
			include("../lib/sql/group_info.php");
34
			include("../lib/$config[general_lib_type]/group_info.php");
35
		$login = $saved_login;
35
		$login = $saved_login;
36
	}
36
	}
37
}
37
}
38
else{
38
else{
39
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
39
	if (is_file("../lib/$config[general_lib_type]/group_info.php"))
Line 52... Line 52...
52
<html>
52
<html>
53
<head>
53
<head>
54
<title>Users & groups edition</title>
54
<title>Users & groups edition</title>
55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
55
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $config['general_charset']?>">
56
<link rel="stylesheet" href="/css/style.css">
56
<link rel="stylesheet" href="/css/style.css">
-
 
57
<script type="text/javascript" src="/js/fonctions.js"></script>
57
<script language="javascript" type="text/javascript">
58
<script language="javascript" type="text/javascript">
58
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
59
var chars='0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'
59
function password(size)
60
function password(size)
60
  {
61
  {
61
  var pass=''
62
  var pass=''
Line 143... Line 144...
143
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
144
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
144
			include("../lib/$config[general_lib_type]/change_passwd.php");
145
			include("../lib/$config[general_lib_type]/change_passwd.php");
145
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
146
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
146
			include("../lib/$config[general_lib_type]/user_info.php");
147
			include("../lib/$config[general_lib_type]/user_info.php");
147
		if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
148
		if ($group_change && $config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
148
			include("../lib/sql/group_change.php");
149
			include("../lib/$config[general_lib_type]/group_change.php");
149
			include("../lib/defaults.php");
150
			include("../lib/defaults.php");
150
		}
151
		}
151
		# Disconnecting user for re-authentication
152
		# Disconnecting user for re-authentication
152
		$mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg(" $login ")." | awk '{print $1}'");
153
		$mac=exec("sudo /usr/sbin/chilli_query list | grep ".escapeshellarg(" $login ")." | awk '{print $1}'");
153
		exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($mac));
154
		exec("sudo /usr/sbin/chilli_query logout ".escapeshellarg($mac));
Line 172... Line 173...
172
//si l'utilisateur fait parti d'un groupe, on charge les attributs du groupe, pour les afficher ensuite.
173
//si l'utilisateur fait parti d'un groupe, on charge les attributs du groupe, pour les afficher ensuite.
173
if(isset($member_groups) && ($user_type != 'group')) {
174
if(isset($member_groups) && ($user_type != 'group')) {
174
	$group = array_values($member_groups)[0];
175
	$group = array_values($member_groups)[0];
175
	$login_saved = $login;
176
	$login_saved = $login;
176
	$login = array_values($member_groups)[0];
177
	$login = array_values($member_groups)[0];
177
	include("../lib/sql/group_info.php");
178
	include("../lib/$config[general_lib_type]/group_info.php");
178
	$login = $login_saved;
179
	$login = $login_saved;
179
	
180
	
180
	foreach ($show_attrs as $key => $desc) {
181
	foreach ($show_attrs as $key => $desc) {
181
		$name = $attrmap["$key"];
182
		$name = $attrmap["$key"];
182
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
183
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
Line 298... Line 299...
298
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
299
		if (is_file("../lib/$config[general_lib_type]/user_info.php"))
299
			include("../lib/$config[general_lib_type]/user_info.php");
300
			include("../lib/$config[general_lib_type]/user_info.php");
300
		if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
301
		if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
301
			$saved_login = $login;
302
			$saved_login = $login;
302
			$login = '';
303
			$login = '';
303
			if (is_file("../lib/sql/group_info.php"))
304
			if (is_file("../lib/$config[general_lib_type]/group_info.php"))
304
				include("../lib/sql/group_info.php");
305
				include("../lib/$config[general_lib_type]/group_info.php");
305
			$login = $saved_login;
306
			$login = $saved_login;
306
		}
307
		}
307
	}
308
	}
308
}
309
}
309
?>
310
?>
Line 344... Line 345...
344
	}
345
	}
345
 
346
 
346
 
347
 
347
	echo <<<EOM
348
	echo <<<EOM
348
	<td>
349
	<td>
349
	<input type=password name=passwd value="" size=20>
350
	<input type="password" name="passwd" value="" size="20">
350
	<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
351
	<br /><input type="button" value="$l_passwd_gen" onclick="password(8)">
351
	<input type="text" value="" name="pwdgene" size=10 readonly>
352
	<input type="text" value="" name="pwdgene" size="10" readonly>
352
	</td>
353
	</td>
353
	</tr>
354
	</tr>
354
EOM;
355
EOM;
355
}
356
}
356
 
357
 
Line 494... Line 495...
494
					case 'Max-Daily-Session' :
495
					case 'Max-Daily-Session' :
495
					case 'Max-Weekly-Session' :
496
					case 'Max-Weekly-Session' :
496
					case 'Max-Monthly-Session' :
497
					case 'Max-Monthly-Session' :
497
					case 'Login-Time' :
498
					case 'Login-Time' :
498
					case 'Expiration' :
499
					case 'Expiration' :
499
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=</option></select></td>";
-
 
500
						break;
-
 
501
					case 'Filter-Id' :
500
					case 'Filter-Id' :
502
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=</option></select></td>";
501
						echo "<td><select name=\"$oper_name\"><option $selected[$op_eq] value=\":=\">:=</option></select></td>";
503
						break;
502
						break;
504
					case 'Session-Timeout' :
503
					case 'Session-Timeout' :
505
					case 'ChilliSpot-Max-Input-Octets' :
504
					case 'ChilliSpot-Max-Input-Octets' :
Line 544... Line 543...
544
					case 'Max-Daily-Session' :
543
					case 'Max-Daily-Session' :
545
					case 'Max-Weekly-Session' :
544
					case 'Max-Weekly-Session' :
546
					case 'Max-Monthly-Session' :
545
					case 'Max-Monthly-Session' :
547
					case 'Login-Time' :
546
					case 'Login-Time' :
548
					case 'Expiration' :
547
					case 'Expiration' :
549
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
-
 
550
						break;
-
 
551
					case 'Filter-Id' :
548
					case 'Filter-Id' :
552
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
549
						echo "<input type=\"hidden\" name=\"$oper_name\" value=\":=\">";
553
						break;
550
						break;
554
					case 'Session-Timeout' :
551
					case 'Session-Timeout' :
555
					case 'ChilliSpot-Max-Input-Octets' :
552
					case 'ChilliSpot-Max-Input-Octets' :
Line 646... Line 643...
646
				case 'Session-Timeout' :
643
				case 'Session-Timeout' :
647
				case 'Max-Daily-Session' :
644
				case 'Max-Daily-Session' :
648
					/*valeur d'origine de durée limite */
645
					/*valeur d'origine de durée limite */
649
					echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
646
					echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
650
					/* Choix d'unité*/
647
					/* Choix d'unité*/
651
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
648
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','edituser')\">
652
							<option value=\"s\" selected>s</option>
649
							<option value=\"s\" selected>s</option>
653
							<option value=\"m\" >m</option>
650
							<option value=\"m\" >m</option>
654
							<option value=\"H\" >H</option>
651
							<option value=\"H\" >H</option>
655
						</select>";
652
						</select>";
656
					break;
653
					break;
657
				case 'Max-Monthly-Session' :
654
				case 'Max-Monthly-Session' :
658
				case 'Max-All-Session' :
655
				case 'Max-All-Session' :
659
					/*valeur d'origine de durée limite */
656
					/*valeur d'origine de durée limite */
660
					echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
657
					echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
661
					/* Choix d'unité*/
658
					/* Choix d'unité*/
662
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','newuser')\">
659
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','edituser')\">
663
							<option value=\"s\" selected>s</option>
660
							<option value=\"s\" selected>s</option>
664
							<option value=\"m\" >m</option>
661
							<option value=\"m\" >m</option>
665
							<option value=\"H\" >H</option>
662
							<option value=\"H\" >H</option>
666
							<option value=\"J\" >J</option>
663
							<option value=\"J\" >J</option>
667
						</select>";
664
						</select>";