$Value) { $phpMussel['Config'][$Category][$Directive] = $Value; } }); $phpMussel['Overrides'] = true; } } else { $fileContent = file_get_contents($phpMussel['Vault'] . $phpMussel['Domain'] . '.config.ini'); if ($phpMussel['Overrides'] = parse_ini_string($fileContent, true)) { array_walk($phpMussel['Overrides'], function ($Keys, $Category) use (&$phpMussel) { foreach ($Keys as $Directive => $Value) { $phpMussel['Config'][$Category][$Directive] = $Value; } }); $phpMussel['Overrides'] = true; } } } /** Kills the script if parsing the configuration overrides file fails. */ if (isset($phpMussel['Overrides']) && $phpMussel['Overrides'] === false) { header('Content-Type: text/plain'); die('[phpMussel] Configuration overrides file is corrupt! Can\'t continue until this is resolved.'); } /** Attempts to parse the phpMussel configuration defaults file. */ $phpMussel['YAML']($phpMussel['ReadFile']($phpMussel['Vault'] . 'config.yaml'), $phpMussel['Config']); /** Kills the script if parsing the configuration defaults file fails. */ if (empty($phpMussel['Config']['Config Defaults'])) { header('Content-Type: text/plain'); die('[phpMussel] Configuration defaults file is corrupt! Please reinstall phpMussel.'); } /** Perform fallbacks and autotyping for missing configuration directives. */ $phpMussel['Config']['Temp'] = []; foreach ($phpMussel['Config']['Config Defaults'] as $phpMussel['Config']['Temp']['KeyCat'] => $phpMussel['Config']['Temp']['DCat']) { if (!isset($phpMussel['Config'][$phpMussel['Config']['Temp']['KeyCat']])) { $phpMussel['Config'][$phpMussel['Config']['Temp']['KeyCat']] = []; } if (isset($phpMussel['Config']['Temp']['Cat'])) { unset($phpMussel['Config']['Temp']['Cat']); } $phpMussel['Config']['Temp']['Cat'] = &$phpMussel['Config'][$phpMussel['Config']['Temp']['KeyCat']]; if (!is_array($phpMussel['Config']['Temp']['DCat'])) { continue; } foreach ($phpMussel['Config']['Temp']['DCat'] as $phpMussel['Config']['Temp']['KeyDir'] => $phpMussel['Config']['Temp']['DDir']) { if ( !isset($phpMussel['Config']['Temp']['Cat'][$phpMussel['Config']['Temp']['KeyDir']]) && isset($phpMussel['Config']['Temp']['DDir']['default']) ) { $phpMussel['Config']['Temp']['Cat'][$phpMussel['Config']['Temp']['KeyDir']] = $phpMussel['Config']['Temp']['DDir']['default']; } if (isset($phpMussel['Config']['Temp']['Dir'])) { unset($phpMussel['Config']['Temp']['Dir']); } $phpMussel['Config']['Temp']['Dir'] = &$phpMussel['Config']['Temp']['Cat'][$phpMussel['Config']['Temp']['KeyDir']]; if (isset($phpMussel['Config']['Temp']['DDir']['type'])) { $phpMussel['AutoType']($phpMussel['Config']['Temp']['Dir'], $phpMussel['Config']['Temp']['DDir']['type']); } } } unset($phpMussel['Config']['Temp']); /** Failsafe for weird ipaddr configuration. */ if ($phpMussel['Config']['general']['ipaddr'] !== 'REMOTE_ADDR' && empty($_SERVER[$phpMussel['Config']['general']['ipaddr']])) { $phpMussel['Config']['general']['ipaddr'] = 'REMOTE_ADDR'; } /** Ensure we have an IP address variable to work with. */ if (!isset($_SERVER[$phpMussel['Config']['general']['ipaddr']])) { $_SERVER[$phpMussel['Config']['general']['ipaddr']] = ''; } /** Adjusted present time. */ $phpMussel['Time'] = time() + ($phpMussel['Config']['general']['timeOffset'] * 60); /** Set timezone. */ if (!empty($phpMussel['Config']['general']['timezone']) && $phpMussel['Config']['general']['timezone'] !== 'SYSTEM') { date_default_timezone_set($phpMussel['Config']['general']['timezone']); } /** Determine whether operating in CLI-mode. */ $phpMussel['Mussel_sapi'] = !defined('Via-Travis') && ( empty($_SERVER['REQUEST_METHOD']) || substr(php_sapi_name(), 0, 3) === 'cli' || ( empty($_SERVER[$phpMussel['Config']['general']['ipaddr']]) && empty($_SERVER['HTTP_USER_AGENT']) && !empty($_SERVER['argc']) && is_numeric($_SERVER['argc']) && $_SERVER['argc'] > 0 ) ); /** Process the request query and query variables (if any exist). */ if (!empty($_SERVER['QUERY_STRING'])) { $phpMussel['Query'] = $_SERVER['QUERY_STRING']; parse_str($_SERVER['QUERY_STRING'], $phpMussel['QueryVars']); } else { $phpMussel['Query'] = ''; $phpMussel['QueryVars'] = []; } /** Set default hashing algorithm. */ $phpMussel['DefaultAlgo'] = ( !empty($phpMussel['Config']['general']['default_algo']) && defined($phpMussel['Config']['general']['default_algo']) ) ? constant($phpMussel['Config']['general']['default_algo']) : 1;