In lib/sql/attrmap.php3, only register variables once. Go through $show_attrs and...
[freeradius.git] / dialup_admin / lib / sql / attrmap.php3
1 <?php
2 #Read sql attribute map
3 unset($attrmap);
4 unset($rev_attrmap);
5 unset($attr_type);
6 if (isset($_SESSION['attrmap'])){
7         #If attrmap is set then the rest will also be set
8         $attrmap = $_SESSION['attrmap'];
9         $rev_attrmap =$_SESSION['rev_attrmap'];
10         $attr_type = $_SESSION['attr_type'];
11 }
12 else{
13         $ARR = file("$config[general_sql_attrmap]");
14         foreach($ARR as $val){
15                 $val=chop($val);
16                 if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
17                         continue;
18                 list($type,$key,$v)=split('[[:space:]]+',$val);
19                 $attrmap["$key"]=$v;
20                 $rev_attrmap["$v"] = $key;
21                 $attr_type["$key"]=$type;
22         }
23         if (isset($show_attrs)){
24                 foreach($show_attrs as $key => $desc){
25                         if ($attrmap["$key"] == ''){
26                                 $attrmap["$key"] = $key;
27                                 $attr_type["key"] = 'replyItem';
28                                 $rev_attrmap["$key"] = $key;
29                         }
30                 }
31         }
32         if ($config[general_use_session] == 'yes'){
33                 session_register('attrmap');
34                 session_register('rev_attrmap');
35                 session_register('attr_type');
36         }
37 }