0)) { $modules = array(); foreach ($settings['modules'] as $module) { $modules[] = safeHTMLstr($module); } sort($modules); foreach ($settings['modules'] as $moduleID => $moduleName) { if (!preg_match("/^[\w-]+$/", $moduleID) || !oc_module_installed($moduleID)) { warn('The file includes settings for uninstalled modules. Please install the modules first, then import the settings. Modules included in the file are:'); } } } // Module prep if (oc_hookSet('settings-import-prep')) { foreach ($OC_hooksAR['settings-import-prep'] as $f) { require_once $f; } } // Configuration settings if (isset($settings['configuration']) && is_array($settings['configuration']) && (count($settings['configuration']) > 0)) { foreach($settings['configuration'] as $k => $v) { list($module, $setting) = explode(':', $k); updateConfigSetting($setting, $v, $module); } print '

Configuration settings imported (including modules) ...

'; } // Topics if (isset($settings['topics']) && is_array($settings['topics']) && (count($settings['topics']) > 0)) { ocsql_query("TRUNCATE `" . OCC_TABLE_TOPIC . "`") or err('Unable to reset topic table'); $q = "INSERT INTO `" . OCC_TABLE_TOPIC . "` (`topicid`, `topicname`, `short`) VALUES "; foreach($settings['topics'] as $k => $kAR) { $q .= "('" . safeSQLstr($k) . "', '" . safeSQLstr($kAR['topicname']) . "', '" . safeSQLstr($kAR['short']) . "'),"; } $q = rtrim($q, ','); ocsql_query($q) or err('Unable to load topics - ' . safeHTMLstr(ocsql_error())); print '

Topics imported ...

'; } // Reviewers if (isset($settings['reviewers']) && !empty($settings['reviewers'])) { ocsql_query("TRUNCATE `" . OCC_TABLE_REVIEWER . "`") or err('Unable to reset reviewer table'); foreach($settings['reviewers'] as $k => $kAR) { $q = "INSERT INTO `" . OCC_TABLE_REVIEWER . "` SET "; foreach ($kAR as $fld => $val) { $q .= "`" . $fld . "`='" . safeSQLstr($val) . "',"; } $q = rtrim($q, ','); ocsql_query($q) or err('Unable to import reviewer - ' . safeHTMLstr(ocsql_error())); } print '

Reviewers imported ...

'; } // Reviewer Topics if (isset($settings['reviewertopics']) && is_array($settings['reviewertopics']) && (count($settings['reviewertopics']) > 0)) { ocsql_query("TRUNCATE `" . OCC_TABLE_REVIEWERTOPIC . "`") or err('Unable to reset reviewertopic table'); foreach($settings['reviewertopics'] as $k => $kAR) { $q = "INSERT INTO `" . OCC_TABLE_REVIEWERTOPIC . "` (`reviewerid`, `topicid`) VALUES "; foreach ($kAR as $topicid) { $q .= "('" . safeSQLstr($k) . "', '" . safeSQLstr($topicid) . "'),"; } $q = rtrim($q, ','); ocsql_query($q) or err('Unable to import reviewertopics - ' . safeHTMLstr(ocsql_error())); } print '

Reviewer Topics imported ...

'; } // Templates if (isset($settings['templates']) && !empty($settings['templates'])) { ocsql_query("TRUNCATE `" . OCC_TABLE_TEMPLATE . "`") or err('Unable to reset template table'); foreach($settings['templates'] as $k => $kAR) { $q = "INSERT INTO `" . OCC_TABLE_TEMPLATE . "` SET "; foreach ($kAR as $fld => $val) { $q .= "`" . $fld . "`='" . safeSQLstr($val) . "',"; } $q = rtrim($q, ','); ocsql_query($q) or err('Unable to import template - ' . safeHTMLstr(ocsql_error())); } print '

Templates imported ...

'; } // Module settings if (oc_hookSet('settings-import-process')) { foreach ($OC_hooksAR['settings-import-process'] as $f) { require_once $f; } } // Confirm print '

Settings have been imported – be sure to review your configuration.

'; } else { print '

In order to import settings from another OpenConf installation, select the settings file you previously exported, then click the Import Settings button. If this is not a new installation, you should first backup your database.



'; } printFooter(); ?>