if (array_key_exists('deleteMissing', $rule)) { $requestRules[$ruleName]['deleteMissing'] = false; } } if (!isset($requestRules[$ruleName]['updateExisting']) && isset($rule['updateExisting'])) { $requestRules[$ruleName]['updateExisting'] = false; } if (!isset($requestRules[$ruleName]['createMissing']) && isset($rule['createMissing'])) { $requestRules[$ruleName]['createMissing'] = false; } if (!isset($requestRules[$ruleName]['deleteMissing']) && isset($rule['deleteMissing'])) { $requestRules[$ruleName]['deleteMissing'] = false; } } $data['rules'] = $requestRules; } if (isset($_FILES['import_file'])) { $result = false; // CUploadFile throws exceptions, so we need to catch them try { $file = new CUploadFile($_FILES['import_file']); $result = API::Configuration()->import(['format' => CImportReaderFactory::fileExt2ImportFormat($file->getExtension()), 'source' => $file->getContent(), 'rules' => $data['rules']]); } catch (Exception $e) { error($e->getMessage()); } show_messages($result, _('Imported successfully'), _('Import failed')); } $view = new CView('conf.import', $data); $view->render(); $view->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$requestRules[$ruleName]['updateExisting'] = false; } if (isset($rule['createMissing'])) { $requestRules[$ruleName]['createMissing'] = false; } } elseif (!isset($requestRules[$ruleName]['updateExisting']) && isset($rule['updateExisting'])) { $requestRules[$ruleName]['updateExisting'] = false; } elseif (!isset($requestRules[$ruleName]['createMissing']) && isset($rule['createMissing'])) { $requestRules[$ruleName]['createMissing'] = false; } } $data['rules'] = $requestRules; } if (isset($_FILES['import_file'])) { try { $file = new CUploadFile($_FILES['import_file']); $importFormat = CImportReaderFactory::fileExt2ImportFormat($file->getExtension()); $importReader = CImportReaderFactory::getReader($importFormat); $configurationImport = new CConfigurationImport($file->getContent(), $data['rules']); $configurationImport->setReader($importReader); $configurationImport->import(); show_messages(true, _('Imported successfully')); } catch (Exception $e) { error($e->getMessage()); show_messages(false, null, _('Import failed')); } } $view = new CView('conf.import', $data); $view->render(); $view->show(); require_once 'include/page_footer.php';