3 # Things should work even if register_globals is set to off
5 $testVer=intval(str_replace(".", "",'4.1.0'));
6 $curVer=intval(str_replace(".", "",phpversion()));
7 if( $curVer >= $testVer )
8 import_request_variables('GPC');
9 # If using sessions set use_session to 1 to also cache the config file
18 $ARR=file("../conf/admin.conf");
20 foreach($ARR as $val) {
22 if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
24 list($key,$v)=split(":[[:space:]]*",$val,2);
25 if (preg_match("/%\{(.+)\}/",$v,$matches)){
26 $val=$config[$matches[1]];
27 $v=preg_replace("/%\{$matches[1]\}/",$val,$v);
29 if (preg_match("/^nas(\d+)_(\w+)$/",$key,$matches))
30 $nas_list[$matches[1]][$matches[2]] = $v;
31 if ($key == 'INCLUDE'){
33 array_push($EXTRA_ARR,file($v));
35 echo "<b>Error: File '$v' does not exist or is not readable</b><br>\n";
40 foreach($EXTRA_ARR as $val1) {
41 foreach($val1 as $val){
43 if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
45 list($key,$v)=split(":[[:space:]]*",$val,2);
46 if (preg_match("/%\{(.+)\}/",$v,$matches)){
47 $val=$config[$matches[1]];
48 $v=preg_replace("/%\{$matches[1]\}/",$val,$v);
50 if (preg_match("/^nas(\d+)_(\w+)$/",$key,$matches))
51 $nas_list[$matches[1]][$matches[2]] = $v;
56 session_register('config');
57 session_register('nas_list');
61 if ($use_session == 0 && $config[general_use_session] == 'yes'){
65 //Make sure we are only passed allowed strings in username
67 $login = preg_replace("/[^\w\s\.\/\@\:]\-i\=/",'',$login);
69 if ($login != '' && $config[general_strip_realms] == 'yes'){
70 $realm_del = ($config[general_realm_delimiter] != '') ? $config[general_realm_delimiter] : '@';
71 $realm_for = ($config[general_realm_format] != '') ? $config[general_realm_format] : 'suffix';
72 $new = explode($realm_del,$login,2);
74 $login = ($realm_for == 'suffix') ? $new[0] : $new[1];
76 if (!isset($mappings) && $config[general_username_mappings_file] != ''){
77 $ARR = file($config[general_username_mappings_file]);
78 foreach($ARR as $val){
80 if (ereg('^[[:space:]]*#',$val) || ereg('^[[:space:]]*$',$val))
82 list($key,$realm,$v)=split(":[[:space:]]*",$val,2);
83 if ($realm == 'accounting' || $realm == 'userdb')
84 $mappings["$key"][$realm] = $v;
86 if ($config[general_use_session] == 'yes')
87 session_register('mappings');