Subversion Repositories ALCASAR

Rev

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

Rev 2340 Rev 2341
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: user_edit.php 2340 2017-07-21 18:15:24Z tom.houdayer $
2
# $Id: user_edit.php 2341 2017-07-21 20:01:36Z 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
 
8
require('/etc/freeradius-web/config.php');
-
 
9
require('../lib/attrshow.php');
-
 
10
require('../lib/defaults.php');
-
 
11
 
-
 
12
if(!isset($change)) $change = 0;
-
 
13
if(!isset($user_type)) $user_type = 'user';
-
 
14
if(!isset($badusers)) $badusers = 0;
-
 
15
if(!isset($cn)) $cn = '';
-
 
16
 
-
 
17
//update Filter-Id for protocol filtering
8
//update Filter-Id for protocol filtering
18
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id0']))
9
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id0']))
19
{
10
{
20
	$upId = (int)$_POST['Filter-Proto'];
11
	$upId = (int)$_POST['Filter-Proto'];
21
	$downId = (int)$_POST['Filter-Id0'];
12
	$downId = (int)$_POST['Filter-Id0'];
22
	$upId = $upId+$downId;
13
	$upId = $upId+$downId;
23
	$upId = str_pad($upId, 8, '0', STR_PAD_LEFT);
14
	$upId = str_pad($upId, 8, '0', STR_PAD_LEFT);
24
	$_POST['Filter-Id0'] = $upId;
15
	$_POST['Filter-Id0'] = $upId;
25
}
16
}
26
 
17
 
-
 
18
require('/etc/freeradius-web/config.php');
-
 
19
require('../lib/attrshow.php');
-
 
20
require('../lib/defaults.php');
-
 
21
require("../lib/operators.php");
-
 
22
 
-
 
23
if(!isset($change)) $change = 0;
-
 
24
if(!isset($user_type)) $user_type = 'user';
-
 
25
if(!isset($badusers)) $badusers = 0;
-
 
26
if(!isset($cn)) $cn = '';
-
 
27
 
27
if ($user_type != 'group'){
28
if ($user_type != 'group'){
28
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
29
	if (is_file("../lib/$config[general_lib_type]/user_info.php"))
29
		include("../lib/$config[general_lib_type]/user_info.php");
30
		include("../lib/$config[general_lib_type]/user_info.php");
30
	if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
31
	if ($config['general_lib_type'] == 'sql' && $config['sql_show_all_groups'] == 'true'){
31
		$saved_login = $login;
32
		$saved_login = $login;
Line 40... Line 41...
40
		include("../lib/$config[general_lib_type]/group_info.php");
41
		include("../lib/$config[general_lib_type]/group_info.php");
41
}
42
}
42
if (false && /* Hide operator column */ $config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true') {
43
if (false && /* Hide operator column */ $config['general_lib_type'] == 'sql' && $config['sql_use_operators'] == 'true') {
43
	$colspan = 2;
44
	$colspan = 2;
44
	$show_ops = 1;
45
	$show_ops = 1;
45
	include("../lib/operators.php");
-
 
46
} else {
46
} else {
47
	$show_ops = 0;
47
	$show_ops = 0;
48
	$colspan = 1;
48
	$colspan = 1;
49
}
49
}
50
?>
50
?>
Line 134... Line 134...
134
<tr bgcolor="black" valign=top><td colspan="2">
134
<tr bgcolor="black" valign=top><td colspan="2">
135
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
135
	<table border=0 width=100% cellpadding=12 cellspacing=0 bgcolor="#ffffd0" valign=top>
136
	<tr><td>
136
	<tr><td>
137
EOM;
137
EOM;
138
 
138
 
139
if ($change == 1){
139
if ($change == 1) {
140
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
140
	if (is_file("../lib/$config[general_lib_type]/change_attrs.php"))
141
		include("../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 ($config['general_show_user_password'] != 'no' && $passwd != ''
143
		if ($config['general_show_user_password'] != 'no' && $passwd != ''
144
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
144
			&& is_file("../lib/$config[general_lib_type]/change_passwd.php"))
Line 584... Line 584...
584
				echo '</td>';
584
				echo '</td>';
585
			}
585
			}
586
 
586
 
587
			if (isset($member_groups) && $user_type !== 'group') {
587
			if (isset($member_groups) && $user_type !== 'group') {
588
				echo '<td bgcolor="#BEBEBE">';
588
				echo '<td bgcolor="#BEBEBE">';
589
				switch ($name){
589
				switch ($key){
590
					case 'Simultaneous-Use' :
590
					case 'Simultaneous-Use' :
591
						echo "$grp_simuse";
591
						echo "$grp_simuse";
592
						break;
592
						break;
593
					case 'Login-Time' :
593
					case 'Login-Time' :
594
						echo "$grp_logtime";
594
						echo "$grp_logtime";
Line 637... Line 637...
637
				}
637
				}
638
				echo '</td>';
638
				echo '</td>';
639
			}
639
			}
640
 
640
 
641
			echo '<td>';
641
			echo '<td>';
642
			switch ($name){
642
			switch ($key) {
643
				/*
643
				/*
644
				Choix de l'unité jour, heures, minutes ou secondes
644
				Choix de l'unité jour, heures, minutes ou secondes
645
				pour les durées limites max, de session,de journée et de mois
645
				pour les durées limites max, de session,de journée et de mois
646
				*/
646
				*/
647
				case 'Session-Timeout' :
647
				case 'Session-Timeout' :
648
				case 'Max-Daily-Session' :
648
				case 'Max-Daily-Session' :
649
					/*valeur d'origine de durée limite */
649
					/*valeur d'origine de durée limite */
650
					echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
650
					echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
651
					/* Choix d'unité*/
651
					/* Choix d'unité*/
652
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','edituser')\">
652
					echo" <select onchange=\"temps(this,'$name1','edituser')\">
653
							<option value=\"s\" selected>s</option>
653
							<option value=\"s\" selected>s</option>
654
							<option value=\"m\" >m</option>
654
							<option value=\"m\" >m</option>
655
							<option value=\"H\" >H</option>
655
							<option value=\"H\" >H</option>
656
						</select>";
656
						</select>";
657
					break;
657
					break;
658
				case 'Max-Monthly-Session' :
658
				case 'Max-Monthly-Session' :
659
				case 'Max-All-Session' :
659
				case 'Max-All-Session' :
660
					/*valeur d'origine de durée limite */
660
					/*valeur d'origine de durée limite */
661
					echo"<input type=\"text\" name=\"$name\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
661
					echo"<input type=\"text\" name=\"$name1\" onfocus=\"this.value=''\" value=\"$val\" size=10>";
662
					/* Choix d'unité*/
662
					/* Choix d'unité*/
663
					echo" <select name=\"$name"."_opt"."\" onchange=\"temps(this,'$name','edituser')\">
663
					echo" <select onchange=\"temps(this,'$name1','edituser')\">
664
							<option value=\"s\" selected>s</option>
664
							<option value=\"s\" selected>s</option>
665
							<option value=\"m\" >m</option>
665
							<option value=\"m\" >m</option>
666
							<option value=\"H\" >H</option>
666
							<option value=\"H\" >H</option>
667
							<option value=\"J\" >J</option>
667
							<option value=\"J\" >J</option>
668
						</select>";
668
						</select>";
669
					break;
669
					break;
670
				case 'Expiration' :
670
				case 'Expiration' :
671
					/*Ajout du calendrier pour choisir la date*/
671
					/*Ajout du calendrier pour choisir la date*/
672
					echo"<input id=\"popup_container\" type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
672
					echo"<input id=\"popup_container\" type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
673
					break;
673
					break;
674
				case 'Filter-Id' :
674
				case 'Filter-Id' :
675
					if (empty($val)) {
675
					if (empty($val)) {
676
						$val = '00000000'; // Set no filters if value is not set
676
						$val = '00000000'; // Set no filters if value is not set
677
					}
677
					}
Line 683... Line 683...
683
					} else if ($val[7] === '1') {
683
					} else if ($val[7] === '1') {
684
						$selected = 'havp';
684
						$selected = 'havp';
685
					} else {
685
					} else {
686
						$selected = 'not_filtered';
686
						$selected = 'not_filtered';
687
					}
687
					}
688
					echo "<select name=\"Filter-Id\">";
688
					echo "<select name=\"$name1\">";
689
					echo "<option value=\"\"".(($selected === 'not_filtered') ? ' selected' : '').">$l_filtering_none</option>";
689
					echo "<option value=\"00000000\"".(($selected === 'not_filtered') ? ' selected' : '').">$l_filtering_none</option>";
690
					echo "<option value=\"00000001\"".(($selected === 'havp') ? ' selected' : '').">$l_filtering_havp</option>";
690
					echo "<option value=\"00000001\"".(($selected === 'havp') ? ' selected' : '').">$l_filtering_havp</option>";
691
					echo "<option value=\"00000011\"".(($selected === 'havp_bl') ? ' selected' : '').">$l_filtering_havp_bl</option>";
691
					echo "<option value=\"00000011\"".(($selected === 'havp_bl') ? ' selected' : '').">$l_filtering_havp_bl</option>";
692
					echo "<option value=\"00000101\"".(($selected === 'havp_wl') ? ' selected' : '').">$l_filtering_havp_wl</option>";
692
					echo "<option value=\"00000101\"".(($selected === 'havp_wl') ? ' selected' : '').">$l_filtering_havp_wl</option>";
693
					echo "</select>";
693
					echo "</select>";
694
					break;
694
					break;
695
				default :
695
				default :
696
					echo "<input type=\"text\" name=\"$name\" value=\"$val\" size=\"20\">";
696
					echo "<input type=\"text\" name=\"$name1\" value=\"$val\" size=\"20\">";
697
					break;
697
					break;
698
			}
698
			}
699
			echo '</td>';
699
			echo '</td>';
700
		}
700
		}
701
	}
701
	}