From 2fe8440f529422cf725443c8a48c025ba47cd0e9 Mon Sep 17 00:00:00 2001 From: kkalev Date: Fri, 22 Apr 2005 13:21:31 +0000 Subject: [PATCH] In lib/sql/attrmap.php3, only register variables once. Go through $show_attrs and set default attribute mappings for any attribute that a mapping does not exist. --- Changelog | 2 ++ lib/sql/attrmap.php3 | 29 ++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Changelog b/Changelog index 41fab0b..87bda0e 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,8 @@ Ver 1.80: * Count online users correctly (through a separate query) in user_finger. * Use the correct max results variable in lib/*/find.php3 * In time2strclock also show days if applicable +* In lib/sql/attrmap.php3, only register variables once. Go through $show_attrs and set default attribute + mappings for any attribute that a mapping does not exist. Ver 1.78: * Add a snmp_clearsession which can disconnect a user by using the Cisco AAA Session MIB * Add a configuration directive general_sessionclear_bin diff --git a/lib/sql/attrmap.php3 b/lib/sql/attrmap.php3 index f7e5e8f..ae3a5cd 100644 --- a/lib/sql/attrmap.php3 +++ b/lib/sql/attrmap.php3 @@ -9,15 +9,26 @@ if (isset($_SESSION['attrmap'])){ $rev_attrmap =$_SESSION['rev_attrmap']; $attr_type = $_SESSION['attr_type']; } -$ARR = file("$config[general_sql_attrmap]"); -foreach($ARR as $val){ - $val=chop($val); - if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val)) - continue; - list($type,$key,$v)=split('[[:space:]]+',$val); - $attrmap["$key"]=$v; - $rev_attrmap["$v"] = $key; - $attr_type["$key"]=$type; +else{ + $ARR = file("$config[general_sql_attrmap]"); + foreach($ARR as $val){ + $val=chop($val); + if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val)) + continue; + list($type,$key,$v)=split('[[:space:]]+',$val); + $attrmap["$key"]=$v; + $rev_attrmap["$v"] = $key; + $attr_type["$key"]=$type; + } + if (isset($show_attrs)){ + foreach($show_attrs as $key => $desc){ + if ($attrmap["$key"] == ''){ + $attrmap["$key"] = $key; + $attr_type["key"] = 'replyItem'; + $rev_attrmap["$key"] = $key; + } + } + } if ($config[general_use_session] == 'yes'){ session_register('attrmap'); session_register('rev_attrmap'); -- 2.39.5