Subversion Repositories ALCASAR

Rev

Details | Last modification | View Log

Rev Author Line No. Line
703 stephane 1
<?php
2
/*
3
 
4
*/
5
if (!(defined('ALCASAR_SESSION') && (ALCASAR_SESSION === 1))){
6
	exit();
7
}
8
 
9
$config['general_use_session'] = "no";
10
$config['general_sql_attrmap'] = ALCASAR_ADMIN_PATH_INC."/sql.attrmap";
11
 
12
#Read sql attribute map
13
unset($attrmap);
14
unset($rev_attrmap);
15
unset($attr_type);
16
if (isset($_SESSION['attrmap'])){
17
	#If attrmap is set then the rest will also be set
18
	$attrmap = $_SESSION['attrmap'];
19
	$rev_attrmap =$_SESSION['rev_attrmap'];
20
	$attr_type = $_SESSION['attr_type'];
21
}
22
else{
23
	$ARR = file("$config[general_sql_attrmap]");
24
	foreach($ARR as $val){
25
		$val=chop($val);
26
		//if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
27
		if (preg_match('/^[[:space:]]*#/',$val) || preg_match('/^[[:space:]]*$/',$val))
28
			continue;
29
		//list($type,$key,$v)=split('[[:space:]]+',$val);
30
		list($type,$key,$v)=preg_split('/[[:space:]]+/',$val);
31
		$attrmap["$key"]=$v;
32
		$rev_attrmap["$v"] = $key;
33
		$attr_type["$key"]=$type;
34
	}
35
	if (isset($show_attrs)){
36
		foreach($show_attrs as $key => $desc){
37
			if ($attrmap["$key"] == ''){
38
				$attrmap["$key"] = $key;
39
				$attr_type["key"] = 'replyItem';
40
				$rev_attrmap["$key"] = $key;
41
			}
42
		}
43
	}
44
	//if ($config[general_use_session] == 'yes'){
45
	if ($config['general_use_session'] == 'yes'){
46
		session_register('attrmap');
47
		session_register('rev_attrmap');
48
		session_register('attr_type');
49
	}
50
}
51
echo "<pre>";
52
print_r($attrmap);
53
print_r($attr_type);
54
print_r($rev_attrmap);
55
echo "</pre>";
56
?>