Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
1805 clement.si 1
<?php
2
//include_once('../lib/xlat.php');
3
#Read user_edit attribute map
4
unset($show_attrs);
5
if (isset($_SESSION['show_attrs']))
6
	$show_attrs = $_SESSION['show_attrs'];
7
if (!isset($show_attrs)){
8
	$infile = $config['general_user_edit_attrs_file'];
9
	$ARR = file($infile);
10
	foreach($ARR as $val){
11
		$val=chop($val);
12
		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
13
			continue;
14
		list($key,$v)=preg_split("/\t+/",$val);
15
		$show_attrs["$key"]=($v != '') ? "$v" : "$key";
16
	}
17
	if ($config['general_use_session'] == 'yes')
18
		session_register('show_attrs');
19
}
20
unset($acct_attrs);
21
if (isset($_SESSION['acct_attrs']))
22
	$acct_attrs = $_SESSION['acct_attrs'];
23
if (!isset($acct_attrs) && isset($config['general_accounting_attrs_file'])){
24
	$infile = $config['general_accounting_attrs_file'];
25
	$ARR = file($infile);
26
	$acct_attrs = array();
27
	$acct_attrs["ua"] = array();
28
	$acct_attrs["ua"]['num'] = 0;
29
	$acct_attrs["uf"] = array();
30
	$acct_attrs["uf"]['num'] = 0;
31
	$acct_attrs["fl"] = array();
32
	$acct_attrs["fl"]['num'] = 0;
33
	foreach ($ARR as $val){
34
		$val=chop($val);
35
		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
36
			continue;
37
		list($num,$desc,$showua,$showuf,$showfl)=preg_split("/\t+/",$val);
38
		if ($showua == 'yes'){
39
			$acct_attrs["ua"]["num"]++;
40
			$acct_attrs["ua"]["$num"]=$desc;
41
		}
42
		if ($showuf == 'yes'){
43
			$acct_attrs["uf"]["num"]++;
44
			$acct_attrs["uf"]["$num"]=$desc;
45
		}
46
		if ($showfl == 'yes'){
47
			$acct_attrs["fl"]["num"]++;
48
			$acct_attrs["fl"]["$num"]=$desc;
49
		}
50
	}
51
	if ($config['general_use_session'] == 'yes')
52
		session_register('acct_attrs');
53
}
54
?>