#!/usr/bin/php -q 1) { if(!isset($setup[$sarray[0]])) { // Create an entry $EtoI[$sarray[0]] = $sarray[0]; $setup[$sarray[0]]['external'] = $sarray[0]; } // Record the value type $setup[$sarray[0]]['type'] = $type; // Record the ruleset type if($category == 'simple') { $setup[$sarray[0]]['ruleset'] = 'no'; } else { $setup[$sarray[0]]['ruleset'] = $category; } // Record the default value $setup[$sarray[0]]['default'] = $sarray[1]; // Record the selectable options (Internal => External) $setup[$sarray[0]]['values'] = array(); while(count($sarray)>2) { $setup[$sarray[0]]['values'][array_pop($sarray)] = array_pop($sarray); } } } elseif($category != 'translation') { // Handle All other values (e.g. Dir, File, Command, Other) if(preg_match('/(\S+)\s*(.*)/',$line,$match)) { $match[1] = strtolower($match[1]); if(!isset($setup[$match[1]])) { // Create an entry $EtoI[$match[1]] = $match[1]; $setup[$match[1]]['external'] = $match[1]; } // Record the value type $setup[$match[1]]['type'] = $type; // Record the ruleset type if($category == 'simple') { $setup[$match[1]]['ruleset'] = 'no'; } else { $setup[$match[1]]['ruleset'] = $category; } // Record the default value if(!preg_match('/^#/',$match[2])) { $setup[$match[1]]['default'] = $match[2]; } else { $setup[$match[1]]['default'] = ""; } } } } fclose($fh); } // Okay - we have MailScanner.conf and EtoI loaded // let's merge the arrays together and build the // difinitive list of all possible values. foreach($conf as $key=>$val) { if(!isset($EtoI[$key])) { // EtoI lookup failed (sendercontentreport) if(isset($setup[$key])) { // Use internal value instead $setup[$key]['name'] = $val['name']; $setup[$key]['desc'] = $val['comment']; $setup[$key]['value'] = $val['value']; } } else { $setup[$EtoI[$key]]['name'] = $val['name']; $setup[$EtoI[$key]]['desc'] = $val['comment']; $setup[$EtoI[$key]]['value'] = $val['value']; } } // Sort the array asort($setup); echo "";