/** * Support function -- get the contents of one of the ini files specified in the * [Extra_Config] section of config.ini. * * @param string $name The ini's name from the [Extra_Config] section of config.ini * * @return array The retrieved configuration settings. */ function getExtraConfigArray($name) { static $extraConfigs = array(); // If the requested settings aren't loaded yet, pull them in: $filename = getExtraConfigArrayFile($name); if (!isset($extraConfigs[$filename])) { // Try to load the .ini file; if loading fails, the file probably doesn't // exist, so we can treat it as an empty array. $extraConfigs[$filename] = @parse_ini_file($filename, true); if ($extraConfigs[$filename] === false) { $extraConfigs[$filename] = array(); } // Load local overrides $localfilename = preg_replace('/(.*)\\./', '\\1.local.', $filename); $localOverride = @parse_ini_file($localfilename, true); if ($localOverride) { foreach ($localOverride as $section => $settings) { if (in_array($name, array('searches', 'PCI', 'MetaLib')) && $section == 'General' && isset($extraConfigs[$filename][$section])) { // Don't override whole General section of searches.ini, PCI.ini or MetaLib.ini $extraConfigs[$filename][$section] = iniMerge($extraConfigs[$filename][$section], $settings); } else { $extraConfigs[$filename][$section] = $settings; } } } } return $extraConfigs[$filename]; }
/** * Support function -- get the contents of one of the ini files specified in the * [Extra_Config] section of config.ini. * * @param string $name The ini's name from the [Extra_Config] section of config.ini * * @return array The retrieved configuration settings. */ function getExtraConfigArray($name) { static $extraConfigs = array(); // If the requested settings aren't loaded yet, pull them in: if (!isset($extraConfigs[$name])) { // Try to load the .ini file; if loading fails, the file probably doesn't // exist, so we can treat it as an empty array. $extraConfigs[$name] = @parse_ini_file(getExtraConfigArrayFile($name), true); if ($extraConfigs[$name] === false) { $extraConfigs[$name] = array(); } } return $extraConfigs[$name]; }
/** * Support function -- get the contents of one of the ini files specified in the * [Extra_Config] section of config.ini. * * @param string $name The ini's name from the [Extra_Config] section of config.ini * @return array The retrieved configuration settings. */ function getExtraConfigArray($name) { static $extraConfigs = array(); // If the requested settings aren't loaded yet, pull them in: if (!isset($extraConfigs[$name])) { // Try to load the .ini file; if loading fails, the file probably doesn't // exist, so we can treat it as an empty array. $extraConfigs[$name] = @parse_ini_file(getExtraConfigArrayFile($name), true); if ($extraConfigs[$name] === false) { $extraConfigs[$name] = array(); } if ($name == 'facets') { //************************* //Marmot overrides for controlling facets based on library system. global $librarySingleton; $library = $librarySingleton->getActiveLibrary(); if (isset($library)) { if ($library->restrictSearchByLibrary && $library->useScope) { unset($extraConfigs[$name]['Results']['institution']); unset($extraConfigs[$name]['Author']['institution']); } } global $locationSingleton; $activeLocation = $locationSingleton->getActiveLocation(); if (!is_null($activeLocation)) { if ($activeLocation->restrictSearchByLocation && $activeLocation->useScope) { unset($extraConfigs[$name]['Results']['institution']); unset($extraConfigs[$name]['Results']['building']); unset($extraConfigs[$name]['Author']['institution']); unset($extraConfigs[$name]['Author']['building']); } } } } return $extraConfigs[$name]; }
function launch() { global $configArray; global $interface; if (isset($_POST['submit'])) { switch ($_GET['file']) { case 'stopwords.txt': $this->processStopWords(); break; case 'synonyms.txt': $this->processSynonyms(); break; case 'protwords.txt': $this->processProtWords(); break; case 'elevate.xml': //$this->processElevate(); $this->processConfigFile($configArray['Index']['local'] . '/biblio/conf/elevate.xml', $_POST['config_file']); break; case 'searchspecs.yaml': case 'searches.ini': case 'facets.ini': // Figure out the path to the file based on its extension -- the YAML option is // hard-coded, but the INI files may be renamed by the user. list($filename, $ext) = explode('.', $_GET['file']); if ($ext == 'yaml') { $path = 'conf/' . $_GET['file']; } else { $path = getExtraConfigArrayFile($filename); } $this->processConfigFile($configArray['Site']['local'] . '/' . $path, $_POST['config_file']); break; case 'config.ini': //$this->processConfig(); // dangerous -- disabled until fixed $this->processConfigFile($configArray['Site']['local'] . '/' . 'conf/config.ini', $_POST['config_file']); break; } } if (isset($_GET['file'])) { switch ($_GET['file']) { case 'stopwords.txt': $this->showStopWords(); break; case 'synonyms.txt': $this->showSynonyms(); break; case 'protwords.txt': $this->showProtWords(); break; case 'elevate.xml': //$this->showElevate(); $this->showConfigFile('Elevated Terms Configuration', $configArray['Index']['local'] . '/biblio/conf/elevate.xml'); break; case 'searchspecs.yaml': $this->showConfigFile('Search Specifications', $configArray['Site']['local'] . '/' . 'conf/searchspecs.yaml'); break; case 'searches.ini': $this->showConfigFile('Search Settings', $configArray['Site']['local'] . '/' . getExtraConfigArrayFile('searches')); break; case 'facets.ini': $this->showConfigFile('Facet Settings', $configArray['Site']['local'] . '/' . getExtraConfigArrayFile('facets')); break; case 'config.ini': default: //$this->showConfig(); // dangerous -- disabled until fixed $this->showConfigFile('General Settings', $configArray['Site']['local'] . '/' . 'conf/config.ini'); break; } } else { $interface->setPageTitle('Configuration'); $interface->setTemplate('config.tpl'); } $interface->display('layout.tpl'); }