0 ? "config_$config.ini" : "config.ini"); $ini = parse_ini_file($PM_INI_FILE); if (isset($ini['pm_config_location'])) { $PM_CONFIG_LOCATION = $ini['pm_config_location']; } else { $PM_CONFIG_LOCATION = "default"; } $PM_CONFIG_DIR = str_replace('\\', '/', realpath($PM_BASECONFIG_DIR . "/" . $PM_CONFIG_LOCATION)); $PM_JS_CONFIG = $PM_CONFIG_LOCATION . "/" . "js_config.php"; $PM_PHP_CONFIG = $PM_CONFIG_LOCATION . "/" . "php_config.php"; /** * Map file */ $mapFileIni = trim($ini["mapFile"]); // try as absolute path if ($mapFileIni{0} == "/" || $mapFileIni{1} == ":") { $PM_MAP_FILE = str_replace('\\', '/', $mapFileIni); // else as relative to $PM_CONFIG_DIR } else { $PM_MAP_FILE = str_replace('\\', '/', realpath($PM_CONFIG_DIR . "/" . $mapFileIni)); } if (!file_exists($PM_MAP_FILE)) { error_log ("P.MAPPER-ERROR: Cannot find map file '$mapFileIni'. Check 'config.ini' file at section 'mapFile'.", 0); exit(); } /** * Set character set for correct display of special characters */ if (isset($ini['defCharset'])) { $defCharset = $ini['defCharset']; } else { $defCharset = "UTF-8"; } /** * WEB location INCPHP */ if (isset($ini['pm_incphp_location'])) { $PM_INCPHP_LOCATION = trim($ini['pm_incphp_location']); $PM_INCPHP = str_replace('\\', '/', realpath(dirname(__FILE__) . "/../" . $PM_INCPHP_LOCATION)); if (!$PM_INCPHP) { error_log("P.MAPPER-ERROR: location '$PM_INCPHP_LOCATION' not existing. Check config at section 'pm_incphp_location'"); exit(); } } else { $PM_INCPHP_LOCATION = "incphp"; $PM_INCPHP = str_replace('\\', '/', realpath(dirname(__FILE__) . "/../incphp")); } /** * Directory location XAJAX */ $PM_XAJAX_LOCATION = $PM_INCPHP_LOCATION . "/xajax/"; /** * Directory JAVASCRIPT */ if (isset($ini['pm_javascript_location'])) { $PM_JAVASCRIPT = trim($ini['pm_javascript_location']); } else { $PM_JAVASCRIPT = "javascript"; } if (!realpath(dirname(__FILE__) . "/../" . $PM_JAVASCRIPT)) { error_log("P.MAPPER-ERROR: location '$PM_JAVASCRIPT' not existing. Check config at section 'pm_javascript'"); exit(); } else { $PM_JAVASCRIPT_REALPATH = realpath(dirname(__FILE__) . "/../" . $PM_JAVASCRIPT); } /** * MapServer version */ if (isset($ini["msVersion"])) { $msVersion = $ini["msVersion"]; } else { error_log("P.MAPPER-ERROR: Missing entry for MapServer version. Check config at section 'msVersion'"); exit(); } /** * Application language */ if (isset($_GET['language'])) { $gLanguage = trim($_GET['language']); } elseif (isset($_SESSION['language'])) { $gLanguage = trim($_SESSION['language']); } elseif (isset($ini['pm_default_language'])) { $gLanguage = trim($ini['pm_default_language']); } elseif (isset($_ENV['PM_DEFAULT_LANGUAGE'])) { $gLanguage = trim($_ENV['PM_DEFAULT_LANGUAGE']); } else { $gLanguage = "en"; // default language } /** * Write vars to session */ $_SESSION['PM_BASECONFIG_DIR'] = $PM_BASECONFIG_DIR; $_SESSION['PM_CONFIG_LOCATION'] = $PM_CONFIG_LOCATION; $_SESSION['PM_CONFIG_DIR'] = $PM_CONFIG_DIR; $_SESSION['PM_INCPHP'] = $PM_INCPHP; $_SESSION['PM_INCPHP_LOCATION'] = $PM_INCPHP_LOCATION; $_SESSION['PM_JAVASCRIPT'] = $PM_JAVASCRIPT; $_SESSION['PM_MAP_FILE'] = $PM_MAP_FILE; $_SESSION['gLanguage'] = $gLanguage; $_SESSION['defCharset'] = $defCharset; $_SESSION['msVersion'] = $msVersion; $_SESSION['session_alive'] = 1; ?>