$GLOBALS['OC_configAR']['OC_version'])) { warn('The file is from a newer version of OpenConf. Upgrade this installation first, then try importing the settings once agian.'); } // Check modules if (isset($settings['modules']) && (count($settings['modules']) > 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:
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'])) { foreach($settings['templates'] as $k => $kAR) { if ( isset($kAR['module']) && ( ($kAR['module'] == 'OC') || oc_module_installed($kAR['module']) ) ) { $qflds = ''; foreach ($kAR as $fld => $val) { if ( ! empty($val) && ($fld != 'templateid')) { $qflds .= "`" . $fld . "`='" . safeSQLstr($val) . "',"; } } $qflds = rtrim($qflds, ','); $q = "INSERT INTO `" . OCC_TABLE_TEMPLATE . "` SET `templateid`='" . safeSQLstr($kAR['templateid']) . "', " . $qflds . " ON DUPLICATE KEY UPDATE " . $qflds; 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. Note that in the case of topics and committee member accounts, any existing entries are deleted.