Subversion Repositories ALCASAR

Rev

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

Rev 2392 Rev 2394
Line 1... Line 1...
1
<?php
1
<?php
2
# $Id: user_edit.php 2392 2017-08-25 15:28:12Z tom.houdayer $
2
# $Id: user_edit.php 2394 2017-08-27 13:28:59Z 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
//update Filter-Id for protocol filtering
8
//update Filter-Id for protocol filtering
9
if (isset($_POST['Filter-Proto']) && isset($_POST['Filter-Id0']))
9
if (isset($_POST['Filter-Proto']) && isset($_POST['Status-Open-Required']) && isset($_POST['Filter-Id0']))
10
{
10
{
11
	$upId = (int)$_POST['Filter-Proto'];
11
	$filterId = (int)$_POST['Filter-Id0'];
12
	$downId = (int)$_POST['Filter-Id0'];
12
	$FilterProto = (int)$_POST['Filter-Proto'];
-
 
13
	$statusOpenRequired = (int)($_POST['Status-Open-Required'].'000');
13
	$upId = $upId+$downId;
14
	$filterId = $filterId+$FilterProto+$statusOpenRequired;
14
	$upId = str_pad($upId, 8, '0', STR_PAD_LEFT);
15
	$_POST['Filter-Id0'] = str_pad($filterId, 8, '0', STR_PAD_LEFT);
-
 
16
}
-
 
17
if (isset($_POST['Status-Open-Required'])) {
-
 
18
	if ($_POST['Status-Open-Required'] === '0') {
-
 
19
		$_POST['Idle-Timeout0'] = '600'; // 10 minutes
-
 
20
	} else {
15
	$_POST['Filter-Id0'] = $upId;
21
		$_POST['Idle-Timeout0'] = '';
-
 
22
	}
-
 
23
	$_POST['Idle-Timeout0_op'] = '=';
16
}
24
}
17
 
25
 
18
require('/etc/freeradius-web/config.php');
26
require('/etc/freeradius-web/config.php');
19
require('../lib/attrshow.php');
27
require('../lib/attrshow.php');
20
require('../lib/defaults.php');
28
require('../lib/defaults.php');
Line 187... Line 195...
187
	$login = array_values($member_groups)[0];
195
	$login = array_values($member_groups)[0];
188
	include("../lib/$config[general_lib_type]/group_info.php");
196
	include("../lib/$config[general_lib_type]/group_info.php");
189
	$login = $login_saved;
197
	$login = $login_saved;
190
	
198
	
191
	foreach ($show_attrs as $key => $desc) {
199
	foreach ($show_attrs as $key => $desc) {
-
 
200
		if ($key === 'Idle-Timeout') continue;
192
		$name = $attrmap["$key"];
201
		$name = $attrmap["$key"];
193
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
202
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
194
		if ($name == 'none')
203
		if ($name == 'none')
195
			continue;
204
			continue;
196
		unset($vals);
205
		unset($vals);
Line 300... Line 309...
300
					} else if ($val[0] === '1') {
309
					} else if ($val[0] === '1') {
301
						$grp_proto = $l_proto_1;
310
						$grp_proto = $l_proto_1;
302
					} else {
311
					} else {
303
						$grp_proto = $l_proto_0;
312
						$grp_proto = $l_proto_0;
304
					}
313
					}
-
 
314
 
-
 
315
					if ($val[4] === '1') {
-
 
316
						$grp_statusOpenRequired = $l_yes;
-
 
317
					} else {
-
 
318
						$grp_statusOpenRequired = $l_no;
-
 
319
					}
305
					
320
					
306
					break;
321
					break;
307
			}
322
			}
308
		}
323
		}
309
	}
324
	}
Line 368... Line 383...
368
	</tr>
383
	</tr>
369
EOM;
384
EOM;
370
}
385
}
371
 
386
 
372
	foreach($show_attrs as $key => $desc){
387
	foreach($show_attrs as $key => $desc){
-
 
388
		if ($key === 'Idle-Timeout') continue;
373
		$name = $attrmap["$key"];
389
		$name = $attrmap["$key"];
374
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
390
		$generic = (isset($attrmap['generic']["$key"])) ? $attrmap['generic']["$key"] : '';
375
		if ($name == 'none')
391
		if ($name == 'none')
376
			continue;
392
			continue;
377
		unset($vals);
393
		unset($vals);
Line 708... Line 724...
708
			}
724
			}
709
			echo '</td>';
725
			echo '</td>';
710
		}
726
		}
711
	}
727
	}
712
	
728
	
713
/*protocole filter*/
729
	/*protocole filter*/
714
print <<<EOM
730
	print <<<EOM
715
<tr>
-
 
716
<td class="etiquette" colspan="$colspan">
-
 
717
	<a href="help/protocols_help.html" target=help onclick="window.open('help/protocols_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_proto</font></a>
-
 
718
</td>
-
 
719
EOM;
-
 
720
if(isset($member_groups) && $user_type != 'group') {
-
 
721
	echo "<td bgcolor=\"#BEBEBE\">$grp_proto</td>";
-
 
722
}
-
 
723
 
-
 
724
if ($val[2] === '1') {
-
 
725
	$selected = 'proto_3';
-
 
726
} else if ($val[1] === '1') {
-
 
727
	$selected = 'proto_2';
-
 
728
} else if ($val[0] === '1') {
-
 
729
	$selected = 'proto_1';
-
 
730
} else {
-
 
731
	$selected = 'proto_0';
-
 
732
}
-
 
733
echo "<td width=20>";
-
 
734
echo "<select name='Filter-Proto'>
-
 
735
	<option value=\"00000000\"".(($selected === 'proto_0') ? ' selected' : '').">$l_proto_0</option>
-
 
736
	<option value=\"10000000\"".(($selected === 'proto_1') ? ' selected' : '').">$l_proto_1</option>
-
 
737
	<option value=\"01000000\"".(($selected === 'proto_2') ? ' selected' : '').">$l_proto_2</option>
-
 
738
	<option value=\"00100000\"".(($selected === 'proto_3') ? ' selected' : '').">$l_proto_3</option>
-
 
739
	</select></td>
-
 
740
</tr>";
-
 
741
	
-
 
742
	
-
 
743
if ($user_type != 'group') {
-
 
744
	echo <<<EOM
-
 
745
	<tr>
731
	<tr>
746
	<td align=right colspan="$colspan" bgcolor="#d0ddb0">
732
	<td class="etiquette" colspan="$colspan">
747
	$l_group_member<br><font size=-2><i>($l_main_group)</i></font>
733
		<a href="help/protocols_help.html" target=help onclick="window.open('help/protocols_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_proto</font></a>
748
	</td>
734
	</td>
749
EOM;
735
EOM;
-
 
736
	if(isset($member_groups) && $user_type != 'group') {
-
 
737
		echo "<td bgcolor=\"#BEBEBE\">$grp_proto</td>";
-
 
738
	}
-
 
739
 
-
 
740
	if ($val[2] === '1') {
-
 
741
		$selected = 'proto_3';
-
 
742
	} else if ($val[1] === '1') {
-
 
743
		$selected = 'proto_2';
-
 
744
	} else if ($val[0] === '1') {
-
 
745
		$selected = 'proto_1';
-
 
746
	} else {
-
 
747
		$selected = 'proto_0';
-
 
748
	}
-
 
749
	echo "<td width=20>";
-
 
750
	echo "<select name='Filter-Proto'>
-
 
751
		<option value=\"00000000\"".(($selected === 'proto_0') ? ' selected' : '').">$l_proto_0</option>
-
 
752
		<option value=\"10000000\"".(($selected === 'proto_1') ? ' selected' : '').">$l_proto_1</option>
-
 
753
		<option value=\"01000000\"".(($selected === 'proto_2') ? ' selected' : '').">$l_proto_2</option>
-
 
754
		<option value=\"00100000\"".(($selected === 'proto_3') ? ' selected' : '').">$l_proto_3</option>
-
 
755
		</select></td>
-
 
756
	</tr>";
-
 
757
 
-
 
758
	// User need to keep status page open
-
 
759
	print <<<EOM
-
 
760
	<tr class="advanced-field">
-
 
761
	<td class="etiquette" colspan="$colspan">
-
 
762
		<a href="help/statusOpenRequired_help.html" target=help onclick="window.open('help/statusOpenRequired_help.html','help','width=600,height=250,toolbar=no,scrollbars=no,resizable=yes')" title="$l_click_for_help"><font color="blue">$l_statusOpenRequired</font></a>
-
 
763
	</td>
-
 
764
EOM;
-
 
765
	if(isset($member_groups) && $user_type != 'group') {
-
 
766
		echo "<td bgcolor=\"#BEBEBE\">$grp_statusOpenRequired</td>";
-
 
767
	}
-
 
768
	if ($val[4] === '1') {
-
 
769
		$selected = true;
-
 
770
	} else {
-
 
771
		$selected = false;
-
 
772
	}
-
 
773
	echo "<td width=20>
-
 
774
		<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"1\"".(($selected) ? ' checked' : '').">$l_yes</label>
-
 
775
		<label><input type=\"radio\" name=\"Status-Open-Required\" value=\"0\"".((!$selected) ? ' checked' : '').">$l_no</label>
-
 
776
		</select></td>
-
 
777
	</tr>";
-
 
778
 
-
 
779
 
-
 
780
	if ($user_type != 'group') {
-
 
781
		echo <<<EOM
-
 
782
		<tr>
-
 
783
		<td align=right colspan="$colspan" bgcolor="#d0ddb0">
-
 
784
		$l_group_member<br><font size=-2><i>($l_main_group)</i></font>
-
 
785
		</td>
-
 
786
EOM;
750
if (isset($member_groups)) {
787
	if (isset($member_groups)) {
751
	echo '<td colspan="2">';
788
		echo '<td colspan="2">';
752
} else {
789
	} else {
753
	echo '<td>';
790
		echo '<td>';
754
}
791
	}
755
 
792
 
756
 
793
 
757
	if (isset($existing_groups)){
794
	if (isset($existing_groups)){
758
		echo '<select size="5" name="edited_groups[]"  OnChange="this.form.group_change.value=1">';
795
		echo '<select size="5" name="edited_groups[]"  OnChange="this.form.group_change.value=1">';
759
		if ($config['sql_show_all_groups'] == 'true') {
796
		if ($config['sql_show_all_groups'] == 'true') {