function parse_conf_files() { $def_file_map =& $GLOBALS['def_file_map']; $file_conf_map =& $GLOBALS['file_conf_map']; foreach ($def_file_map as $files) { foreach ($files as $p) { if (!isset($file_conf_map[$p])) { $conf = parse_conf_file($p); if ($conf === FALSE) { echo "parse_conf_files failed when parsing {$p}"; return FALSE; } $file_conf_map[$p] = $conf; } } } echo "file_conf_map:\n"; print_r($file_conf_map); return TRUE; }
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ require_once __DIR__ . '/functions.php'; session_start(); require __DIR__ . '/login.function.php'; if ($_SESSION['user_type'] != 'A') { header("Location: index.php"); } else { html_start("Configuration"); audit_log('Viewed MailScanner configuration'); $conf_dir = get_conf_include_folder(); $MailScanner_conf_file = '' . MS_CONFIG_DIR . 'MailScanner.conf'; echo '<table border="0" cellpadding="1" cellspacing="1" class="maildetail" width="100%">'; echo '<tr><th colspan="2">MailScanner Configuration</th></tr>'; $array_output = array(); $array_output1 = parse_conf_file($MailScanner_conf_file); $array_output2 = parse_conf_dir($conf_dir); if (is_array($array_output2)) { $array_output = array_merge($array_output1, $array_output2); } else { $array_output = $array_output1; } // Display the information from the configuration files foreach ($array_output as $out_key => $value) { // expand %var% variables if (preg_match("/(%.+%)/", $value, $match)) { $value = preg_replace("/%.+%/", $var[$match[1]], $value); } // See if parameter is a rules file if (@is_file($value) && @is_readable($value) && !@is_executable($value)) { $value = '<a href="msrule.php?file=' . $value . '">' . $value . '</A>';
/** * @param $name * @return bool */ function get_conf_truefalse($name) { if (DISTRIBUTED_SETUP) { return true; } $conf_dir = get_conf_include_folder(); $MailScanner_conf_file = MS_CONFIG_DIR . 'MailScanner.conf'; $array_output1 = parse_conf_file($MailScanner_conf_file); $array_output2 = parse_conf_dir($conf_dir); if (is_array($array_output2)) { $array_output = array_merge($array_output1, $array_output2); } else { $array_output = $array_output1; } foreach ($array_output as $parameter_name => $parameter_value) { $parameter_name = preg_replace('/ */', '', $parameter_name); if (strtolower($parameter_name) == strtolower($name)) { // Is it a ruleset? if (is_readable($parameter_value)) { $parameter_value = get_default_ruleset_value($parameter_value); } $parameter_value = strtolower($parameter_value); switch ($parameter_value) { case "yes": case "1": return true; case "no": case "0": return false; default: // if $parameter_value is a ruleset or a function call return true $parameter_value = trim($parameter_value); if (strlen($parameter_value) > 0) { return true; } return false; } } } return false; }